diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-01-24 12:31:05 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-01-24 12:31:05 +0100 |
commit | dec7bdb04a1ee049e30efb1e6118df4523c8cce4 (patch) | |
tree | 502f343f9420b90e58756832e82c88210a5a331f /nslcd/myldap.c | |
parent | f6f2e4ed1e4f00a84c1cb719c5391a5632984492 (diff) |
free data returned from ldap_passwd_s() call if needed and add missing casts
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1056 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/myldap.c')
-rw-r--r-- | nslcd/myldap.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/nslcd/myldap.c b/nslcd/myldap.c index 929cd23..c0248e1 100644 --- a/nslcd/myldap.c +++ b/nslcd/myldap.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2006 Luke Howard Copyright (C) 2006, 2007 West Consulting - Copyright (C) 2006, 2007, 2008, 2009 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -1602,11 +1602,11 @@ int myldap_passwd( /* log the call */ log_log(LOG_DEBUG,"myldap_exop_passwd(userdn=\"%s\")",userdn); /* translate to ber stuff */ - ber_userdn.bv_val=userdn; + ber_userdn.bv_val=(char *)userdn; ber_userdn.bv_len=strlen(userdn); - ber_oldpassword.bv_val=oldpassword; - ber_oldpassword.bv_len=strlen(oldpassword); - ber_newpassword.bv_val=newpasswd; + ber_oldpassword.bv_val=(char *)oldpassword; + ber_oldpassword.bv_len=(oldpassword==NULL)?0:strlen(oldpassword); + ber_newpassword.bv_val=(char *)newpasswd; ber_newpassword.bv_len=strlen(newpasswd); ber_retpassword.bv_val=NULL; ber_retpassword.bv_len=0; @@ -1615,10 +1615,8 @@ int myldap_passwd( &ber_retpassword,NULL,NULL); if (rc!=LDAP_SUCCESS) log_log(LOG_ERR,"ldap_passwd_s() failed: %s",ldap_err2string(rc)); - - - /* FIXME: free ber_retpassword data if bv_val!=NULL */ - + /* free returned data if needed */ + if (ber_retpassword.bv_val!=NULL) + ldap_memfree(ber_retpassword.bv_val); return rc; - } |