[SCM] Samba Shared Repository - branch v4-12-test updated
Karolin Seeger
kseeger at samba.org
Fri Mar 27 13:20:03 UTC 2020
The branch, v4-12-test has been updated
via ee06963cbb4 selftest: test samba-tool group commands with groupnames with brackets and spaces
via f2dae546f22 samba-tool group edit: use binary encoded group name
via fc8961c1562 samba-tool group delete: use binary encoded group name
via ecd119fc6cf samba-tool group move: use binary encoded group name
via 2dbe9c13d68 samba-tool group listmembers: use binary encoded group names
via 88edeec6fc1 samba-tool group listmembers: find group members by groups SID
via 439aeba45e9 samba-tool group listmembers: handle group-does-not-exist error
via 20d4785856a samba-tool group listmembers: hide python backtracke on command error
from a17de0ee683 WHATSNEW: Fix date.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-test
- Log -----------------------------------------------------------------
commit ee06963cbb42db243764b3a3cf7dcb887483d564
Author: Björn Baumbach <bb at sernet.de>
Date: Thu Feb 27 11:06:34 2020 +0100
selftest: test samba-tool group commands with groupnames with brackets and spaces
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 534809a0f09775390e89fa1cbfae3a1d0fafecb8)
Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-12-test): Fri Mar 27 13:19:20 UTC 2020 on sn-devel-184
commit f2dae546f22051192e170d4be0fb64cbafb60509
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:56:14 2020 +0100
samba-tool group edit: use binary encoded group name
Allows to edit groups with names like e.g. 'group1 (xy)'.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit f3e7ea0405d46ddfbeba9b3a84c13b7878464180)
commit fc8961c15621a44554cb36fde04a40483f7b94a8
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:55:01 2020 +0100
samba-tool group delete: use binary encoded group name
Allows to delete groups with names like e.g. 'group1 (xy)'.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 104582b73caf008600e15d76d57424263a0f28d4)
commit ecd119fc6cf1c3292f6d4a68ac25b5cf48099090
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:40:50 2020 +0100
samba-tool group move: use binary encoded group name
Allows to move groups with names like e.g. 'group1 (xy)'.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 626209beab2fc9b0fdb7e90338cdfec5cfa48dd7)
commit 2dbe9c13d68927e39c58a40e87d1f38d4d15d419
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:38:50 2020 +0100
samba-tool group listmembers: use binary encoded group names
Allows to find groups with names like e.g. 'group1 (xy)'.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit d0f8e833653df652df01a472c4bbfd256f10f810)
commit 88edeec6fc18c6b92910bfcef5f27362dc4b520b
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:39:44 2020 +0100
samba-tool group listmembers: find group members by groups SID
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 1d2e9f27fa9cff55245e45a194f696fc9ca4376d)
commit 439aeba45e96078fb5d63c51d54c5a5d1edc7263
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:08:43 2020 +0100
samba-tool group listmembers: handle group-does-not-exist error
Return a error with a proper message instead of just do nothing when
the target group does not exist.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 40e498e743e4677a42030373e8d97f6f9763080a)
commit 20d4785856adda252010b9edd7efb3460651a9f7
Author: Björn Baumbach <bb at sernet.de>
Date: Wed Feb 26 13:05:16 2020 +0100
samba-tool group listmembers: hide python backtracke on command error
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit 789d84c0a9a406f7e0c9ab48cf2f31afdc4d3829)
-----------------------------------------------------------------------
Summary of changes:
python/samba/netcmd/group.py | 41 ++++++++++++++++++----------------
python/samba/tests/samba_tool/group.py | 5 ++++-
2 files changed, 26 insertions(+), 20 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/netcmd/group.py b/python/samba/netcmd/group.py
index 6e5ed1def28..76705100960 100644
--- a/python/samba/netcmd/group.py
+++ b/python/samba/netcmd/group.py
@@ -179,7 +179,7 @@ Example2 deletes group Group2 from the local server. The command is run under r
credentials=creds, lp=lp)
filter = ("(&(sAMAccountName=%s)(objectClass=group))" %
- groupname)
+ ldb.binary_encode(groupname))
try:
res = samdb.search(base=samdb.domain_dn(),
@@ -516,21 +516,22 @@ samba-tool group listmembers \"Domain Users\" -H ldap://samba.samdom.example.com
samdb = SamDB(url=H, session_info=system_session(),
credentials=creds, lp=lp)
- search_filter = "(&(objectClass=group)(samaccountname=%s))" % groupname
- res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE,
- expression=(search_filter),
- attrs=["objectSid"])
-
- if (len(res) != 1):
- return
-
- group_dn = res[0].get('dn', idx=0)
- object_sid = res[0].get('objectSid', idx=0)
-
- object_sid = ndr_unpack(security.dom_sid, object_sid)
- (group_dom_sid, rid) = object_sid.split()
-
- search_filter = "(|(primaryGroupID=%s)(memberOf=%s))" % (rid, group_dn)
+ search_filter = ("(&(objectClass=group)(sAMAccountName=%s))" %
+ ldb.binary_encode(groupname))
+ try:
+ res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE,
+ expression=(search_filter),
+ attrs=["objectSid"])
+ group_sid_binary = res[0].get('objectSid', idx=0)
+ except IndexError:
+ raise CommandError('Unable to find group "%s"' % (groupname))
+
+ group_sid = ndr_unpack(security.dom_sid, group_sid_binary)
+ (group_dom_sid, rid) = group_sid.split()
+ group_sid_dn = "<SID=%s>" % (group_sid)
+
+ search_filter = ("(|(primaryGroupID=%s)(memberOf=%s))" %
+ (rid, group_sid_dn))
res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE,
expression=(search_filter),
attrs=["samAccountName", "cn"])
@@ -549,7 +550,8 @@ samba-tool group listmembers \"Domain Users\" -H ldap://samba.samdom.example.com
self.outf.write("%s\n" % member_name)
except Exception as e:
- raise CommandError('Failed to list members of "%s" group ' % groupname, e)
+ raise CommandError('Failed to list members of "%s" group - %s' %
+ (groupname, e))
class cmd_group_move(Command):
@@ -605,7 +607,7 @@ class cmd_group_move(Command):
domain_dn = ldb.Dn(samdb, samdb.domain_dn())
filter = ("(&(sAMAccountName=%s)(objectClass=group))" %
- groupname)
+ ldb.binary_encode(groupname))
try:
res = samdb.search(base=domain_dn,
expression=filter,
@@ -871,7 +873,8 @@ class cmd_group_edit(Command):
samdb = SamDB(url=H, session_info=system_session(),
credentials=creds, lp=lp)
- filter = ("(&(sAMAccountName=%s)(objectClass=group))" % groupname)
+ filter = ("(&(sAMAccountName=%s)(objectClass=group))" %
+ ldb.binary_encode(groupname))
domaindn = samdb.domain_dn()
diff --git a/python/samba/tests/samba_tool/group.py b/python/samba/tests/samba_tool/group.py
index c5c9cdb1d34..cd9d9d9ed28 100644
--- a/python/samba/tests/samba_tool/group.py
+++ b/python/samba/tests/samba_tool/group.py
@@ -39,16 +39,19 @@ class GroupCmdTestCase(SambaToolCmdTest):
self.groups.append(self._randomGroup({"name": "testgroup2"}))
self.groups.append(self._randomGroup({"name": "testgroup3"}))
self.groups.append(self._randomGroup({"name": "testgroup4"}))
+ self.groups.append(self._randomGroup({"name": "testgroup5 (with brackets)"}))
self.groups.append(self._randomPosixGroup({"name": "posixgroup1"}))
self.groups.append(self._randomPosixGroup({"name": "posixgroup2"}))
self.groups.append(self._randomPosixGroup({"name": "posixgroup3"}))
self.groups.append(self._randomPosixGroup({"name": "posixgroup4"}))
+ self.groups.append(self._randomPosixGroup({"name": "posixgroup5 (with brackets)"}))
self.groups.append(self._randomUnixGroup({"name": "unixgroup1"}))
self.groups.append(self._randomUnixGroup({"name": "unixgroup2"}))
self.groups.append(self._randomUnixGroup({"name": "unixgroup3"}))
self.groups.append(self._randomUnixGroup({"name": "unixgroup4"}))
+ self.groups.append(self._randomUnixGroup({"name": "unixgroup5 (with brackets)"}))
- # setup the 12 groups and ensure they are correct
+ # setup the groups and ensure they are correct
for group in self.groups:
(result, out, err) = group["createGroupFn"](group)
--
Samba Shared Repository
More information about the samba-cvs
mailing list