]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/ppolicy.c
forgot access control...
[openldap] / servers / slapd / overlays / ppolicy.c
index 36836c51271f01c0344b7af4bbb7d5785e2ebb24..17f90fa17b45b2d4fcceb419b3129d307917e2ca 100644 (file)
@@ -395,17 +395,16 @@ create_passcontrol( Operation *op, int exptime, int grace, LDAPPasswordPolicyErr
        }
        ber_printf( ber, /*{*/ "N}" );
 
-       if (ber_flatten2( ber, &(c.ldctl_value), 1 ) == LBER_DEFAULT) {
+       if (ber_flatten2( ber, &c.ldctl_value, 0 ) == -1) {
                return NULL;
        }
-       (void)ber_free_buf(ber);
        cp = op->o_tmpalloc( sizeof( LDAPControl ) + c.ldctl_value.bv_len, op->o_tmpmemctx );
        cp->ldctl_oid = (char *)ppolicy_ctrl_oid;
        cp->ldctl_iscritical = 0;
        cp->ldctl_value.bv_val = (char *)&cp[1];
        cp->ldctl_value.bv_len = c.ldctl_value.bv_len;
        AC_MEMCPY( cp->ldctl_value.bv_val, c.ldctl_value.bv_val, c.ldctl_value.bv_len );
-       ber_memfree( c.ldctl_value.bv_val );
+       (void)ber_free_buf(ber);
        
        return cp;
 }
@@ -679,7 +678,7 @@ parse_pwdhistory( struct berval *bv, char **oid, time_t *oldtime, struct berval
 {
        char *ptr;
        struct berval nv, npw;
-       int i, j;
+       ber_len_t i, j;
        
        assert (bv && (bv->bv_len > 0) && (bv->bv_val) && oldtime && oldpw );
 
@@ -855,8 +854,7 @@ ctrls_cleanup( Operation *op, SlapReply *rs, LDAPControl **oldctrls )
 
        for ( n = 0; rs->sr_ctrls[n]; n++ ) {
                if ( rs->sr_ctrls[n]->ldctl_oid == ppolicy_ctrl_oid ) {
-                       ch_free( rs->sr_ctrls[n]->ldctl_value.bv_val );
-                       ch_free( rs->sr_ctrls[n] );
+                       op->o_tmpfree( rs->sr_ctrls[n], op->o_tmpmemctx );
                        rs->sr_ctrls[n] = (LDAPControl *)(-1);
                        break;
                }
@@ -2021,7 +2019,7 @@ return_results:
        if ( send_ctrl ) {
                if ( is_pwdexop ) {
                        if ( rs->sr_flags & REP_CTRLS_MUSTBEFREED ) {
-                               slap_free_ctrls( op, oldctrls );
+                               op->o_tmpfree( oldctrls, op->o_tmpmemctx );
                        }
                        oldctrls = NULL;
                        rs->sr_flags |= REP_CTRLS_MUSTBEFREED;