mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
samba-tool: Escape username and computername in ldb search filter
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
306f5e57f2
commit
0a6c2ac88f
@ -360,7 +360,8 @@ sudo is used so a computer may run the command as root.
|
||||
samaccountname = "%s$" % computername
|
||||
|
||||
filter = ("(&(sAMAccountName=%s)(sAMAccountType=%u))" %
|
||||
(samaccountname, dsdb.ATYPE_WORKSTATION_TRUST))
|
||||
(ldb.binary_encode(samaccountname),
|
||||
dsdb.ATYPE_WORKSTATION_TRUST))
|
||||
try:
|
||||
res = samdb.search(base=samdb.domain_dn(),
|
||||
scope=ldb.SCOPE_SUBTREE,
|
||||
@ -544,7 +545,8 @@ class cmd_computer_move(Command):
|
||||
samaccountname = "%s$" % computername
|
||||
|
||||
filter = ("(&(sAMAccountName=%s)(sAMAccountType=%u))" %
|
||||
(samaccountname, dsdb.ATYPE_WORKSTATION_TRUST))
|
||||
(ldb.binary_encode(samaccountname),
|
||||
dsdb.ATYPE_WORKSTATION_TRUST))
|
||||
try:
|
||||
res = samdb.search(base=domain_dn,
|
||||
expression=filter,
|
||||
|
@ -440,7 +440,7 @@ Example2 shows how to delete a user in the domain against the local server. su
|
||||
credentials=creds, lp=lp)
|
||||
|
||||
filter = ("(&(sAMAccountName=%s)(sAMAccountType=805306368))" %
|
||||
username)
|
||||
ldb.binary_encode(username))
|
||||
|
||||
try:
|
||||
res = samdb.search(base=samdb.domain_dn(),
|
||||
|
Loading…
Reference in New Issue
Block a user