Wrap request/response bervals in a sequence.

This commit is contained in:
Kurt Zeilenga 1999-12-11 19:33:45 +00:00
parent 7ee49bc676
commit fe5608c4d5
3 changed files with 18 additions and 4 deletions

View File

@ -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" );

View File

@ -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

View File

@ -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 );
}