Skip to content

Commit

Permalink
nav stress testem, paar fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Kodden committed Nov 9, 2023
1 parent 25decd3 commit 406a604
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions plsc_ordered.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,24 +501,32 @@ def cleanup(dst):
logging.info(" - People")
src_members = vc.get(dc, {}).get(co, {}).get('members', [])
dst_dns = dst.rfind(
"ou=people,o={},dc=ordered,dc={}".format(co, escape_dn_chars(service)),
"ou=people,o={},dc=ordered,dc={}".format(
co,
escape_dn_chars(service)
),
'(objectClass=person)'
)
for dst_dn, dst_entry in dst_dns.items():
logging.info(" - dest_dn: {}".format(dst_dn))
if dst_entry.get('eduPersonUniqueId', None):
dst_uid = dst_entry['eduPersonUniqueId'][0]
if dst_uid not in src_members:
logging.debug(" dst_uid not found in src_members, deleting {}".format(dst_dn))
logging.info(" dst_uid not found in {}, deleting {}".format(src_members, dst_dn))
dst.delete(dst_dn)
else:
# verify that rdn uid is indeed (still) valid registered user, if not delete entry
if dst_dn not in registered_users:
dst.delete(dst_dn)

logging.info(" - Groups")
dst_dns = dst.rfind("ou=Groups,o={},dc=ordered,dc={}".format(co, escape_dn_chars(service)),
'(objectClass=groupOfMembers)')
dst_dns = dst.rfind(
"ou=Groups,o={},dc=ordered,dc={}".format(
co,
escape_dn_chars(service)
),
'(objectClass=groupOfMembers)'
)
for dst_dn, dst_entry in dst_dns.items():
grp_name = dst_entry['cn'][0]
if grp_name not in vc.get(dc, {}).get(co, {}).get('groups', []):
Expand Down
2 changes: 1 addition & 1 deletion util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def make_secret(password):
return '{SSHA}' + crypted.decode('ascii')


SPECIAL_DN_CHARACTERS = "\\,+<>;\"=#"
SPECIAL_DN_CHARACTERS = "\\,+<>;\"= "
SPECIAL_FILTER_CHARACTERS = "*()"


Expand Down

0 comments on commit 406a604

Please sign in to comment.