Skip to content

Commit

Permalink
Duplicate cookie is not an error
Browse files Browse the repository at this point in the history
sync_new_cookie returns -1 for error and -2 for duplicate
  • Loading branch information
ndptech committed Oct 31, 2024
1 parent 9ccf1b7 commit ed1bbea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/listen/ldap_sync/rfc4533.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ int rfc4533_sync_search_entry(sync_state_t *sync, LDAPMessage *msg, LDAPControl
goto error;
}

if (sync_new_cookie(&new_cookie, sync, ber) < 0) goto error;
if (sync_new_cookie(&new_cookie, sync, ber) == -1) goto error;

if (ber_scanf(ber, "}") == LBER_ERROR ) {
ERROR("Malformed syncStatevalue sequence");
Expand Down Expand Up @@ -492,7 +492,7 @@ int rfc4533_sync_intermediate(sync_state_t *sync, LDAPMessage *msg, UNUSED LDAPC
* but those changes don't match the search.
*/
case LDAP_TAG_SYNC_NEW_COOKIE:
if (sync_new_cookie(&new_cookie, sync, ber) < 0) {
if (sync_new_cookie(&new_cookie, sync, ber) == -1) {
error:
if (sync_uuids) ber_bvarray_free(sync_uuids);
if (ber) ber_free(ber, 1);
Expand Down Expand Up @@ -533,7 +533,7 @@ int rfc4533_sync_intermediate(sync_state_t *sync, LDAPMessage *msg, UNUSED LDAPC
goto error;
}

if (sync_new_cookie(&new_cookie, sync, ber) < 0) goto error;
if (sync_new_cookie(&new_cookie, sync, ber) == -1) goto error;

if (ber_peek_tag(ber, &len) == LDAP_TAG_REFRESHDONE) {
if (ber_scanf(ber, "b", &refresh_done) == LBER_ERROR) {
Expand Down Expand Up @@ -579,7 +579,7 @@ int rfc4533_sync_intermediate(sync_state_t *sync, LDAPMessage *msg, UNUSED LDAPC
goto error;
}

if (sync_new_cookie(&new_cookie, sync, ber) < 0) goto error;
if (sync_new_cookie(&new_cookie, sync, ber) == -1) goto error;

if (ber_peek_tag(ber, &len) == LDAP_TAG_REFRESHDONE) {
if (ber_scanf(ber, "b", &refresh_done) == LBER_ERROR) {
Expand Down Expand Up @@ -609,7 +609,7 @@ int rfc4533_sync_intermediate(sync_state_t *sync, LDAPMessage *msg, UNUSED LDAPC
goto error;
}

if (sync_new_cookie(&new_cookie, sync, ber) < 0) goto error;
if (sync_new_cookie(&new_cookie, sync, ber) == -1) goto error;

if (ber_peek_tag(ber, &len) == LDAP_TAG_REFRESHDELETES) {
if (ber_scanf(ber, "b", &refresh_deletes) == LBER_ERROR) {
Expand Down Expand Up @@ -750,7 +750,7 @@ int rfc4533_sync_refresh_required(sync_state_t *sync, LDAPMessage *msg, LDAPCont

if (ber_scanf( ber, "{" /*"}"*/) == LBER_ERROR) goto error;

if (sync_new_cookie(&new_cookie, sync, ber) < 0) goto error;
if (sync_new_cookie(&new_cookie, sync, ber) == -1) goto error;

if (ber_peek_tag(ber, &len) == LDAP_TAG_REFRESHDELETES) {
if (ber_scanf(ber, "b", &refresh_deletes) == LBER_ERROR) {
Expand Down

0 comments on commit ed1bbea

Please sign in to comment.