]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/ldapsync.c
Fix prev commit
[openldap] / servers / slapd / ldapsync.c
index 0139a7639a933f128d4c8382c39935ebb4ebfe9d..cfbbe4b5d96294967c99d6ffc374c94f10b883f0 100644 (file)
@@ -2,7 +2,7 @@
 /* $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 "../../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,
@@ -388,7 +395,7 @@ slap_parse_sync_cookie(
 
        if (( csn_ptr = strstr( cookie->octet_str[0].bv_val, "csn=" )) != NULL ) {
                csn_str = SLAP_STRNDUP( csn_ptr, LDAP_LUTIL_CSNSTR_BUFSIZE );
-               if ( cval = strchr( csn_str, ',' )) {
+               if ( (cval = strchr( csn_str, ',' )) != NULL ) {
                        *cval = '\0';
                        csn_str_len = cval - csn_str - (sizeof("csn=") - 1);
                } else {
@@ -408,7 +415,7 @@ slap_parse_sync_cookie(
        if (( sid_ptr = strstr( cookie->octet_str->bv_val, "sid=" )) != NULL ) {
                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 );
@@ -420,7 +427,7 @@ slap_parse_sync_cookie(
        if (( rid_ptr = strstr( cookie->octet_str->bv_val, "rid=" )) != NULL ) {
                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 );
@@ -428,6 +435,7 @@ slap_parse_sync_cookie(
        } else {
                cookie->rid = -1;
        }
+       return 0;
 }
 
 int