[sork] whoops...

Amith Varghese amith@xalan.com
10 Aug 2002 17:53:01 -0400


I have some bugs with the patch i just sent... hold on for a few and
i'll send a new one.  Sorry

Amith

On Sat, 2002-08-10 at 17:32, Amith Varghese wrote:
> I forgot to remove some debug statements.... Here is a new one
> 
> Amith
> 
> 
> 
> 
> ----
> 

> Index: config/conf.php.dist
> ===================================================================
> RCS file: /repository/passwd/config/conf.php.dist,v
> retrieving revision 1.12
> diff -r1.12 conf.php.dist
> 67c67
> < // Encryption can be on of the folowing: plain, SHA or crypt
> ---
> > // Encryption can be on of the folowing: plain, SHA, MD5, or crypt
> 74a75,80
> > 
> > // If we know the user dn that we want to change we can specify it here
> > // That way we can skip the anonymous bind -> search -> rebind process.  
> > // $conf['server']['params']['optional'] = array(
> > //   'userdn' => 'uid=' . Auth::getAuth() . ',o=example.com'
> > // };
> Index: lib/Driver/ldap.php
> ===================================================================
> RCS file: /repository/passwd/lib/Driver/ldap.php,v
> retrieving revision 1.5
> diff -r1.5 ldap.php
> 40a41,42
> >      * @param    $userdn   The dn to use when binding to the ldap server
> >      * @param    $oldpassword  The password used when binding to the ldap server
> 46c48
> <     function connect($host, $port) {
> ---
> >     function connect($host, $port, $userdn, $oldpassword) {
> 52,53c54,61
> <         if (!ldap_bind($this->ds)) {
> <           $this->err_str = _("Could not bind to ldap server as guest");
> ---
> >         if (isset($userdn)) {
> >             $result = ldap_bind($this->ds,$userdn,$oldpassword);
> >         }
> >         else {
> >             $result = ldap_bind($this->ds);
> >         }
> >         if (!$result) {
> >           $this->err_str = _("Could not bind to ldap server");
> 80c88
> <     function lookupdn($user, $realm, $basedn, $uid) {        
> ---
> >     function lookupdn($user, $realm, $basedn, $uid) { 
> 86,96c94,96
> <     
> <     /**
> <      * Modify (update) an ldap password record for a user.
> <      *
> <      * @param   $user         The user whose record we will udpate.
> <      * @param   $realm        The realm (domain) name of the user.
> <      * @param   $oldPassword  The old (current) password value.
> <      * @param   $newPassword  The new password value to set.
> <      * @param   $basedn       The ldap basedn.
> <      * @param   $uid          The ldap uid.
> <      * @param   $encryption   The type of encryption to use (plain, crypt, SHA).
> ---
> > 
> >     /** 
> >      * Encrypt the new password string to use when updating the ldap server.
> 98c98,101
> <      * @return  boolean       True or False based on success of the modify.
> ---
> >      * @param   $encryption   The encryption type(plain, crypt, SHA, MD5).
> >      * @param   $newPassword  The new password to encrypt
> >      * 
> >      * @return  array         The array that contains the modified password
> 101,103c104
> <     function modify($user, $realm, $oldPassword,
> <                     $newPassword, $basedn, $uid, $encryption) {
> < 
> ---
> >     function encryptPassword($encryption,$newPassword) {
> 107a109,112
> >       case "md5":
> >          $change_info["userPassword"] = "{MD5}" .
> >          base64_encode(mHash(MHASH_MD5, $newPassword));
> >          break;
> 109c114
> <          $change_info["userPassword"] = "{SHA}" . 
> ---
> >          $change_info["userPassword"] = "{SHA}" .
> 120a126,142
> >       return $change_info;
> >     }
> >     
> >     /**
> >      * Rebind to the ldap server if initially bound as guest
> >      *
> >      * @param   $user         The user whose record we will udpate.
> >      * @param   $realm        The realm (domain) name of the user.
> >      * @param   $oldPassword  The old (current) password value.
> >      * @param   $basedn       The ldap basedn.
> >      * @param   $uid          The ldap uid.
> >      *
> >      * @return  boolean       True or False based on success of the rebind.
> >      */
> > 
> >     function rebind($user, $realm, $oldPassword, $basedn, $uid) {
> > 
> 133c155
> <       return ldap_mod_replace($this->ds, $dn, $change_info);
> ---
> >       return $dn;
> 153a176
> >         $userdn     = @$this->params['optional']['userdn'];
> 161a185,186
> >            if ( isset( $this->params[$realm]['userdn'] ) ) 
> >               $binddn =$this->params[$realm]['userdn'];
> 170,173c195,202
> <         if ($this->connect($host, $port)) {
> <             if ($this->modify($username, $realm, $oldpassword, 
> <                               $newpassword, $basedn, $uid, $encryption)) {
> <                         $return_value = true;
> ---
> >         if ($this->connect($host, $port, $userdn, $oldpassword)) {
> >             $change_info = $this->encryptPassword($encryption,$newpassword);
> >             if (!isset($userdn)) {
> >                 $userdn = $this->rebind($username, $realm, $oldpassword, 
> >                                         $basedn, $uid);
> >             }
> >             if (ldap_mod_replace($this->ds,$userdn,$change_info)) {
> >                 $return_value = true;
> ----
> 

> -- 
> Sork mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sork-unsubscribe@lists.horde.org