374
374
else if ((mods[i]->mod_op & LDAP_MOD_DELETE) || mods[i]->mod_bvalues == NULL
375
375
|| mods[i]->mod_bvalues[0]->bv_val == NULL)
377
/* currently, you can only remove referral,
378
legacy consumer or bind dn attribute */
378
* Where possible/allowed return replica config settings to their
379
381
if (strcasecmp (config_attr, attr_replicaBindDn) == 0)
381
383
*returncode = replica_config_change_updatedn (r, mods[i], errortext, apply_mods);
398
400
strcasecmp (config_attr, type_replicaAbortCleanRUV) == 0)
401
* Only allow the deletion of the cleanAllRUV config attributes, and the
403
* Nothing to do in this case, allow it, and continue.
406
407
else if (strcasecmp (config_attr, type_replicaProtocolTimeout) == 0 )
408
replica_set_protocol_timeout(r, DEFAULT_PROTOCOL_TIMEOUT);
410
replica_set_protocol_timeout(r, DEFAULT_PROTOCOL_TIMEOUT);
412
else if(strcasecmp (config_attr, type_replicaBackoffMin) == 0 )
415
replica_set_backoff_min(r, PROTOCOL_BACKOFF_MINIMUM);
417
else if (strcasecmp (config_attr, type_replicaBackoffMax) == 0 )
420
replica_set_backoff_max(r, PROTOCOL_BACKOFF_MAXIMUM);
417
429
else /* modify an attribute */
419
431
config_attr_value = (char *) mods[i]->mod_bvalues[0]->bv_val;
432
if (NULL == config_attr_value) {
433
*returncode = LDAP_UNWILLING_TO_PERFORM;
434
PR_snprintf (errortext, SLAPI_DSE_RETURNTEXT_SIZE, "attribute %s value is NULL.\n",
436
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_config_modify: %s\n",
421
441
if (strcasecmp (config_attr, attr_replicaBindDn) == 0)
425
445
else if (strcasecmp (config_attr, attr_replicaType) == 0)
447
slapi_ch_free_string(&new_repl_type);
427
448
new_repl_type = slapi_ch_strdup(config_attr_value);
429
450
else if (strcasecmp (config_attr, attr_replicaId) == 0)
452
slapi_ch_free_string(&new_repl_id);
431
453
new_repl_id = slapi_ch_strdup(config_attr_value);
433
455
else if (strcasecmp (config_attr, attr_flags) == 0)
480
502
else if (strcasecmp (config_attr, type_replicaLegacyConsumer) == 0)
504
if (apply_mods && config_attr_value[0])
484
506
PRBool legacy = (strcasecmp (config_attr_value, "on") == 0) ||
485
507
(strcasecmp (config_attr_value, "true") == 0) ||
498
520
else if (strcasecmp (config_attr, type_replicaProtocolTimeout) == 0 ){
523
PRUint64 ptimeout = 0;
503
if(config_attr_value){
504
ptimeout = atol(config_attr_value);
525
ptimeout = atoll(config_attr_value);
507
527
if(ptimeout <= 0){
508
528
*returncode = LDAP_UNWILLING_TO_PERFORM;
509
529
PR_snprintf (errortext, SLAPI_DSE_RETURNTEXT_SIZE,
510
530
"attribute %s value (%s) is invalid, must be a number greater than zero.\n",
511
config_attr, config_attr_value ? config_attr_value : "");
531
config_attr, config_attr_value);
512
532
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_config_modify: %s\n", errortext);
515
535
replica_set_protocol_timeout(r, ptimeout);
538
else if(strcasecmp (config_attr, type_replicaBackoffMin) == 0 )
542
PRUint64 val = atoll(config_attr_value);
545
*returncode = LDAP_UNWILLING_TO_PERFORM;
546
PR_snprintf (errortext, SLAPI_DSE_RETURNTEXT_SIZE,
547
"attribute %s value (%s) is invalid, must be a number greater than zero.\n",
548
config_attr, config_attr_value);
549
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_config_modify: %s\n", errortext);
552
replica_set_backoff_min(r, val);
555
else if (strcasecmp (config_attr, type_replicaBackoffMax) == 0 )
559
PRUint64 val = atoll(config_attr_value);
562
*returncode = LDAP_UNWILLING_TO_PERFORM;
563
PR_snprintf (errortext, SLAPI_DSE_RETURNTEXT_SIZE,
564
"attribute %s value (%s) is invalid, must be a number greater than zero.\n",
565
config_attr, config_attr_value);
566
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_config_modify: %s\n", errortext);
569
replica_set_backoff_max(r, val);
520
574
*returncode = LDAP_UNWILLING_TO_PERFORM;
1153
1207
PR_snprintf (fName, MAXPATHLEN, "%s/%s.ldif", clDir, replica_get_name (replica));
1154
slapi_ch_free_string (&clDir);
1156
1208
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
1157
1209
"Beginning changelog export of replica \"%s\"\n",
1158
1210
replica_get_name(replica));
1226
1280
"Beginning changelog import of replica \"%s\"\n",
1227
1281
replica_get_name(replica));
1228
1282
imprc = cl5ImportLDIF (clDir, fName, rlist);
1229
slapi_ch_free_string (&clDir);
1230
1283
if (CL5_SUCCESS == imprc)
1232
1285
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
1256
1309
config.dir?config.dir:"null config dir");
1257
1310
rc = LDAP_OPERATIONS_ERROR;
1314
slapi_ch_free_string(&clDir);
1260
1315
changelog5_config_done(&config);
1261
1317
/* if cl5ImportLDIF returned an error, report it first. */
1262
1318
return imprc?imprc:rc;
2224
2280
rc = ldap_modify_ext_s( ld, repl_dn, mods, NULL, NULL);
2226
2282
if(rc != LDAP_SUCCESS){
2283
char *hostname = agmt_get_hostname(agmt);
2227
2285
cleanruv_log(clean_data->task, CLEANALLRUV_ID, "Failed to add CLEANRUV task (%s) to replica "
2228
2286
"(%s). You will need to manually run the CLEANRUV task on this replica (%s) error (%d)",
2229
repl_dn, agmt_get_long_name(agmt), agmt_get_hostname(agmt), rc);
2287
repl_dn, agmt_get_long_name(agmt), hostname, rc);
2288
slapi_ch_free_string(&hostname);
2231
2290
slapi_ch_free_string(&repl_dn);
2232
2291
slapi_sdn_free(&sdn);