/* * This is passed the slapd command line arguments. */ void repl_entry_init(int argc, char** argv) { int i; for(i=1;i<argc;i++) { if(strcmp(argv[i],"db2ldif")==0) { dumping_to_ldif= 1; } if(strcmp(argv[i],"-r")==0) { doing_replica_init= 1; } if(strcmp(argv[i],"-s")==0) { char *s= slapi_dn_normalize ( slapi_ch_strdup(argv[i+1]) ); charray_add(&include_suffix,s); i++; } } }
/* * Function Implementations */ int linked_attrs_fixup_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) { PRThread *thread = NULL; int rv = SLAPI_DSE_CALLBACK_OK; task_data *mytaskdata = NULL; Slapi_Task *task = NULL; const char *linkdn = NULL; char *bind_dn; *returncode = LDAP_SUCCESS; /* make sure the plugin is not closed */ if(!linked_attrs_is_started()){ *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } /* get arg(s) */ linkdn = fetch_attr(e, "linkdn", 0); /* setup our task data */ slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &bind_dn); mytaskdata = (task_data*)slapi_ch_calloc(1, sizeof(task_data)); if (mytaskdata == NULL) { *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } if (linkdn) { mytaskdata->linkdn = slapi_dn_normalize(slapi_ch_strdup(linkdn)); } mytaskdata->bind_dn = slapi_ch_strdup(bind_dn); /* allocate new task now */ task = slapi_new_task(slapi_entry_get_ndn(e)); /* register our destructor for cleaning up our private data */ slapi_task_set_destructor_fn(task, linked_attrs_fixup_task_destructor); /* Stash a pointer to our data in the task */ slapi_task_set_data(task, mytaskdata); /* start the sample task as a separate thread */ thread = PR_CreateThread(PR_USER_THREAD, linked_attrs_fixup_task_thread, (void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE); if (thread == NULL) { slapi_log_error( SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM, "unable to create task thread!\n"); *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; slapi_task_finish(task, *returncode); } else { rv = SLAPI_DSE_CALLBACK_OK; } out: return rv; }