mirror of
https://github.com/samba-team/samba.git
synced 2025-06-03 17:05:54 +03:00
samba-tool: You cannot add members to a group if the member exists as a sAMAccountName and a CN.
Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Fri Jun 9 23:24:47 CEST 2017 on sn-devel-144
This commit is contained in:
parent
f180b1c21c
commit
b64f0b5da6
@ -199,6 +199,8 @@ This command adds one or more members to an existing Active Directory group. The
|
||||
|
||||
When a member is added to a group the member may inherit permissions and rights from the group. Likewise, when permission or rights of a group are changed, the changes may reflect in the members through inheritance.
|
||||
|
||||
The member names specified on the command must be the sAMaccountName.
|
||||
|
||||
Example1:
|
||||
samba-tool group addmembers supergroup Group1,Group2,User1 -H ldap://samba.samdom.example.com -Uadministrator%passw0rd
|
||||
|
||||
|
@ -266,9 +266,12 @@ changetype: modify
|
||||
""" % (str(targetgroup[0].dn))
|
||||
|
||||
for member in members:
|
||||
targetmember = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
|
||||
expression="(|(sAMAccountName=%s)(CN=%s))" % (
|
||||
ldb.binary_encode(member), ldb.binary_encode(member)), attrs=[])
|
||||
filter = ('(&(sAMAccountName=%s)(|(objectclass=user)'
|
||||
'(objectclass=group)))' % ldb.binary_encode(member))
|
||||
targetmember = self.search(base=self.domain_dn(),
|
||||
scope=ldb.SCOPE_SUBTREE,
|
||||
expression="%s" % filter,
|
||||
attrs=[])
|
||||
|
||||
if len(targetmember) != 1:
|
||||
raise Exception('Unable to find "%s". Operation cancelled.' % member)
|
||||
|
Loading…
x
Reference in New Issue
Block a user