]> git.sur5r.net Git - openldap/commitdiff
cleanup
authorPierangelo Masarati <ando@openldap.org>
Thu, 13 Oct 2005 22:28:30 +0000 (22:28 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 13 Oct 2005 22:28:30 +0000 (22:28 +0000)
contrib/slapd-modules/smbk5pwd/smbk5pwd.c

index 06ae34215ff80e9a244623a8b0f2ee1312754faa..9e8f27c7df8da5b6080688d76bb9f8a40d01d6cf 100644 (file)
@@ -23,9 +23,9 @@
 
 #include <slap.h>
 #include <ac/errno.h>
+#include <ac/string.h>
 
 #ifdef DO_KRB5
-#include <ac/string.h>
 #include <lber.h>
 #include <lber_pvt.h>
 #include <lutil.h>
@@ -365,8 +365,7 @@ static int smbk5pwd_exop_passwd(
                        keys[i].bv_val = (char *)buf;
                        keys[i].bv_len = len;
                }
-               keys[i].bv_val = NULL;
-               keys[i].bv_len = 0;
+               BER_BVZERO( &keys[i] );
 
                _kadm5_free_keys(kadm_context, ent.keys.len, ent.keys.val);
 
@@ -401,8 +400,7 @@ static int smbk5pwd_exop_passwd(
                ml->sml_values[0].bv_val = ch_malloc( 64 );
                ml->sml_values[0].bv_len = sprintf(ml->sml_values[0].bv_val,
                        "%d", kvno+1 );
-               ml->sml_values[1].bv_val = NULL;
-               ml->sml_values[1].bv_len = 0;
+               BER_BVZERO( &ml->sml_values[1] );
                ml->sml_nvalues = NULL;
        } while(0);
 #endif /* DO_KRB5 */
@@ -439,8 +437,7 @@ static int smbk5pwd_exop_passwd(
                qpw->rs_mods = ml;
 
                keys = ch_malloc( 2 * sizeof(struct berval) );
-               keys[1].bv_val = NULL;
-               keys[1].bv_len = 0;
+               BER_BVZERO( &keys[1] );
                nthash( &pwd, keys );
                
                ml->sml_desc = ad_sambaNTPassword;
@@ -466,8 +463,7 @@ static int smbk5pwd_exop_passwd(
                qpw->rs_mods = ml;
 
                keys = ch_malloc( 2 * sizeof(struct berval) );
-               keys[1].bv_val = NULL;
-               keys[1].bv_len = 0;
+               BER_BVZERO( &keys[1] );
                lmhash( &pwd, keys );
                
                ml->sml_desc = ad_sambaLMPassword;
@@ -485,11 +481,11 @@ static int smbk5pwd_exop_passwd(
                qpw->rs_mods = ml;
 
                keys = ch_malloc( 2 * sizeof(struct berval) );
-               keys[1].bv_val = NULL;
-               keys[1].bv_len = 0;
-               keys[0].bv_val = ch_malloc(16);
-               keys[0].bv_len = sprintf(keys[0].bv_val, "%ld",
-                       slap_get_time());
+               keys[0].bv_val = ch_malloc( STRLENOF( "9223372036854775807L" ) + 1 );
+               keys[0].bv_len = snprintf(keys[0].bv_val,
+                       STRLENOF( "9223372036854775807L" ) + 1,
+                       "%ld", slap_get_time());
+               BER_BVZERO( &keys[1] );
                
                ml->sml_desc = ad_sambaPwdLastSet;
                ml->sml_op = LDAP_MOD_REPLACE;