diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2007-10-18 00:08:38 +0000 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2007-10-18 00:08:38 +0000 |
commit | 19cd513a509aa6e45361df774e74f2d39451e08a (patch) | |
tree | 13ad0e58a486afd842559e1d74d019190c3f1d79 /ldap/servers | |
parent | 878c163528ed089dae1edb8295a6dd4ae842b9b4 (diff) | |
download | ds-19cd513a509aa6e45361df774e74f2d39451e08a.tar.gz ds-19cd513a509aa6e45361df774e74f2d39451e08a.tar.xz ds-19cd513a509aa6e45361df774e74f2d39451e08a.zip |
Resolves: #188320
Summary: HP-UX: warnings reported by the HP-UX compiler
Diffstat (limited to 'ldap/servers')
87 files changed, 323 insertions, 646 deletions
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c index ea1b17ab..120e70db 100644 --- a/ldap/servers/plugins/acl/acl.c +++ b/ldap/servers/plugins/acl/acl.c @@ -244,7 +244,6 @@ acl_access_allowed( int err; int ret_val; char *right; - int num_handle; struct acl_pblock *aclpb = NULL; AclAttrEval *c_attrEval = NULL; int got_reader_locked = 0; @@ -555,7 +554,7 @@ acl_access_allowed( ** figure out if there are any ACLs which can be applied. ** If no ACLs are there, then it's a DENY as default. */ - if (!(num_handle = acl__scan_for_acis(aclpb, &err))) { + if (!(acl__scan_for_acis(aclpb, &err))) { /* We might have accessed the ACL first time which could ** have caused syntax error. @@ -782,7 +781,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien } } else{ slapi_log_error(loglevel, plugin_name, - "conn=%d op=%d (%s): %s %s on entry(%s).attr(%s)" + "conn=%d op=%d (%s): %s %s on entry(%s).attr(%s) to %s" ": %s\n", op->o_connid, op->o_opid, source, @@ -790,6 +789,7 @@ static void print_access_control_summary( char *source, int ret_val, char *clien right, edn, attr ? attr: "NULL", + real_user, acl_info[0] ? acl_info : access_reason); } @@ -2252,7 +2252,6 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int * Targetattrfilter *attrFilter = NULL; - int found_applicable = 0; Slapi_Attr *attr_ptr = NULL; Slapi_Value *sval; const struct berval *attrVal; @@ -2299,8 +2298,6 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int * * values in on the back of it. */ - found_applicable = 1; - sval=NULL; attrVal=NULL; k= slapi_attr_first_value(attr_ptr,&sval); @@ -2695,12 +2692,9 @@ acl__TestRights(Acl_PBlock *aclpb,int access, char **right, char ** map_generic, char *testRights[2]; aci_t *aci; int numHandles = 0; - aclEvalContext *c_evalContext = NULL; TNF_PROBE_0_DEBUG(acl__TestRights_start,"ACL",""); - c_evalContext = &aclpb->aclpb_curr_entryEval_context; - /* record the aci and reason for access decision */ result_reason->deciding_aci = NULL; result_reason->reason = ACL_REASON_NONE; @@ -3931,7 +3925,7 @@ acl__recompute_acl ( Acl_PBlock *aclpb, char *unused_str1, *unused_str2; char *acl_tag, *testRight[2]; int j, expr_num; - int result_status, rv, cache_result; + int result_status, cache_result; PRUint32 cookie; aci_t *aci; @@ -3992,7 +3986,7 @@ acl__recompute_acl ( Acl_PBlock *aclpb, ACL_SetDefaultResult (NULL, aclpb->aclpb_acleval, ACL_RES_INVALID); - rv = ACL_EvalSetACL(NULL, aclpb->aclpb_acleval, aci->aci_handle); + ACL_EvalSetACL(NULL, aclpb->aclpb_acleval, aci->aci_handle); testRight[0] = acl_access2str ( access ); testRight[1] = '\0'; diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c index 4d70a69b..93988a64 100644 --- a/ldap/servers/plugins/acl/acl_ext.c +++ b/ldap/servers/plugins/acl/acl_ext.c @@ -43,11 +43,13 @@ #include "acl.h" static void acl__done_aclpb ( struct acl_pblock *aclpb ); +#ifdef FOR_DEBUGGING static void acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type); +static char * acl__get_aclpb_type ( Acl_PBlock *aclpb ); +#endif static Acl_PBlock * acl__get_aclpb_from_pool ( ); static int acl__put_aclpb_back_to_pool ( Acl_PBlock *aclpb ); static Acl_PBlock * acl__malloc_aclpb ( ); -static char * acl__get_aclpb_type ( Acl_PBlock *aclpb ); static PRLock *aclext_get_lock (); @@ -788,7 +790,9 @@ acl__done_aclpb ( struct acl_pblock *aclpb ) } - /* acl__dump_stats ( aclpb, acl__get_aclpb_type(aclpb)); */ +#ifdef FOR_DEBUGGING + acl__dump_stats ( aclpb, acl__get_aclpb_type(aclpb)); +#endif /* reset the usergroup cache */ aclg_reset_userGroup ( aclpb ); @@ -956,15 +960,16 @@ acl__done_aclpb ( struct acl_pblock *aclpb ) } +#ifdef FOR_DEBUGGING static char * acl__get_aclpb_type ( Acl_PBlock *aclpb ) { - if (aclpb->aclpb_state & ACLPB_TYPE_PROXY) return ACLPB_TYPE_PROXY_STR; return ACLPB_TYPE_MAIN_STR; } + static void acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type) { @@ -998,6 +1003,7 @@ acl__dump_stats ( struct acl_pblock *aclpb , const char *block_type) aclpb->aclpb_stat_num_copy_attrs); slapi_log_error( SLAPI_LOG_ACL, plugin_name, " **** ACL OPERATION STAT END *******\n"); } +#endif /****************************************************************************/ /* E N D */ /****************************************************************************/ diff --git a/ldap/servers/plugins/acl/acleffectiverights.c b/ldap/servers/plugins/acl/acleffectiverights.c index a9cba0c4..c40840a5 100644 --- a/ldap/servers/plugins/acl/acleffectiverights.c +++ b/ldap/servers/plugins/acl/acleffectiverights.c @@ -663,7 +663,6 @@ acl_get_effective_rights ( char *gerstr = NULL; size_t gerstrsize = 0; size_t gerstrcap = 0; - unsigned long entryrights; int iscritical = 1; int rc; @@ -698,7 +697,7 @@ acl_get_effective_rights ( } /* Get entry level effective rights */ - entryrights = _ger_get_entry_rights ( gerpb, e, subjectndn, &gerstr, &gerstrsize, &gerstrcap, errbuf ); + _ger_get_entry_rights ( gerpb, e, subjectndn, &gerstr, &gerstrsize, &gerstrcap, errbuf ); /* * Attribute level effective rights may not be NULL diff --git a/ldap/servers/plugins/acl/aclinit.c b/ldap/servers/plugins/acl/aclinit.c index e6b7c4f3..9ef4993f 100644 --- a/ldap/servers/plugins/acl/aclinit.c +++ b/ldap/servers/plugins/acl/aclinit.c @@ -232,7 +232,6 @@ aclinit_search_and_update_aci ( int thisbeonly, const Slapi_DN *base, /* Tell __aclinit_handler whether it's an add or a delete */ Slapi_PBlock *aPb; LDAPControl **ctrls=NULL; - int retval; struct berval *bval; aclinit_handler_callback_data_t call_back_data; @@ -273,7 +272,7 @@ aclinit_search_and_update_aci ( int thisbeonly, const Slapi_DN *base, ctrls[0] = NULL; ctrls[1] = NULL; - retval = slapi_build_control_from_berval( + slapi_build_control_from_berval( MTN_CONTROL_USE_ONE_BACKEND_OID, bval, 1 /* is critical */, diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c index b69c86ad..e017c581 100644 --- a/ldap/servers/plugins/acl/acllas.c +++ b/ldap/servers/plugins/acl/acllas.c @@ -478,7 +478,6 @@ DS_LASUserDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, int matched; int rc; short len; - char *s = NULL; const size_t LDAP_URL_prefix_len = strlen(LDAP_URL_prefix); lasInfo lasinfo; int got_undefined = 0; @@ -579,9 +578,9 @@ DS_LASUserDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, } else { /* URL format */ - if ((s = strstr (user, ACL_RULE_MACRO_DN_KEY)) != NULL || - (s = strstr (user, ACL_RULE_MACRO_DN_LEVELS_KEY)) != NULL || - (s = strstr (user, ACL_RULE_MACRO_ATTR_KEY)) != NULL) { + if ((strstr (user, ACL_RULE_MACRO_DN_KEY) != NULL) || + (strstr (user, ACL_RULE_MACRO_DN_LEVELS_KEY) != NULL) || + (strstr (user, ACL_RULE_MACRO_ATTR_KEY) != NULL)) { matched = aclutil_evaluate_macro( s_user, &lasinfo, ACL_EVAL_USER); @@ -589,7 +588,7 @@ DS_LASUserDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, break; } - } else if ((s = strchr (user, '?'))!= NULL) { + } else if (strchr (user, '?') != NULL) { /* URL format */ if (acllas__client_match_URL ( lasinfo.aclpb, lasinfo.clientDn, s_user) == ACL_TRUE) { @@ -828,12 +827,9 @@ DS_LASGroupDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, "Group not evaluated(%s)\n", groupName); break; } else { - char *s; - - if ((s = strstr (groupName, ACL_RULE_MACRO_DN_KEY)) != NULL || - (s = strstr (groupName, ACL_RULE_MACRO_DN_LEVELS_KEY)) != NULL || - (s = strstr (groupName, ACL_RULE_MACRO_ATTR_KEY)) != NULL) { - + if ((strstr (groupName, ACL_RULE_MACRO_DN_KEY) != NULL) || + (strstr (groupName, ACL_RULE_MACRO_DN_LEVELS_KEY) != NULL) || + (strstr (groupName, ACL_RULE_MACRO_ATTR_KEY) != NULL)) { matched = aclutil_evaluate_macro( groupName, &lasinfo, ACL_EVAL_GROUP); slapi_log_error ( SLAPI_LOG_ACL, plugin_name, @@ -993,12 +989,9 @@ DS_LASRoleDnEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, } else { /* Take care of param strings */ - - char *s; - - if ((s = strstr (role, ACL_RULE_MACRO_DN_KEY)) != NULL || - (s = strstr (role, ACL_RULE_MACRO_DN_LEVELS_KEY)) != NULL || - (s = strstr (role, ACL_RULE_MACRO_ATTR_KEY)) != NULL) { + if ((strstr (role, ACL_RULE_MACRO_DN_KEY) != NULL) || + (strstr (role, ACL_RULE_MACRO_DN_LEVELS_KEY) != NULL) || + (strstr (role, ACL_RULE_MACRO_ATTR_KEY) != NULL)) { matched = aclutil_evaluate_macro( role, &lasinfo, ACL_EVAL_ROLE); @@ -1431,6 +1424,7 @@ dump_member_info ( struct member_info *minfo, char *buf ) } } +#ifdef FOR_DEBUGGING static void dump_eval_info (char *caller, struct eval_info *info, int idx) { @@ -1481,7 +1475,7 @@ dump_eval_info (char *caller, struct eval_info *info, int idx) slapi_log_error ( SLAPI_LOG_FATAL, NULL, "%s\n", buf ); } } - +#endif /*************************************************************************** * @@ -1611,7 +1605,9 @@ acllas__user_ismember_of_group( struct acl_pblock *aclpb, max_memberlimit = aclpb->aclpb_max_member_sizelimit; max_nestlevel = aclpb->aclpb_max_nesting_level; - /* dump_eval_info ( "acllas__user_ismember_of_group", &info, -1 ); */ +#ifdef FOR_DEBUGGING + dump_eval_info ( "acllas__user_ismember_of_group", &info, -1 ); +#endif eval_another_member: @@ -2101,14 +2097,12 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, */ attrName = attr_pattern; if (strstr(attrName, LDAP_URL_prefix)) { - char *s; - /* In this case "grppupdnattr="ldap:///base??attr" */ - if ((s = strstr (attrName, ACL_RULE_MACRO_DN_KEY)) != NULL || - (s = strstr (attrName, ACL_RULE_MACRO_DN_LEVELS_KEY)) != NULL || - (s = strstr (attrName, ACL_RULE_MACRO_ATTR_KEY)) != NULL) { + if ((strstr (attrName, ACL_RULE_MACRO_DN_KEY) != NULL) || + (strstr (attrName, ACL_RULE_MACRO_DN_LEVELS_KEY) != NULL) || + (strstr (attrName, ACL_RULE_MACRO_ATTR_KEY) != NULL)) { matched = aclutil_evaluate_macro( attrName, &lasinfo, ACL_EVAL_GROUPDNATTR); @@ -3162,7 +3156,6 @@ static int acllas__user_has_role( struct acl_pblock *aclpb, Slapi_DN *roleDN, Slapi_DN *clientDn) { int present = 0; - int rc = 0; /* Get the client's entry if we don't have already */ if ( aclpb && ( NULL == aclpb->aclpb_client_entry )) { @@ -3202,7 +3195,7 @@ static int acllas__user_has_role( struct acl_pblock *aclpb, /* If the client has the role then it's a match, otherwise no */ - rc = slapi_role_check( aclpb->aclpb_client_entry, roleDN, &present); + slapi_role_check( aclpb->aclpb_client_entry, roleDN, &present); if ( present ) { return(ACL_TRUE); } @@ -3356,13 +3349,11 @@ aclutil_evaluate_macro( char * rule, lasInfo *lasinfo, char **tptr = NULL; char *t = NULL; char *s = NULL; - char *target_dn = NULL; struct acl_pblock *aclpb = lasinfo->aclpb; - int found_matched_val_in_ht = 0; aci = lasinfo->aclpb->aclpb_curr_aci; /* Get a pointer to the ndn in the resouirce */ - target_dn = slapi_entry_get_ndn ( lasinfo->resourceEntry ); + slapi_entry_get_ndn ( lasinfo->resourceEntry ); /* * First, get the matched value from the target resource. @@ -3395,8 +3386,6 @@ aclutil_evaluate_macro( char * rule, lasInfo *lasinfo, "ACL info: found matched_val (%s) for aci index %d" "in macro ht\n", aci->aclName, aci->aci_index,0); - - found_matched_val_in_ht = 1; } } @@ -3740,14 +3729,10 @@ static int acllas_eval_one_user( struct acl_pblock *aclpb, char * clientDN, char *rule) { int exact_match = 0; - int ret_code = 0; const size_t LDAP_URL_prefix_len = strlen(LDAP_URL_prefix); - char *s = NULL; - - /* URL format */ - if ((s = strchr (rule, '?'))!= NULL) { + if (strchr (rule, '?') != NULL) { /* URL format */ if (acllas__client_match_URL ( aclpb, clientDN, rule) == ACL_TRUE) { @@ -3763,7 +3748,7 @@ acllas_eval_one_user( struct acl_pblock *aclpb, char * clientDN, char *rule) { /* Here, contains a =*, so need to match comp by comp */ /* skip the ldap:/// part */ rule += LDAP_URL_prefix_len; - ret_code = acl_match_prefix( rule, clientDN, &exact_match); + acl_match_prefix( rule, clientDN, &exact_match); } if ( exact_match) { return( ACL_TRUE); diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c index 0fe5a3a7..099ed797 100644 --- a/ldap/servers/plugins/acl/aclparse.c +++ b/ldap/servers/plugins/acl/aclparse.c @@ -1768,7 +1768,7 @@ static int __acl__init_targetattrfilters( aci_t *aci, char *input_str) { static int process_filter_list( Targetattrfilter ***input_attrFilterArray, char * input_str) { - char *str, *end_attr, *tmp_attr; + char *str, *end_attr; Targetattrfilter *attrfilter = NULL; int numattr=0; Targetattrfilter **attrFilterArray = NULL; @@ -1801,7 +1801,7 @@ static int process_filter_list( Targetattrfilter ***input_attrFilterArray, attrfilter = (Targetattrfilter *) slapi_ch_malloc (sizeof (Targetattrfilter)); memset (attrfilter, 0, sizeof(Targetattrfilter)); - if ((tmp_attr = strstr( str,":")) != NULL) { + if (strstr( str,":") != NULL) { if ( __acl_init_targetattrfilter( attrfilter, str ) != 0 ) { slapi_ch_free((void**)&attrfilter); diff --git a/ldap/servers/plugins/acl/aclutil.c b/ldap/servers/plugins/acl/aclutil.c index 56ca5cef..7c79a299 100644 --- a/ldap/servers/plugins/acl/aclutil.c +++ b/ldap/servers/plugins/acl/aclutil.c @@ -57,7 +57,9 @@ static int acl_find_comp_start(char * s, int pos ); static PRIntn acl_ht_free_entry_and_value(PLHashEntry *he, PRIntn i, void *arg); static PLHashNumber acl_ht_hash( const void *key); +#ifdef FOR_DEBUGGING static PRIntn acl_ht_display_entry(PLHashEntry *he, PRIntn i, void *arg); +#endif /***************************************************************************/ /* UTILITY FUNCTIONS */ @@ -664,7 +666,6 @@ acl_match_macro_in_target( const char *ndn, char * match_this, char *macro_suffix = NULL; char *tmp_ptr = NULL; char *matched_val = NULL; - char *ndn_suffix_start = NULL; char *ret_val = NULL; int ndn_len = 0; int macro_suffix_len = 0; @@ -717,9 +718,6 @@ acl_match_macro_in_target( const char *ndn, char * match_this, } } - /* Start of the suffix in ndn...and it matched. */ - ndn_suffix_start = (char*)&ndn[ndn_len-macro_suffix_len]; - /* Here, macro_suffix is a suffix of ndn. * * @@ -1374,11 +1372,12 @@ acl_ht_free_entry_and_value(PLHashEntry *he, PRIntn i, void *arg) /* Free all the values in the ht */ void acl_ht_display_ht( acl_ht_t *acl_ht) { -#ifdef DEBUG +#ifdef FOR_DEBUGGING PL_HashTableEnumerateEntries( acl_ht, acl_ht_display_entry, NULL); #endif } +#ifdef FOR_DEBUGGING static PRIntn acl_ht_display_entry(PLHashEntry *he, PRIntn i, void *arg) { @@ -1393,6 +1392,7 @@ acl_ht_display_entry(PLHashEntry *he, PRIntn i, void *arg) return HT_ENUMERATE_NEXT; } +#endif /* remove this entry from the ht--doesn't free the value.*/ void acl_ht_remove( acl_ht_t *acl_ht, PLHashNumber key) { diff --git a/ldap/servers/plugins/bitwise/bitwise.c b/ldap/servers/plugins/bitwise/bitwise.c index 2ff2a6b3..8116599c 100644 --- a/ldap/servers/plugins/bitwise/bitwise.c +++ b/ldap/servers/plugins/bitwise/bitwise.c @@ -81,7 +81,7 @@ delete_bitwise_match_cb(struct bitwise_match_cb *bmc) slapi_ch_free((void **)&bmc); } -static int +static void bitwise_filter_destroy(Slapi_PBlock* pb) { void *obj = NULL; diff --git a/ldap/servers/plugins/chainingdb/cb_conn_stateless.c b/ldap/servers/plugins/chainingdb/cb_conn_stateless.c index 5e2f3a59..a7df413b 100644 --- a/ldap/servers/plugins/chainingdb/cb_conn_stateless.c +++ b/ldap/servers/plugins/chainingdb/cb_conn_stateless.c @@ -886,141 +886,6 @@ void cb_stale_all_connections( cb_backend_instance * cb) } - -/**************************************************************************/ -/* Need to use our own connect function until we've switched to C-SDK 4.1 */ -/* to have a timeout in the connect system call. */ -/**************************************************************************/ - -static int global_connect_to; - -#if 0 - -/* Taken from C-SDK 4.1 */ -#include <fcntl.h> -#include <errno.h> -#define LDAP_X_IO_TIMEOUT_NO_TIMEOUT (-1) - -static int -nsldapi_os_connect_with_to(LBER_SOCKET sockfd, struct sockaddr *saptr, - int salen) -{ -#ifndef _WIN32 - int flags; -#endif /* _WIN32 */ - int n, error; - int len; - fd_set rset, wset; - struct timeval tval; -#ifdef _WIN32 - int nonblock = 1; - int block = 0; - fd_set eset; -#endif /* _WIN32 */ - - int msec=global_connect_to; /* global */ - -#ifdef _WIN32 - ioctlsocket(sockfd, FIONBIO, &nonblock); -#else - flags = fcntl(sockfd, F_GETFL, 0); - fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); -#endif /* _WIN32 */ - - error = 0; - if ((n = connect(sockfd, saptr, salen)) < 0) -#ifdef _WIN32 - if ((n != SOCKET_ERROR) && (WSAGetLastError() != WSAEWOULDBLOCK)) { -#else - if (errno != EINPROGRESS) { -#endif /* _WIN32 */ - return (-1); - } - - /* success */ - if (n == 0) - goto done; - - FD_ZERO(&rset); - FD_SET(sockfd, &rset); - wset = rset; - -#ifdef _WIN32 - eset = rset; -#endif /* _WIN32 */ - - if (msec < 0 && msec != LDAP_X_IO_TIMEOUT_NO_TIMEOUT) { - msec = LDAP_X_IO_TIMEOUT_NO_TIMEOUT; - } else { - if (msec != 0) - tval.tv_sec = msec / 1000; - else - tval.tv_sec = 0; - tval.tv_usec = 0; - } - - /* if timeval structure == NULL, select will block indefinitely */ - /* != NULL, and value == 0, select will */ - /* not block */ - /* Windows is a bit quirky on how it behaves w.r.t nonblocking */ - /* connects. If the connect fails, the exception fd, eset, is */ - /* set to show the failure. The first argument in select is */ - /* ignored */ - -#ifdef _WIN32 - if ((n = select(sockfd +1, &rset, &wset, &eset, - (msec != LDAP_X_IO_TIMEOUT_NO_TIMEOUT) ? &tval : NULL)) == 0) { - errno = WSAETIMEDOUT; - return (-1); - } - /* if wset is set, the connect worked */ - if (FD_ISSET(sockfd, &wset) || FD_ISSET(sockfd, &rset)) { - len = sizeof(error); - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *)&error, &len) - < 0) - return (-1); - goto done; - } - - /* if eset is set, the connect failed */ - if (FD_ISSET(sockfd, &eset)) { - return (-1); - } - - /* failure on select call */ - if (n == SOCKET_ERROR) { - return (-1); - } -#else - if ((n = select(sockfd +1, &rset, &wset, NULL, - (msec != LDAP_X_IO_TIMEOUT_NO_TIMEOUT) ? &tval : NULL)) == 0) { - errno = ETIMEDOUT; - return (-1); - } - if (FD_ISSET(sockfd, &rset) || FD_ISSET(sockfd, &wset)) { - len = sizeof(error); - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *)&error, &len) - < 0) - return (-1); - } -#endif /* _WIN32 */ -done: -#ifdef _WIN32 - ioctlsocket(sockfd, FIONBIO, &block); -#else - fcntl(sockfd, F_SETFL, flags); -#endif /* _WIN32 */ - - if (error) { - errno = error; - return (-1); - } - - return (0); -} - -#endif - /* Try to figure out if a farm server is still alive */ int cb_ping_farm(cb_backend_instance *cb, cb_outgoing_conn * cnx,time_t end_time) { @@ -1030,9 +895,6 @@ int cb_ping_farm(cb_backend_instance *cb, cb_outgoing_conn * cnx,time_t end_time struct timeval timeout; LDAP *ld; LDAPMessage *result; -#if 0 - struct ldap_io_fns iof; -#endif time_t now; if (cb->max_idle_time <=0) /* Heart-beat disabled */ return LDAP_SUCCESS; @@ -1049,27 +911,9 @@ int cb_ping_farm(cb_backend_instance *cb, cb_outgoing_conn * cnx,time_t end_time return LDAP_SERVER_DOWN; } -#if 0 - memset(&iof,0,sizeof(struct ldap_io_fns)); - if (LDAP_SUCCESS !=ldap_get_option(ld,LDAP_OPT_IO_FN_PTRS,&iof)) { - slapi_ldap_unbind( ld ); - cb_update_failed_conn_cpt( cb ); - return LDAP_SERVER_DOWN; - } - - iof.liof_connect = nsldapi_os_connect_with_to; - if (LDAP_SUCCESS !=ldap_set_option(ld,LDAP_OPT_IO_FN_PTRS,&iof)) { - slapi_ldap_unbind( ld ); - cb_update_failed_conn_cpt( cb ); - return LDAP_SERVER_DOWN; - } - -#endif - timeout.tv_sec=cb->max_test_time; timeout.tv_usec=0; - global_connect_to=cb->max_test_time * 1000; /* Reuse the same for the connect */ rc=ldap_search_ext_s(ld ,NULL,LDAP_SCOPE_BASE,"objectclass=*",attrs,1,NULL, NULL, &timeout, 1,&result); if ( LDAP_SUCCESS != rc ) { @@ -1122,7 +966,6 @@ void cb_reset_conn_cpt( cb_backend_instance *cb ) { int cb_check_availability( cb_backend_instance *cb, Slapi_PBlock *pb ) { /* check wether the farmserver is available or not */ - int rc ; time_t now ; if ( cb->monitor_availability.farmserver_state == FARMSERVER_UNAVAILABLE ){ slapi_lock_mutex(cb->monitor_availability.lock_timeLimit); @@ -1138,7 +981,7 @@ int cb_check_availability( cb_backend_instance *cb, Slapi_PBlock *pb ) { } slapi_log_error( SLAPI_LOG_PLUGIN, CB_PLUGIN_SUBSYSTEM, "cb_check_availability: ping the farm server and check if it's still unavailable"); - if ((rc = cb_ping_farm(cb, NULL, 0)) != LDAP_SUCCESS) { /* farm still unavailable... Just change the timelimit */ + if (cb_ping_farm(cb, NULL, 0) != LDAP_SUCCESS) { /* farm still unavailable... Just change the timelimit */ slapi_lock_mutex(cb->monitor_availability.lock_timeLimit); now = current_time(); cb->monitor_availability.unavailableTimeLimit = now + CB_UNAVAILABLE_PERIOD ; diff --git a/ldap/servers/plugins/chainingdb/cb_instance.c b/ldap/servers/plugins/chainingdb/cb_instance.c index e2719151..91da2aab 100644 --- a/ldap/servers/plugins/chainingdb/cb_instance.c +++ b/ldap/servers/plugins/chainingdb/cb_instance.c @@ -716,8 +716,6 @@ static int cb_instance_hosturl_set(void *arg, void *value, char *errorbuf, int p if (apply) { - char * ptr; - PR_RWLock_Wlock(inst->rwl_config_lock); if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) && @@ -771,7 +769,7 @@ static int cb_instance_hosturl_set(void *arg, void *value, char *errorbuf, int p while (aHostName) { char * aHostPort; - if ( NULL == ( ptr=strstr(aHostName,":"))) { + if ( NULL == strstr(aHostName,":")) { aHostPort = slapi_ch_smprintf("%s://%s:%d/", inst->pool->secure ? "ldaps" : "ldap", aHostName,inst->pool->port); diff --git a/ldap/servers/plugins/chainingdb/cb_test.c b/ldap/servers/plugins/chainingdb/cb_test.c index ffb8b724..82e64b9c 100644 --- a/ldap/servers/plugins/chainingdb/cb_test.c +++ b/ldap/servers/plugins/chainingdb/cb_test.c @@ -46,7 +46,7 @@ int cb_back_test( Slapi_PBlock *pb ) { Slapi_Backend * be; - cb_backend * cb; + cb_backend * cb; cb_backend_instance * inst; Slapi_PBlock * apb; int res; @@ -56,9 +56,9 @@ int cb_back_test( Slapi_PBlock *pb ) char * theTarget; - slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &cb ); - slapi_pblock_get( pb, SLAPI_BACKEND, &be ); - inst = cb_get_instance(be); + slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &cb ); + slapi_pblock_get( pb, SLAPI_BACKEND, &be ); + inst = cb_get_instance(be); apb = slapi_pblock_new(); /* @@ -70,16 +70,16 @@ int cb_back_test( Slapi_PBlock *pb ) printf("Begin test instance %s.\n",inst->inst_name); - aSuffix = slapi_be_getsuffix(be,0); - aSuffixString=slapi_sdn_get_dn(aSuffix); - /* Remove leading white spaces */ - for (aSuffixString; *aSuffixString==' ';aSuffixString++) {} + aSuffix = slapi_be_getsuffix(be,0); + /* Remove leading white spaces */ + for (aSuffixString=slapi_sdn_get_dn(aSuffix); + *aSuffixString==' '; aSuffixString++) {} theTarget=slapi_ch_smprintf("cn=test,%s",aSuffixString); /* XXXSD make sure chaining allowed for this plugin... */ - slapi_search_internal_set_pb (apb, theTarget, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, NULL, NULL, + slapi_search_internal_set_pb (apb, theTarget, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, NULL, NULL, cb->identity,0 ); - slapi_search_internal_pb (apb); + slapi_search_internal_pb (apb); slapi_ch_free((void **)&theTarget); @@ -91,22 +91,22 @@ int cb_back_test( Slapi_PBlock *pb ) slapi_pblock_get(apb, SLAPI_PLUGIN_INTOP_RESULT, &res); /* OPERATIONS ERRORS also returned when bind failed */ - if (CB_LDAP_CONN_ERROR(res) || (res==LDAP_OPERATIONS_ERROR )) - { + if (CB_LDAP_CONN_ERROR(res) || (res==LDAP_OPERATIONS_ERROR )) + { printf("Can't contact the remote farm server %s. (%s).\n",inst->pool->hostname,ldap_err2string(res)); rc=-1; goto the_end; - } else { + } else { printf("Connection established with the remote farm server %s.\n",inst->pool->hostname); } the_end: - if (apb) - { - slapi_free_search_results_internal(apb); - slapi_pblock_destroy (apb); - } - - return rc; + if (apb) + { + slapi_free_search_results_internal(apb); + slapi_pblock_destroy (apb); + } + + return rc; } diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c index 88678868..aa042670 100644 --- a/ldap/servers/plugins/cos/cos_cache.c +++ b/ldap/servers/plugins/cos/cos_cache.c @@ -284,7 +284,6 @@ static void cos_cache_add_ll_entry(void **attrval, void *theVal, int ( *compare /* cosAttrValue manipulation */ static int cos_cache_add_attrval(cosAttrValue **attrval, char *val); static void cos_cache_del_attrval_list(cosAttrValue **pVal); -static int cos_cache_attrval_count(cosAttrValue *pVal); static int cos_cache_attrval_exists(cosAttrValue *pAttrs, const char *val); /* cosAttributes manipulation */ @@ -298,18 +297,12 @@ static int cos_cache_cmp_attr(cosAttributes *pAttr, Slapi_Value *test_this, int /* cosTemplates manipulation */ static int cos_cache_add_dn_tmpls(char *dn, cosAttrValue *pCosSpecifier, cosAttrValue *pAttrs, cosTemplates **pTmpls); static int cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAttrValue *objclasses, cosAttrValue *pCosSpecifier, cosAttributes *pAttrs,cosAttrValue *cosPriority); -#if 0 -static int cos_cache_del_tmpl(cosTemplates *pTemplates, char *dn); -#endif /* cosDefinitions manipulation */ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_cacheable); static int cos_cache_add_dn_defs(char *dn, cosDefinitions **pDefs, int *vattr_cacheable); static int cos_cache_add_defn(cosDefinitions **pDefs, cosAttrValue **dn, int cosType, cosAttrValue **tree, cosAttrValue **tmpDn, cosAttrValue **spec, cosAttrValue **pAttrs, cosAttrValue **pOverrides, cosAttrValue **pOperational, cosAttrValue **pCosMerge, cosAttrValue **pCosOpDefault); static int cos_cache_entry_is_cos_related( Slapi_Entry *e); -#if 0 -static int cos_cache_del_defn(cosDefinitions *pDefs, char *dn); -#endif /* schema checking */ static int cos_cache_schema_check(cosCache *pCache, int cache_attr_index, Slapi_Attr *pObjclasses); @@ -332,8 +325,6 @@ static int cos_cache_vattr_get(vattr_sp_handle *handle, vattr_context *c, Slapi_ static int cos_cache_vattr_compare(vattr_sp_handle *handle, vattr_context *c, Slapi_Entry *e, char *type, Slapi_Value *test_this, int* result, int flags, void *hint); static int cos_cache_vattr_types(vattr_sp_handle *handle,Slapi_Entry *e,vattr_type_list_context *type_context,int flags); static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context, Slapi_Entry *e, char *type, Slapi_ValueSet **out_attr, Slapi_Value *test_this, int *result, int *ops); -static void cos_cache_query_attr_free(struct berval ***vals); /* deprecated */ - /* compares s2 to s1 starting from end of string until the beginning of either @@ -344,7 +335,6 @@ static int cos_cache_backwards_stricmp_and_clip(char*s1,char*s2); /* module level thread control stuff */ -static PRThread *cos_tid = NULL; static int keeprunning = 0; static int started = 0; @@ -411,18 +401,18 @@ int cos_cache_init() goto out; } - if ((cos_tid = PR_CreateThread (PR_USER_THREAD, + if ( PR_CreateThread (PR_USER_THREAD, cos_cache_wait_on_change, NULL, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - SLAPD_DEFAULT_THREAD_STACKSIZE)) == NULL ) + SLAPD_DEFAULT_THREAD_STACKSIZE) == NULL ) { slapi_log_error( SLAPI_LOG_FATAL, COS_PLUGIN_SUBSYSTEM, "cos_cache_init: PR_CreateThread failed\n" ); ret = -1; - goto out; + goto out; } /* wait for that thread to get started */ @@ -794,14 +784,6 @@ static int cos_dn_defs_cb (Slapi_Entry* e, void *callback_data) { int valIndex = 0; Slapi_Attr *dnAttr; char *attrType = 0; - char *attrs[7]; - - attrs[0] = "objectclass"; - attrs[1] = "cosTargetTree"; - attrs[2] = "cosTemplateDn"; - attrs[3] = "cosSpecifier"; - attrs[4] = "cosAttribute"; - attrs[5] = 0; info=(struct dn_defs_info *)callback_data; @@ -849,7 +831,6 @@ static int cos_dn_defs_cb (Slapi_Entry* e, void *callback_data) { */ if(pSneakyVal == &pCosAttribute) { - cosAttrValue *pTmpTargetTree = 0; int qualifier_hit = 0; int op_qualifier_hit = 0; int merge_schemes_qualifier_hit = 0; @@ -935,8 +916,6 @@ static int cos_dn_defs_cb (Slapi_Entry* e, void *callback_data) { slapi_ch_free((void**)&parent); } - pTmpTargetTree = pCosTargetTree; - slapi_vattrspi_regattr((vattr_sp_handle *)vattr_handle, dnVals[valIndex]->bv_val, NULL, NULL); } /* if(attrType is cosAttribute) */ @@ -1821,27 +1800,6 @@ int cos_cache_release(cos_cache *ptheCache) return ret; } -/* - cos_cache_attrval_count - ----------------------- - counts the number of values in the list -*/ - -static int cos_cache_attrval_count(cosAttrValue *pVal) -{ - int ret = 0; - - LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_attrval_count\n",0,0,0); - - while(pVal) - { - ret++; - pVal = pVal->list.pNext; - } - - LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_attrval_count\n",0,0,0); - return ret; -} /* cos_cache_del_attr_list @@ -1875,7 +1833,6 @@ static void cos_cache_del_attr_list(cosAttributes **pAttrs) static void cos_cache_del_schema(cosCache *pCache) { char *pLastName = 0; - cosAttrValue *pLastRef = 0; int attr_index = 0; LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_del_schema\n",0,0,0); @@ -1883,7 +1840,6 @@ static void cos_cache_del_schema(cosCache *pCache) if(pCache && pCache->attrCount && pCache->ppAttrIndex) { pLastName = pCache->ppAttrIndex[0]->pAttrName; - pLastRef = pCache->ppAttrIndex[0]->pObjectclasses; for(attr_index=1; attr_index<pCache->attrCount; attr_index++) { @@ -2578,25 +2534,6 @@ bail: } /* - cos_cache_query_attr_free - ------------------------- - frees the memory allocated for the data returned - by cos_cache_query_attr -*/ -static void cos_cache_query_attr_free(struct berval ***vals) -{ - int index = 0; - - while((*vals)[index]) - { - slapi_ch_free((void**)&((*vals)[index])); - index++; - } - - slapi_ch_free((void**)*vals); -} - -/* cos_cache_find_attr ------------------- searches for the attribute "type", and if found returns the index @@ -3006,19 +2943,6 @@ static int cos_cache_total_attr_count(cosCache *pCache) } -/* - cos_cache_XXX_compare - --------------------- - this set of functions are passed to sorting and searching - functions to provide an ordering comparison between to structures -*/ -#if 0 -int cos_cache_attrval_compare(const void *e1, const void *e2) -{ - return slapi_utf8casecmp((unsigned char*)(*(cosAttrValue**)e1)->val,(unsigned char*)(*(cosAttrValue**)e2)->val); -} -#endif - static int cos_cache_attr_compare(const void *e1, const void *e2) { int com_Result; @@ -3045,13 +2969,6 @@ static int cos_cache_attr_compare(const void *e1, const void *e2) return com_Result; } -#if 0 -int cos_cache_tmpl_compare(const void *e1, const void *e2) -{ - return slapi_utf8casecmp((unsigned char*)(*(cosTemplates**)e1)->cosGrade,(unsigned char*)(*(cosTemplates**)e2)->cosGrade); -} -#endif - static int cos_cache_string_compare(const void *e1, const void *e2) { return slapi_utf8casecmp((*(unsigned char**)e1),(*(unsigned char**)e2)); diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c index 6187c83a..2541bdf8 100644 --- a/ldap/servers/plugins/dna/dna.c +++ b/ldap/servers/plugins/dna/dna.c @@ -962,8 +962,8 @@ static int dna_pre_op(Slapi_PBlock *pb, int modtype) e, config_entry->type); if((value && !slapi_utf8casecmp( - config_entry->generate, - value)) || + (unsigned char *)config_entry->generate, + (unsigned char *)value)) || 0 == value) { generate = 1; @@ -996,8 +996,8 @@ static int dna_pre_op(Slapi_PBlock *pb, int modtype) if(len == bv->bv_len) { if(!slapi_utf8ncasecmp( - bv->bv_val, - config_entry-> + (unsigned char *)bv->bv_val, + (unsigned char *)config_entry-> generate, len)) @@ -1128,7 +1128,6 @@ static int dna_config_check_post_op(Slapi_PBlock *pb) loadPluginConfig(); } -bail: slapi_log_error( SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM , "<-- dna_config_check_post_op\n"); return 0; @@ -1165,11 +1164,14 @@ void dnaDumpConfig() void dnaDumpConfigEntry(configEntry *entry) { + char buffer[BUFSIZ]; + size_t bufsiz = (size_t)sizeof(buffer); printf("<- type --------------> %s\n", entry->type); printf("<---- prefix ---------> %s\n", entry->prefix); printf("<---- next value -----> %lu\n", entry->nextval); printf("<---- interval -------> %lu\n", entry->interval); - printf("<---- filter ---------> %s\n", entry->filter); + printf("<---- filter ---------> %s\n", + slapi_filter_to_string_internal((const struct slapi_filter *)entry->filter, buffer, &bufsiz)); printf("<---- generate flag --> %s\n", entry->generate); } diff --git a/ldap/servers/plugins/http/http_impl.c b/ldap/servers/plugins/http/http_impl.c index 708a8579..d11ce0af 100644 --- a/ldap/servers/plugins/http/http_impl.c +++ b/ldap/servers/plugins/http/http_impl.c @@ -57,6 +57,7 @@ #include "http_client.h" #include "secerr.h" #include "sslerr.h" +#include "slap.h" #include "slapi-private.h" #include "slapi-plugin-compat4.h" /* get file mode flags for unix */ diff --git a/ldap/servers/plugins/pam_passthru/pam_ptconfig.c b/ldap/servers/plugins/pam_passthru/pam_ptconfig.c index 4447c8a7..beff65d0 100644 --- a/ldap/servers/plugins/pam_passthru/pam_ptconfig.c +++ b/ldap/servers/plugins/pam_passthru/pam_ptconfig.c @@ -231,7 +231,6 @@ static int parse_map_method(char *map_method, int *one, int *two, int *three, char *returntext) { int err = LDAP_SUCCESS; - int extra; char **ptr = &map_method; *one = *two = *three = PAMPT_MAP_METHOD_NONE; @@ -256,7 +255,7 @@ parse_map_method(char *map_method, int *one, int *two, int *three, char *returnt "one of %s", map_method, get_map_method_values()); return LDAP_UNWILLING_TO_PERFORM; } - if (((extra = meth_to_int(ptr, &err)) != PAMPT_MAP_METHOD_NONE) || + if ((meth_to_int(ptr, &err) != PAMPT_MAP_METHOD_NONE) || err) { PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid extra text [%s] after last map method", diff --git a/ldap/servers/plugins/pam_passthru/pam_ptimpl.c b/ldap/servers/plugins/pam_passthru/pam_ptimpl.c index 93aa9207..1f3b5db4 100644 --- a/ldap/servers/plugins/pam_passthru/pam_ptimpl.c +++ b/ldap/servers/plugins/pam_passthru/pam_ptimpl.c @@ -177,7 +177,7 @@ free_pam_response(int nresp, struct pam_response *resp) * tell if this is actually the case. */ static int -pam_conv_func(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *mydata) +pam_conv_func(int num_msg, struct pam_message **msg, struct pam_response **resp, void *mydata) { int ii; struct berval *creds; diff --git a/ldap/servers/plugins/pwdstorage/md5_pwd.c b/ldap/servers/plugins/pwdstorage/md5_pwd.c index 4e9dcb55..b63c5b04 100644 --- a/ldap/servers/plugins/pwdstorage/md5_pwd.c +++ b/ldap/servers/plugins/pwdstorage/md5_pwd.c @@ -76,14 +76,14 @@ md5_pw_cmp( char *userpwd, char *dbpwd ) /* create the hash */ PK11_DigestBegin(ctx); - PK11_DigestOp(ctx, userpwd, strlen(userpwd)); + PK11_DigestOp(ctx, (const unsigned char *)userpwd, strlen(userpwd)); PK11_DigestFinal(ctx, hash_out, &outLen, sizeof hash_out); PK11_DestroyContext(ctx, 1); /* convert the binary hash to base64 */ binary_item.data = hash_out; binary_item.len = outLen; - bver = NSSBase64_EncodeItem(NULL, b2a_out, sizeof b2a_out, &binary_item); + bver = NSSBase64_EncodeItem(NULL, (char *)b2a_out, sizeof b2a_out, &binary_item); /* bver points to b2a_out upon success */ if (bver) { rc = strcmp(bver,dbpwd); @@ -114,14 +114,14 @@ md5_pw_enc( char *pwd ) /* create the hash */ PK11_DigestBegin(ctx); - PK11_DigestOp(ctx, pwd, strlen(pwd)); + PK11_DigestOp(ctx, (const unsigned char *)pwd, strlen(pwd)); PK11_DigestFinal(ctx, hash_out, &outLen, sizeof hash_out); PK11_DestroyContext(ctx, 1); /* convert the binary hash to base64 */ binary_item.data = hash_out; binary_item.len = outLen; - bver = NSSBase64_EncodeItem(NULL, b2a_out, sizeof b2a_out, &binary_item); + bver = NSSBase64_EncodeItem(NULL, (char *)b2a_out, sizeof b2a_out, &binary_item); if (bver) { enc = slapi_ch_smprintf("%c%s%c%s", PWD_HASH_PREFIX_START, MD5_SCHEME_NAME, PWD_HASH_PREFIX_END, bver ); diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index 0d8fbbf3..286169c6 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/ldap/servers/plugins/referint/referint.c @@ -537,19 +537,20 @@ int referint_postop_start( Slapi_PBlock *pb) keeprunning_cv = PR_NewCondVar(keeprunning_mutex); keeprunning =1; - if (( referint_tid = PR_CreateThread (PR_USER_THREAD, + referint_tid = PR_CreateThread (PR_USER_THREAD, referint_thread_func, (void *)argv, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, - SLAPD_DEFAULT_THREAD_STACKSIZE)) == NULL ) { + SLAPD_DEFAULT_THREAD_STACKSIZE); + if ( referint_tid == NULL ) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "referint_postop_start PR_CreateThread failed\n" ); exit( 1 ); - } + } } - } else { + } else { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "referint_postop_start insufficient arguments supplied\n" ); return( -1 ); @@ -818,11 +819,10 @@ void writeintegritylog(char *logfilename, char *dn, char *newrdn){ " line length exceeded. It will not be able" " to update references to this entry.\n"); }else{ - PRInt32 rv; PR_snprintf(buffer, MAX_LINE, "%s\t%s\t\n", dn, (newrdn != NULL) ? newrdn : "NULL"); - if ((rv = PR_Write(prfd,buffer,strlen(buffer))) < 0){ + if (PR_Write(prfd,buffer,strlen(buffer)) < 0){ slapi_log_error(SLAPI_LOG_FATAL,REFERINT_PLUGIN_SUBSYSTEM, " writeintegritylog: PR_Write failed : The disk" " may be full or the file is unwritable :: NSPR error - %d\n", 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) diff --git a/ldap/servers/plugins/retrocl/retrocl_trim.c b/ldap/servers/plugins/retrocl/retrocl_trim.c index e8723b09..b43415d1 100644 --- a/ldap/servers/plugins/retrocl/retrocl_trim.c +++ b/ldap/servers/plugins/retrocl/retrocl_trim.c @@ -363,7 +363,6 @@ changelog_trim_thread_fn( void *arg ) void retrocl_housekeeping ( time_t cur_time, void *noarg ) { - static time_t thread_start_time; int ldrc; if (retrocl_be_changelog == NULL) { @@ -402,7 +401,6 @@ void retrocl_housekeeping ( time_t cur_time, void *noarg ) if ( must_trim ) { LDAPDebug(LDAP_DEBUG_TRACE,"changelog about to create thread\n",0,0,0); /* Start a thread to trim the changelog */ - thread_start_time = cur_time; ts.ts_s_trimming = 1; if ( PR_CreateThread( PR_USER_THREAD, changelog_trim_thread_fn, NULL, diff --git a/ldap/servers/plugins/shared/utils.c b/ldap/servers/plugins/shared/utils.c index f3e1ec42..1010e8c9 100644 --- a/ldap/servers/plugins/shared/utils.c +++ b/ldap/servers/plugins/shared/utils.c @@ -97,7 +97,6 @@ int initCounterLock() { Slapi_PBlock * readPblockAndEntry( const char *baseDN, const char *filter, char *attrs[] ) { - int result = 0; Slapi_PBlock *spb = NULL; BEGIN @@ -107,15 +106,15 @@ readPblockAndEntry( const char *baseDN, const char *filter, spb = slapi_search_internal((char *)baseDN, LDAP_SCOPE_BASE, (char *)filter, NULL, attrs, 0); if ( !spb ) { - result = op_error(20); + op_error(20); break; } if ( slapi_pblock_get( spb, SLAPI_PLUGIN_INTOP_RESULT, &sres ) ) { - result = op_error(21); + op_error(21); break; } else if (sres) { - result = op_error(22); + op_error(22); break; } END @@ -166,7 +165,6 @@ entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e, */ Slapi_PBlock * dnHasObjectClass( const char *baseDN, const char *objectClass ) { - int result = 0; char *filter = NULL; Slapi_PBlock *spb = NULL; @@ -184,7 +182,7 @@ dnHasObjectClass( const char *baseDN, const char *objectClass ) { if ( slapi_pblock_get(spb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries) ) { - result = op_error(23); + op_error(23); break; } /* @@ -213,7 +211,6 @@ dnHasObjectClass( const char *baseDN, const char *objectClass ) { */ Slapi_PBlock * dnHasAttribute( const char *baseDN, const char *attrName ) { - int result = 0; Slapi_PBlock *spb = NULL; char *filter = NULL; @@ -229,21 +226,21 @@ dnHasAttribute( const char *baseDN, const char *attrName ) { spb = slapi_search_internal((char *)baseDN, LDAP_SCOPE_BASE, filter, NULL, attrs, 0); if ( !spb ) { - result = op_error(20); + op_error(20); break; } if ( slapi_pblock_get( spb, SLAPI_PLUGIN_INTOP_RESULT, &sres ) ) { - result = op_error(21); + op_error(21); break; } else if (sres) { - result = op_error(22); + op_error(22); break; } if ( slapi_pblock_get(spb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries) ) { - result = op_error(23); + op_error(23); break; } /* diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c index 243ac962..3735440f 100644 --- a/ldap/servers/plugins/views/views.c +++ b/ldap/servers/plugins/views/views.c @@ -1202,12 +1202,8 @@ static int views_dn_views_cb (Slapi_Entry* e, void *callback_data) { struct berval **dnVals; Slapi_Attr *dnAttr; char *attrType = 0; - char *attrs[3]; viewEntry *pView; - - attrs[0] = VIEW_FILTER_ATTR; - attrs[1] = "entryid"; - attrs[2] = 0; + info=(struct dn_views_info *)callback_data; info->ret = 0; diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c index 12797037..b500e34c 100644 --- a/ldap/servers/slapd/add.c +++ b/ldap/servers/slapd/add.c @@ -93,7 +93,7 @@ do_add( Slapi_PBlock *pb ) ber = operation->o_ber; /* count the add request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps); /* * Parse the add request. It looks like this: diff --git a/ldap/servers/slapd/auditlog.c b/ldap/servers/slapd/auditlog.c index d524415b..7a757845 100644 --- a/ldap/servers/slapd/auditlog.c +++ b/ldap/servers/slapd/auditlog.c @@ -66,7 +66,6 @@ write_audit_log_entry( Slapi_PBlock *pb ) char *dn; void *change; int flag = 0; - int internal_op = 0; Operation *op; /* if the audit log is not enabled, just skip all of @@ -76,7 +75,6 @@ write_audit_log_entry( Slapi_PBlock *pb ) } slapi_pblock_get( pb, SLAPI_OPERATION, &op ); - internal_op = operation_is_flag_set(op, OP_FLAG_INTERNAL); slapi_pblock_get( pb, SLAPI_TARGET_DN, &dn ); switch ( operation_get_type(op) ) { diff --git a/ldap/servers/slapd/back-ldbm/dbhelp.c b/ldap/servers/slapd/back-ldbm/dbhelp.c index 0a96df8f..36e8dd04 100644 --- a/ldap/servers/slapd/back-ldbm/dbhelp.c +++ b/ldap/servers/slapd/back-ldbm/dbhelp.c @@ -57,8 +57,8 @@ static int dblayer_copy_file_keybykey(DB_ENV *env, char *source_file_name, char DB *destination_file = NULL; DBC *source_cursor = NULL; DBTYPE dbtype = 0; - int dbflags = 0; - int dbpagesize = 0; + PRUint32 dbflags = 0; + PRUint32 dbpagesize = 0; int cursor_flag = 0; int finished = 0; int mode = 0; @@ -187,14 +187,11 @@ error: int dblayer_copy_file_resetlsns(char *home_dir ,char *source_file_name, char *destination_file_name, int overwrite, dblayer_private *priv) { int retval = 0; - int mode = 0; DB_ENV *env = NULL; LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_copy_file_resetlsns\n", 0, 0, 0 ); /* Make the environment */ - if (priv->dblayer_file_mode) - mode = priv->dblayer_file_mode; retval = dblayer_make_private_simple_env(home_dir,&env); if (retval) { LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns: Call to dblayer_make_private_simple_env failed!\n" diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index af82af54..42111735 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -478,6 +478,7 @@ static int dblayer_seek24_large(int fd, size_t pgsize, db_pgno_t pageno, return (ret < 0) ? errno : 0; } +#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300 /* Helper function for large seeks, db4.3 */ static int dblayer_seek43_large(int fd, off64_t offset, int whence) { @@ -487,6 +488,7 @@ static int dblayer_seek43_large(int fd, off64_t offset, int whence) return (ret < 0) ? errno : 0; } +#endif /* helper function for large fstat -- this depends on 'struct stat64' having * the following members: @@ -5828,7 +5830,6 @@ done: int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext) { struct attrinfo *a = NULL; - backend *be = NULL; struct ldbminfo *li = NULL; dblayer_private *priv = NULL; DB *thisdb = NULL; @@ -5844,7 +5845,6 @@ int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext) "update_db_ext: Null instance is passed\n", 0, 0, 0); return -1; /* non zero */ } - be = inst->inst_be; li = inst->inst_li; priv = (dblayer_private*)li->li_dblayer_private; inst_dirp = dblayer_get_full_inst_dir(li, inst, inst_dir, MAXPATHLEN); diff --git a/ldap/servers/slapd/back-ldbm/dbverify.c b/ldap/servers/slapd/back-ldbm/dbverify.c index bd3ec2e0..c6f910b9 100644 --- a/ldap/servers/slapd/back-ldbm/dbverify.c +++ b/ldap/servers/slapd/back-ldbm/dbverify.c @@ -169,7 +169,7 @@ ldbm_back_dbverify( Slapi_PBlock *pb ) slapi_log_error(SLAPI_LOG_TRACE, "verify DB", "Verifying db files...\n"); slapi_pblock_get(pb, SLAPI_BACKEND_INSTANCE_NAME, &instance_names); - slapi_pblock_get(pb, SLAPI_SEQ_VAL, &verbose); + slapi_pblock_get(pb, SLAPI_SEQ_TYPE, &verbose); slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &li); ldbm_config_load_dse_info(li); ldbm_config_internal_set(li, CONFIG_DB_TRANSACTION_LOGGING, "off"); diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c index 9513a8bf..7666dcfe 100644 --- a/ldap/servers/slapd/back-ldbm/import.c +++ b/ldap/servers/slapd/back-ldbm/import.c @@ -173,8 +173,6 @@ static void import_log_status_add_line(ImportJob *job, char *format, ...) static void import_log_status_done(ImportJob *job) { if (job->task) { - int len = 0; - len = strlen(job->task_status); slapi_task_log_status(job->task, "%s", job->task_status); } } diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c index 93032d60..28b79f19 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c @@ -572,7 +572,7 @@ static int grok_and_rewrite_filter(Slapi_Filter *f) rhs = f->f_ava.ava_value.bv_val; /* is the value zero ? */ rhs_num = atoi(rhs); - if (0 == rhs) { + if (0 == rhs_num) { /* If so, rewrite to same as numsubordinates=* */ free_the_filter_bits(f); replace_filter(f,"(objectclass=*)"); diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c index 5e1d998c..154c8af6 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c @@ -200,7 +200,7 @@ attrcrypt_keymgmt_store_key(ldbm_instance *li, attrcrypt_cipher_state *acs, SECK char *entry_string = slapi_ch_smprintf(entry_template,acs->ace->cipher_display_name,instance_name,acs->ace->cipher_display_name); e = slapi_str2entry(entry_string, 0); /* Add the key as a binary attribute */ - key_as_berval.bv_val = wrapped_symmetric_key.data; + key_as_berval.bv_val = (char *)wrapped_symmetric_key.data; key_as_berval.bv_len = wrapped_symmetric_key.len; key_value = slapi_value_new_berval(&key_as_berval); /* key_value is now a copy of key_as_berval - free wrapped_symmetric_key */ @@ -236,7 +236,7 @@ attrcrypt_wrap_key(attrcrypt_cipher_state *acs, PK11SymKey *symmetric_key, SECKE CK_MECHANISM_TYPE wrap_mechanism = CKM_RSA_PKCS; SECKEYPublicKey *wrapping_key = public_key; wrapped_symmetric_key->len = slapd_SECKEY_PublicKeyStrength(public_key); - wrapped_symmetric_key->data = slapi_ch_malloc(wrapped_symmetric_key->len); + wrapped_symmetric_key->data = (unsigned char *)slapi_ch_malloc(wrapped_symmetric_key->len); LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_wrap_key\n", 0, 0, 0); s = slapd_pk11_PubWrapSymKey(wrap_mechanism, wrapping_key, symmetric_key, wrapped_symmetric_key); if (SECSuccess != s) { @@ -567,7 +567,7 @@ attrcrypt_crypto_op(attrcrypt_private *priv, backend *be, struct attrinfo *ai, c SECItem *security_parameter = NULL; int output_buffer_length = 0; int output_buffer_size1 = 0; - int output_buffer_size2 = 0; + unsigned int output_buffer_size2 = 0; unsigned char *output_buffer = NULL; attrcrypt_cipher_state *acs = NULL; @@ -586,7 +586,7 @@ attrcrypt_crypto_op(attrcrypt_private *priv, backend *be, struct attrinfo *ai, c #endif /* Allocate the output buffer */ output_buffer_length = in_size + 16; - output_buffer = slapi_ch_malloc(output_buffer_length); + output_buffer = (unsigned char *)slapi_ch_malloc(output_buffer_length); /* Now call NSS to do the cipher op */ iv_item.data = "aaaaaaaaaaaaaaaa"; /* ptr to an array of IV bytes */ iv_item.len = acs->ace->iv_length; /* length of the array of IV bytes */ @@ -602,7 +602,7 @@ attrcrypt_crypto_op(attrcrypt_private *priv, backend *be, struct attrinfo *ai, c LDAPDebug(LDAP_DEBUG_ANY,"attrcrypt_crypto_op failed on cipher %s : %d - %s\n", acs->ace->cipher_display_name, errorCode, slapd_pr_strerror(errorCode)); goto error; } - secret = slapd_pk11_cipherOp(sec_context, output_buffer, &output_buffer_size1, output_buffer_length, in_data, in_size); + secret = slapd_pk11_cipherOp(sec_context, output_buffer, &output_buffer_size1, output_buffer_length, (unsigned char *)in_data, in_size); if (SECSuccess != secret) { int errorCode = PR_GetError(); LDAPDebug(LDAP_DEBUG_ANY,"attrcrypt_crypto_op failed on cipher %s : %d - %s\n", acs->ace->cipher_display_name, errorCode, slapd_pr_strerror(errorCode)); @@ -621,11 +621,11 @@ attrcrypt_crypto_op(attrcrypt_private *priv, backend *be, struct attrinfo *ai, c if (encrypt) { log_bytes("slapd_pk11_DigestFinal '%s' (%d)\n", output_buffer, output_buffer_size1 + output_buffer_size2); } else { - LDAPDebug(LDAP_DEBUG_ANY,"slapd_pk11_DigestFinal '%s', %d\n", output_buffer, output_buffer_size2, 0); + LDAPDebug(LDAP_DEBUG_ANY,"slapd_pk11_DigestFinal '%s', %u\n", output_buffer, output_buffer_size2, 0); } #endif *out_size = output_buffer_size1 + output_buffer_size2; - *out_data = output_buffer; + *out_data = (char *)output_buffer; } error: if (sec_context) { diff --git a/ldap/servers/slapd/back-ldbm/sort.c b/ldap/servers/slapd/back-ldbm/sort.c index f2ee1fd4..b9f3e211 100644 --- a/ldap/servers/slapd/back-ldbm/sort.c +++ b/ldap/servers/slapd/back-ldbm/sort.c @@ -673,7 +673,6 @@ static int compare_entries_sv(ID *id_a, ID *id_b, sort_spec *s,baggage_carrier * struct backentry *b = NULL; int result = 0; sort_spec_thing *this_one = NULL; - int return_value = -1; backend *be = bc->be; ldbm_instance *inst = (ldbm_instance *) be->be_instance_info; int err; @@ -706,8 +705,8 @@ static int compare_entries_sv(ID *id_a, ID *id_b, sort_spec *s,baggage_carrier * struct berval **value_b = NULL; /* Get the two attribute values from the entries */ - return_value = slapi_entry_attr_find(a->ep_entry,type,&attr_a); - return_value = slapi_entry_attr_find(b->ep_entry,type,&attr_b); + slapi_entry_attr_find(a->ep_entry,type,&attr_a); + slapi_entry_attr_find(b->ep_entry,type,&attr_b); /* What do we do if one or more of the entries lacks this attribute ? */ /* if one lacks the attribute */ if (NULL == attr_a) { diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c index 29772657..6b8314d2 100644 --- a/ldap/servers/slapd/bind.c +++ b/ldap/servers/slapd/bind.c @@ -335,7 +335,7 @@ do_bind( Slapi_PBlock *pb ) * All SASL auth methods are categorized as strong binds, * although they are not necessarily stronger than simple. */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds); if ( saslmech == NULL || *saslmech == '\0' ) { send_ldap_result( pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL, "SASL mechanism absent", 0, NULL ); @@ -407,13 +407,13 @@ do_bind( Slapi_PBlock *pb ) } break; case LDAP_AUTH_SIMPLE: - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds); /* accept null binds */ if (dn == NULL || *dn == '\0') { - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds); /* by definition its anonymous is also UnAuthenticated so increment that counter */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds); /* call preop plugins */ if (plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) == 0){ @@ -439,7 +439,7 @@ do_bind( Slapi_PBlock *pb ) if ( isroot && method == LDAP_AUTH_SIMPLE ) { if ( cred.bv_len == 0 ) { /* unauthenticated bind */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds); } else { /* a passwd was supplied -- check it */ @@ -457,7 +457,7 @@ do_bind( Slapi_PBlock *pb ) send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL, NULL, 0, NULL ); /* increment BindSecurityErrorcount */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors); value_done(&cv); goto free_and_return; } @@ -601,11 +601,11 @@ do_bind( Slapi_PBlock *pb ) if(cred.bv_len == 0) { /* its an UnAuthenticated Bind, DN specified but no pw */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds); }else{ /* password must have been invalid */ /* increment BindSecurityError count */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors); } } diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c index 59961d8d..7f899341 100644 --- a/ldap/servers/slapd/compare.c +++ b/ldap/servers/slapd/compare.c @@ -77,7 +77,7 @@ do_compare( Slapi_PBlock *pb ) LDAPDebug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 ); /* count the compare request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsCompareOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsCompareOps); /* have to init this here so we can "done" it below if we short circuit */ slapi_sdn_init(&sdn); diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c index 05186834..200d0e91 100644 --- a/ldap/servers/slapd/connection.c +++ b/ldap/servers/slapd/connection.c @@ -222,8 +222,8 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is PR_Unlock( num_conns_mutex ); if (! in_referral_mode) { - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq); - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsConnections); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnections); } /* @@ -823,7 +823,7 @@ static int process_operation(Connection *conn, Operation *op) if (! config_check_referral_mode()) { PR_AtomicIncrement(&ops_initiated); - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsInOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsInOps); } if ( (tag = ber_get_int( op->o_ber, &msgid )) @@ -1920,10 +1920,9 @@ int table_iterate_function(Connection *conn, void *arg) */ void connection_find_our_rank(Connection *conn,int *connection_count, int *our_rank) { - int ret = 0; table_iterate_info info = {0}; info.our_rate = conn->c_private->operation_rate; - ret = connection_table_iterate_active_connections(the_connection_table, &info, &table_iterate_function); + connection_table_iterate_active_connections(the_connection_table, &info, &table_iterate_function); *connection_count = info.connection_count; *our_rank = info.rank_count; } @@ -2060,7 +2059,7 @@ connection_threadmain() PR_Unlock(conn->c_mutex); if (! config_check_referral_mode()) { PR_AtomicIncrement(&ops_initiated); - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsInOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsInOps); } } /* Once we're here we have a pb */ @@ -2243,7 +2242,7 @@ connection_activity(Connection *conn) if (! config_check_referral_mode()) { PR_AtomicIncrement(&ops_initiated); - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsInOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsInOps); } return 0; } @@ -2562,7 +2561,7 @@ disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode } if (! config_check_referral_mode()) { - PR_AtomicDecrement(g_get_global_snmp_vars()->ops_tbl.dsConnections); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnections); } conn->c_gettingber = 0; diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c index 0e083a8a..ade87707 100644 --- a/ldap/servers/slapd/conntable.c +++ b/ldap/servers/slapd/conntable.c @@ -249,6 +249,7 @@ int connection_table_iterate_active_connections(Connection_Table *ct, void* arg, return ret; } +#ifdef FOR_DEBUGGING static void connection_table_dump_active_connection (Connection *c) { @@ -257,7 +258,6 @@ connection_table_dump_active_connection (Connection *c) c->c_mutex, c->c_next, c->c_prev); } -#if 0 /* useful for debugging */ static void connection_table_dump_active_connections (Connection_Table *ct) { @@ -289,8 +289,10 @@ connection_table_move_connection_out_of_active_list(Connection_Table *ct,Connect /* we always have previous element because list contains a dummy header */; PR_ASSERT (c->c_prev); - /* slapi_log_error(SLAPI_LOG_FATAL, "connection", "Moving connection out of active list\n"); - connection_table_dump_active_connection (c);*/ +#ifdef FOR_DEBUGGING + slapi_log_error(SLAPI_LOG_FATAL, "connection", "Moving connection out of active list\n"); + connection_table_dump_active_connection (c); +#endif /* * Note: the connection will NOT be moved off the active list if any other threads still hold @@ -314,7 +316,9 @@ connection_table_move_connection_out_of_active_list(Connection_Table *ct,Connect PR_Unlock(ct->table_mutex); - /* connection_table_dump_active_connections (ct); */ +#ifdef FOR_DEBUGGING + connection_table_dump_active_connections (ct); +#endif } /* @@ -333,8 +337,10 @@ connection_table_move_connection_on_to_active_list(Connection_Table *ct,Connecti connection_acquire_nolock (c); - /* slapi_log_error(SLAPI_LOG_FATAL, "connection", "Moving connection into active list\n"); - connection_table_dump_active_connection (c);*/ +#ifdef FOR_DEBUGGING + slapi_log_error(SLAPI_LOG_FATAL, "connection", "Moving connection into active list\n"); + connection_table_dump_active_connection (c); +#endif c->c_next = ct->c[0].c_next; if ( c->c_next != NULL ) @@ -346,7 +352,9 @@ connection_table_move_connection_on_to_active_list(Connection_Table *ct,Connecti PR_Unlock(ct->table_mutex); - /* connection_table_dump_active_connections (ct); */ +#ifdef FOR_DEBUGGING + connection_table_dump_active_connections (ct); +#endif } /* diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c index 38c4e236..714f32ee 100644 --- a/ldap/servers/slapd/daemon.c +++ b/ldap/servers/slapd/daemon.c @@ -1570,7 +1570,6 @@ slapd_poll( void *handle, int output, int secure ) struct POLL_STRUCT pr_pd; PRIntervalTime timeout = PR_MillisecondsToInterval(ioblock_timeout); - if (timeout < 0) timeout = 0; pr_pd.fd = (PRFileDesc *)handle; pr_pd.in_flags = output ? PR_POLL_WRITE : PR_POLL_READ; pr_pd.out_flags = 0; @@ -2841,7 +2840,7 @@ failed: exit( 1 ); suppressed: - return (PRFileDesc *)-1; + return (PRFileDesc **)-1; } /* createprlistensockets */ diff --git a/ldap/servers/slapd/defbackend.c b/ldap/servers/slapd/defbackend.c index 549ebbf5..bb87cac4 100644 --- a/ldap/servers/slapd/defbackend.c +++ b/ldap/servers/slapd/defbackend.c @@ -216,7 +216,7 @@ defbackend_bind( Slapi_PBlock *pb ) slapi_pblock_get( pb, SLAPI_BIND_METHOD, &method ); slapi_pblock_get( pb, SLAPI_BIND_CREDENTIALS, &cred ); if ( method == LDAP_AUTH_SIMPLE && cred->bv_len == 0 ) { - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds); rc = SLAPI_BIND_ANONYMOUS; } else { send_nobackend_ldap_result( pb ); diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c index 381239bd..b442df5a 100644 --- a/ldap/servers/slapd/delete.c +++ b/ldap/servers/slapd/delete.c @@ -80,7 +80,7 @@ do_delete( Slapi_PBlock *pb ) ber = operation->o_ber; /* count the delete request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps); /* * Parse the delete request. It looks like this: diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c index 023972d9..74127880 100644 --- a/ldap/servers/slapd/dse.c +++ b/ldap/servers/slapd/dse.c @@ -590,7 +590,7 @@ dse_updateNumSubordinates(Slapi_Entry *entry, int op) struct berval val; vals[0] = &val; vals[1] = NULL; - sprintf(value_buffer,"%u",current_sub_count); + sprintf(value_buffer,"%lu",current_sub_count); val.bv_val = value_buffer; val.bv_len = strlen (val.bv_val); switch(mod_op) @@ -640,7 +640,6 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, char *buf = NULL; char *lastp = NULL; int rc= 0; /* Fail */ - PRInt32 remaining; PRInt32 nr = 0; PRFileInfo prfinfo; PRFileDesc *prfd = 0; @@ -689,7 +688,6 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb, int done= 0; /* read the entire file into core */ buf = slapi_ch_malloc( prfinfo.size + 1 ); - remaining = prfinfo.size; if (( nr = slapi_read_buffer( prfd, buf, prfinfo.size )) < 0 ) { slapi_log_error(SLAPI_LOG_FATAL, "dse", diff --git a/ldap/servers/slapd/dynalib.c b/ldap/servers/slapd/dynalib.c index a939996d..41dfaf91 100644 --- a/ldap/servers/slapd/dynalib.c +++ b/ldap/servers/slapd/dynalib.c @@ -150,12 +150,12 @@ static void symload_report_error( const char *libpath, char *symbol, char *plugin, int libopen ) { char *errtext = NULL; - PRInt32 errlen, err; + PRInt32 errlen; errlen = PR_GetErrorTextLength(); if ( errlen > 0 ) { errtext = slapi_ch_malloc( errlen ); - if (( err = PR_GetErrorText( errtext )) > 0 ) { + if ( PR_GetErrorText( errtext ) > 0 ) { LDAPDebug( LDAP_DEBUG_ANY, SLAPI_COMPONENT_NAME_NSPR " error %d: %s\n", PR_GetError(), errtext, 0 ); } diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 31e2cb08..4254af6f 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -197,7 +197,6 @@ str2entry_fast( char *s, int flags, int read_stateinfo ) Slapi_Attr **a; char *valuecharptr=NULL; int valuelen; - CSNType attributecsntype; int value_state= VALUE_NOTFOUND; int attr_state= ATTRIBUTE_NOTFOUND; int maxvals; @@ -217,7 +216,6 @@ str2entry_fast( char *s, int flags, int read_stateinfo ) /* * Extract the attribute and value CSNs from the attribute type. */ - attributecsntype= CSN_TYPE_NONE; csn_free(&attributedeletioncsn); /* JCM - Do this more efficiently */ csnset_free(&valuecsnset); value_state= VALUE_NOTFOUND; @@ -596,7 +594,6 @@ str2entry_dupcheck( char *s, int flags, int read_stateinfo ) while ( (s = ldif_getline( &next )) != NULL ) { CSN *attributedeletioncsn= NULL; - CSNType attributecsntype; CSNSet *valuecsnset= NULL; int value_state= VALUE_NOTFOUND; int attr_state= VALUE_NOTFOUND; @@ -615,7 +612,6 @@ str2entry_dupcheck( char *s, int flags, int read_stateinfo ) /* * Extract the attribute and value CSNs from the attribute type. */ - attributecsntype= CSN_TYPE_UNKNOWN; csn_free(&attributedeletioncsn); csnset_free(&valuecsnset); value_state= VALUE_NOTFOUND; diff --git a/ldap/servers/slapd/errormap.c b/ldap/servers/slapd/errormap.c index adbbc659..d05e495a 100644 --- a/ldap/servers/slapd/errormap.c +++ b/ldap/servers/slapd/errormap.c @@ -106,7 +106,7 @@ slapd_versatile_strerror( const PRErrorCode prerrno ) const char *s; if (( s = (const char *)SECU_Strerror( prerrno )) == NULL ) { - s = slapd_system_strerror( (const int)prerrno ); + s = slapd_system_strerror( prerrno ); } return( s ); diff --git a/ldap/servers/slapd/getopt_ext.c b/ldap/servers/slapd/getopt_ext.c index f2d65492..4557aca0 100644 --- a/ldap/servers/slapd/getopt_ext.c +++ b/ldap/servers/slapd/getopt_ext.c @@ -52,7 +52,6 @@ int optind_last; static int _getopt_ext_inited = 0; static int _optind_firstHandled = 0; static int _optind_firstRecognized = 0; -static int _getopt_ext_done_long = 0; static int _getopt_ext_init(int argc) @@ -63,7 +62,6 @@ int _getopt_ext_init(int argc) _optind_firstHandled = argc; _optind_firstRecognized = argc; /* optind = 1;*/ - _getopt_ext_done_long = 0; return(0); } diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c index 890e6c85..a1e05156 100644 --- a/ldap/servers/slapd/index_subsystem.c +++ b/ldap/servers/slapd/index_subsystem.c @@ -611,8 +611,6 @@ static int index_subsys_group_decoders(Slapi_Filter *flist) /* indicates we found an existing targetf */ int assigned = 0; - struct slapi_filter *f_last = 0; /* previos filter in list */ - /* something to join with next compatible * subfilter we find - this will be the * first occurence of a filter assigned @@ -768,8 +766,6 @@ static int index_subsys_group_decoders(Slapi_Filter *flist) break; } } - - f_last = f; } /* iterate through the main list diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c index a1189c95..35e768e2 100644 --- a/ldap/servers/slapd/log.c +++ b/ldap/servers/slapd/log.c @@ -1488,7 +1488,7 @@ log_set_expirationtimeunit(const char *attrname, char *expunit, int logtype, cha { int value = 0; int rv = 0; - int eunit, etimeunit, rsecs; + int etimeunit, rsecs; slapdFrontendConfig_t *fe_cfg = getFrontendConfig(); if ( logtype != SLAPD_ACCESS_LOG && @@ -1543,16 +1543,12 @@ log_set_expirationtimeunit(const char *attrname, char *expunit, int logtype, cha } if (strcasecmp(expunit, "month") == 0) { - eunit = LOG_UNIT_MONTHS; value = 31 * 24 * 60 * 60 * etimeunit; } else if (strcasecmp(expunit, "week") == 0) { - eunit = LOG_UNIT_WEEKS; value = 7 * 24 * 60 * 60 * etimeunit; } else if (strcasecmp(expunit, "day") == 0) { - eunit = LOG_UNIT_DAYS; value = 24 * 60 * 60 * etimeunit; } else { - eunit = LOG_UNIT_UNKNOWN; value = -1; } @@ -2225,7 +2221,7 @@ log__needrotation(LOGFD fp, int logtype) int f_size = 0; int maxlogsize, nlogs; int rotationtime_secs = -1; - int sync_enabled, synchour, syncmin, timeunit; + int sync_enabled, timeunit; if (fp == NULL) { return LOG_ROTATE; @@ -2236,8 +2232,6 @@ log__needrotation(LOGFD fp, int logtype) nlogs = loginfo.log_access_maxnumlogs; maxlogsize = loginfo.log_access_maxlogsize; sync_enabled = loginfo.log_access_rotationsync_enabled; - synchour = loginfo.log_access_rotationsynchour; - syncmin = loginfo.log_access_rotationsyncmin; syncclock = loginfo.log_access_rotationsyncclock; timeunit = loginfo.log_access_rotationunit; rotationtime_secs = loginfo.log_access_rotationtime_secs; @@ -2247,8 +2241,6 @@ log__needrotation(LOGFD fp, int logtype) nlogs = loginfo.log_error_maxnumlogs; maxlogsize = loginfo.log_error_maxlogsize; sync_enabled = loginfo.log_error_rotationsync_enabled; - synchour = loginfo.log_error_rotationsynchour; - syncmin = loginfo.log_error_rotationsyncmin; syncclock = loginfo.log_error_rotationsyncclock; timeunit = loginfo.log_error_rotationunit; rotationtime_secs = loginfo.log_error_rotationtime_secs; @@ -2258,8 +2250,6 @@ log__needrotation(LOGFD fp, int logtype) nlogs = loginfo.log_audit_maxnumlogs; maxlogsize = loginfo.log_audit_maxlogsize; sync_enabled = loginfo.log_audit_rotationsync_enabled; - synchour = loginfo.log_audit_rotationsynchour; - syncmin = loginfo.log_audit_rotationsyncmin; syncclock = loginfo.log_audit_rotationsyncclock; timeunit = loginfo.log_audit_rotationunit; rotationtime_secs = loginfo.log_audit_rotationtime_secs; @@ -2875,11 +2865,10 @@ static int log__getfilesize(LOGFD fp) { PRFileInfo info; - int rv; - if ((rv = PR_GetOpenFileInfo (fp, &info)) == PR_FAILURE) { - return -1; - } + if (PR_GetOpenFileInfo (fp, &info) == PR_FAILURE) { + return -1; + } return info.size; } #endif @@ -3076,6 +3065,7 @@ log__delete_error_logfile() */ if (++numoflogs > loginfo.log_error_maxnumlogs) { logstr = "Exceeded max number of logs allowed"; + syslog(LOG_ERR, "%s\n", logstr); goto delete_logfile; } @@ -3166,7 +3156,15 @@ delete_logfile: /* Delete the error file */ log_convert_time (delete_logp->l_ctime, tbuf, 1 /*short */); PR_snprintf (buffer, sizeof(buffer), "%s.%s", loginfo.log_error_file, tbuf); - PR_Delete(buffer); + if (PR_Delete(buffer) != PR_SUCCESS) { + LDAPDebug(LDAP_DEBUG_ANY, "LOGINFO:Unable to remove file:%s.%s\n", + loginfo.log_audit_file, tbuf,0); + } else { + LDAPDebug(LDAP_DEBUG_TRACE, + "LOGINFO:Removed file:%s.%s because of (%s)\n", + loginfo.log_error_file, tbuf, + logstr); + } slapi_ch_free((void**)&delete_logp); loginfo.log_numof_error_logs--; @@ -3222,7 +3220,7 @@ log__delete_audit_logfile() ** have to delete one any how. */ if (++numoflogs > loginfo.log_audit_maxnumlogs) { - logstr = "Exceeded max number of logs allowed"; + logstr = "Delete Error Log File: Exceeded max number of logs allowed"; goto delete_logfile; } diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index ff4b0d84..0b5f3e7d 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -189,17 +189,14 @@ cmd_set_shutdown (int sig) * yourself). */ -#if 0 - LDAPDebug( LDAP_DEBUG_ANY, "slapd got shutdown signal\n", 0, 0, 0 ); -#endif - c_set_shutdown(); + c_set_shutdown(); #ifndef _WIN32 #ifndef LINUX - /* don't mess with USR1/USR2 on linux, used by libpthread */ - (void) SIGNAL( SIGUSR2, cmd_set_shutdown ); + /* don't mess with USR1/USR2 on linux, used by libpthread */ + (void) SIGNAL( SIGUSR2, cmd_set_shutdown ); #endif - (void) SIGNAL( SIGTERM, cmd_set_shutdown ); - (void) SIGNAL( SIGHUP, cmd_set_shutdown ); + (void) SIGNAL( SIGTERM, cmd_set_shutdown ); + (void) SIGNAL( SIGHUP, cmd_set_shutdown ); #endif } @@ -470,7 +467,6 @@ static int i_port = 0; static int s_port = 0; static char **ldif_file = NULL; static int ldif_files = 0; -static int ldif_backend = 0; static char *cmd_line_instance_name = NULL; static char **cmd_line_instance_names = NULL; static int skip_db_protect_check = 0; @@ -484,7 +480,6 @@ static char *archive_name = NULL; static int db2ldif_dump_replica = 0; static int db2ldif_dump_uniqueid = 1; static int ldif2db_generate_uniqueid = SLAPI_UNIQUEID_GENERATE_TIME_BASED; -static int ldif2db_load_state = 1; static int dbverify_verbose = 0; static char *ldif2db_namespaceid = NULL; int importexport_encrypt = 0; @@ -1218,7 +1213,7 @@ main( int argc, char **argv) #if ( defined( hpux ) || defined( irix )) -void * +void signal2sigaction( int s, void *a ) { struct sigaction act; @@ -1596,8 +1591,6 @@ process_command_line(int argc, char **argv, char *myname, slapd_exemode == SLAPD_EXEMODE_DBVERIFY) { char *s = slapi_ch_strdup(optarg_ext); charray_add(&cmd_line_instance_names, s); - } else { - ldif_backend = atoi( optarg_ext ); } break; case 's': /* which suffix to include in import/export */ @@ -1766,7 +1759,6 @@ process_command_line(int argc, char **argv, char *myname, case 'Z': if (slapd_exemode == SLAPD_EXEMODE_LDIF2DB) { - ldif2db_load_state= 0; break; } usage( myname, *extraname ); @@ -2122,7 +2114,6 @@ slapd_exemode_ldif2db() pb.pb_ldif_generate_uniqueid = ldif2db_generate_uniqueid; pb.pb_ldif_namespaceid = ldif2db_namespaceid; pb.pb_ldif_encrypt = importexport_encrypt; -/* pb.pb_ldif_load_state = ldif2db_load_state; */ pb.pb_instance_name = cmd_line_instance_name; pb.pb_ldif_files = ldif_file; pb.pb_ldif_include = db2ldif_include; @@ -2662,7 +2653,7 @@ slapd_exemode_dbverify() memset( &pb, '\0', sizeof(pb) ); pb.pb_backend = NULL; - pb.pb_seq_val = dbverify_verbose; + pb.pb_seq_type = dbverify_verbose; pb.pb_plugin = backend_plugin; pb.pb_instance_name = (char *)cmd_line_instance_names; pb.pb_task_flags = TASK_RUNNING_FROM_COMMANDLINE; diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c index 0fbfb555..ab57f33e 100644 --- a/ldap/servers/slapd/mapping_tree.c +++ b/ldap/servers/slapd/mapping_tree.c @@ -2059,8 +2059,6 @@ int slapi_mapping_tree_select_all(Slapi_PBlock *pb, Slapi_Backend **be_list, int ret_code = LDAP_SUCCESS; int be_index = 0 ; int referral_index = 0 ; - int be_list_size = 0; - int referral_list_size = 0; Slapi_Backend * be; Slapi_Entry * referral; int scope = LDAP_SCOPE_BASE; @@ -2091,8 +2089,6 @@ int slapi_mapping_tree_select_all(Slapi_PBlock *pb, Slapi_Backend **be_list, mtn_lock(); - be_list_size = BE_LIST_SIZE; - referral_list_size = BE_LIST_SIZE; be_list[0] = NULL; referral_list[0] = NULL; @@ -3182,7 +3178,6 @@ slapi_mtn_get_referral(const Slapi_DN *sdn) char * slapi_mtn_get_state(const Slapi_DN *sdn) { - int hint; char * node_dn; Slapi_Attr *attr; char * state = NULL; @@ -3199,7 +3194,7 @@ slapi_mtn_get_state(const Slapi_DN *sdn) if (attr) { /* entry state was found */ - hint = slapi_attr_first_value(attr, &val); + slapi_attr_first_value(attr, &val); state = slapi_ch_strdup(slapi_value_get_string(val)); slapi_attr_free(&attr); } diff --git a/ldap/servers/slapd/match.c b/ldap/servers/slapd/match.c index f89103f4..24d9137b 100644 --- a/ldap/servers/slapd/match.c +++ b/ldap/servers/slapd/match.c @@ -216,12 +216,11 @@ int slapi_matchingrule_register(Slapi_MatchingRuleEntry *mrule) { struct matchingRuleList *mrl=NULL; struct matchingRuleList *newmrl=NULL; - int rc=0; if(NULL == mrule) { return(-1); } - if((rc = _mr_alloc_new(&newmrl)) != 0) { + if(_mr_alloc_new(&newmrl) != 0) { return(-1); } if(NULL != mrule->mr_name) { diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c index 4be05468..14a182b9 100644 --- a/ldap/servers/slapd/modify.c +++ b/ldap/servers/slapd/modify.c @@ -138,7 +138,7 @@ do_modify( Slapi_PBlock *pb ) ber = operation->o_ber; /* count the modify request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps); /* * Parse the modify request. It looks like this: diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c index a9c5100a..dfc7edf9 100644 --- a/ldap/servers/slapd/modrdn.c +++ b/ldap/servers/slapd/modrdn.c @@ -79,7 +79,7 @@ do_modrdn( Slapi_PBlock *pb ) LDAPDebug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 ); /* count the modrdn request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps); slapi_pblock_get( pb, SLAPI_OPERATION, &operation); ber = operation->o_ber; diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c index 85c45666..b9aec66a 100644 --- a/ldap/servers/slapd/opshared.c +++ b/ldap/servers/slapd/opshared.c @@ -464,6 +464,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result) while (be) { const Slapi_DN * be_suffix; + int err = 0; if (be->be_search == NULL) { @@ -546,7 +547,6 @@ op_shared_search (Slapi_PBlock *pb, int send_result) rc = (*be->be_search)(pb); switch (rc) { - int err = 0; case 1: /* if the backend returned LDAP_NO_SUCH_OBJECT for a SEARCH request, it will not have sent back a result - otherwise, it will have sent a result */ diff --git a/ldap/servers/slapd/passwd_extop.c b/ldap/servers/slapd/passwd_extop.c index feff7241..d5950984 100644 --- a/ldap/servers/slapd/passwd_extop.c +++ b/ldap/servers/slapd/passwd_extop.c @@ -436,7 +436,7 @@ passwd_modify_extop( Slapi_PBlock *pb ) char *errMesg = NULL; int ret=0, rc=0, sasl_ssf=0; ber_tag_t tag=0; - ber_len_t len=-1; + ber_len_t len=(ber_len_t)-1; struct berval *extop_value = NULL; struct berval *gen_passwd = NULL; BerElement *ber = NULL; diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c index e936c1a1..30aa1101 100644 --- a/ldap/servers/slapd/plugin_internal_op.c +++ b/ldap/servers/slapd/plugin_internal_op.c @@ -591,7 +591,6 @@ static int search_internal_pb (Slapi_PBlock *pb) int opresult = 0; Slapi_Entry **pb_search_entries = NULL; char **pb_search_referrals = NULL; - int rc; PR_ASSERT (pb); @@ -609,7 +608,7 @@ static int search_internal_pb (Slapi_PBlock *pb) /* call internal search callback, define search_entry_callback, and result_callback such that the results of the search are stuffed into pb */ - rc = search_internal_callback_pb (pb, &psid, internal_plugin_result_callback, + search_internal_callback_pb (pb, &psid, internal_plugin_result_callback, internal_plugin_search_entry_callback, internal_plugin_search_referral_callback); opresult = psid.rc; diff --git a/ldap/servers/slapd/protect_db.c b/ldap/servers/slapd/protect_db.c index ccef1bb3..a6ff87a8 100644 --- a/ldap/servers/slapd/protect_db.c +++ b/ldap/servers/slapd/protect_db.c @@ -248,7 +248,6 @@ add_this_process_to(char *dir_name) } } } -bail: PR_Close(prfd); } diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index f68ae94c..571f4edc 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -1273,6 +1273,6 @@ void *slapd_service_exit_wait(); * main.c */ #if ( defined( hpux ) || defined( irix )) -void * signal2sigaction( int s, void *a ); +void signal2sigaction( int s, void *a ); #endif #endif /* _PROTO_SLAP */ diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c index bb9e200b..753663a5 100644 --- a/ldap/servers/slapd/pw.c +++ b/ldap/servers/slapd/pw.c @@ -782,7 +782,7 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals, num_digits++; } else if ( ldap_utf8isalpha( p ) ) { num_alphas++; - if ( slapi_utf8isLower( p ) ) { + if ( slapi_utf8isLower( (unsigned char *)p ) ) { num_lowers++; } else { num_uppers++; diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c index 98f824f1..34afa15b 100644 --- a/ldap/servers/slapd/pw_mgmt.c +++ b/ldap/servers/slapd/pw_mgmt.c @@ -297,7 +297,6 @@ check_account_lock ( Slapi_PBlock *pb, Slapi_Entry * bind_target_entry, int pwre time_t unlock_time; time_t cur_time; - double diff_t; char *cur_time_str = NULL; char *accountUnlockTime; passwdPolicy *pwpolicy = NULL; @@ -401,8 +400,7 @@ check_account_lock ( Slapi_PBlock *pb, Slapi_Entry * bind_target_entry, int pwre } cur_time = current_time(); cur_time_str = format_genTime( cur_time); - if ( ( diff_t = difftime ( parse_genTime( cur_time_str ), - unlock_time ) ) < 0 ) { + if ( difftime ( parse_genTime( cur_time_str ), unlock_time ) < 0 ) { /* account is locked, cannot do anything */ if (pwresponse_req) { diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c index ebc7990d..31c839d1 100644 --- a/ldap/servers/slapd/result.c +++ b/ldap/servers/slapd/result.c @@ -328,7 +328,7 @@ send_ldap_result_ext( || err == LDAP_AUTH_UNKNOWN ) { if(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors!=NULL) - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors); }else if( err != LDAP_REFERRAL && err != LDAP_OPT_REFERRALS && err != LDAP_PARTIAL_RESULTS) @@ -339,7 +339,7 @@ send_ldap_result_ext( -- partially seviced operations will not be conted as an error */ if(g_get_global_snmp_vars()->ops_tbl.dsErrors!=NULL) - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsErrors); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsErrors); } } @@ -413,7 +413,7 @@ send_ldap_result_ext( int len; /* count the referral */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsReferrals); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferrals); /* * figure out how much space we need @@ -486,7 +486,7 @@ send_ldap_result_ext( */ /* count the referral */ if (! config_check_referral_mode()) - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsReferrals); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferrals); rc = ber_printf( ber, "{it{esst{s", operation->o_msgid, tag, err, matched ? matched : "", text ? text : "", LDAP_TAG_REFERRAL, urls[0]->bv_val ); @@ -524,7 +524,7 @@ send_ldap_result_ext( if ( operation->o_results.result_controls != NULL && conn->c_ldapversion >= LDAP_VERSION3 && write_controls( ber, operation->o_results.result_controls ) != 0 ) { - rc = LBER_ERROR; + rc = (int)LBER_ERROR; } if ( rc != LBER_ERROR ) { /* end the LDAPMessage sequence */ @@ -677,7 +677,7 @@ send_ldap_referral ( char *attrs[2] = { NULL, NULL }; /* count the referral */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsReferrals); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferrals); attrs[0] = refAttr; if ( e != NULL && @@ -1550,11 +1550,11 @@ flush_ber( plugin_call_plugins( pb, SLAPI_PLUGIN_POST_RESULT_FN ); break; case _LDAP_SEND_REFERRAL: - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned); plugin_call_plugins( pb, SLAPI_PLUGIN_POST_REFERRAL_FN ); break; case _LDAP_SEND_ENTRY: - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned); plugin_call_plugins( pb, SLAPI_PLUGIN_POST_ENTRY_FN ); break; } diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c index 98e7cf57..95185837 100644 --- a/ldap/servers/slapd/sasl_io.c +++ b/ldap/servers/slapd/sasl_io.c @@ -227,7 +227,7 @@ sasl_io_start_packet(Connection *c, PRInt32 *err) static int sasl_io_read_packet(Connection *c, PRInt32 *err) { - size_t ret = 0; + PRInt32 ret = 0; sasl_io_private *sp = c->c_sasl_io_private; size_t bytes_remaining_to_read = sp->encrypted_buffer_count - sp->encrypted_buffer_offset; diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c index 51f2b92a..dcd8265c 100644 --- a/ldap/servers/slapd/search.c +++ b/ldap/servers/slapd/search.c @@ -86,7 +86,7 @@ do_search( Slapi_PBlock *pb ) ber = operation->o_ber; /* count the search request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsSearchOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsSearchOps); /* * Parse the search request. It looks like this: @@ -140,11 +140,11 @@ do_search( Slapi_PBlock *pb ) /* check and record the scope for snmp */ if ( scope == LDAP_SCOPE_ONELEVEL) { /* count the one level search request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps); } else if (scope == LDAP_SCOPE_SUBTREE) { /* count the subtree search request */ - PR_AtomicIncrement(g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps); + snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps); } /* filter - returns a "normalized" version */ diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h index 020514f5..f10e8fb2 100644 --- a/ldap/servers/slapd/slap.h +++ b/ldap/servers/slapd/slap.h @@ -1368,7 +1368,6 @@ typedef struct slapi_pblock { int pb_ldif_dump_replica; int pb_ldif_dump_uniqueid; /* dump uniqueid during db2ldif */ int pb_ldif_generate_uniqueid; /* generate uniqueid during db2ldif */ -/* JCMREPL int pb_ldif_load_state; */ char* pb_ldif_namespaceid; /* used for name based uniqueid generation */ int pb_ldif_encrypt; /* used to enable encrypt/decrypt on import and export */ /* diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h index 85aa85c5..320f392e 100644 --- a/ldap/servers/slapd/slapi-private.h +++ b/ldap/servers/slapd/slapi-private.h @@ -377,6 +377,8 @@ Slapi_DN *slapi_sdn_init_dn_ndn_byref(Slapi_DN *sdn,const char *dn); /* filter.c */ int filter_flag_is_set(const Slapi_Filter *f,unsigned char flag); char *slapi_filter_to_string(const Slapi_Filter *f, char *buffer, size_t bufsize); +char * +slapi_filter_to_string_internal( const struct slapi_filter *f, char *buf, size_t *bufsize ); /* operation.c */ @@ -1226,6 +1228,14 @@ void DS_Sleep(PRIntervalTime ticks); #define PRLDAP_SET_PORT(myaddr,myport) \ ((myaddr)->raw.family == PR_AF_INET6 ? ((myaddr)->ipv6.port = PR_htons(myport)) : ((myaddr)->inet.port = PR_htons(myport))) +/* + * snmp_collator.c + * wrapper functions to ease the cast burdon between net-snmp APIs which expect + * unsigned int and PR_AtomicIncrement/PR_AtomicSet which expect signed int. + */ +void snmp_increment_counter(PRUint32 *counter); +void snmp_set_counter(PRUint32 *counter, PRInt32 newval); + #ifdef __cplusplus } #endif diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c index 2b9dca38..016b55c8 100644 --- a/ldap/servers/slapd/snmp_collator.c +++ b/ldap/servers/slapd/snmp_collator.c @@ -570,7 +570,7 @@ snmp_collator_update(time_t start_time, void *arg) /* if we got a value for entrycachehits, then set it */ if(val != NULL) { - PR_AtomicSet(g_get_global_snmp_vars()->entries_tbl.dsCacheHits, atoi(val->bv_val)); + snmp_set_counter(g_get_global_snmp_vars()->entries_tbl.dsCacheHits, atoi(val->bv_val)); } @@ -590,7 +590,7 @@ snmp_collator_update(time_t start_time, void *arg) /* if we got a value for currententrycachesize, then set it */ if(val != NULL) { - PR_AtomicSet(g_get_global_snmp_vars()->entries_tbl.dsCacheEntries, atoi(val->bv_val)); + snmp_set_counter(g_get_global_snmp_vars()->entries_tbl.dsCacheEntries, atoi(val->bv_val)); } @@ -704,7 +704,7 @@ getConfigEntry( Slapi_Entry **e ) { slapi_sdn_done( &sdn ); return *e; } - + static void freeConfigEntry( Slapi_Entry **e ) { if ( (e != NULL) && (*e != NULL) ) { @@ -713,9 +713,20 @@ freeConfigEntry( Slapi_Entry **e ) { } } +/* + * wrapper functions to ease the cast burdon between net=snmp APIs which expect + * unsigned int and PR_AtomicIncrement/PR_AtomicSet which expect signed int. + * NSPR_API(PRInt32) PR_AtomicSet(PRInt32 *val, PRInt32 newval); + * NSPR_API(PRInt32) PR_AtomicIncrement(PRInt32 *val); + */ +void +snmp_increment_counter(PRUint32 *counter) +{ + PR_AtomicIncrement((PRInt32 *)counter); +} - - - - +void snmp_set_counter(PRUint32 *counter, PRInt32 newval) +{ + PR_AtomicSet((PRInt32 *)counter, newval); +} diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c index a328a5eb..10f601c5 100644 --- a/ldap/servers/slapd/ssl.c +++ b/ldap/servers/slapd/ssl.c @@ -400,7 +400,6 @@ slapd_nss_init(int init_ssl, int config_available) { SECStatus secStatus; PRErrorCode errorCode; - PRStatus status; int rv = 0; int len = 0; PRUint32 nssFlags = 0; @@ -423,7 +422,7 @@ slapd_nss_init(int init_ssl, int config_available) } else { /* otherwise, NSS will create empty databases */ /* we open the key/cert db in rw mode, so make sure the directory is writable */ - if (PR_SUCCESS != (status = PR_Access(certdir, PR_ACCESS_WRITE_OK))) { + if (PR_SUCCESS != PR_Access(certdir, PR_ACCESS_WRITE_OK)) { char *serveruser = "unknown"; #ifndef _WIN32 serveruser = config_get_localuser(); diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c index 5a815fba..13606c1c 100644 --- a/ldap/servers/slapd/task.c +++ b/ldap/servers/slapd/task.c @@ -425,7 +425,7 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Attr *attr; Slapi_Value *val = NULL; Slapi_Backend *be = NULL; - const char *cn, *instance_name; + const char *instance_name; char **ldif_file = NULL, **include = NULL, **exclude = NULL; int idx, rv = 0; const char *do_attr_indexes, *uniqueid_kind_str; @@ -435,7 +435,7 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e, char *nameFrombe_name = NULL; const char *encrypt_on_import = NULL; - if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + if (fetch_attr(e, "cn", NULL) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; return SLAPI_DSE_CALLBACK_ERROR; } @@ -724,7 +724,6 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Attr *attr; Slapi_Value *val = NULL; Slapi_Backend *be = NULL; - const char *cn; char *ldif_file = NULL; char **instance_names = NULL, **inp; char **include = NULL, **exclude = NULL; @@ -744,7 +743,7 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e, const char *decrypt_on_export = NULL; *returncode = LDAP_SUCCESS; - if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + if (fetch_attr(e, "cn", NULL) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; @@ -994,7 +993,6 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e, { Slapi_Backend *be = NULL; PRThread *thread = NULL; - const char *cn; const char *archive_dir = NULL; const char *my_database_type = NULL; const char *database_type = "ldbm database"; @@ -1004,7 +1002,7 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Task *task = NULL; *returncode = LDAP_SUCCESS; - if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + if (fetch_attr(e, "cn", NULL) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; @@ -1139,7 +1137,6 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) { Slapi_Backend *be = NULL; - const char *cn = NULL; const char *instance_name = NULL; const char *archive_dir = NULL; const char *my_database_type = NULL; @@ -1151,7 +1148,7 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e, PRThread *thread = NULL; *returncode = LDAP_SUCCESS; - if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + if (fetch_attr(e, "cn", NULL) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; @@ -1285,7 +1282,6 @@ static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) { const char *instance_name; - const char *cn; int rv = SLAPI_DSE_CALLBACK_OK; Slapi_Backend *be = NULL; Slapi_Task *task = NULL; @@ -1297,7 +1293,7 @@ static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e, PRThread *thread = NULL; *returncode = LDAP_SUCCESS; - if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + if (fetch_attr(e, "cn", NULL) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; @@ -1411,7 +1407,6 @@ static int task_upgradedb_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) { - const char *cn; int rv = SLAPI_DSE_CALLBACK_OK; Slapi_Backend *be = NULL; Slapi_Task *task = NULL; @@ -1423,7 +1418,7 @@ task_upgradedb_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, char *cookie = NULL; *returncode = LDAP_SUCCESS; - if ((cn = fetch_attr(e, "cn", NULL)) == NULL) { + if (fetch_attr(e, "cn", NULL) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; @@ -1556,8 +1551,6 @@ void slapi_task_status_changed(Slapi_Task *task) if ((task->task_state == SLAPI_TASK_FINISHED) && !(task->task_flags & SLAPI_TASK_DESTROYING)) { - /* queue an event to destroy the state info */ - Slapi_Eq_Context event; Slapi_PBlock *pb = slapi_pblock_new(); Slapi_Entry *e; int ttl; @@ -1571,7 +1564,8 @@ void slapi_task_status_changed(Slapi_Task *task) ttl = 3600; /* be reasonable. */ expire = time(NULL) + ttl; task->task_flags |= SLAPI_TASK_DESTROYING; - event = slapi_eq_once(destroy_task, (void *)task, expire); + /* queue an event to destroy the state info */ + slapi_eq_once(destroy_task, (void *)task, expire); slapi_free_search_results_internal(pb); slapi_pblock_destroy(pb); diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c index 775bb43d..e5b6de5a 100644 --- a/ldap/servers/slapd/tools/dbscan.c +++ b/ldap/servers/slapd/tools/dbscan.c @@ -66,6 +66,12 @@ typedef unsigned char uint8_t; #include <inttypes.h> #endif +#if ( defined( hpux ) ) +#ifdef _XOPEN_SOURCE_EXTENDED +#include <arpa/inet.h> /* for ntohl, et al. */ +#endif +#endif + /* file type */ #define ENTRYTYPE 0x1 #define INDEXTYPE 0x2 @@ -227,7 +233,7 @@ static char *format_raw(unsigned char *s, int len, int flags, } if (truncatesiz > 0 && o > bufend - 5) { /* truncate it */ - strcpy(o, " ..."); + strcpy((char *)o, " ..."); i = len; o += 4; } @@ -416,9 +422,7 @@ void _cl5ReadMod(char **buff) uint32 i; uint32 val_count; char *type = NULL; - int op; - op = (*pos) & 0x000000FF; pos ++; _cl5ReadString (&type, &pos); @@ -440,7 +444,7 @@ void _cl5ReadMod(char **buff) /* data format: <value count> <value size> <value> <value size> <value> ..... */ void print_ruv(unsigned char *buff) { - char *pos = buff; + char *pos = (char *)buff; uint32 i; uint32 val_count; @@ -942,7 +946,7 @@ int main(int argc, char **argv) } while (0 == ret); key.size = 0; key.data = NULL; - } else if (entry_id != -1) { + } else if (entry_id != 0xffffffff) { key.size = sizeof(entry_id); key.data = &entry_id; ret = db->get(db, NULL, &key, &data, 0); diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c index 32e5371a..33037734 100644 --- a/ldap/servers/slapd/tools/ldclt/ldapfct.c +++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c @@ -629,7 +629,7 @@ connectToServer ( if (close ((int)fd) < 0) { perror ("ldctx"); - printf ("ldclt[%d]: T%03d: cannot close(fd=%d), error=%d (%s)\n", + printf ("ldclt[%d]: T%03d: cannot close(fd=%ld), error=%d (%s)\n", mctx.pid, tttctx->thrdNum, fd, errno, strerror (errno)); return (-1); } diff --git a/ldap/servers/slapd/tools/ldclt/scalab01.c b/ldap/servers/slapd/tools/ldclt/scalab01.c index 45974e02..2228a852 100644 --- a/ldap/servers/slapd/tools/ldclt/scalab01.c +++ b/ldap/servers/slapd/tools/ldclt/scalab01.c @@ -1019,7 +1019,6 @@ scalab01_control ( /* * End of thread */ - return (arg); } diff --git a/ldap/servers/slapd/tools/mmldif.c b/ldap/servers/slapd/tools/mmldif.c index fb820823..19b039b1 100644 --- a/ldap/servers/slapd/tools/mmldif.c +++ b/ldap/servers/slapd/tools/mmldif.c @@ -290,7 +290,6 @@ static char line[2048]; static char seed; static int hashmask; static entry_t **hashtable; -static int maxcount; static int emitchanges; static int readrec(edfFILE * edf1, attrib1_t ** attrib); @@ -641,7 +640,6 @@ int mm_init(int argc, char * argv[]) time(&tl); seed = (char)tl; - maxcount = 10; ndirectories = 0; emitchanges = 0; ofp = NULL; diff --git a/ldap/servers/slapd/tools/rsearch/infadd.c b/ldap/servers/slapd/tools/rsearch/infadd.c index 039f85cb..f4a8aedf 100644 --- a/ldap/servers/slapd/tools/rsearch/infadd.c +++ b/ldap/servers/slapd/tools/rsearch/infadd.c @@ -223,8 +223,7 @@ int main(int argc, char **argv) exit(1); } - if (use_random < 0 || sampleInterval <= 0 || thread_count <= 0 || - lmtCount < 0 || blobsize < 0 || firstUID < 0) { + if ( sampleInterval <= 0 || thread_count <= 0 || lmtCount < 0 ) { printf("infadd: invalid option value\n"); usage(); exit(-1); diff --git a/ldap/servers/slapd/uuid.c b/ldap/servers/slapd/uuid.c index 2bc3c701..92e22f42 100644 --- a/ldap/servers/slapd/uuid.c +++ b/ldap/servers/slapd/uuid.c @@ -291,7 +291,7 @@ int uuid_compare(const guid_t *u1, const guid_t *u2) void uuid_format(const guid_t *u, char *buff) { - sprintf(buff, "%8.8lx-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", + sprintf(buff, "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", u->time_low, u->time_mid, u->time_hi_and_version, u->clock_seq_hi_and_reserved, u->clock_seq_low, u->node[0], u->node[1], u->node[2], u->node[3], u->node[4], u->node[5]); @@ -368,7 +368,7 @@ static int uuid_create_mt(guid_t *uuid) time calls are made by a uuid_update_state */ update_time_mt (×tamp, &clock_seq); - if (timestamp == NEED_TIME_UPDATE) + if (timestamp == (uuid_time_t)NEED_TIME_UPDATE) { slapi_log_error (SLAPI_LOG_FATAL, MODULE, "uuid_create_mt: generator ran " "out of sequence numbers.\n"); diff --git a/ldap/servers/snmp/ldap-agent.c b/ldap/servers/snmp/ldap-agent.c index fac31c63..a93e1f37 100644 --- a/ldap/servers/snmp/ldap-agent.c +++ b/ldap/servers/snmp/ldap-agent.c @@ -277,7 +277,6 @@ load_stats_table(netsnmp_cache *cache, void *foo) time_t previous_start; int previous_state; int stats_hdl = -1; - int err; snmp_log(LOG_INFO, "Reloading stats.\n"); @@ -293,7 +292,7 @@ load_stats_table(netsnmp_cache *cache, void *foo) serv_p->stats_file, serv_p->port); /* Open the stats file */ - if ((err = agt_mopen_stats(serv_p->stats_file, O_RDONLY, &stats_hdl)) != 0) { + if ( agt_mopen_stats(serv_p->stats_file, O_RDONLY, &stats_hdl) != 0 ) { /* Server must be down */ serv_p->server_state = SERVER_DOWN; /* Zero out the ops and entries tables */ @@ -304,13 +303,13 @@ load_stats_table(netsnmp_cache *cache, void *foo) serv_p->stats_file, serv_p->port); } else { /* Initialize ops table */ - if ((err = agt_mread_stats(stats_hdl, &ctx->hdr_tbl, &ctx->ops_tbl, - &ctx->entries_tbl)) != 0) + if ( agt_mread_stats(stats_hdl, &ctx->hdr_tbl, &ctx->ops_tbl, + &ctx->entries_tbl) != 0 ) snmp_log(LOG_ERR, "Unable to read stats file: %s\n", serv_p->stats_file); /* Close stats file */ - if ((err = agt_mclose_stats(stats_hdl)) != 0) + if ( agt_mclose_stats(stats_hdl) != 0 ) snmp_log(LOG_ERR, "Error closing stats file: %s\n", serv_p->stats_file); |