Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
f0bd9b3a
Commit
f0bd9b3a
authored
Jul 09, 2004
by
Kurt Zeilenga
Browse files
Mark areas needed poll(2) support with HAVE_POLL.
parent
d6c68cdf
Changes
5
Hide whitespace changes
Inline
Side-by-side
libraries/libldap/init.c
View file @
f0bd9b3a
...
...
@@ -534,8 +534,10 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
|| defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
ldap_int_hostname
=
ldap_pvt_get_fqdn
(
ldap_int_hostname
);
#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
);
...
...
libraries/libldap/ldap-int.h
View file @
f0bd9b3a
...
...
@@ -448,7 +448,11 @@ LDAP_F (int) ldap_int_open_connection( LDAP *ld,
/*
* in os-ip.c
*/
#ifndef HAVE_POLL
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
,
const
struct
timeval
*
tm
);
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
);
#endif
LDAP_F
(
void
)
ldap_int_ip_init
(
void
);
LDAP_F
(
int
)
ldap_int_select
(
LDAP
*
ld
,
struct
timeval
*
timeout
);
LDAP_F
(
void
*
)
ldap_new_select_info
(
void
);
LDAP_F
(
void
)
ldap_free_select_info
(
void
*
sip
);
...
...
libraries/libldap/os-ip.c
View file @
f0bd9b3a
...
...
@@ -39,8 +39,6 @@
#include
"ldap-int.h"
int
ldap_int_tblsize
=
0
;
#if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
# ifdef LDAP_PF_INET6
int
ldap_int_inet4or6
=
AF_UNSPEC
;
...
...
@@ -212,10 +210,12 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
{
int
rc
;
struct
timeval
tv
,
*
opt_tv
=
NULL
;
#ifndef HAVE_POLL
fd_set
wfds
,
*
z
=
NULL
;
#ifdef HAVE_WINSOCK
fd_set
efds
;
#endif
#endif
#ifdef LDAP_CONNECTIONLESS
/* 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
);
#endif
#ifdef HAVE_POLL
assert
(
0
);
#else
FD_ZERO
(
&
wfds
);
FD_SET
(
s
,
&
wfds
);
...
...
@@ -305,6 +308,8 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
return
(
-
1
);
return
(
0
);
}
#endif
osip_debug
(
ld
,
"ldap_connect_timeout: timed out
\n
"
,
0
,
0
,
0
);
ldap_pvt_set_errno
(
ETIMEDOUT
);
return
(
-
1
);
...
...
@@ -607,14 +612,18 @@ ldap_host_connected_to( Sockbuf *sb, const char *host )
#endif
/* for UNIX */
#ifdef HAVE_POLL
/* for UNIX poll(2) */
/* ??? */
#else
/* for UNIX select(2) */
struct
selectinfo
{
fd_set
si_readfds
;
fd_set
si_writefds
;
fd_set
si_use_readfds
;
fd_set
si_use_writefds
;
};
#endif
void
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
ldap_int_ip_init
(
void
)
{
int
tblsize
;
#if defined( HAVE_SYSCONF )
tblsize
=
sysconf
(
_SC_OPEN_MAX
);
#elif defined( HAVE_GETDTABLESIZE )
...
...
@@ -721,11 +734,12 @@ ldap_int_ip_init( void )
#endif
/* !USE_SYSCONF */
#ifdef FD_SETSIZE
if
(
tblsize
>
FD_SETSIZE
)
tblsize
=
FD_SETSIZE
;
if
(
tblsize
>
FD_SETSIZE
)
tblsize
=
FD_SETSIZE
;
#endif
/* FD_SETSIZE*/
ldap_int_tblsize
=
tblsize
;
}
#endif
int
...
...
@@ -739,14 +753,20 @@ ldap_int_select( LDAP *ld, struct timeval *timeout )
Debug
(
LDAP_DEBUG_TRACE
,
"ldap_int_select
\n
"
,
0
,
0
,
0
);
#endif
if
(
ldap_int_tblsize
==
0
)
ldap_int_ip_init
();
#ifndef HAVE_POLL
if
(
ldap_int_tblsize
==
0
)
ldap_int_ip_init
();
#endif
sip
=
(
struct
selectinfo
*
)
ld
->
ld_selectinfo
;
sip
->
si_use_readfds
=
sip
->
si_readfds
;
sip
->
si_use_writefds
=
sip
->
si_writefds
;
#ifdef HAVE_POLL
assert
(
0
);
return
-
1
;
#else
return
(
select
(
ldap_int_tblsize
,
&
sip
->
si_use_readfds
,
&
sip
->
si_use_writefds
,
NULL
,
timeout
));
&
sip
->
si_use_readfds
,
&
sip
->
si_use_writefds
,
NULL
,
timeout
));
#endif
}
libraries/libldap/os-local.c
View file @
f0bd9b3a
...
...
@@ -51,8 +51,6 @@
#include
"ldap-int.h"
#include
"ldap_defaults.h"
/* int ldap_int_tblsize = 0; */
#ifdef LDAP_DEBUG
#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
;
struct
timeval
tv
,
*
opt_tv
=
NULL
;
fd_set
wfds
,
*
z
=
NULL
;
if
(
(
opt_tv
=
ld
->
ld_options
.
ldo_tm_net
)
!=
NULL
)
{
tv
.
tv_usec
=
opt_tv
->
tv_usec
;
...
...
@@ -177,17 +174,15 @@ 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
"
,
s
,
opt_tv
?
tv
.
tv_sec
:
-
1L
,
async
);
s
,
opt_tv
?
tv
.
tv_sec
:
-
1L
,
async
);
if
(
ldap_pvt_ndelay_on
(
ld
,
s
)
==
-
1
)
return
(
-
1
);
if
(
ldap_pvt_ndelay_on
(
ld
,
s
)
==
-
1
)
return
-
1
;
if
(
connect
(
s
,
(
struct
sockaddr
*
)
sa
,
sizeof
(
struct
sockaddr_un
))
!=
AC_SOCKET_ERROR
)
{
if
(
ldap_pvt_ndelay_off
(
ld
,
s
)
==
-
1
)
{
return
(
-
1
);
}
if
(
ldap_pvt_ndelay_off
(
ld
,
s
)
==
-
1
)
return
-
1
;
#ifdef DO_SENDMSG
/* Send a dummy message with access rights. Remote side will
* obtain our uid/gid by fstat'ing this descriptor.
...
...
@@ -211,38 +206,42 @@ sendcred:
}
}
#endif
return
(
0
)
;
return
0
;
}
if
(
errno
!=
EINPROGRESS
&&
errno
!=
EWOULDBLOCK
)
{
return
(
-
1
);
}
if
(
errno
!=
EINPROGRESS
&&
errno
!=
EWOULDBLOCK
)
return
-
1
;
#ifdef notyet
if
(
async
)
return
(
-
2
)
;
if
(
async
)
return
-
2
;
#endif
FD_ZERO
(
&
wfds
);
FD_SET
(
s
,
&
wfds
);
#ifdef HAVE_POLL
assert
(
0
);
#else
{
fd_set
wfds
,
*
z
=
NULL
;
FD_ZERO
(
&
wfds
);
FD_SET
(
s
,
&
wfds
);
do
{
rc
=
select
(
ldap_int_tblsize
,
z
,
&
wfds
,
z
,
opt_tv
?
&
tv
:
NULL
);
}
while
(
rc
==
AC_SOCKET_ERROR
&&
errno
==
EINTR
&&
LDAP_BOOL_GET
(
&
ld
->
ld_options
,
LDAP_BOOL_RESTART
));
do
{
rc
=
select
(
ldap_int_tblsize
,
z
,
&
wfds
,
z
,
opt_tv
?
&
tv
:
NULL
);
}
while
(
rc
==
AC_SOCKET_ERROR
&&
errno
==
EINTR
&&
LDAP_BOOL_GET
(
&
ld
->
ld_options
,
LDAP_BOOL_RESTART
));
if
(
rc
==
AC_SOCKET_ERROR
)
return
rc
;
if
(
rc
==
AC_SOCKET_ERROR
)
return
rc
;
if
(
FD_ISSET
(
s
,
&
wfds
)
)
{
if
(
ldap_pvt_is_socket_ready
(
ld
,
s
)
==
-
1
)
return
(
-
1
);
if
(
ldap_pvt_ndelay_off
(
ld
,
s
)
==
-
1
)
return
(
-
1
);
if
(
FD_ISSET
(
s
,
&
wfds
)
)
{
if
(
ldap_pvt_is_socket_ready
(
ld
,
s
)
==
-
1
)
return
-
1
;
if
(
ldap_pvt_ndelay_off
(
ld
,
s
)
==
-
1
)
return
-
1
;
#ifdef DO_SENDMSG
goto
sendcred
;
goto
sendcred
;
#else
return
(
0
);
return
(
0
);
#endif
}
}
#endif
oslocal_debug
(
ld
,
"ldap_connect_timeout: timed out
\n
"
,
0
,
0
,
0
);
ldap_pvt_set_errno
(
ETIMEDOUT
);
return
(
-
1
);
...
...
libraries/libldap/request.c
View file @
f0bd9b3a
...
...
@@ -158,8 +158,7 @@ ldap_send_initial_request(
int
ldap_int_flush_request
(
LDAP
*
ld
,
LDAPRequest
*
lr
)
LDAPRequest
*
lr
)
{
LDAPConn
*
lc
=
lr
->
lr_conn
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment