Skip to content

Commit 3264d23

Browse files
committed
Fix modify function
1 parent 0e43e81 commit 3264d23

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

impacket/ldap/ldap.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,12 @@ def modify(self, dn, modifications, controls=None):
610610

611611
# prepare changed values. Integer values need to be converted to string
612612
vals = []
613-
for op in ops:
614-
if isinstance(op[1], list):
615-
vals.extend([str(val) if isinstance(val, int) else val for val in op[1]])
616-
else:
617-
vals.append(str(op[1]) if isinstance(op[1], int) else op[1])
613+
if isinstance(op[1], list):
614+
vals.extend([str(val) if isinstance(val, int) else val for val in op[1]])
615+
else:
616+
vals.append(str(op[1]) if isinstance(op[1], int) else op[1])
618617
modifyRequest['changes'][idx]['modification']['vals'].setComponents(*vals)
618+
idx += 1
619619

620620
response = self.sendReceive(modifyRequest, controls)[0]['protocolOp']
621621
if response['modifyResponse']['resultCode'] != ResultCode('success'):
@@ -624,6 +624,7 @@ def modify(self, dn, modifications, controls=None):
624624
errorString=f"Error in modifyRequest -> {response['modifyResponse']['resultCode'].prettyPrint()}: {response['modifyResponse']['diagnosticMessage']}"
625625
)
626626
return True
627+
627628
def modify_dn(self, dn, newrdn, deleteoldrdn=True, newSuperior=None, controls=None):
628629
"""
629630
Modify the Distinguished Name of an entry in the LDAP directory.

0 commit comments

Comments
 (0)