Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/chainingdb
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25950/ldap/servers/plugins/chainingdb
Modified Files:
cb_conn_stateless.c cb_instance.c cb_test.c
Log Message:
Resolves: #188320
Summary: HP-UX: warnings reported by the HP-UX compiler
Index: cb_conn_stateless.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/chainingdb/cb_conn_stateless.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cb_conn_stateless.c 10 Nov 2006 23:44:50 -0000 1.6
+++ cb_conn_stateless.c 18 Oct 2007 00:08:28 -0000 1.7
@@ -886,141 +886,6 @@
}
-
-/**************************************************************************/
-/* 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 @@
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 @@
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 @@
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 @@
}
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 ;
Index: cb_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/chainingdb/cb_instance.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cb_instance.c 10 Nov 2006 23:44:50 -0000 1.7
+++ cb_instance.c 18 Oct 2007 00:08:28 -0000 1.8
@@ -716,8 +716,6 @@
if (apply) {
- char * ptr;
-
PR_RWLock_Wlock(inst->rwl_config_lock);
if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) &&
@@ -771,7 +769,7 @@
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);
Index: cb_test.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/chainingdb/cb_test.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cb_test.c 10 Nov 2006 23:44:50 -0000 1.6
+++ cb_test.c 18 Oct 2007 00:08:28 -0000 1.7
@@ -46,7 +46,7 @@
{
Slapi_Backend * be;
- cb_backend * cb;
+ cb_backend * cb;
cb_backend_instance * inst;
Slapi_PBlock * apb;
int res;
@@ -56,9 +56,9 @@
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 @@
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 @@
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;
}