From f301b0cae52828711a4f7ce38be2f888e88551a3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 18 Mar 2004 00:28:30 +0000 Subject: [PATCH] Sync with HEAD --- servers/slapd/passwd.c | 33 +++++++++++++++++++++++++++------ servers/slapd/proto-slap.h | 17 +++++++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c index fde6514a41..a70fcc2102 100644 --- a/servers/slapd/passwd.c +++ b/servers/slapd/passwd.c @@ -168,7 +168,7 @@ int passwd_extop( } ml->sml_values = ch_malloc( (nhash+1)*sizeof(struct berval) ); for ( i=0; hashes[i]; i++ ) { - slap_passwd_hash( hashes[i], &qpw->rs_new, &hash, &rs->sr_text ); + slap_passwd_hash_type( &qpw->rs_new, &hash, hashes[i], &rs->sr_text ); if ( hash.bv_len == 0 ) { if ( !rs->sr_text ) { rs->sr_text = "password hash failed"; @@ -183,9 +183,7 @@ int passwd_extop( ml->sml_op = LDAP_MOD_REPLACE; ml->sml_next = qpw->rs_mods; qpw->rs_mods = ml; - if ( rsp ) { - free( qpw->rs_new.bv_val ); - } + if ( hashes[i] ) { rs->sr_err = LDAP_OTHER; } else { @@ -194,6 +192,8 @@ int passwd_extop( op2.o_tag = LDAP_REQ_MODIFY; op2.o_callback = &cb2; op2.orm_modlist = qpw->rs_mods; + cb2.sc_private = qpw; /* let Modify know this was pwdMod, + * if it cares... */ rs->sr_err = slap_mods_opattrs( &op2, ml, qpw->rs_modtail, &rs->sr_text, NULL, 0 ); @@ -208,6 +208,9 @@ int passwd_extop( } } slap_mods_free( qpw->rs_mods ); + if ( rsp ) { + free( qpw->rs_new.bv_val ); + } return rs->sr_err; } @@ -452,15 +455,17 @@ slap_passwd_generate( struct berval *pass ) } void -slap_passwd_hash( - char *hash, +slap_passwd_hash_type( struct berval * cred, struct berval * new, + char *hash, const char **text ) { new->bv_len = 0; new->bv_val = NULL; + assert( hash ); + #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD ) ldap_pvt_thread_mutex_lock( &passwd_mutex ); #endif @@ -472,3 +477,19 @@ slap_passwd_hash( #endif } +void +slap_passwd_hash( + struct berval * cred, + struct berval * new, + const char **text ) +{ + char *hash = NULL; + if ( default_passwd_hash ) { + hash = default_passwd_hash[0]; + } + if ( !hash ) { + hash = (char *)defhash[0]; + } + + slap_passwd_hash_type( cred, new, hash, text ); +} diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index f58c1d2487..2956c7ed70 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -283,6 +283,7 @@ LDAP_SLAPD_F (int) glue_sub_init( void ); LDAP_SLAPD_F (int) overlay_register( slap_overinst *on ); LDAP_SLAPD_F (int) overlay_config( BackendDB *be, const char *ov ); +LDAP_SLAPD_F (slap_overinst *) overlay_next( slap_overinst *on ); /* * ch_malloc.c @@ -339,7 +340,6 @@ LDAP_SLAPD_F (int) connections_timeout_idle LDAP_P((time_t)); LDAP_SLAPD_F (int) connection_client_setup LDAP_P(( ber_socket_t s, - Listener *l, ldap_pvt_thread_start_t *func, void *arg )); LDAP_SLAPD_F (void) connection_client_enable LDAP_P(( ber_socket_t s )); @@ -371,6 +371,10 @@ LDAP_SLAPD_F (Connection *) connection_next LDAP_P(( LDAP_SLAPD_F (void) connection_done LDAP_P((Connection *)); LDAP_SLAPD_F (void) connection2anonymous LDAP_P((Connection *)); +LDAP_SLAPD_F (void) connection_fake_init LDAP_P(( + Connection *conn, + Operation *op, + void *threadctx )); /* * cr.c @@ -528,8 +532,8 @@ LDAP_SLAPD_F (int) extops_kill LDAP_P(( void )); LDAP_SLAPD_F (struct berval *) get_supported_extop LDAP_P((int index)); /* - * * cancel.c - * */ + * cancel.c + */ LDAP_SLAPD_F ( SLAP_EXTOP_MAIN_FN ) cancel_extop; /* @@ -864,11 +868,16 @@ LDAP_SLAPD_F (int) slap_passwd_check( LDAP_SLAPD_F (void) slap_passwd_generate( struct berval * ); LDAP_SLAPD_F (void) slap_passwd_hash( - char *type, struct berval *cred, struct berval *hash, const char **text ); +LDAP_SLAPD_F (void) slap_passwd_hash_type( + struct berval *cred, + struct berval *hash, + char *htype, + const char **text ); + LDAP_SLAPD_F (struct berval *) slap_passwd_return( struct berval *cred ); -- 2.39.5