exit( 1 );
}
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
tblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
tblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ tblsize = FD_SETSIZE;
+#endif
#ifdef FD_SETSIZE
if (tblsize > FD_SETSIZE) {
#elif defined( HAVE_GETDTABLESIZE )
nbits = getdtablesize();
#else
- nbits = 32;
+ nbits = FD_SETSIZE;
#endif
#ifdef FD_SETSIZE
(void) dup2( sd, 2 );
close( sd );
-#ifdef USE_SETSID
+#ifdef HAVE_SETSID
(void) setsid();
-#else /* USE_SETSID */
+#else /* HAVE_SETSID */
if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
(void) ioctl( sd, TIOCNOTTY, NULL );
(void) close( sd );
}
-#endif /* USE_SETSID */
+#endif /* HAVE_SETSID */
}
(void) signal( SIGPIPE, SIG_IGN );
}
#endif
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ dtblsize = FD_SETSIZE;
+#endif
#ifdef FD_SETSIZE
if (dtblsize > FD_SETSIZE) {
#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
#else
- dtblsize = 32;
+ dtblsize = FD_SETSIZE;
#endif
#ifdef FD_SETSIZE
/*
* open connection to LDAP server and bind as dapuser
*/
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_cldap )
ldp = cldap_open( ldaphost, ldapport );
else
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
ldp = ldap_open( ldaphost, ldapport );
if ( ldp == NULL ) {
return( 0 );
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( !do_cldap )
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
if ( ldap_simple_bind_s( ldp, dapuser, NULL ) != LDAP_SUCCESS ) {
report_ldap_err( ldp, reply );
close_ldap( ldp );
matches = 0;
#ifdef RCPT500_UFN
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( !do_cldap && strchr( msgp->msg_arg, ',' ) != NULL ) {
-#else /* CLDAP */
+#else /* LDAP_CONNECTIONLESS */
if ( strchr( msgp->msg_arg, ',' ) != NULL ) {
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
struct timeval tv;
ldap_ufn_setprefix( ldp, searchbase );
for ( lfi = ldap_getfirstfilter( lfdp, "rcpt500", msgp->msg_arg );
lfi != NULL; lfi = ldap_getnextfilter( lfdp )) {
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_cldap )
rc = cldap_search_s( ldp, searchbase, LDAP_SCOPE_SUBTREE,
lfi->lfi_filter, attrs, 0, &ldmsgp, dapuser );
else
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
rc = ldap_search_s( ldp, searchbase, LDAP_SCOPE_SUBTREE,
lfi->lfi_filter, attrs, 0, &ldmsgp );
void
close_ldap( LDAP *ld )
{
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_cldap )
cldap_close( ld );
else
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
ldap_unbind( ld );
}
fprintf( stderr, " -z size lim\tsize limit (in entries) for search\n" );
fprintf( stderr, " -D binddn\tbind dn\n" );
fprintf( stderr, " -w passwd\tbind passwd (for simple authentication)\n" );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
fprintf( stderr, " -k\t\tuse Kerberos instead of Simple Password authentication\n" );
#endif
fprintf( stderr, " -h host\tldap server\n" );
scope = LDAP_SCOPE_SUBTREE;
while (( i = getopt( argc, argv,
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
"KknuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:"
#else
"nuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:"
fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
#endif /* LDAP_DEBUG */
break;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
case 'k': /* use kerberos bind */
kerberos = 2;
break;
extern int debug; /* debug flag */
#endif
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
static char tktpath[20]; /* ticket file path */
static int kinit();
static int valid_tgt();
#ifdef UOFM
{ "multiLineDescription", "Description", change_field, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ | ATTR_FLAG_PERSON_MOD | ATTR_FLAG_GROUP_MOD | ATTR_FLAG_IS_MULTILINE },
#endif
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
{ "krbName", "Kerberos name", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_READ },
#endif
{ "description", "Brief description", NULL, ATTR_FLAG_PERSON | ATTR_FLAG_GROUP | ATTR_FLAG_READ },
printf(" Thank you!\n");
ldap_unbind(ld);
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
destroy_tickets();
#endif
exit(0);
fflush(stderr);
fflush(stdout);
printf("\n\n INTERRUPTED!\n");
-#if defined(DOS) || defined(SYSV)
+
(void) signal(SIGINT, attn);
-#endif
+
longjmp(env, 1);
}
if (win.ws_col != 0)
col_size = win.ws_col;
}
+
(void) signal(SIGWINCH, chwinsz);
}
#endif
#include "portable.h"
#include <stdio.h>
-#include <string.h>
#include <ctype.h>
-#ifndef __STDC__
-#include <memory.h>
-#endif
-#include <time.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
+
#include <lber.h>
#include <ldap.h>
+
#include "ud.h"
#ifdef DEBUG
/* gtime.c - inverse gmtime */
-#if !defined( MACOS ) && !defined( _WIN32 ) && !defined( DOS )
-#include <sys/time.h>
-#endif /* !MACOS */
+#include <ac/time.h>
/* gtime(): the inverse of localtime().
This routine was supplied by Mike Accetta at CMU many years ago.
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#ifdef DOS
-#include "protoud.h"
-#define strncasecmp(a, b, n) strnicmp(a, b, n)
-#define strcasecmp(a, b) stricmp(a, b)
#define MAX_VALUES 8
#else
#define MAX_VALUES 1000
-#endif /* end of DOS ifdef */
+#endif /* !DOS */
/*****************************************************************************
**
/*
* Authentication method we will be using.
*/
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
#define UD_AUTH_METHOD LDAP_AUTH_KRBV4
#else
#define UD_AUTH_METHOD LDAP_AUTH_SIMPLE
#define ATTR_FLAG_IS_A_BOOL 0x4000
#define ATTR_FLAG_IS_MULTILINE 0x8000
+LDAP_BEGIN_DECL
+
/*
* These are the structures we use when parsing an answer we get from the LDAP
* server.
char *name;
struct attribute attrs[MAX_ATTRS];
};
+
+LDAP_END_DECL
{
if (errno != 0)
perror(s);
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
destroy_tickets();
#endif
exit(-1);