]> git.sur5r.net Git - openldap/commitdiff
Use struct berval * instead of ** for newpasswd
authorHoward Chu <hyc@openldap.org>
Sun, 16 Feb 2003 09:42:04 +0000 (09:42 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 16 Feb 2003 09:42:04 +0000 (09:42 +0000)
libraries/libldap/passwd.c
servers/slapd/back-ldap/extended.c

index c4ab24abd5896bf0337c7f7218e08d7dca83faa2..e228ba8ced28d929cbc3cc384bec0325ea480483 100644 (file)
@@ -20,7 +20,7 @@
 int ldap_parse_passwd(
        LDAP *ld,
        LDAPMessage *res,
-       struct berval **newpasswd )
+       struct berval *newpasswd )
 {
        int rc;
        char *retoid = NULL;
@@ -31,7 +31,8 @@ int ldap_parse_passwd(
        assert( res != NULL );
        assert( newpasswd != NULL );
 
-       *newpasswd = NULL;
+       newpasswd->bv_val = NULL;
+       newpasswd->bv_len = 0;
 
        rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 0 );
 
@@ -49,7 +50,7 @@ int ldap_parse_passwd(
                }
 
                /* we should check the tag */
-               tag = ber_scanf( ber, "{O}", newpasswd );
+               tag = ber_scanf( ber, "{o}", newpasswd );
                ber_free( ber, 1 );
 
                if( tag == LBER_ERROR ) {
@@ -129,7 +130,7 @@ ldap_passwd_s(
        struct berval   *user,
        struct berval   *oldpw,
        struct berval   *newpw,
-       struct berval **newpasswd,
+       struct berval *newpasswd,
        LDAPControl **sctrls,
        LDAPControl **cctrls )
 {
index f5c5df81d6cda1528b58a6435762a50b21f15e5d..47a1f1b6c5a16b31725787bac8d2f850831e1564 100644 (file)
@@ -72,7 +72,7 @@ ldap_back_exop_passwd(
        struct berval id = { 0, NULL };
        struct berval old = { 0, NULL };
        struct berval new = { 0, NULL };
-       struct berval dn, mdn = { 0, NULL }, *newpw = NULL;
+       struct berval dn, mdn = { 0, NULL }, newpw;
        LDAPMessage *res;
        ber_int_t msgid;
        char *msg = NULL, *match = NULL;
@@ -156,9 +156,9 @@ ldap_back_exop_passwd(
                        if (rc == LDAP_SUCCESS) {
                                if (err == LDAP_SUCCESS) {
                                        rc = ldap_parse_passwd(lc->ld, res, &newpw);
-                                       if (rc == LDAP_SUCCESS && newpw) {
-                                               *rspdata = slap_passwd_return(newpw);
-                                               ber_bvfree(newpw);
+                                       if (rc == LDAP_SUCCESS && newpw.bv_val) {
+                                               *rspdata = slap_passwd_return(&newpw);
+                                               free(newpw.bv_val);
                                        }
                                } else {
                                        rc = err;