mirror of
https://github.com/kakwa/ldapcherry
synced 2025-02-18 08:28:21 +01:00
pepify the source code
This commit is contained in:
parent
d8631da7ba
commit
b8a65a44b6
@ -58,7 +58,6 @@ DONT_REQ_PREAUTH = 0x400000
|
|||||||
PASSWORD_EXPIRED = 0x800000
|
PASSWORD_EXPIRED = 0x800000
|
||||||
TRUSTED_TO_AUTH_FOR_DELEGATION = 0x1000000
|
TRUSTED_TO_AUTH_FOR_DELEGATION = 0x1000000
|
||||||
PARTIAL_SECRETS_ACCOUNT = 0x04000000
|
PARTIAL_SECRETS_ACCOUNT = 0x04000000
|
||||||
|
|
||||||
# Generated by the followin command:
|
# Generated by the followin command:
|
||||||
|
|
||||||
# samba-tool group list | \
|
# samba-tool group list | \
|
||||||
@ -184,21 +183,19 @@ class Backend(ldapcherry.backend.backendLdap.Backend):
|
|||||||
dn = str('CN=%(cn)s,%(user_dn)s' % {
|
dn = str('CN=%(cn)s,%(user_dn)s' % {
|
||||||
'cn': cn,
|
'cn': cn,
|
||||||
'user_dn': self.userdn
|
'user_dn': self.userdn
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
attrs = {}
|
attrs = {}
|
||||||
|
|
||||||
attrs['unicodePwd'] = str(password_value)
|
attrs['unicodePwd'] = str(password_value)
|
||||||
|
|
||||||
#ldif = modlist.modifyModlist({'unicodePwd': 'asad'}, attrs)
|
|
||||||
ldif = modlist.modifyModlist({'unicodePwd': 'tmp'}, attrs)
|
ldif = modlist.modifyModlist({'unicodePwd': 'tmp'}, attrs)
|
||||||
ldap_client.modify_s(dn,ldif)
|
ldap_client.modify_s(dn, ldif)
|
||||||
|
|
||||||
del(attrs['unicodePwd'])
|
del(attrs['unicodePwd'])
|
||||||
attrs['UserAccountControl'] = str(NORMAL_ACCOUNT)
|
attrs['UserAccountControl'] = str(NORMAL_ACCOUNT)
|
||||||
ldif = modlist.modifyModlist({'UserAccountControl': 'tmp'}, attrs)
|
ldif = modlist.modifyModlist({'UserAccountControl': 'tmp'}, attrs)
|
||||||
ldap_client.modify_s(dn,ldif)
|
ldap_client.modify_s(dn, ldif)
|
||||||
|
|
||||||
def add_user(self, attrs):
|
def add_user(self, attrs):
|
||||||
password = attrs['unicodePwd']
|
password = attrs['unicodePwd']
|
||||||
|
@ -259,7 +259,6 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
else:
|
else:
|
||||||
dn_entry = r[0]
|
dn_entry = r[0]
|
||||||
return dn_entry
|
return dn_entry
|
||||||
|
|
||||||
# python-ldap talks in bytes,
|
# python-ldap talks in bytes,
|
||||||
# as the rest of ldapcherry talks in unicode utf-8:
|
# as the rest of ldapcherry talks in unicode utf-8:
|
||||||
# * everything passed to python-ldap must be converted to bytes
|
# * everything passed to python-ldap must be converted to bytes
|
||||||
@ -308,10 +307,10 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
attrs_str['objectClass'] = self.objectclasses
|
attrs_str['objectClass'] = self.objectclasses
|
||||||
# construct is DN
|
# construct is DN
|
||||||
dn = \
|
dn = \
|
||||||
self._str(self.dn_user_attr) +\
|
self._str(self.dn_user_attr) + \
|
||||||
'=' +\
|
'=' + \
|
||||||
self._str(attrs[self.dn_user_attr]) +\
|
self._str(attrs[self.dn_user_attr]) + \
|
||||||
',' +\
|
',' + \
|
||||||
self._str(self.userdn)
|
self._str(self.userdn)
|
||||||
# gen the ldif fir add_s and add the user
|
# gen the ldif fir add_s and add the user
|
||||||
ldif = modlist.addModlist(attrs_str)
|
ldif = modlist.addModlist(attrs_str)
|
||||||
|
@ -127,7 +127,7 @@ class WrongParamValue(Exception):
|
|||||||
self.param = param
|
self.param = param
|
||||||
possible_values_str = string.join(possible_values, ', ')
|
possible_values_str = string.join(possible_values, ', ')
|
||||||
self.log = \
|
self.log = \
|
||||||
"wrong value for param '%(param)s' in section '%(section)s'"\
|
"wrong value for param '%(param)s' in section '%(section)s'" \
|
||||||
", possible values are [%(values)s]" % \
|
", possible values are [%(values)s]" % \
|
||||||
{
|
{
|
||||||
'param': param,
|
'param': param,
|
||||||
@ -167,7 +167,7 @@ class PasswordAttributesCollision(Exception):
|
|||||||
self.key = key
|
self.key = key
|
||||||
self.log = \
|
self.log = \
|
||||||
"key '" + key + "' type is password," \
|
"key '" + key + "' type is password," \
|
||||||
" keys '" + key + "1' and '" + key + "2'"\
|
" keys '" + key + "1' and '" + key + "2'" \
|
||||||
" are reserved and cannot be used"
|
" are reserved and cannot be used"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user