comparison MoinMoin/auth/smb_mount.py @ 2041:fa0bec111fdf

fix smb_mount
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 22 May 2007 11:45:16 +0200
parents d919b7b7b3e9
children 40c4670c3410
comparison
equal deleted inserted replaced
2040:68e302934c77 2041:fa0bec111fdf
37 37
38 import os, pwd, subprocess 38 import os, pwd, subprocess
39 web_username = self.smb_dir_user 39 web_username = self.smb_dir_user
40 web_uid = pwd.getpwnam(web_username)[2] # XXX better just use current uid? 40 web_uid = pwd.getpwnam(web_username)[2] # XXX better just use current uid?
41 41
42 if not login: # logout -> we don't have username in form
43 username = user_obj.name # so we take it from previous auth method
44
45 mountpoint = self.smb_mountpoint_fn(username) 42 mountpoint = self.smb_mountpoint_fn(username)
46 if login: 43 if login:
47 cmd = u"sudo mount -t cifs -o user=%(user)s,domain=%(domain)s,uid=%(uid)d,dir_mode=%(dir_mode)s,file_mode=%(file_mode)s,iocharset=%(iocharset)s //%(server)s/%(share)s %(mountpoint)s >>%(log)s 2>&1" 44 cmd = u"sudo mount -t cifs -o user=%(user)s,domain=%(domain)s,uid=%(uid)d,dir_mode=%(dir_mode)s,file_mode=%(file_mode)s,iocharset=%(iocharset)s //%(server)s/%(share)s %(mountpoint)s >>%(log)s 2>&1"
48 else: 45 else:
49 cmd = u"sudo umount %(mountpoint)s >>%(log)s 2>&1" 46 cmd = u"sudo umount %(mountpoint)s >>%(log)s 2>&1"
72 69
73 def login(self, request, user_obj, **kw): 70 def login(self, request, user_obj, **kw):
74 username = kw.get('username') 71 username = kw.get('username')
75 password = kw.get('password') 72 password = kw.get('password')
76 if user_obj and user_obj.valid: 73 if user_obj and user_obj.valid:
77 do_smb(request, username, password, True) 74 self.do_smb(request, username, password, True)
78 return ContinueLogin(user_obj) 75 return ContinueLogin(user_obj)
79 76
80 def logout(self, request, user_obj, **kw): 77 def logout(self, request, user_obj, **kw):
81 if user_obj and not user_obj.valid: 78 if user_obj and not user_obj.valid:
82 do_smb(request, None, None, False) 79 self.do_smb(request, user_obj.name, None, False)
83 return user_obj, True 80 return user_obj, True