/* $OpenLDAP$ */
-/*
- * Copyright 1999-2003 The OpenLDAP Foundation.
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2003 The OpenLDAP Foundation.
* All rights reserved.
*
- * Redistribution and use in source and binary forms are permitted only
- * as authorized by the OpenLDAP Public License. A copy of this
- * license is available at http://www.OpenLDAP.org/license.html or
- * in file LICENSE in the top-level directory of the distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
+
#include "portable.h"
#include <stdio.h>
}
siz = sizeof( AttributeName );
- off = 0;
+ off = offsetof( AttributeName, an_name );
if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
rs->sr_text = "preread control: decoding error";
return LDAP_PROTOCOL_ERROR;
}
siz = sizeof( AttributeName );
- off = 0;
+ off = offsetof( AttributeName, an_name );
if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
rs->sr_text = "postread control: decoding error";
return LDAP_PROTOCOL_ERROR;
BerElement *ber;
ber_int_t mode;
ber_len_t len;
- struct berval cookie = { 0, NULL };
+ struct slap_session_entry *se;
if ( op->o_sync != SLAP_NO_CONTROL ) {
rs->sr_text = "LDAP Sync control specified multiple times";
tag = ber_peek_tag( ber, &len );
- if ( tag == LDAP_SYNC_TAG_COOKIE ) {
- if (( ber_scanf( ber, /*{*/ "m}",
- &cookie )) == LBER_ERROR ) {
+ if ( tag == LDAP_TAG_SYNC_COOKIE ) {
+ struct berval tmp_bv;
+ if (( ber_scanf( ber, /*{*/ "o", &tmp_bv )) == LBER_ERROR ) {
rs->sr_text = "LDAP Sync control : cookie decoding error";
return LDAP_PROTOCOL_ERROR;
}
- } else {
- if (( ber_scanf( ber, /*{*/ "}")) == LBER_ERROR ) {
- rs->sr_text = "LDAP Sync control : decoding error";
+ ber_bvarray_add( &op->o_sync_state.octet_str, &tmp_bv );
+ slap_parse_sync_cookie( &op->o_sync_state );
+ }
+ if ( tag == LDAP_TAG_RELOAD_HINT ) {
+ if (( ber_scanf( ber, /*{*/ "b", &op->o_sync_rhint )) == LBER_ERROR ) {
+ rs->sr_text = "LDAP Sync control : rhint decoding error";
return LDAP_PROTOCOL_ERROR;
}
- cookie.bv_len = 0;
- cookie.bv_val = NULL;
}
-
- ber_dupbv( &op->o_sync_state, &cookie );
+ if (( ber_scanf( ber, /*{*/ "}")) == LBER_ERROR ) {
+ rs->sr_text = "LDAP Sync control : decoding error";
+ return LDAP_PROTOCOL_ERROR;
+ }
(void) ber_free( ber, 1 );