]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/ppolicy.c
Fix prev commit
[openldap] / servers / slapd / overlays / ppolicy.c
index 88633d167c55687909242472e820e820ea298d13..958348e939e035196849fc15ead5b2ddcadf92f8 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2004-2005 The OpenLDAP Foundation.
+ * Copyright 2004-2006 The OpenLDAP Foundation.
  * Portions Copyright 2004-2005 Howard Chu, Symas Corporation.
  * Portions Copyright 2004 Hewlett-Packard Company.
  * All rights reserved.
@@ -259,11 +259,12 @@ account_locked( Operation *op, Entry *e,
        return 0;
 }
 
-#define PPOLICY_WARNING 0xa0L
-#define PPOLICY_ERROR 0xa1L
+/* IMPLICIT TAGS, all context-specific */
+#define PPOLICY_WARNING 0xa0L  /* constructed + 0 */
+#define PPOLICY_ERROR 0x81L            /* primitive + 1 */
  
-#define PPOLICY_EXPIRE 0xa0L
-#define PPOLICY_GRACE  0xa1L
+#define PPOLICY_EXPIRE 0x80L   /* primitive + 0 */
+#define PPOLICY_GRACE  0x81L   /* primitive + 1 */
 
 static LDAPControl *
 create_passcontrol( int exptime, int grace, LDAPPasswordPolicyError err )
@@ -731,8 +732,10 @@ ppolicy_bind_resp( Operation *op, SlapReply *rs )
                m->sml_type = ad_pwdFailureTime->ad_cname;
                m->sml_desc = ad_pwdFailureTime;
                m->sml_values = ch_calloc( sizeof(struct berval), 2 );
+               m->sml_nvalues = ch_calloc( sizeof(struct berval), 2 );
 
                ber_dupbv( &m->sml_values[0], &timestamp );
+               ber_dupbv( &m->sml_nvalues[0], &timestamp );
                m->sml_next = mod;
                mod = m;
 
@@ -778,7 +781,9 @@ ppolicy_bind_resp( Operation *op, SlapReply *rs )
                        m->sml_type = ad_pwdAccountLockedTime->ad_cname;
                        m->sml_desc = ad_pwdAccountLockedTime;
                        m->sml_values = ch_calloc( sizeof(struct berval), 2 );
+                       m->sml_nvalues = ch_calloc( sizeof(struct berval), 2 );
                        ber_dupbv( &m->sml_values[0], &timestamp );
+                       ber_dupbv( &m->sml_nvalues[0], &timestamp );
                        m->sml_next = mod;
                        mod = m;
                }
@@ -880,7 +885,9 @@ grace:
                m->sml_type = ad_pwdGraceUseTime->ad_cname;
                m->sml_desc = ad_pwdGraceUseTime;
                m->sml_values = ch_calloc( sizeof(struct berval), 2 );
+               m->sml_nvalues = ch_calloc( sizeof(struct berval), 2 );
                ber_dupbv( &m->sml_values[0], &timestamp );
+               ber_dupbv( &m->sml_nvalues[0], &timestamp );
                m->sml_next = mod;
                mod = m;
 
@@ -1155,7 +1162,7 @@ ppolicy_add(
                        timestamp.bv_len = sizeof(timebuf);
                        slap_timestamp( &now, &timestamp );
 
-                       attr_merge_one( op->ora_e, ad_pwdChangedTime, &timestamp, NULL );
+                       attr_merge_one( op->ora_e, ad_pwdChangedTime, &timestamp, &timestamp );
                }
        }
        return SLAP_CB_CONTINUE;
@@ -1568,7 +1575,9 @@ do_modify:
                if (pwmop != LDAP_MOD_DELETE) {
                        mods->sml_op = LDAP_MOD_REPLACE;
                        mods->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
+                       mods->sml_nvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
                        ber_dupbv( &mods->sml_values[0], &timestamp );
+                       ber_dupbv( &mods->sml_nvalues[0], &timestamp );
                        mods->sml_values[1].bv_len = 0;
                        mods->sml_values[1].bv_val = NULL;
                        assert( mods->sml_values[0].bv_val != NULL );