lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1056 - nss-pam-ldapd/nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1056 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sun Jan 24 12:31:05 2010
New Revision: 1056
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1056

Log:
free data returned from ldap_passwd_s() call if needed and add missing casts

Modified:
   nss-pam-ldapd/nslcd/myldap.c

Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c        Sun Jan 24 12:10:34 2010        (r1055)
+++ nss-pam-ldapd/nslcd/myldap.c        Sun Jan 24 12:31:05 2010        (r1056)
@@ -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 @@
   /* 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 @@
                    &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;
-
 }
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits