From: Kurt Zeilenga Date: Sat, 11 Dec 1999 19:33:45 +0000 (+0000) Subject: Wrap request/response bervals in a sequence. X-Git-Tag: UCDATA_2_4~98 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe5608c4d57ad8042600b4978383af572a0157d4;p=openldap Wrap request/response bervals in a sequence. --- diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index 43e93fc130..04b4d469c9 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -246,6 +246,8 @@ main( int argc, char *argv[] ) return EXIT_FAILURE; } + ber_printf( ber, "{" /*}*/ ); + if( dn != NULL ) { ber_printf( ber, "ts", LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID, dn ); @@ -264,6 +266,8 @@ main( int argc, char *argv[] ) free(newpw); } + ber_printf( ber, /*{*/ "}" ); + rc = ber_flatten( ber, &bv ); if( rc < 0 ) { @@ -294,7 +298,7 @@ main( int argc, char *argv[] ) } /* we should check the tag */ - tag = ber_scanf( ber, "a", &s); + tag = ber_scanf( ber, "{a}", &s); if( tag == LBER_ERROR ) { perror( "ber_scanf" ); diff --git a/include/ldap.h b/include/ldap.h index e9352f9dbc..9b4a009b03 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -184,6 +184,7 @@ typedef struct ldapcontrol { #define LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID ((ber_tag_t) 0x80U) #define LDAP_TAG_EXOP_X_MODIFY_PASSWD_OLD ((ber_tag_t) 0x81U) #define LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW ((ber_tag_t) 0x82U) +#define LDAP_TAG_EXOP_X_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U) /* * specific LDAP instantiations of BER types we know about diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c index 7a57bce129..d75926d1d1 100644 --- a/servers/slapd/passwd.c +++ b/servers/slapd/passwd.c @@ -75,7 +75,11 @@ int slap_passwd_parse( struct berval *reqdata, return LDAP_PROTOCOL_ERROR; } - tag = ber_peek_tag( ber, &len ); + tag = ber_scanf( ber, "{" /*}*/ ); + + if( tag != LBER_ERROR ) { + tag = ber_peek_tag( ber, &len ); + } if( tag == LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID ) { if( id == NULL ) { @@ -183,8 +187,8 @@ struct berval * slap_passwd_return( if( ber == NULL ) return NULL; - rc = ber_printf( ber, "tO", - LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW, cred ); + rc = ber_printf( ber, "{tO}", + LDAP_TAG_EXOP_X_MODIFY_PASSWD_GEN, cred ); if( rc == -1 ) { ber_free( ber, 1 ); @@ -226,6 +230,11 @@ slap_passwd_check( struct berval * slap_passwd_generate( void ) { Debug( LDAP_DEBUG_TRACE, "slap_passwd_generate\n", 0, 0, 0 ); + + /* + * generate passwords of only 8 characters as some getpass(3) + * implementations truncate at 8 characters. + */ return lutil_passwd_generate( 8 ); }