version 1.6, 1998/08/20 17:42:38
|
version 1.6.10.3, 1998/10/22 01:03:09
|
Line 5
|
Line 5
|
* result.c - wait for an ldap result |
* result.c - wait for an ldap result |
*/ |
*/ |
|
|
|
#include "portable.h" |
|
|
#ifndef lint |
#ifndef lint |
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; |
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; |
#endif |
#endif |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
|
#include <stdlib.h> |
#include <stdlib.h> |
|
|
#ifdef MACOS |
#include <ac/errno.h> |
#include <time.h> |
#include <ac/socket.h> |
#include "macos.h" |
#include <ac/string.h> |
#else /* MACOS */ |
#include <ac/time.h> |
#if defined( DOS ) || defined( _WIN32 ) |
#include <ac/unistd.h> |
#include <time.h> |
|
#include "msdos.h" |
|
#ifdef PCNFS |
|
#include <tklib.h> |
|
#include <tk_errno.h> |
|
#include <bios.h> |
|
#endif /* PCNFS */ |
|
#ifdef NCSA |
|
#include "externs.h" |
|
#endif /* NCSA */ |
|
#else /* DOS */ |
|
#include <sys/time.h> |
|
#include <sys/types.h> |
|
#include <sys/socket.h> |
|
#include <sys/errno.h> |
|
#ifdef _AIX |
|
#include <sys/select.h> |
|
#endif /* _AIX */ |
|
#endif /* DOS */ |
|
#endif /* MACOS */ |
|
#ifdef VMS |
|
#include "ucx_select.h" |
|
#endif |
|
|
|
#include "portable.h" |
|
|
|
#include "lber.h" |
#include "lber.h" |
#include "ldap.h" |
#include "ldap.h" |
#include "ldap-int.h" |
#include "ldap-int.h" |
|
|
#ifdef USE_SYSCONF |
|
#include <unistd.h> |
static int ldap_abandoned LDAP_P(( LDAP *ld, int msgid )); |
#endif /* USE_SYSCONF */ |
static int ldap_mark_abandoned LDAP_P(( LDAP *ld, int msgid )); |
|
static int wait4msg LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeout, |
#ifdef NEEDPROTOS |
LDAPMessage **result )); |
static int ldap_abandoned( LDAP *ld, int msgid ); |
|
static int ldap_mark_abandoned( LDAP *ld, int msgid ); |
|
static int wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout, |
|
LDAPMessage **result ); |
|
#ifdef LDAP_REFERRALS |
#ifdef LDAP_REFERRALS |
static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc, |
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc, |
LDAPMessage **result ); |
LDAPMessage **result )); |
static int build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr ); |
static int build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr )); |
static void merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ); |
static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )); |
#else /* LDAP_REFERRALS */ |
#else /* LDAP_REFERRALS */ |
static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, |
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, |
LDAPMessage **result ); |
LDAPMessage **result )); |
#endif /* LDAP_REFERRALS */ |
|
#if defined( CLDAP ) || !defined( LDAP_REFERRALS ) |
|
static int ldap_select1( LDAP *ld, struct timeval *timeout ); |
|
#endif |
|
#else /* NEEDPROTOS */ |
|
static int ldap_abandoned(); |
|
static int ldap_mark_abandoned(); |
|
static int wait4msg(); |
|
static int read1msg(); |
|
#ifdef LDAP_REFERRALS |
|
static int build_result_ber(); |
|
static void merge_error_info(); |
|
#endif /* LDAP_REFERRALS */ |
#endif /* LDAP_REFERRALS */ |
#if defined( CLDAP ) || !defined( LDAP_REFERRALS ) |
#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS ) |
static int ldap_select1(); |
static int ldap_select1 LDAP_P(( LDAP *ld, struct timeval *timeout )); |
#endif |
|
#endif /* NEEDPROTOS */ |
|
|
|
#if !defined( MACOS ) && !defined( DOS ) |
|
extern int errno; |
|
#endif |
#endif |
|
|
|
|
Line 483 lr->lr_res_matched ? lr->lr_res_matched
|
Line 438 lr->lr_res_matched ? lr->lr_res_matched
|
new->lm_msgtype = tag; |
new->lm_msgtype = tag; |
new->lm_ber = ber_dup( &ber ); |
new->lm_ber = ber_dup( &ber ); |
|
|
#ifndef NO_CACHE |
#ifndef LDAP_NOCACHE |
if ( ld->ld_cache != NULL ) { |
if ( ld->ld_cache != NULL ) { |
ldap_add_result_to_cache( ld, new ); |
ldap_add_result_to_cache( ld, new ); |
} |
} |
#endif /* NO_CACHE */ |
#endif /* LDAP_NOCACHE */ |
|
|
/* is this the one we're looking for? */ |
/* is this the one we're looking for? */ |
if ( msgid == LDAP_RES_ANY || id == msgid ) { |
if ( msgid == LDAP_RES_ANY || id == msgid ) { |
Line 633 merge_error_info( LDAP *ld, LDAPRequest
|
Line 588 merge_error_info( LDAP *ld, LDAPRequest
|
|
|
|
|
|
|
#if defined( CLDAP ) || !defined( LDAP_REFERRALS ) |
#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS ) |
#if !defined( MACOS ) && !defined( DOS ) && !defined( _WIN32 ) |
#if !defined( MACOS ) && !defined( DOS ) && !defined( _WIN32 ) |
static int |
static int |
ldap_select1( LDAP *ld, struct timeval *timeout ) |
ldap_select1( LDAP *ld, struct timeval *timeout ) |
Line 642 ldap_select1( LDAP *ld, struct timeval *
|
Line 597 ldap_select1( LDAP *ld, struct timeval *
|
static int tblsize; |
static int tblsize; |
|
|
if ( tblsize == 0 ) { |
if ( tblsize == 0 ) { |
#ifdef USE_SYSCONF |
#ifdef HAVE_SYSCONF |
tblsize = sysconf( _SC_OPEN_MAX ); |
tblsize = sysconf( _SC_OPEN_MAX ); |
#else /* !USE_SYSCONF */ |
#elif HAVE_GETDTABLESIZE |
tblsize = getdtablesize(); |
tblsize = getdtablesize(); |
#endif /* !USE_SYSCONF */ |
#else |
|
tblsize = FD_SETSIZE; |
|
#endif |
#ifdef FD_SETSIZE |
#ifdef FD_SETSIZE |
if ( tblsize > FD_SETSIZE ) { |
if ( tblsize > FD_SETSIZE ) { |
tblsize = FD_SETSIZE; |
tblsize = FD_SETSIZE; |
Line 827 ldap_mark_abandoned( LDAP *ld, int msgid
|
Line 784 ldap_mark_abandoned( LDAP *ld, int msgid
|
} |
} |
|
|
|
|
#ifdef CLDAP |
#ifdef LDAP_CONNECTIONLESS |
int |
int |
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber ) |
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber ) |
{ |
{ |
Line 853 cldap_getmsg( LDAP *ld, struct timeval *
|
Line 810 cldap_getmsg( LDAP *ld, struct timeval *
|
|
|
return( tag ); |
return( tag ); |
} |
} |
#endif /* CLDAP */ |
#endif /* LDAP_CONNECTIONLESS */ |