mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#3917 don't check csn syntax if schema isn't inited yet
This commit is contained in:
parent
a99e5846b3
commit
0b2a428a29
@ -95,17 +95,33 @@ slap_parse_sync_cookie(
|
||||
int csn_str_len;
|
||||
int valid = 0;
|
||||
char *rid_ptr;
|
||||
char *rid_str;
|
||||
char *cval;
|
||||
|
||||
if ( cookie == NULL )
|
||||
return -1;
|
||||
|
||||
cookie->rid = -1;
|
||||
if (( rid_ptr = strstr( cookie->octet_str.bv_val, "rid=" )) != NULL ) {
|
||||
if ( (cval = strchr( rid_ptr, ',' )) != NULL ) {
|
||||
*cval = '\0';
|
||||
}
|
||||
cookie->rid = atoi( rid_ptr + sizeof("rid=") - 1 );
|
||||
if ( cval != NULL ) {
|
||||
*cval = ',';
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (( csn_ptr = strstr( cookie->octet_str.bv_val, "csn=" )) != NULL ) {
|
||||
AttributeDescription *ad = slap_schema.si_ad_modifyTimestamp;
|
||||
slap_syntax_validate_func *validate;
|
||||
struct berval stamp;
|
||||
|
||||
/* This only happens when called from main */
|
||||
if ( ad == NULL )
|
||||
break;
|
||||
|
||||
csn_str = csn_ptr + STRLENOF("csn=");
|
||||
cval = strchr( csn_str, ',' );
|
||||
if ( cval )
|
||||
@ -131,17 +147,6 @@ slap_parse_sync_cookie(
|
||||
BER_BVZERO( &cookie->ctxcsn );
|
||||
}
|
||||
|
||||
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, ',' )) != NULL ) {
|
||||
*cval = '\0';
|
||||
}
|
||||
cookie->rid = atoi( rid_str + sizeof("rid=") - 1 );
|
||||
ch_free( rid_str );
|
||||
} else {
|
||||
cookie->rid = -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -362,8 +362,18 @@ int main( int argc, char **argv )
|
||||
scp = (struct sync_cookie *) ch_calloc( 1,
|
||||
sizeof( struct sync_cookie ));
|
||||
ber_str2bv( optarg, 0, 1, &scp->octet_str );
|
||||
|
||||
/* This only parses out the rid at this point */
|
||||
slap_parse_sync_cookie( scp, NULL );
|
||||
|
||||
if ( scp->rid == -1 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"main: invalid cookie \"%s\"\n",
|
||||
optarg, 0, 0 );
|
||||
slap_sync_cookie_free( scp, 1 );
|
||||
goto destroy;
|
||||
}
|
||||
|
||||
LDAP_STAILQ_FOREACH( scp_entry, &slap_sync_cookie, sc_next ) {
|
||||
if ( scp->rid == scp_entry->rid ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
|
@ -482,6 +482,8 @@ do_syncrep1(
|
||||
|
||||
LDAP_STAILQ_REMOVE( &slap_sync_cookie, sc, sync_cookie, sc_next );
|
||||
|
||||
/* ctxcsn wasn't parsed yet, do it now */
|
||||
slap_parse_sync_cookie( sc, op->o_tmpmemctx );
|
||||
if ( BER_BVISNULL( &sc->ctxcsn ) ) {
|
||||
/* if cmdline cookie does not have ctxcsn */
|
||||
/* component, set it to an initial value */
|
||||
|
Loading…
Reference in New Issue
Block a user