X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libraries%2Flibldap%2Fpasswd.c;h=ab330a81b7a347b72f0c694923046c88e41efe41;hb=544d00f3e53f598e51d23c795f72e5ba3a2f8642;hp=a935d07343af377e77a8a2783117ee748e3fedba;hpb=159de0f1359459371c590ac770cc30edbade58d5;p=openldap
diff --git a/libraries/libldap/passwd.c b/libraries/libldap/passwd.c
index a935d07343..ab330a81b7 100644
--- a/libraries/libldap/passwd.c
+++ b/libraries/libldap/passwd.c
@@ -1,7 +1,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 1998-2003 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -12,6 +12,10 @@
* top-level directory of the distribution or, alternatively, at
* .
*/
+/* ACKNOWLEDGEMENTS:
+ * This program was orignally developed by Kurt D. Zeilenga for inclusion in
+ * OpenLDAP Software.
+ */
#include "portable.h"
@@ -32,8 +36,7 @@ int ldap_parse_passwd(
struct berval *newpasswd )
{
int rc;
- char *retoid = NULL;
- struct berval *retdata;
+ struct berval *retdata = NULL;
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
@@ -43,31 +46,32 @@ int ldap_parse_passwd(
newpasswd->bv_val = NULL;
newpasswd->bv_len = 0;
- rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 0 );
-
- if( rc != LDAP_SUCCESS ) {
+ rc = ldap_parse_extended_result( ld, res, NULL, &retdata, 0 );
+ if ( rc != LDAP_SUCCESS ) {
return rc;
}
- if( retdata != NULL ) {
+ if ( retdata != NULL ) {
ber_tag_t tag;
BerElement *ber = ber_init( retdata );
- if( ber == NULL ) {
- ld->ld_errno = LDAP_NO_MEMORY;
- return ld->ld_errno;
+ if ( ber == NULL ) {
+ rc = ld->ld_errno = LDAP_NO_MEMORY;
+ goto done;
}
/* we should check the tag */
tag = ber_scanf( ber, "{o}", newpasswd );
ber_free( ber, 1 );
- if( tag == LBER_ERROR ) {
+ if ( tag == LBER_ERROR ) {
rc = ld->ld_errno = LDAP_DECODING_ERROR;
}
}
- ber_memfree( retoid );
+done:;
+ ber_bvfree( retdata );
+
return rc;
}
@@ -81,7 +85,7 @@ ldap_passwd( LDAP *ld,
int *msgidp )
{
int rc;
- struct berval bv = {0, NULL};
+ struct berval bv = BER_BVNULL;
BerElement *ber = NULL;
assert( ld != NULL );
@@ -152,7 +156,7 @@ ldap_passwd_s(
return rc;
}
- if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) {
+ if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *) NULL, &res ) == -1 ) {
return ld->ld_errno;
}