From 19cd513a509aa6e45361df774e74f2d39451e08a Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Thu, 18 Oct 2007 00:08:38 +0000 Subject: Resolves: #188320 Summary: HP-UX: warnings reported by the HP-UX compiler --- ldap/servers/plugins/replication/cl5_api.c | 9 ++++--- ldap/servers/plugins/replication/cl5_config.c | 6 ++--- .../servers/plugins/replication/repl5_connection.c | 9 +++---- .../plugins/replication/repl5_inc_protocol.c | 5 ---- ldap/servers/plugins/replication/repl5_plugins.c | 14 ++++------ ldap/servers/plugins/replication/repl5_replica.c | 3 +-- ldap/servers/plugins/replication/repl5_total.c | 2 +- ldap/servers/plugins/replication/repl_controls.c | 2 +- ldap/servers/plugins/replication/repl_extop.c | 22 +++++++--------- ldap/servers/plugins/replication/repl_monitor.c | 10 ++++++-- ldap/servers/plugins/replication/replutil.c | 5 ---- .../plugins/replication/windows_connection.c | 30 +++------------------- .../plugins/replication/windows_inc_protocol.c | 5 ---- ldap/servers/plugins/replication/windows_private.c | 14 ++++++++-- .../plugins/replication/windows_protocol_util.c | 21 +++++++++------ .../plugins/replication/windows_tot_protocol.c | 13 ++-------- 16 files changed, 68 insertions(+), 102 deletions(-) (limited to 'ldap/servers/plugins/replication') diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index 44e81d28..6ea4ec9a 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -348,7 +348,9 @@ static int _cl5ReadBervals (struct berval ***bv, char** buff, unsigned int size) static int _cl5WriteBervals (struct berval **bv, char** buff, unsigned int *size); /* replay iteration */ +#ifdef FOR_DEBUGGING static PRBool _cl5ValidReplayIterator (const CL5ReplayIterator *iterator); +#endif static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consumerRuv, Object *replica, Object *fileObject, CL5ReplayIterator **iterator); static int _cl5CheckMissingCSN (const CSN *minCsn, const RUV *supplierRUV, CL5DBFile *file); @@ -3766,7 +3768,6 @@ static int _cl5RemoveGuardian () /* must be called under the state lock */ static void _cl5Close () { - int rc2 = 0; PRIntervalTime interval; if (s_cl5Desc.dbState != CL5_STATE_CLOSED) /* Don't try to close twice */ @@ -3792,7 +3793,7 @@ static void _cl5Close () if (s_cl5Desc.dbEnv) { DB_ENV *dbEnv = s_cl5Desc.dbEnv; - rc2 = dbEnv->close(dbEnv, 0); + dbEnv->close(dbEnv, 0); s_cl5Desc.dbEnv = NULL; } @@ -5596,6 +5597,7 @@ PRBool cl5HelperEntry (const char *csnstr, CSN *csnp) return retval; } +#ifdef FOR_DEBUGGING /* Replay iteration helper functions */ static PRBool _cl5ValidReplayIterator (const CL5ReplayIterator *iterator) { @@ -5606,6 +5608,7 @@ static PRBool _cl5ValidReplayIterator (const CL5ReplayIterator *iterator) return PR_TRUE; } +#endif /* Algorithm: ONREPL!!! */ @@ -5628,7 +5631,6 @@ static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consum int rc = CL5_SUCCESS; Object *supplierRuvObj = NULL; RUV *supplierRuv = NULL; - ReplicaId supplierRID; PRBool newReplica; PRBool haveChanges = PR_FALSE; char *agmt_name; @@ -5638,7 +5640,6 @@ static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consum csnStr[0] = '\0'; file = (CL5DBFile*)object_get_data (fileObj); - supplierRID = replica_get_rid((Replica*)object_get_data(replica)); /* get supplier's RUV */ supplierRuvObj = replica_get_ruv((Replica*)object_get_data(replica)); diff --git a/ldap/servers/plugins/replication/cl5_config.c b/ldap/servers/plugins/replication/cl5_config.c index 15aa6b3d..8ce06f8a 100644 --- a/ldap/servers/plugins/replication/cl5_config.c +++ b/ldap/servers/plugins/replication/cl5_config.c @@ -330,7 +330,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr slapi_ch_free_string(&config.maxAge); config.maxAge = slapi_ch_strdup(CL5_STR_IGNORE); config.dbconfig.maxChCacheEntries = 0; - config.dbconfig.maxChCacheSize = CL5_NUM_IGNORE; + config.dbconfig.maxChCacheSize = (PRUint32)CL5_NUM_IGNORE; slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods ); for (i = 0; mods[i] != NULL; i++) @@ -438,7 +438,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr } if (config.dbconfig.maxChCacheEntries == 0) config.dbconfig.maxChCacheEntries = originalConfig->dbconfig.maxChCacheEntries; - if (config.dbconfig.maxChCacheSize == CL5_NUM_IGNORE) + if (config.dbconfig.maxChCacheSize == (PRUint32)CL5_NUM_IGNORE) config.dbconfig.maxChCacheSize = originalConfig->dbconfig.maxChCacheSize; @@ -567,7 +567,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr } } - if (config.dbconfig.maxChCacheEntries != 0 || config.dbconfig.maxChCacheSize != CL5_NUM_IGNORE) + if (config.dbconfig.maxChCacheEntries != 0 || config.dbconfig.maxChCacheSize != (PRUint32)CL5_NUM_IGNORE) clcache_set_config(&config.dbconfig); done:; diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c index f03fd4b6..aa754cf4 100644 --- a/ldap/servers/plugins/replication/repl5_connection.c +++ b/ldap/servers/plugins/replication/repl5_connection.c @@ -471,7 +471,6 @@ perform_operation(Repl_Connection *conn, int optype, const char *dn, LDAPControl *server_controls[3]; /* LDAPControl **loc_returned_controls; */ const char *op_string = NULL; - const char *extra_op_string = NULL; int msgid = 0; server_controls[0] = &manageDSAITControl; @@ -562,7 +561,6 @@ perform_operation(Repl_Connection *conn, int optype, const char *dn, case CONN_EXTENDED_OPERATION: conn->status = STATUS_PROCESSING_EXTENDED_OPERATION; op_string = "extended"; - extra_op_string = extop_oid; rc = ldap_extended_operation(conn->ld, extop_oid, extop_payload, server_controls, NULL /* clientctls */, &msgid); } @@ -864,7 +862,6 @@ conn_start_linger(Repl_Connection *conn) ConnResult conn_connect(Repl_Connection *conn) { - int ldap_rc; int optdata; int secure = 0; char* binddn = NULL; @@ -1012,7 +1009,7 @@ conn_connect(Repl_Connection *conn) } else { - conn->last_ldap_error = ldap_rc = LDAP_SUCCESS; + conn->last_ldap_error = LDAP_SUCCESS; conn->state = STATE_CONNECTED; return_value = CONN_OPERATION_SUCCESS; } @@ -1028,7 +1025,7 @@ conn_connect(Repl_Connection *conn) close_connection_internal(conn); } else { - conn->last_ldap_error = ldap_rc = LDAP_SUCCESS; + conn->last_ldap_error = LDAP_SUCCESS; conn->state = STATE_CONNECTED; } @@ -1698,6 +1695,7 @@ repl5_set_debug_timeout(const char *val) } } +#ifdef FOR_DEBUGGING static time_t PRTime2time_t (PRTime tm) { @@ -1709,6 +1707,7 @@ PRTime2time_t (PRTime tm) return (time_t)rt; } +#endif static Slapi_Eq_Context repl5_start_debug_timeout(int *setlevel) diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c index 5b151dfb..3249319d 100644 --- a/ldap/servers/plugins/replication/repl5_inc_protocol.c +++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c @@ -598,8 +598,6 @@ repl5_inc_run(Private_Repl_Protocol *prp) int wait_change_timer_set = 0; time_t last_start_time; PRUint32 num_changes_sent; - char *hostname = NULL; - int portnum = 0; /* use a different backoff timer strategy for ACQUIRE_REPLICA_BUSY errors */ PRBool use_busy_backoff_timer = PR_FALSE; long pausetime = 0; @@ -607,8 +605,6 @@ repl5_inc_run(Private_Repl_Protocol *prp) prp->stopped = 0; prp->terminate = 0; - hostname = agmt_get_hostname(prp->agmt); - portnum = agmt_get_port(prp->agmt); /* establish_protocol_callbacks(prp); */ done = 0; @@ -1264,7 +1260,6 @@ repl5_inc_run(Private_Repl_Protocol *prp) current_state = next_state; } while (!done); - slapi_ch_free((void**)&hostname); /* remove_protocol_callbacks(prp); */ prp->stopped = 1; /* Cancel any linger timer that might be in effect... */ diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c index 9753f26b..2c64382a 100644 --- a/ldap/servers/plugins/replication/repl5_plugins.c +++ b/ldap/servers/plugins/replication/repl5_plugins.c @@ -86,7 +86,6 @@ static int ruv_tombstone_op (Slapi_PBlock *pb); static PRBool process_operation (Slapi_PBlock *pb, const CSN *csn); static PRBool is_mmr_replica (Slapi_PBlock *pb); static const char *replica_get_purl_for_op (const Replica *r, Slapi_PBlock *pb, const CSN *opcsn); -static void strip_legacy_info (slapi_operation_parameters *op_params); /* * XXXggood - what to do if both ssl and non-ssl ports available? How @@ -695,12 +694,10 @@ multimaster_bepreop_add (Slapi_PBlock *pb) Slapi_Operation *op; int is_replicated_operation; int is_fixup_operation; - int is_legacy_operation; slapi_pblock_get(pb, SLAPI_OPERATION, &op); is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED); is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP); - is_legacy_operation= operation_is_flag_set(op,OP_FLAG_LEGACY_REPLICATION_DN); /* For replicated operations, apply URP algorithm */ if (is_replicated_operation && !is_fixup_operation) @@ -718,12 +715,10 @@ multimaster_bepreop_delete (Slapi_PBlock *pb) Slapi_Operation *op; int is_replicated_operation; int is_fixup_operation; - int is_legacy_operation; slapi_pblock_get(pb, SLAPI_OPERATION, &op); is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED); is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP); - is_legacy_operation= operation_is_flag_set(op,OP_FLAG_LEGACY_REPLICATION_DN); /* For replicated operations, apply URP algorithm */ if(is_replicated_operation && !is_fixup_operation) @@ -741,12 +736,10 @@ multimaster_bepreop_modify (Slapi_PBlock *pb) Slapi_Operation *op; int is_replicated_operation; int is_fixup_operation; - int is_legacy_operation; slapi_pblock_get(pb, SLAPI_OPERATION, &op); is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED); is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP); - is_legacy_operation= operation_is_flag_set(op,OP_FLAG_LEGACY_REPLICATION_DN); /* For replicated operations, apply URP algorithm */ if(is_replicated_operation && !is_fixup_operation) @@ -767,12 +760,10 @@ multimaster_bepreop_modrdn (Slapi_PBlock *pb) Slapi_Operation *op; int is_replicated_operation; int is_fixup_operation; - int is_legacy_operation; slapi_pblock_get(pb, SLAPI_OPERATION, &op); is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED); is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP); - is_legacy_operation= operation_is_flag_set(op,OP_FLAG_LEGACY_REPLICATION_DN); /* For replicated operations, apply URP algorithm */ if(is_replicated_operation && !is_fixup_operation) @@ -1341,6 +1332,7 @@ static const char *replica_get_purl_for_op (const Replica *r, Slapi_PBlock *pb, return purl; } +#ifdef NOTUSED /* ONREPL at the moment, I decided not to trim copiedFrom and copyingFrom attributes when sending operation to replicas. This is because, each operation results in a state information stored in the database and @@ -1385,6 +1377,7 @@ static void strip_legacy_info (slapi_operation_parameters *op_params) default: break; } } +#endif /* this function is called when state of a backend changes */ void @@ -1432,9 +1425,12 @@ multimaster_be_state_change (void *handle, char *be_name, int old_be_state, int object_release (r_obj); } +#ifdef NOTUSED +/* Keeping the function just in case */ static void close_changelog_for_replica (Object *r_obj) { if (cl5GetState () == CL5_STATE_OPEN) cl5CloseDB (r_obj); } +#endif diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c index f6cc9e40..40e84da4 100644 --- a/ldap/servers/plugins/replication/repl5_replica.c +++ b/ldap/servers/plugins/replication/repl5_replica.c @@ -3230,7 +3230,6 @@ replica_disable_replication (Replica *r, Object *r_obj) char *current_purl = NULL; char *p_locking_purl = NULL; char *locking_purl = NULL; - int junkrc; ReplicaId junkrid; PRBool isInc = PR_FALSE; /* get exclusive access, but not for inc update */ RUV *repl_ruv = NULL; @@ -3255,7 +3254,7 @@ replica_disable_replication (Replica *r, Object *r_obj) from a supplier */ repl_ruv = (RUV*) object_get_data (r->repl_ruv); - junkrc = ruv_get_first_id_and_purl(repl_ruv, &junkrid, &p_locking_purl); + ruv_get_first_id_and_purl(repl_ruv, &junkrid, &p_locking_purl); locking_purl = slapi_ch_strdup(p_locking_purl); p_locking_purl = NULL; repl_ruv = NULL; diff --git a/ldap/servers/plugins/replication/repl5_total.c b/ldap/servers/plugins/replication/repl5_total.c index ac6c1b8a..80186fd5 100644 --- a/ldap/servers/plugins/replication/repl5_total.c +++ b/ldap/servers/plugins/replication/repl5_total.c @@ -634,7 +634,7 @@ my_ber_scanf_attr (BerElement *ber, Slapi_Attr **attr, PRBool *deleted) /* The "attribute deleted" flag is next, and is optional */ if (ber_peek_tag(ber, &len) == LBER_BOOLEAN) { - if (ber_scanf(ber, "b", deleted) == -1) + if (ber_scanf(ber, "b", deleted) == LBER_DEFAULT) { goto loser; } diff --git a/ldap/servers/plugins/replication/repl_controls.c b/ldap/servers/plugins/replication/repl_controls.c index 07a20cfe..066c6c59 100644 --- a/ldap/servers/plugins/replication/repl_controls.c +++ b/ldap/servers/plugins/replication/repl_controls.c @@ -229,7 +229,7 @@ decode_NSDS50ReplUpdateInfoControl(LDAPControl **controlsp, if (ber_peek_tag(tmp_bere, &len) == LBER_OCTETSTRING) { /* The optional superior_uuid is present */ - if (ber_scanf(tmp_bere, "o", &superior_uuid_val) == -1) + if (ber_scanf(tmp_bere, "o", &superior_uuid_val) == LBER_DEFAULT) { rc = -1; goto loser; diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c index 91bbd647..0abc6417 100644 --- a/ldap/servers/plugins/replication/repl_extop.c +++ b/ldap/servers/plugins/replication/repl_extop.c @@ -110,7 +110,6 @@ create_NSDS50ReplicationExtopPayload(const char *protocol_oid, struct berval *req_data = NULL; BerElement *tmp_bere = NULL; int rc = 0; - const char *csnstr = NULL; Object *repl_obj, *ruv_obj = NULL; Replica *repl; RUV *ruv; @@ -203,7 +202,7 @@ create_NSDS50ReplicationExtopPayload(const char *protocol_oid, } /* Add the CSN */ PR_ASSERT(NULL != csn); - if (ber_printf(tmp_bere, "s", csnstr = csn_as_string(csn,PR_FALSE,s)) == -1) + if (ber_printf(tmp_bere, "s", csn_as_string(csn,PR_FALSE,s)) == -1) { rc = LDAP_ENCODING_ERROR; goto loser; @@ -274,7 +273,7 @@ decode_ruv (BerElement *ber, RUV **ruv) PR_ASSERT (ber && ruv); - if (ber_scanf(ber, "[V]", &bvals) == -1) + if (ber_scanf(ber, "[V]", &bvals) == LBER_DEFAULT) { goto done; } @@ -339,12 +338,12 @@ decode_startrepl_extop(Slapi_PBlock *pb, char **protocol_oid, char **repl_root, goto free_and_return; } /* Get the required protocol OID and root of replicated subtree */ - if (ber_get_stringa(tmp_bere, protocol_oid) == -1) + if (ber_get_stringa(tmp_bere, protocol_oid) == LBER_DEFAULT) { rc = -1; goto free_and_return; } - if (ber_get_stringa(tmp_bere, repl_root) == -1) + if (ber_get_stringa(tmp_bere, repl_root) == LBER_DEFAULT) { rc = -1; goto free_and_return; @@ -439,18 +438,18 @@ decode_endrepl_extop(Slapi_PBlock *pb, char **repl_root) rc = -1; goto free_and_return; } - if (ber_scanf(tmp_bere, "{") == -1) + if (ber_scanf(tmp_bere, "{") == LBER_DEFAULT) { rc = -1; goto free_and_return; } /* Get the required root of replicated subtree */ - if (ber_get_stringa(tmp_bere, repl_root) == -1) + if (ber_get_stringa(tmp_bere, repl_root) == LBER_DEFAULT) { rc = -1; goto free_and_return; } - if (ber_scanf(tmp_bere, "}") == -1) + if (ber_scanf(tmp_bere, "}") == LBER_DEFAULT) { rc = -1; goto free_and_return; @@ -494,7 +493,6 @@ decode_repl_ext_response(struct berval *data, int *response_code, else { ber_len_t len; - ber_tag_t tag = 0; ber_int_t temp_response_code = 0; *ruv_bervals = NULL; if ((tmp_bere = ber_init(data)) == NULL) @@ -505,7 +503,7 @@ decode_repl_ext_response(struct berval *data, int *response_code, { return_value = -1; } - else if ((tag = ber_peek_tag(tmp_bere, &len)) == LBER_SEQUENCE) + else if (ber_peek_tag(tmp_bere, &len) == LBER_SEQUENCE) { if (ber_scanf(tmp_bere, "{V}}", ruv_bervals) == LBER_ERROR) { @@ -1034,7 +1032,6 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb) ber_int_t response; void *conn; consumer_connection_extension *connext = NULL; - int rc; int connid=-1, opid=-1; /* Decode the extended operation */ @@ -1092,7 +1089,7 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb) if (cl5GetState () == CL5_STATE_OPEN) { - rc = cl5DeleteDBSync (connext->replica_acquired); + cl5DeleteDBSync (connext->replica_acquired); } replica_set_ruv (r, connext->supplier_ruv); @@ -1140,7 +1137,6 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb) /* Send the response code */ if ((resp_bere = der_alloc()) == NULL) { - rc = LDAP_ENCODING_ERROR; goto free_and_return; } ber_printf(resp_bere, "{e}", response); diff --git a/ldap/servers/plugins/replication/repl_monitor.c b/ldap/servers/plugins/replication/repl_monitor.c index 297277d2..67949359 100644 --- a/ldap/servers/plugins/replication/repl_monitor.c +++ b/ldap/servers/plugins/replication/repl_monitor.c @@ -46,8 +46,10 @@ #include "repl.h" #include "slapi-plugin.h" +#ifdef FOR_40_STYLE_CHANGELOG /* Forward Declartions */ static int repl_monitor_search (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg); +#endif int repl_monitor_init() @@ -58,14 +60,17 @@ repl_monitor_init() if (!initialized) { - /* ONREPL - this is commented until we implement 4.0 style changelog - slapi_config_register_callback(SLAPI_OPERATION_SEARCH,DSE_FLAG_PREOP,"cn=monitor",LDAP_SCOPE_BASE,"(objectclass=*)",repl_monitor_search,NULL); */ +#ifdef FOR_40_STYLE_CHANGELOG + /* ONREPL - this is commented until we implement 4.0 style changelog */ + slapi_config_register_callback(SLAPI_OPERATION_SEARCH,DSE_FLAG_PREOP,"cn=monitor",LDAP_SCOPE_BASE,"(objectclass=*)",repl_monitor_search,NULL); +#endif initialized = 1; } return return_value; } +#ifdef FOR_40_STYLE_CHANGELOG static int repl_monitor_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg) { @@ -93,4 +98,5 @@ repl_monitor_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, i } return SLAPI_DSE_CALLBACK_OK; } +#endif diff --git a/ldap/servers/plugins/replication/replutil.c b/ldap/servers/plugins/replication/replutil.c index c5e65ee7..5b292f52 100644 --- a/ldap/servers/plugins/replication/replutil.c +++ b/ldap/servers/plugins/replication/replutil.c @@ -824,7 +824,6 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn, int local_backend = -1; /* index of local backend */ int chaining_backend = -1; /* index of chain backend */ PRBool local_online = PR_FALSE; /* true if the local db is online */ - PRBool chain_online = PR_FALSE; /* true if the chain db is online */ int ii; int opid; #ifdef DEBUG_CHAIN_ON_UPDATE @@ -850,10 +849,6 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn, if (slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA)) { chaining_backend = ii; - if (mtn_be_states[ii] == SLAPI_BE_STATE_ON) - { - chain_online = PR_TRUE; - } } else { diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c index 77507c94..2c54c64b 100644 --- a/ldap/servers/plugins/replication/windows_connection.c +++ b/ldap/servers/plugins/replication/windows_connection.c @@ -601,7 +601,6 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter, ConnResult return_value = 0; int ldap_rc = 0; LDAPMessage *res = NULL; - int not_unique = 0; int nummessages = 0; int numentries = 0; int numreferences = 0; @@ -635,10 +634,7 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter, /* See if there are any more entries : if so then that's an error * but we still need to get them to avoid gumming up the connection */ - while (NULL != ( message = ldap_next_entry(conn->ld,message))) - { - not_unique = 1; - } + while (NULL != ( message = ldap_next_entry(conn->ld,message))) ; return_value = CONN_OPERATION_SUCCESS; } else if (IS_DISCONNECT_ERROR(ldap_rc)) @@ -838,9 +834,8 @@ Slapi_Entry * windows_conn_get_search_result(Repl_Connection *conn) { LDAPControl **returned_controls = NULL; int code = 0; - int parse_rc = 0; /* Purify says this is a leak : */ - parse_rc = ldap_parse_result( conn->ld, res, &code, NULL, NULL, NULL, &returned_controls, 0 ); + ldap_parse_result( conn->ld, res, &code, NULL, NULL, NULL, &returned_controls, 0 ); if (returned_controls) { windows_private_update_dirsync_control(conn->agmt, returned_controls); @@ -1096,7 +1091,6 @@ windows_conn_start_linger(Repl_Connection *conn) ConnResult windows_conn_connect(Repl_Connection *conn) { - int ldap_rc; int optdata; int secure = 0; char* binddn = NULL; @@ -1252,7 +1246,7 @@ windows_conn_connect(Repl_Connection *conn) } else { - conn->last_ldap_error = ldap_rc = LDAP_SUCCESS; + conn->last_ldap_error = LDAP_SUCCESS; conn->state = STATE_CONNECTED; return_value = CONN_OPERATION_SUCCESS; } @@ -1291,7 +1285,7 @@ windows_conn_connect(Repl_Connection *conn) close_connection_internal(conn); } else { - conn->last_ldap_error = ldap_rc = LDAP_SUCCESS; + conn->last_ldap_error = LDAP_SUCCESS; conn->state = STATE_CONNECTED; } @@ -1863,22 +1857,6 @@ do_simple_bind (Repl_Connection *conn, LDAP *ld, char * binddn, char *password) } -static time_t -PRTime2time_t (PRTime tm) -{ - PRInt64 rt; - - LDAPDebug( LDAP_DEBUG_TRACE, "=> PRTime2time_t\n", 0, 0, 0 ); - - PR_ASSERT (tm); - - LL_DIV(rt, tm, PR_USEC_PER_SEC); - - LDAPDebug( LDAP_DEBUG_TRACE, "<= PRTime2time_t\n", 0, 0, 0 ); - - return (time_t)rt; -} - static Slapi_Eq_Context repl5_start_debug_timeout(int *setlevel) { diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c index 1bcf8ee3..adcc417b 100644 --- a/ldap/servers/plugins/replication/windows_inc_protocol.c +++ b/ldap/servers/plugins/replication/windows_inc_protocol.c @@ -277,8 +277,6 @@ windows_inc_run(Private_Repl_Protocol *prp) int wait_change_timer_set = 0; time_t last_start_time = 0; PRUint32 num_changes_sent = 0; - char *hostname = NULL; - int portnum = 0; /* use a different backoff timer strategy for ACQUIRE_REPLICA_BUSY errors */ PRBool use_busy_backoff_timer = PR_FALSE; long pausetime = 0; @@ -292,8 +290,6 @@ windows_inc_run(Private_Repl_Protocol *prp) prp->stopped = 0; prp->terminate = 0; - hostname = agmt_get_hostname(prp->agmt); - portnum = agmt_get_port(prp->agmt); windows_private_load_dirsync_cookie(prp->agmt); @@ -970,7 +966,6 @@ windows_inc_run(Private_Repl_Protocol *prp) current_state = next_state; } while (!done); - slapi_ch_free((void**)&hostname); /* remove_protocol_callbacks(prp); */ prp->stopped = 1; /* Cancel any linger timer that might be in effect... */ diff --git a/ldap/servers/plugins/replication/windows_private.c b/ldap/servers/plugins/replication/windows_private.c index b0edf9d6..5baa7ce2 100644 --- a/ldap/servers/plugins/replication/windows_private.c +++ b/ldap/servers/plugins/replication/windows_private.c @@ -554,7 +554,9 @@ void windows_private_update_dirsync_control(const Repl_Agmt *ra,LDAPControl **co ber_int_t hasMoreData; ber_int_t maxAttributeCount; BerValue *serverCookie; +#ifdef FOR_DEBUGGING int return_value = LDAP_SUCCESS; +#endif LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_private_update_dirsync_control\n", 0, 0, 0 ); @@ -572,7 +574,9 @@ void windows_private_update_dirsync_control(const Repl_Agmt *ra,LDAPControl **co if ( !foundDirsyncControl ) { +#ifdef FOR_DEBUGGING return_value = LDAP_CONTROL_NOT_FOUND; +#endif goto choke; } else @@ -584,7 +588,9 @@ void windows_private_update_dirsync_control(const Repl_Agmt *ra,LDAPControl **co if (ber_scanf( ber, "{iiO}", &hasMoreData, &maxAttributeCount, &serverCookie) == LBER_ERROR) { +#ifdef FOR_DEBUGGING return_value = LDAP_CONTROL_NOT_FOUND; +#endif goto choke; } @@ -603,12 +609,16 @@ choke: } else { +#ifdef FOR_DEBUGGING return_value = LDAP_CONTROL_NOT_FOUND; +#endif } - +#ifdef FOR_DEBUGGING + LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_private_update_dirsync_control: rc=%d\n", return_value, 0, 0 ); +#else LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_private_update_dirsync_control\n", 0, 0, 0 ); - /* return return_value; */ +#endif } PRBool windows_private_dirsync_has_more(const Repl_Agmt *ra) diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c index d9fda14d..e0ab290c 100644 --- a/ldap/servers/plugins/replication/windows_protocol_util.c +++ b/ldap/servers/plugins/replication/windows_protocol_util.c @@ -58,12 +58,10 @@ Code common to both incremental and total protocols. int ruv_private_new( RUV **ruv, RUV *clone ); - +#ifdef FOR_DEBUGGING static Slapi_Entry* windows_entry_already_exists(Slapi_Entry *e); -static void windows_dirsync_now (Private_Repl_Protocol *prp); -static Slapi_DN* map_dn_user(Slapi_DN *sdn, int map_to, const Slapi_DN *root); -static Slapi_DN* map_dn_group(Slapi_DN *sdn, int map_to, const Slapi_DN *root); -static void make_mods_from_entries(Slapi_Entry *new_entry, Slapi_Entry *existing_entry, LDAPMod ***attrs); +static void extract_guid_from_entry_bv(Slapi_Entry *e, const struct berval **bv); +#endif static void windows_map_mods_for_replay(Private_Repl_Protocol *prp,LDAPMod **original_mods, LDAPMod ***returned_mods, int is_user, char** password); static int is_subject_of_agreement_local(const Slapi_Entry *local_entry,const Repl_Agmt *ra); static int windows_create_remote_entry(Private_Repl_Protocol *prp,Slapi_Entry *original_entry, Slapi_DN *remote_sdn, Slapi_Entry **remote_entry, char** password); @@ -395,6 +393,9 @@ map_dn_values(Private_Repl_Protocol *prp,Slapi_ValueSet *original_values, Slapi_ original_dn_string = slapi_value_get_string(original_value); /* Sanity check the data was a valid string */ original_dn_string_length = slapi_value_get_length(original_value); + if (0 == original_dn_string_length) { + slapi_log_error(SLAPI_LOG_REPL, NULL, "map_dn_values: length of dn is 0\n"); + } /* Make a sdn from the string */ original_dn = slapi_sdn_new_dn_byref(original_dn_string); if (to_windows) @@ -1098,9 +1099,10 @@ process_replay_add(Private_Repl_Protocol *prp, slapi_operation_parameters *op, S } } else { - Slapi_Entry *remote_entry = NULL; + Slapi_Entry *remote_entry; modify_fallback: + remote_entry = NULL; /* Fetch the remote entry */ rc = windows_get_remote_entry(prp, remote_dn,&remote_entry); if (0 == rc && remote_entry) { @@ -1605,6 +1607,7 @@ error: return retval; } +#ifdef FOR_DEBUGGING /* the entry has already been translated, so be sure to search for ntuserid and not samaccountname or anything else. */ @@ -1632,6 +1635,7 @@ windows_entry_already_exists(Slapi_Entry *e){ } } +#endif static int windows_delete_local_entry(Slapi_DN *sdn){ @@ -1740,13 +1744,12 @@ windows_map_mods_for_replay(Private_Repl_Protocol *prp,LDAPMod **original_mods, */ if (0 == slapi_attr_type_cmp(mapped_type, "streetAddress", SLAPI_TYPE_CMP_SUBTYPE)) { Slapi_Mod smod; - struct berval *new_bval = NULL; slapi_mod_init_byref(&smod,mod); /* Check if there is more than one value */ if (slapi_mod_get_num_values(&smod) > 1) { - new_bval = slapi_mod_get_first_value(&smod); + slapi_mod_get_first_value(&smod); /* Remove all values except for the first */ while (slapi_mod_get_next_value(&smod)) { /* This modifies the bvalues in the mod itself */ @@ -2315,6 +2318,7 @@ extract_guid_from_entry(Slapi_Entry *e, int is_nt4) return guid; } +#ifdef FOR_DEBUGGING static void extract_guid_from_entry_bv(Slapi_Entry *e, const struct berval **bv) { @@ -2330,6 +2334,7 @@ extract_guid_from_entry_bv(Slapi_Entry *e, const struct berval **bv) } } } +#endif static char* extract_username_from_entry(Slapi_Entry *e) diff --git a/ldap/servers/plugins/replication/windows_tot_protocol.c b/ldap/servers/plugins/replication/windows_tot_protocol.c index ac52e1c2..6e01f633 100644 --- a/ldap/servers/plugins/replication/windows_tot_protocol.c +++ b/ldap/servers/plugins/replication/windows_tot_protocol.c @@ -70,8 +70,8 @@ typedef struct callback_data Private_Repl_Protocol *prp; int rc; unsigned long num_entries; - time_t sleep_on_busy; - time_t last_busy; + time_t sleep_on_busy; /* not used ??? */ + time_t last_busy; /* not used ??? */ } callback_data; /* @@ -100,8 +100,6 @@ windows_tot_run(Private_Repl_Protocol *prp) callback_data cb_data; Slapi_PBlock *pb; const char* dn; - CSN *remote_schema_csn = NULL; - PRBool cookie_has_more = PR_TRUE; RUV *ruv = NULL; RUV *starting_ruv = NULL; Replica *replica = NULL; @@ -143,7 +141,6 @@ windows_tot_run(Private_Repl_Protocol *prp) } agmt_set_last_init_status(prp->agmt, 0, 0, "Total schema update in progress"); - remote_schema_csn = agmt_get_consumer_schema_csn ( prp->agmt ); agmt_set_last_init_status(prp->agmt, 0, 0, "Total update in progress"); @@ -154,7 +151,6 @@ windows_tot_run(Private_Repl_Protocol *prp) /* get everything */ windows_dirsync_inc_run(prp); - cookie_has_more = windows_private_dirsync_has_more(prp->agmt); windows_private_save_dirsync_cookie(prp->agmt); @@ -350,10 +346,7 @@ int send_entry (Slapi_Entry *e, void *cb_data) { int rc; Private_Repl_Protocol *prp; - unsigned long *num_entriesp; - time_t *sleep_on_busyp; - time_t *last_busyp; LDAPDebug( LDAP_DEBUG_TRACE, "=> send_entry\n", 0, 0, 0 ); @@ -361,8 +354,6 @@ int send_entry (Slapi_Entry *e, void *cb_data) prp = ((callback_data*)cb_data)->prp; num_entriesp = &((callback_data *)cb_data)->num_entries; - sleep_on_busyp = &((callback_data *)cb_data)->sleep_on_busy; - last_busyp = &((callback_data *)cb_data)->last_busy; PR_ASSERT (prp); if (prp->terminate) -- cgit