static void get_plugin_config_dn_and_entry( char *msg, Slapi_PBlock *pb ) { char *dn = NULL; Slapi_Entry *e = NULL; int loglevel = SLAPI_LOG_PLUGIN; if ( slapi_pblock_get( pb, SLAPI_TARGET_DN, &dn ) != 0 || dn == NULL ) { slapi_log_err( loglevel, msg, "failed to get plugin config DN\n" ); } else { slapi_log_err( loglevel, msg, "this plugin's config DN is \"%s\"\n", dn ); } if ( slapi_pblock_get( pb, SLAPI_ADD_ENTRY, &e ) != 0 || e == NULL ) { slapi_log_err( loglevel, msg, "failed to get plugin config entry\n" ); } else { char *ldif; ldif = slapi_entry2str_with_options( e, NULL, 0 ); slapi_log_err( loglevel, msg, "this plugin's config entry is \"\n%s\"\n", ldif ); slapi_ch_free_string( &ldif ); } }
/* * This plugin entry point is called whenever an NSDS50ReplicationEntry * extended operation is received. */ int multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb) { int rc; Slapi_Entry *e = NULL; Slapi_Connection *conn = NULL; PRUint64 connid = 0; int opid = 0; slapi_pblock_get(pb, SLAPI_CONN_ID, &connid); slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid); /* Decode the extended operation */ rc = decode_total_update_extop(pb, &e); if (0 == rc) { #ifdef notdef /* * Just spew LDIF so we're sure we got it right. Later we'll firehose * this into the database import code */ int len; char *str = slapi_entry2str_with_options(e, &len,SLAPI_DUMP_UNIQUEID); puts(str); free(str); #endif rc = slapi_import_entry (pb, e); /* slapi_import_entry returns an LDAP error in case of a * problem. If there's a problem, it's our responsibility * to free the slapi_entry that we're trying to import. */ if (rc != LDAP_SUCCESS) { const char *dn = slapi_entry_get_dn_const(e); slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "Error %d: could not import entry dn %s " "for total update operation conn=%" NSPRIu64 " op=%d\n", rc, dn, connid, opid); rc = -1; } } else { slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "Error %d: could not decode the total update extop " "for total update operation conn=%" NSPRIu64 " op=%d\n", rc, connid, opid); } if (rc != 0) { /* just disconnect from the supplier. bulk import is stopped when connection object is destroyed */ slapi_pblock_get (pb, SLAPI_CONNECTION, &conn); if (conn) { slapi_disconnect_server(conn); } /* cleanup */ if (e) { slapi_entry_free (e); } } return rc; }