From c2d9d642f97f58e2e7739a74d326421aea566229 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 13 Oct 2005 22:28:30 +0000 Subject: [PATCH] cleanup --- contrib/slapd-modules/smbk5pwd/smbk5pwd.c | 24 ++++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/contrib/slapd-modules/smbk5pwd/smbk5pwd.c b/contrib/slapd-modules/smbk5pwd/smbk5pwd.c index 06ae34215f..9e8f27c7df 100644 --- a/contrib/slapd-modules/smbk5pwd/smbk5pwd.c +++ b/contrib/slapd-modules/smbk5pwd/smbk5pwd.c @@ -23,9 +23,9 @@ #include #include +#include #ifdef DO_KRB5 -#include #include #include #include @@ -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; -- 2.39.5