]> git.sur5r.net Git - openldap/commitdiff
Password policy request control should have no control value.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 22 Aug 2007 19:26:55 +0000 (19:26 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 22 Aug 2007 19:26:55 +0000 (19:26 +0000)
Extend ldap_create_control() to supporting creating such.

libraries/libldap/controls.c
libraries/libldap/ppolicy.c

index aa38040c3eed251186f467bd2b668838b0f456b8..042dfe97a75e53170db1c29685efe1939068d64b 100644 (file)
@@ -427,7 +427,6 @@ ldap_create_control(
        LDAPControl *ctrl;
 
        assert( requestOID != NULL );
-       assert( ber != NULL );
        assert( ctrlp != NULL );
 
        ctrl = (LDAPControl *) LDAP_MALLOC( sizeof(LDAPControl) );
@@ -435,7 +434,8 @@ ldap_create_control(
                return LDAP_NO_MEMORY;
        }
 
-       if ( ber_flatten2( ber, &ctrl->ldctl_value, 1 ) == -1 ) {
+    ctrl->ldctl_value = NULL;
+       if ( ber && ( ber_flatten2( ber, &ctrl->ldctl_value, 1 ) == -1 )) {
                LDAP_FREE( ctrl );
                return LDAP_NO_MEMORY;
        }
index 16193f64008c5c830f4582712108859a85d3f147..b82208fe763f6454991b11771c4e6fd90a95ce12 100644 (file)
@@ -61,21 +61,13 @@ int
 ldap_create_passwordpolicy_control( LDAP *ld,
                                     LDAPControl **ctrlp )
 {
-       BerElement *ber;
-
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
        assert( ctrlp != NULL );
 
-       if ((ber = ldap_alloc_ber_with_options(ld)) == NULL) {
-               ld->ld_errno = LDAP_NO_MEMORY;
-               return(LDAP_NO_MEMORY);
-       }
-
        ld->ld_errno = ldap_create_control( LDAP_CONTROL_PASSWORDPOLICYREQUEST,
-               ber, 0, ctrlp);
+               NULL, 0, ctrlp);
 
-       ber_free(ber, 1);
        return(ld->ld_errno);
 }