mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 15:49:34 -05:00
Mark areas needed poll(2) support with HAVE_POLL.
This commit is contained in:
parent
d6c68cdf48
commit
f0bd9b3a5b
5 changed files with 70 additions and 47 deletions
|
|
@ -534,8 +534,10 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
|
||||||
|| defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
|
|| defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
|
||||||
ldap_int_hostname = ldap_pvt_get_fqdn( ldap_int_hostname );
|
ldap_int_hostname = ldap_pvt_get_fqdn( ldap_int_hostname );
|
||||||
#endif
|
#endif
|
||||||
if ( ldap_int_tblsize == 0 )
|
|
||||||
ldap_int_ip_init();
|
#ifndef HAVE_POLL
|
||||||
|
if ( ldap_int_tblsize == 0 ) ldap_int_ip_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
ldap_int_initialize_global_options(gopts, NULL);
|
ldap_int_initialize_global_options(gopts, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,11 @@ LDAP_F (int) ldap_int_open_connection( LDAP *ld,
|
||||||
/*
|
/*
|
||||||
* in os-ip.c
|
* in os-ip.c
|
||||||
*/
|
*/
|
||||||
|
#ifndef HAVE_POLL
|
||||||
LDAP_V (int) ldap_int_tblsize;
|
LDAP_V (int) ldap_int_tblsize;
|
||||||
|
LDAP_F (void) ldap_int_ip_init( void );
|
||||||
|
#endif
|
||||||
|
|
||||||
LDAP_F (int) ldap_int_timeval_dup( struct timeval **dest,
|
LDAP_F (int) ldap_int_timeval_dup( struct timeval **dest,
|
||||||
const struct timeval *tm );
|
const struct timeval *tm );
|
||||||
LDAP_F (int) ldap_connect_to_host( LDAP *ld, Sockbuf *sb,
|
LDAP_F (int) ldap_connect_to_host( LDAP *ld, Sockbuf *sb,
|
||||||
|
|
@ -461,7 +465,6 @@ LDAP_F (char *) ldap_host_connected_to( Sockbuf *sb,
|
||||||
const char *host );
|
const char *host );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LDAP_F (void) ldap_int_ip_init( void );
|
|
||||||
LDAP_F (int) ldap_int_select( LDAP *ld, struct timeval *timeout );
|
LDAP_F (int) ldap_int_select( LDAP *ld, struct timeval *timeout );
|
||||||
LDAP_F (void *) ldap_new_select_info( void );
|
LDAP_F (void *) ldap_new_select_info( void );
|
||||||
LDAP_F (void) ldap_free_select_info( void *sip );
|
LDAP_F (void) ldap_free_select_info( void *sip );
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@
|
||||||
|
|
||||||
#include "ldap-int.h"
|
#include "ldap-int.h"
|
||||||
|
|
||||||
int ldap_int_tblsize = 0;
|
|
||||||
|
|
||||||
#if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
|
#if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
|
||||||
# ifdef LDAP_PF_INET6
|
# ifdef LDAP_PF_INET6
|
||||||
int ldap_int_inet4or6 = AF_UNSPEC;
|
int ldap_int_inet4or6 = AF_UNSPEC;
|
||||||
|
|
@ -212,10 +210,12 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct timeval tv, *opt_tv=NULL;
|
struct timeval tv, *opt_tv=NULL;
|
||||||
|
#ifndef HAVE_POLL
|
||||||
fd_set wfds, *z=NULL;
|
fd_set wfds, *z=NULL;
|
||||||
#ifdef HAVE_WINSOCK
|
#ifdef HAVE_WINSOCK
|
||||||
fd_set efds;
|
fd_set efds;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LDAP_CONNECTIONLESS
|
#ifdef LDAP_CONNECTIONLESS
|
||||||
/* We could do a connect() but that would interfere with
|
/* We could do a connect() but that would interfere with
|
||||||
|
|
@ -258,6 +258,9 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
|
||||||
if ( async ) return ( -2 );
|
if ( async ) return ( -2 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_POLL
|
||||||
|
assert(0);
|
||||||
|
#else
|
||||||
FD_ZERO(&wfds);
|
FD_ZERO(&wfds);
|
||||||
FD_SET(s, &wfds );
|
FD_SET(s, &wfds );
|
||||||
|
|
||||||
|
|
@ -305,6 +308,8 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
|
||||||
return ( -1 );
|
return ( -1 );
|
||||||
return ( 0 );
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
osip_debug(ld, "ldap_connect_timeout: timed out\n",0,0,0);
|
osip_debug(ld, "ldap_connect_timeout: timed out\n",0,0,0);
|
||||||
ldap_pvt_set_errno( ETIMEDOUT );
|
ldap_pvt_set_errno( ETIMEDOUT );
|
||||||
return ( -1 );
|
return ( -1 );
|
||||||
|
|
@ -607,14 +612,18 @@ ldap_host_connected_to( Sockbuf *sb, const char *host )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* for UNIX */
|
#ifdef HAVE_POLL
|
||||||
|
/* for UNIX poll(2) */
|
||||||
|
/* ??? */
|
||||||
|
#else
|
||||||
|
/* for UNIX select(2) */
|
||||||
struct selectinfo {
|
struct selectinfo {
|
||||||
fd_set si_readfds;
|
fd_set si_readfds;
|
||||||
fd_set si_writefds;
|
fd_set si_writefds;
|
||||||
fd_set si_use_readfds;
|
fd_set si_use_readfds;
|
||||||
fd_set si_use_writefds;
|
fd_set si_use_writefds;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
|
ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
|
||||||
|
|
@ -708,10 +717,14 @@ ldap_free_select_info( void *sip )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_POLL
|
||||||
|
int ldap_int_tblsize = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
ldap_int_ip_init( void )
|
ldap_int_ip_init( void )
|
||||||
{
|
{
|
||||||
int tblsize;
|
int tblsize;
|
||||||
|
|
||||||
#if defined( HAVE_SYSCONF )
|
#if defined( HAVE_SYSCONF )
|
||||||
tblsize = sysconf( _SC_OPEN_MAX );
|
tblsize = sysconf( _SC_OPEN_MAX );
|
||||||
#elif defined( HAVE_GETDTABLESIZE )
|
#elif defined( HAVE_GETDTABLESIZE )
|
||||||
|
|
@ -721,11 +734,12 @@ ldap_int_ip_init( void )
|
||||||
#endif /* !USE_SYSCONF */
|
#endif /* !USE_SYSCONF */
|
||||||
|
|
||||||
#ifdef FD_SETSIZE
|
#ifdef FD_SETSIZE
|
||||||
if( tblsize > FD_SETSIZE )
|
if( tblsize > FD_SETSIZE ) tblsize = FD_SETSIZE;
|
||||||
tblsize = FD_SETSIZE;
|
|
||||||
#endif /* FD_SETSIZE*/
|
#endif /* FD_SETSIZE*/
|
||||||
|
|
||||||
ldap_int_tblsize = tblsize;
|
ldap_int_tblsize = tblsize;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -739,14 +753,20 @@ ldap_int_select( LDAP *ld, struct timeval *timeout )
|
||||||
Debug( LDAP_DEBUG_TRACE, "ldap_int_select\n", 0, 0, 0 );
|
Debug( LDAP_DEBUG_TRACE, "ldap_int_select\n", 0, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( ldap_int_tblsize == 0 )
|
#ifndef HAVE_POLL
|
||||||
ldap_int_ip_init();
|
if ( ldap_int_tblsize == 0 ) ldap_int_ip_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||||
sip->si_use_readfds = sip->si_readfds;
|
sip->si_use_readfds = sip->si_readfds;
|
||||||
sip->si_use_writefds = sip->si_writefds;
|
sip->si_use_writefds = sip->si_writefds;
|
||||||
|
|
||||||
|
#ifdef HAVE_POLL
|
||||||
|
assert(0);
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
return( select( ldap_int_tblsize,
|
return( select( ldap_int_tblsize,
|
||||||
&sip->si_use_readfds, &sip->si_use_writefds,
|
&sip->si_use_readfds, &sip->si_use_writefds,
|
||||||
NULL, timeout ));
|
NULL, timeout ));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,6 @@
|
||||||
#include "ldap-int.h"
|
#include "ldap-int.h"
|
||||||
#include "ldap_defaults.h"
|
#include "ldap_defaults.h"
|
||||||
|
|
||||||
/* int ldap_int_tblsize = 0; */
|
|
||||||
|
|
||||||
#ifdef LDAP_DEBUG
|
#ifdef LDAP_DEBUG
|
||||||
|
|
||||||
#define oslocal_debug(ld,fmt,arg1,arg2,arg3) \
|
#define oslocal_debug(ld,fmt,arg1,arg2,arg3) \
|
||||||
|
|
@ -169,7 +167,6 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct timeval tv, *opt_tv=NULL;
|
struct timeval tv, *opt_tv=NULL;
|
||||||
fd_set wfds, *z=NULL;
|
|
||||||
|
|
||||||
if ( (opt_tv = ld->ld_options.ldo_tm_net) != NULL ) {
|
if ( (opt_tv = ld->ld_options.ldo_tm_net) != NULL ) {
|
||||||
tv.tv_usec = opt_tv->tv_usec;
|
tv.tv_usec = opt_tv->tv_usec;
|
||||||
|
|
@ -179,15 +176,13 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async)
|
||||||
oslocal_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
|
oslocal_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
|
||||||
s, opt_tv ? tv.tv_sec : -1L, async);
|
s, opt_tv ? tv.tv_sec : -1L, async);
|
||||||
|
|
||||||
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
|
if ( ldap_pvt_ndelay_on(ld, s) == -1 ) return -1;
|
||||||
return ( -1 );
|
|
||||||
|
|
||||||
if ( connect(s, (struct sockaddr *) sa, sizeof(struct sockaddr_un))
|
if ( connect(s, (struct sockaddr *) sa, sizeof(struct sockaddr_un))
|
||||||
!= AC_SOCKET_ERROR )
|
!= AC_SOCKET_ERROR )
|
||||||
{
|
{
|
||||||
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) {
|
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) return -1;
|
||||||
return ( -1 );
|
|
||||||
}
|
|
||||||
#ifdef DO_SENDMSG
|
#ifdef DO_SENDMSG
|
||||||
/* Send a dummy message with access rights. Remote side will
|
/* Send a dummy message with access rights. Remote side will
|
||||||
* obtain our uid/gid by fstat'ing this descriptor.
|
* obtain our uid/gid by fstat'ing this descriptor.
|
||||||
|
|
@ -211,17 +206,20 @@ sendcred:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( errno != EINPROGRESS && errno != EWOULDBLOCK ) {
|
if ( errno != EINPROGRESS && errno != EWOULDBLOCK ) return -1;
|
||||||
return ( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
if ( async ) return ( -2 );
|
if ( async ) return -2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_POLL
|
||||||
|
assert(0);
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
fd_set wfds, *z=NULL;
|
||||||
FD_ZERO(&wfds);
|
FD_ZERO(&wfds);
|
||||||
FD_SET(s, &wfds );
|
FD_SET(s, &wfds );
|
||||||
|
|
||||||
|
|
@ -233,16 +231,17 @@ sendcred:
|
||||||
if( rc == AC_SOCKET_ERROR ) return rc;
|
if( rc == AC_SOCKET_ERROR ) return rc;
|
||||||
|
|
||||||
if ( FD_ISSET(s, &wfds) ) {
|
if ( FD_ISSET(s, &wfds) ) {
|
||||||
if ( ldap_pvt_is_socket_ready(ld, s) == -1 )
|
if ( ldap_pvt_is_socket_ready(ld, s) == -1 ) return -1;
|
||||||
return ( -1 );
|
if ( ldap_pvt_ndelay_off(ld, s) == -1 ) return -1;
|
||||||
if ( ldap_pvt_ndelay_off(ld, s) == -1 )
|
|
||||||
return ( -1 );
|
|
||||||
#ifdef DO_SENDMSG
|
#ifdef DO_SENDMSG
|
||||||
goto sendcred;
|
goto sendcred;
|
||||||
#else
|
#else
|
||||||
return ( 0 );
|
return ( 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
oslocal_debug(ld, "ldap_connect_timeout: timed out\n",0,0,0);
|
oslocal_debug(ld, "ldap_connect_timeout: timed out\n",0,0,0);
|
||||||
ldap_pvt_set_errno( ETIMEDOUT );
|
ldap_pvt_set_errno( ETIMEDOUT );
|
||||||
return ( -1 );
|
return ( -1 );
|
||||||
|
|
|
||||||
|
|
@ -158,8 +158,7 @@ ldap_send_initial_request(
|
||||||
int
|
int
|
||||||
ldap_int_flush_request(
|
ldap_int_flush_request(
|
||||||
LDAP *ld,
|
LDAP *ld,
|
||||||
LDAPRequest *lr
|
LDAPRequest *lr )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
LDAPConn *lc = lr->lr_conn;
|
LDAPConn *lc = lr->lr_conn;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue