From 7e1a5663910649d3c72b683eacc589a44cbc16ef Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 16 Feb 2003 09:42:04 +0000 Subject: [PATCH] Use struct berval * instead of ** for newpasswd --- libraries/libldap/passwd.c | 9 +++++---- servers/slapd/back-ldap/extended.c | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libraries/libldap/passwd.c b/libraries/libldap/passwd.c index c4ab24abd5..e228ba8ced 100644 --- a/libraries/libldap/passwd.c +++ b/libraries/libldap/passwd.c @@ -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 ) { diff --git a/servers/slapd/back-ldap/extended.c b/servers/slapd/back-ldap/extended.c index f5c5df81d6..47a1f1b6c5 100644 --- a/servers/slapd/back-ldap/extended.c +++ b/servers/slapd/back-ldap/extended.c @@ -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; -- 2.39.5