develop
asamoukin 16 years ago
parent 37a444bfea
commit 7a4bcc70e1

@ -124,4 +124,12 @@ chown=root:root
comment = Share Files
browseable = yes
writable = yes
hide unreadable = yes
[remote]
path = /var/calculate/remote
comment = Client Files
browseable = No
writable = yes
hide unreadable = yes

@ -3941,6 +3941,9 @@ class servSamba(shareLdap):
if not resSearch:
# Добавим пользователя LDAP
optUnix = {}
# id пользователя
if options.has_key('u'):
optUnix['u'] = options['u']
# Группа пользователя
if options.has_key('g'):
optUnix['g'] = options['g']
@ -4250,11 +4253,65 @@ class servSamba(shareLdap):
_("Retype ROOT password")]
if not self.addUserSambaServer('root',{'p':""},pwDialog):
return False
clientName = 'client'
clientGroup = 'client'
clientUid = '900'
clientGid = '900'
# Проверяем на наличие группы client
resGroupClient = self.servUnixObj.searchUnixGroupName(clientGroup)
if not resGroupClient:
# Создаем группу для пользователя client
if not self.servUnixObj.addGroupUnixServer(clientGroup,
{'g':clientGid},
False):
self.printERROR(_("not created unix group 'client'"))
return False
# Добавляем пользователя client для smb ресурса [remote]
if not self.addUserSambaServer('client',{'f':'','u':clientUid,
'g':clientGroup}):
self.printERROR(_("not created samba user 'client'"))
return False
# Если нет то создадим директорию /var/calculate/remote
remotePath = "/var/calculate/remote"
if not os.path.exists(remotePath):
os.makedirs(remotePath)
# права и владелец /var/calculate/remote
if os.path.exists(remotePath):
os.chown(remotePath,int(clientUid),int(clientGid))
os.chmod(remotePath,0750)
if not self.setDaemonAutostart("slapd"):
return False
# Устанавливаем автозапуск демона
if not self.setDaemonAutostart("samba"):
return False
#считаем переменные для клиента
servDn = self.clVars.Get("ld_services_dn")
unixDN = self.clVars.Get("ld_unix_dn")
bindDn = self.clVars.Get("ld_bind_dn")
bindPw = self.clVars.Get("ld_bind_pw")
baseDn = self.clVars.Get("ld_base_dn")
# запишем их
if not (servDn and unixDN and bindDn and bindPw):
self.printERROR(_("Not found variables:"))
self.printERROR("ld_services_dn or ld_unix_dn \
or ld_bind_dn or ld_bind_pw or ld_base_dn")
return False
retServDn = self.clVars.Write("ld_services_dn",servDn,True,
"remote","client")
retUnixDN = self.clVars.Write("ld_unix_dn",unixDN,True,
"remote","client")
retBindDn = self.clVars.Write("ld_bind_dn",bindDn,True,
"remote","client")
retBindPw = self.clVars.Write("ld_bind_pw",bindPw,True,
"remote","client")
retBaseDn = self.clVars.Write("ld_base_dn",baseDn,True,
"remote","client")
if not (retServDn and retUnixDN and retBindDn and retBindPw and\
retBaseDn):
self.printERROR(_("Not write variable:"))
self.printERROR("ld_services_dn or ld_unix_dn \
or ld_bind_dn or ld_bind_pw or ld_base_dn")
return False
self.clVars.Write("sr_samba_set","on")
self.printOK(_("Samba service configured") + " ...")
return True
@ -5097,6 +5154,13 @@ class cl_ldap(shareLdap):
'helpChapter':_("Samba service options"),
'help':_("force use GROUP for the new user Unix service account")
},
{'progAccess':(3,),
'shortOption':"u",
'longOption':"uid",
'optVal':_("UID"),
'helpChapter':_("Samba service options"),
'help':_("force use UID for the new user Unix service account")
},
{'progAccess':(3,),
'shortOption':"g",
'longOption':"gid",

Loading…
Cancel
Save