/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003 The OpenLDAP Foundation.
+ * Copyright 2003-2004 The OpenLDAP Foundation.
* Portions Copyright 2003 IBM Corporation.
* All rights reserved.
*
#include "ldap_pvt.h"
#include "lutil.h"
#include "slap.h"
+#include "../../libraries/liblber/lber-int.h" /* get ber_strndup() */
#include "lutil_ldap.h"
+#if 0
+struct sync_cookie *slap_sync_cookie = NULL;
+#else
+struct slap_sync_cookie_s slap_sync_cookie =
+ LDAP_STAILQ_HEAD_INITIALIZER( slap_sync_cookie );
+#endif
+
int
slap_build_sync_state_ctrl(
Operation *op,
BerElementBuffer berbuf;
BerElement *ber = (BerElement *)&berbuf;
- struct berval entryuuid_bv = { 0, NULL };
+ struct berval entryuuid_bv = BER_BVNULL;
ber_init2( ber, 0, LBER_USE_DER );
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
BerElementBuffer berbuf;
BerElement *ber = (BerElement *)&berbuf;
- struct berval entryuuid_bv = { 0, NULL };
+ struct berval entryuuid_bv = BER_BVNULL;
ber_init2( ber, NULL, LBER_USE_DER );
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
return -1;
if (( csn_ptr = strstr( cookie->octet_str[0].bv_val, "csn=" )) != NULL ) {
- csn_str = (char *) SLAP_STRNDUP( csn_ptr, LDAP_LUTIL_CSNSTR_BUFSIZE );
- if ( cval = strchr( csn_str, ',' )) {
+ csn_str = SLAP_STRNDUP( csn_ptr, LDAP_LUTIL_CSNSTR_BUFSIZE );
+ if ( (cval = strchr( csn_str, ',' )) != NULL ) {
*cval = '\0';
csn_str_len = cval - csn_str - (sizeof("csn=") - 1);
} else {
}
if (( sid_ptr = strstr( cookie->octet_str->bv_val, "sid=" )) != NULL ) {
- sid_str = (char *) SLAP_STRNDUP( sid_ptr,
+ sid_str = SLAP_STRNDUP( sid_ptr,
SLAP_SYNC_SID_SIZE + sizeof("sid=") - 1 );
- if ( cval = strchr( sid_str, ',' )) {
+ if ( (cval = strchr( sid_str, ',' )) != NULL ) {
*cval = '\0';
}
cookie->sid = atoi( sid_str + sizeof("sid=") - 1 );
}
if (( rid_ptr = strstr( cookie->octet_str->bv_val, "rid=" )) != NULL ) {
- rid_str = (char *) SLAP_STRNDUP( rid_ptr,
+ rid_str = SLAP_STRNDUP( rid_ptr,
SLAP_SYNC_RID_SIZE + sizeof("rid=") - 1 );
- if ( cval = strchr( rid_str, ',' )) {
+ if ( (cval = strchr( rid_str, ',' )) != NULL ) {
*cval = '\0';
}
cookie->rid = atoi( rid_str + sizeof("rid=") - 1 );
} else {
cookie->rid = -1;
}
+ return 0;
}
int
)
{
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE + 4 ];
- struct berval octet_str = { 0, NULL };
- struct berval ctxcsn = { 0, NULL };
- struct berval ctxcsn_dup = { 0, NULL };
+ struct berval octet_str = BER_BVNULL;
+ struct berval ctxcsn = BER_BVNULL;
+ struct berval ctxcsn_dup = BER_BVNULL;
struct berval slap_syncCookie;
if ( cookie == NULL )
int ret;
Attribute* a;
- struct berval entryuuid_bv = { 0, NULL };
+ struct berval entryuuid_bv = BER_BVNULL;
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
AttributeDescription *desc = a->a_desc;