from samba.idmap import IDmapDB
import pwd
import time
+import base64
__docformat__ = "restructuredText"
objectClass: top
objectClass: foreignSecurityPrincipal
description: %s
- """ % (sid, domaindn, desc)
+""" % (sid, domaindn, desc)
# deliberately ignore errors from this, as the records may
# already exist
for msg in self.parse_ldif(add):
user_dn = res[0].dn
setpw = """
- dn: %s
- changetype: modify
- replace: userPassword
- userPassword: %s
- """ % (user_dn, password)
+dn: %s
+changetype: modify
+replace: userPassword
+userPassword:: %s
+""" % (user_dn, base64.b64encode(password))
self.modify_ldif(setpw)
glue.samdb_set_domain_sid(self, sid)
def attach_schema_from_ldif(self, pf, df):
- glue.dsdb_attach_schema_from_ldif_file(self, pf, df)
+ glue.dsdb_attach_schema_from_ldif(self, pf, df)
+
+ def convert_schema_to_openldap(self, target, mapping):
+ return glue.dsdb_convert_schema_to_openldap(self, target, mapping)
def set_invocation_id(self, invocation_id):
"""Set the invocation id for this SamDB handle.
accountExpires = glue.unix2nttime(expiry_seconds + int(time.time()))
mod = """
- dn: %s
- changetype: modify
- replace: userAccountControl
- userAccountControl: %u
- replace: accountExpires
- accountExpires: %u
- """ % (res[0].dn, userAccountControl, accountExpires)
+dn: %s
+changetype: modify
+replace: userAccountControl
+userAccountControl: %u
+replace: accountExpires
+accountExpires: %u
+""" % (res[0].dn, userAccountControl, accountExpires)
# now change the database
self.modify_ldif(mod)
except: