Commit 62a5807b authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Use autoconf defines

parent bed979f9
......@@ -170,11 +170,13 @@ static do_query()
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) {
......
......@@ -31,7 +31,7 @@ int debug;
#elif defined( HAVE_GETDTABLESIZE )
nbits = getdtablesize();
#else
nbits = 32;
nbits = FD_SETSIZE;
#endif
#ifdef FD_SETSIZE
......@@ -73,14 +73,14 @@ int debug;
(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 );
......
......@@ -137,11 +137,13 @@ char **argv;
}
#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) {
......
......@@ -153,7 +153,7 @@ char **argv;
#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
#else
dtblsize = 32;
dtblsize = FD_SETSIZE;
#endif
#ifdef FD_SETSIZE
......
......@@ -80,11 +80,11 @@ query_cmd( msgp, reply )
/*
* 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 ) {
......@@ -94,9 +94,9 @@ query_cmd( msgp, reply )
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 );
......@@ -113,11 +113,11 @@ query_cmd( msgp, reply )
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 );
......@@ -136,12 +136,12 @@ query_cmd( msgp, reply )
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 );
......@@ -223,11 +223,11 @@ query_cmd( msgp, reply )
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 );
}
......
......@@ -50,7 +50,7 @@ char *s;
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" );
......@@ -111,7 +111,7 @@ char **argv;
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:"
......@@ -131,7 +131,7 @@ char **argv;
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;
......
......@@ -34,7 +34,7 @@ extern char *mygetpass(); /* getpass() passwds are too short */
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();
......
......@@ -44,7 +44,7 @@ struct attribute attrlist[] = {
#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 },
......
......@@ -270,7 +270,7 @@ do_commands()
printf(" Thank you!\n");
ldap_unbind(ld);
#ifdef KERBEROS
#ifdef HAVE_KERBEROS
destroy_tickets();
#endif
exit(0);
......@@ -693,9 +693,9 @@ RETSIGTYPE attn()
fflush(stderr);
fflush(stdout);
printf("\n\n INTERRUPTED!\n");
#if defined(DOS) || defined(SYSV)
(void) signal(SIGINT, attn);
#endif
longjmp(env, 1);
}
......@@ -711,6 +711,7 @@ RETSIGTYPE chwinsz()
if (win.ws_col != 0)
col_size = win.ws_col;
}
(void) signal(SIGWINCH, chwinsz);
}
#endif
......@@ -13,14 +13,14 @@
#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
......@@ -597,9 +597,7 @@ time2text( char *ldtimestr, int dateonly )
/* 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.
......
......@@ -10,14 +10,13 @@
* 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 */
/*****************************************************************************
**
......@@ -87,7 +86,7 @@
/*
* 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
......@@ -136,6 +135,8 @@
#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.
......@@ -156,3 +157,5 @@ struct entry {
char *name;
struct attribute attrs[MAX_ATTRS];
};
LDAP_END_DECL
......@@ -217,7 +217,7 @@ char *s;
{
if (errno != 0)
perror(s);
#ifdef KERBEROS
#ifdef HAVE_KERBEROS
destroy_tickets();
#endif
exit(-1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment