Exemplo n.º 1
0
 def passwd(self, id, oldpw, newpw):
     self.context.ldap_session.passwd(
         self.context.child_dn(id), oldpw, newpw)
     object_classes = self.context.child_defaults['objectClass']
     user_node = self[id].context
     user_node.attrs.load()
     if 'sambaSamAccount' in object_classes:
         user_node.attrs['sambaNTPassword'] = sambaNTPassword(newpw)
         user_node.attrs['sambaLMPassword'] = sambaLMPassword(newpw)
         user_node()
Exemplo n.º 2
0
 def passwd(self, id, oldpw, newpw):
     user_id = self.id_for_login(decode_utf8(id))
     criteria = {self._key_attr: user_id}
     attrlist = ["dn"]
     if self.expiresAttr:
         attrlist.append(self.expiresAttr)
     res = self.context.search(criteria=criteria, attrlist=attrlist)
     if not res:
         raise KeyError(id)
     if len(res) > 1:
         msg = u'More than one principal with login "{0}" found.'
         logger.warning(msg.format(user_id))
     user_dn = res[0][1]["dn"]
     self.context.ldap_session.passwd(user_dn, oldpw, newpw)
     object_classes = self.context.child_defaults["objectClass"]
     user_node = self[user_id].context
     user_node.attrs.load()
     if "sambaSamAccount" in object_classes:
         user_node.attrs["sambaNTPassword"] = sambaNTPassword(newpw)
         user_node.attrs["sambaLMPassword"] = sambaLMPassword(newpw)
         user_node()
Exemplo n.º 3
0
 def passwd(self, id, oldpw, newpw):
     user_id = self.id_for_login(id)
     criteria = {self._key_attr: user_id}
     attrlist = ['dn']
     if self.expiresAttr:
         attrlist.append(self.expiresAttr)
     res = self.context.search(criteria=criteria, attrlist=attrlist)
     if not res:
         raise KeyError(id)
     if len(res) > 1:  # pragma: no cover
         msg = u'More than one principal with login "{0}" found.'
         logger.warning(msg.format(user_id))
     user_dn = res[0][1]['dn']
     self.context.ldap_session.passwd(user_dn, oldpw, newpw)
     object_classes = self.context.child_defaults['objectClass']
     user_node = self[user_id].context
     user_node.attrs.load()
     if 'sambaSamAccount' in object_classes:
         user_node.attrs['sambaNTPassword'] = sambaNTPassword(newpw)
         user_node.attrs['sambaLMPassword'] = sambaLMPassword(newpw)
         user_node()