From: Kurt Zeilenga Date: Thu, 22 Oct 1998 19:37:05 +0000 (+0000) Subject: Blindly added Autoconf support to ldapd. X-Git-Tag: PHP3_TOOL_0_0~18^2~17 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=18a3335172a50be2527efa97d5e15a529049abd0;p=openldap Blindly added Autoconf support to ldapd. --- diff --git a/configure b/configure index f6e6ddf6df..2f0cf6241d 100755 --- a/configure +++ b/configure @@ -4958,40 +4958,41 @@ EOF fi for ac_hdr in \ - stddef.h \ - errno.h \ - fcntl.h \ - filio.h \ - getopt.h \ - limits.h \ - malloc.h \ - regex.h \ - sgtty.h \ - sys/file.h \ - sys/errno.h \ - sys/ioctl.h \ - sys/param.h \ - sys/socket.h\ - sys/time.h \ - sys/types.h \ - syslog.h \ - termios.h \ - unistd.h \ + stddef.h \ + errno.h \ + fcntl.h \ + filio.h \ + getopt.h \ + limits.h \ + malloc.h \ + regex.h \ + sgtty.h \ + sys/file.h \ + sys/errno.h \ + sys/ioctl.h \ + sys/param.h \ + sys/socket.h \ + sys/syslog.h \ + sys/time.h \ + sys/types.h \ + syslog.h \ + termios.h \ + unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4985: checking for $ac_hdr" >&5 +echo "configure:4986: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4995: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5019,12 +5020,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5023: checking for uid_t in sys/types.h" >&5 +echo "configure:5024: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -5053,7 +5054,7 @@ EOF fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:5057: checking type of array argument to getgroups" >&5 +echo "configure:5058: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5061,7 +5062,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -5100,7 +5101,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -5124,12 +5125,12 @@ EOF echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:5128: checking for mode_t" >&5 +echo "configure:5129: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5157,12 +5158,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:5161: checking for off_t" >&5 +echo "configure:5162: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5190,12 +5191,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:5194: checking for pid_t" >&5 +echo "configure:5195: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5223,12 +5224,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5227: checking return type of signal handlers" >&5 +echo "configure:5228: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5245,7 +5246,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5264,12 +5265,12 @@ EOF echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:5268: checking for size_t" >&5 +echo "configure:5269: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5297,12 +5298,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5301: checking for uid_t in sys/types.h" >&5 +echo "configure:5302: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -5331,12 +5332,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:5335: checking for st_blksize in struct stat" >&5 +echo "configure:5336: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5344,7 +5345,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:5348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -5365,12 +5366,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:5369: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:5370: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5379,7 +5380,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:5383: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -5400,12 +5401,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:5404: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:5405: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5413,7 +5414,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:5417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -5436,7 +5437,7 @@ fi echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6 -echo "configure:5440: checking if toupper() requires islower()" >&5 +echo "configure:5441: checking if toupper() requires islower()" >&5 if eval "test \"`echo '$''{'ol_cv_c_upper_lower'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5445,7 +5446,7 @@ else ol_cv_c_upper_lower=safe else cat > conftest.$ac_ext < @@ -5457,7 +5458,7 @@ main() exit(1); } EOF -if { (eval echo configure:5461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ol_cv_c_upper_lower=no else @@ -5480,12 +5481,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5484: checking for working const" >&5 +echo "configure:5485: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5557,7 +5558,7 @@ fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:5561: checking for 8-bit clean memcmp" >&5 +echo "configure:5562: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5565,7 +5566,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -5593,12 +5594,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:5597: checking for strftime" >&5 +echo "configure:5598: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -5643,7 +5644,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:5647: checking for strftime in -lintl" >&5 +echo "configure:5648: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5651,7 +5652,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5689,12 +5690,12 @@ fi fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:5693: checking for vprintf" >&5 +echo "configure:5694: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -5741,12 +5742,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:5745: checking for _doprnt" >&5 +echo "configure:5746: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -5794,7 +5795,7 @@ fi fi echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 -echo "configure:5798: checking for wait3 that fills in rusage" >&5 +echo "configure:5799: checking for wait3 that fills in rusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5802,7 +5803,7 @@ else ac_cv_func_wait3_rusage=no else cat > conftest.$ac_ext < #include @@ -5833,7 +5834,7 @@ main() { } } EOF -if { (eval echo configure:5837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_wait3_rusage=yes else @@ -5887,12 +5888,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5891: checking for $ac_func" >&5 +echo "configure:5892: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5943,12 +5944,12 @@ done for ac_func in getopt strdup tempnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5947: checking for $ac_func" >&5 +echo "configure:5948: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6001,13 +6002,13 @@ done # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:6005: checking declaration of sys_errlist" >&5 +echo "configure:6006: checking declaration of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6017,7 +6018,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:6021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes else @@ -6038,20 +6039,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:6042: checking existence of sys_errlist" >&5 +echo "configure:6043: checking existence of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:6055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ol_cv_have_sys_errlist=yes else diff --git a/configure.in b/configure.in index cbe71429a0..3c1ed4fc77 100644 --- a/configure.in +++ b/configure.in @@ -685,26 +685,27 @@ dnl Checks for header files. AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS( \ - stddef.h \ - errno.h \ - fcntl.h \ - filio.h \ - getopt.h \ - limits.h \ - malloc.h \ - regex.h \ - sgtty.h \ - sys/file.h \ - sys/errno.h \ - sys/ioctl.h \ - sys/param.h \ - sys/socket.h\ - sys/time.h \ - sys/types.h \ - syslog.h \ - termios.h \ - unistd.h \ +AC_CHECK_HEADERS( \ + stddef.h \ + errno.h \ + fcntl.h \ + filio.h \ + getopt.h \ + limits.h \ + malloc.h \ + regex.h \ + sgtty.h \ + sys/file.h \ + sys/errno.h \ + sys/ioctl.h \ + sys/param.h \ + sys/socket.h \ + sys/syslog.h \ + sys/time.h \ + sys/types.h \ + syslog.h \ + termios.h \ + unistd.h \ ) dnl ---------------------------------------------------------------- diff --git a/include/ac/syslog.h b/include/ac/syslog.h index d5d4e26201..c7afb100ba 100644 --- a/include/ac/syslog.h +++ b/include/ac/syslog.h @@ -4,8 +4,11 @@ #ifndef _AC_SYSLOG_H_ #define _AC_SYSLOG_H_ -#ifdef HAVE_SYSLOG_H +#if defined( HAVE_SYSLOG_H ) #include +#elif defined ( HAVE_SYS_SYSLOG_H ) +#include +#endif #if defined( LOG_NDELAY ) && defined( LOG_NOWAIT ) # define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY | LOG_NOWAIT ) @@ -17,6 +20,4 @@ # define OPENLOG_OPTIONS ( LOG_PID ) #endif -#endif /* syslog.h */ - #endif /* _AC_SYSLOG_H_ */ diff --git a/include/portable.h.in b/include/portable.h.in index 831e522fe0..c306baebc4 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -410,6 +410,9 @@ is provided ``as is'' without express or implied warranty. /* Define if you have the header file. */ #undef HAVE_SYS_SOCKET_H +/* Define if you have the header file. */ +#undef HAVE_SYS_SYSLOG_H + /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H diff --git a/include/portable.h.nt b/include/portable.h.nt index ae613ff498..13a155fc44 100644 --- a/include/portable.h.nt +++ b/include/portable.h.nt @@ -428,6 +428,9 @@ typedef char * caddr_t; /* Define if you have the header file. */ /* #undef HAVE_SYS_SOCKET_H */ +/* Define if you have the header file. */ +/* #undef HAVE_SYS_SYSLOG_H */ + /* Define if you have the header file. */ /* #undef HAVE_SYS_TIME_H */ diff --git a/servers/ldapd/abandon.c b/servers/ldapd/abandon.c index 3e51192590..899bf3f449 100644 --- a/servers/ldapd/abandon.c +++ b/servers/ldapd/abandon.c @@ -10,15 +10,19 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + +#include + #include #include #include #include #include #include -#include -#include + #include "lber.h" #include "ldap.h" #include "common.h" diff --git a/servers/ldapd/add.c b/servers/ldapd/add.c index cc76223a73..08bf49404b 100644 --- a/servers/ldapd/add.c +++ b/servers/ldapd/add.c @@ -10,20 +10,23 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + +#include + #include #include #include #include #include #include -#include -#include #include "lber.h" #include "ldap.h" #include "common.h" -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 extern int ldap_compat; #define ADDTAG (ldap_compat == 20 ? OLD_LDAP_RES_ADD : LDAP_RES_ADD) #else diff --git a/servers/ldapd/association.c b/servers/ldapd/association.c index ab15d0460a..a24871b7db 100644 --- a/servers/ldapd/association.c +++ b/servers/ldapd/association.c @@ -10,27 +10,32 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include + +#include +#include +#include +#include + #include #include -#include -#include -#include -#include -#include #include "lber.h" #include "ldap.h" + #if ISODEPACKAGE == IC #include #else #include #endif #include "common.h" -#ifdef SVR4 -#if !defined(_AIX) && !defined(__osf__) -#include + +#ifdef HAVE_SYS_IOCTL_H +#include #endif +#ifdef HAVE_SYS_FILIO_H +#include #endif #ifdef __hpux diff --git a/servers/ldapd/bind.c b/servers/ldapd/bind.c index db76ff0bf7..defcb19e0a 100644 --- a/servers/ldapd/bind.c +++ b/servers/ldapd/bind.c @@ -10,21 +10,23 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include -#include + +#include + #include #include #include #include #include + #include "lber.h" #include "ldap.h" #include "common.h" -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 extern int ldap_compat; #define BINDTAG (ldap_compat == 20 ? OLD_LDAP_RES_BIND : LDAP_RES_BIND) #else @@ -75,7 +77,7 @@ do_bind( LDAP_PROTOCOL_ERROR, NULL, "Decoding error" ); return( 0 ); } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) method = ber_skip_tag( ber, &len ); else @@ -141,7 +143,7 @@ do_bind_real( struct DSError dse; char *dn = dsaconn->c_dn; int err; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS u_long nonce; #endif extern DN ldap_str2dn(); @@ -155,10 +157,10 @@ do_bind_real( } switch ( dsaconn->c_method ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_AUTH_SIMPLE: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_AUTH_SIMPLE_30: #endif case LDAP_AUTH_SIMPLE: /* x.500 simple authentication */ @@ -176,11 +178,11 @@ do_bind_real( ba.dba_version = DBA_VERSION_V1988; break; -#ifdef KERBEROS -#ifdef COMPAT20 +#ifdef HAVE_KERBEROS +#ifdef LDAP_COMPAT20 case OLD_LDAP_AUTH_KRBV4: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_AUTH_KRBV41_30: #endif case LDAP_AUTH_KRBV41: /* kerberos authentication to ldap server */ @@ -188,10 +190,10 @@ do_bind_real( dsaconn->c_credlen ) ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_AUTH_KRBV42: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_AUTH_KRBV42_30: #endif case LDAP_AUTH_KRBV42: /* kerberos authentication to x500 dsa */ @@ -254,7 +256,7 @@ do_bind_real( Debug( LDAP_DEBUG_TRACE, "dap_bind successful\n", 0, 0, 0 ); -#ifdef KERBEROS +#ifdef HAVE_KERBEROS /* XXX why doesn't this work?? if ( dsaconn->c_method == LDAP_AUTH_KRBV42 && kerberos_check_mutual( &br, nonce ) != 0 ) { diff --git a/servers/ldapd/certificate.c b/servers/ldapd/certificate.c index 228d65a6e8..1299b0cf55 100644 --- a/servers/ldapd/certificate.c +++ b/servers/ldapd/certificate.c @@ -3,18 +3,21 @@ * donated by Eric Rosenquist and BNR */ +#include "portable.h" + #include -#include -#include -#include -#include -#include + +#include +#include +#include + #include #include #include #include #include #include + #include "lber.h" #include "ldap.h" #include "common.h" diff --git a/servers/ldapd/common.h b/servers/ldapd/common.h index 9239a72f7d..82ef371fbc 100644 --- a/servers/ldapd/common.h +++ b/servers/ldapd/common.h @@ -10,6 +10,9 @@ * is provided ``as is'' without express or implied warranty. */ +#ifndef _LDAPD_COMMON_H +#define _LDAPD_COMMON_H 1 + /* * This structure represents an association to a dsa. There is one of * these for each association open (a new association is made for each @@ -41,32 +44,17 @@ struct msg { LDAPMod *m_mods; /* for modify operations only */ BerElement *m_ber; /* the unparsed ber for the op */ struct conn *m_conn; /* connection structure */ -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int m_cldap; /* connectionless transport? (CLDAP) */ struct sockaddr m_clientaddr; /* client address (if using CLDAP) */ DN m_searchbase; /* base used in search */ -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ struct msg *m_next; }; #define DEFAULT_TIMEOUT 3600 /* idle client connections */ #define DEFAULT_REFERRAL_TIMEOUT 900 /* DSA connections */ -#ifdef NEEDPROTOS #include "proto-ldapd.h" -#else -extern struct msg *add_msg(); -extern struct msg *get_msg(); -extern struct msg *get_cldap_msg(); -extern int del_msg(); - -extern struct conn *conn_getfd(); -extern struct conn *conn_find(); -extern struct conn *conn_dup(); -extern void conn_del(); -extern AttributeValue ldap_str2AttrV(); -extern DN ldap_str2dn(); -extern void ldap_str2alg(); -extern void ldap_print_algid(); -#endif /* don't need protos */ +#endif diff --git a/servers/ldapd/compare.c b/servers/ldapd/compare.c index 88ac1604f7..7cf0833d10 100644 --- a/servers/ldapd/compare.c +++ b/servers/ldapd/compare.c @@ -10,20 +10,24 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + +#include + #include #include #include #include #include #include -#include -#include + #include "lber.h" #include "ldap.h" #include "common.h" -#ifdef COMPAT20 +#ifdef HAVE_COMPAT20 extern int ldap_compat; #define COMPTAG (ldap_compat == 20 ? OLD_LDAP_RES_COMPARE : LDAP_RES_COMPARE) #else diff --git a/servers/ldapd/delete.c b/servers/ldapd/delete.c index 57fe76ec07..008f341ee3 100644 --- a/servers/ldapd/delete.c +++ b/servers/ldapd/delete.c @@ -10,20 +10,24 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + #include #include #include #include #include #include -#include -#include + +#include + #include "lber.h" #include "ldap.h" #include "common.h" -#ifdef COMPAT20 +#ifdef HAVE_COMPAT20 extern int ldap_compat; #define DELTAG (ldap_compat == 20 ? OLD_LDAP_RES_DELETE : LDAP_RES_DELETE) #else diff --git a/servers/ldapd/detach.c b/servers/ldapd/detach.c index ff435eea82..672ccfda13 100644 --- a/servers/ldapd/detach.c +++ b/servers/ldapd/detach.c @@ -10,20 +10,17 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#ifdef SVR4 + +#include +#include + #include -#endif /* svr4 */ #include #include #include -#include -#include "portable.h" - -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ detach() @@ -33,11 +30,19 @@ detach() extern int ldap_debug; #endif -#ifdef USE_SYSCONF +#ifdef HAVE_SYSCONF nbits = sysconf( _SC_OPEN_MAX ); -#else /* USE_SYSCONF */ +#elif HAVE_GETDTABLESIZE nbits = getdtablesize(); -#endif /* USE_SYSCONF */ +#else + nbits = FD_SETSIZE +#endif + +#ifdef FD_SETSIZE + if( nbits > FD_SETSIZE ) { + nbits = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ #ifdef LDAP_DEBUG if ( ldap_debug == 0 ) { @@ -74,14 +79,14 @@ detach() (void) dup2( sd, 2 ); close( sd ); -#ifdef USE_SETSID +#ifdef HAVE_SETSID 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 */ #ifdef LDAP_DEBUG } #endif diff --git a/servers/ldapd/error.c b/servers/ldapd/error.c index e35448c3f1..5974817988 100644 --- a/servers/ldapd/error.c +++ b/servers/ldapd/error.c @@ -10,14 +10,18 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + +#include +#include + #include #include #include #include -#include -#include -#include + #include "lber.h" #include "ldap.h" diff --git a/servers/ldapd/kerberos.c b/servers/ldapd/kerberos.c index 937236e29a..5f7d9767a1 100644 --- a/servers/ldapd/kerberos.c +++ b/servers/ldapd/kerberos.c @@ -10,20 +10,22 @@ * is provided ``as is'' without express or implied warranty. */ -#ifdef KERBEROS +#include "portable.h" + +#ifdef HAVE_KERBEROS #include -#include -#include "krb.h" -#include -#include -#include + +#include +#include + #include #if ISODEPACKAGE == IC #include #else #include #endif + #include "lber.h" #include "ldap.h" #include "common.h" diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index 5626a34c4f..f5f421e512 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -17,36 +17,37 @@ * University of Minnesota Microcomputer Workstation and Networks Center */ +#include "portable.h" + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef _AIX -#include -#endif -#include + +#include +#include +#include +#include +#include +#include +#include + #include #include -#include "portable.h" + #include "lber.h" #include "ldap.h" #include "common.h" -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ +#ifdef HAVE_TCPD +#include + +int allow_severity = LOG_INFO; +int deny_severity = LOG_NOTICE; +#endif /* TCP_WRAPPERS */ void log_and_exit(); static set_socket(); static do_queries(); -static SIG_FN wait4child(); -#ifdef CLDAP +static RETSIGTYPE wait4child(); +#ifdef LDAP_CONNECTIONLESS static udp_init(); #endif @@ -54,18 +55,18 @@ static udp_init(); int ldap_debug; #endif int version; -#ifdef COMPAT +#ifdef LDAP_COMPAT int ldap_compat; #endif int dosyslog; int do_tcp = 1; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int do_udp = 0; #endif int idletime = DEFAULT_TIMEOUT; int referral_connection_timeout = DEFAULT_REFERRAL_TIMEOUT; struct timeval conn_start_tv; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS char *krb_ldap_service = "ldapserver"; char *krb_x500_service = "x500dsa"; char *krb_x500_instance; @@ -82,13 +83,13 @@ static usage( name ) char *name; { fprintf( stderr, "usage: %s [-d debuglvl] [-p port] [-l] [-c dsa] [-r referraltimeout]", name ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS fprintf( stderr, " [ -U | -t timeout ]" ); #else fprintf( stderr, " [ -t timeout ]" ); #endif fprintf( stderr, " [-I]" ); -#ifdef KERBEROS +#ifdef HAVE_KERBEROS fprintf( stderr, " [-i dsainstance]" ); #endif fprintf( stderr, "\n" ); @@ -99,7 +100,7 @@ int argc; char **argv; { int tcps, ns; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int udps; #endif int myport = LDAP_PORT; @@ -111,7 +112,7 @@ char **argv; int len; int dsapargc; char **dsapargv; - SIG_FN wait4child(); + RETSIGTYPE wait4child(); #ifndef NOSETPROCTITLE char title[80]; extern char **Argv; @@ -139,7 +140,7 @@ char **argv; dsapargv[2] = 0; dsapargv[3] = 0; dsapargc = 1; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS kerberos_keyfile = ""; #endif @@ -178,7 +179,7 @@ char **argv; idletime = atoi( optarg ); break; -#ifdef KERBEROS +#ifdef HAVE_KERBEROS case 'f': /* kerberos key file */ kerberos_keyfile = strdup( optarg ); break; @@ -194,7 +195,7 @@ char **argv; RunFromInetd = 1; break; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS case 'U': /* UDP only (no TCP) */ do_tcp = 0; do_udp = 1; @@ -206,7 +207,7 @@ char **argv; break; #endif /* NOTYET */ -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ default: usage( argv[0] ); @@ -219,7 +220,7 @@ char **argv; exit( 1 ); } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( do_udp && !do_tcp && idletime != DEFAULT_TIMEOUT ) { usage( argv[ 0 ] ); exit( 1 ); @@ -228,11 +229,19 @@ char **argv; Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 ); -#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 ) { + dtblsize = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ #ifndef NOSETPROCTITLE /* for setproctitle */ @@ -292,17 +301,17 @@ char **argv; len = sizeof( socktype ); getsockopt( ns, SOL_SOCKET, SO_TYPE, &socktype, &len ); if ( socktype == SOCK_DGRAM ) { -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS Debug( LDAP_DEBUG_ARGS, "CLDAP request from unknown (%s)\n", inet_ntoa( from.sin_addr ), 0, 0 ); conn_start_tv.tv_sec = 0; udp_init( 0, 0 ); do_queries( ns, 1 ); -#else /* CLDAP */ +#else /* LDAP_CONNECTIONLESS */ Debug( LDAP_DEBUG_ARGS, - "Compile with -DCLDAP for UDP support\n",0,0,0 ); -#endif /* CLDAP */ + "Compile with -DLDAP_CONNECTIONLESS for UDP support\n",0,0,0 ); +#endif /* LDAP_CONNECTIONLESS */ exit( 0 ); } @@ -336,7 +345,7 @@ char **argv; if ( do_tcp ) tcps = set_socket( myport, 0 ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( do_udp ) udps = udp_init( myport, 1 ); #endif @@ -347,7 +356,7 @@ char **argv; */ #ifndef NOSETPROCTITLE -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS sprintf( title, "listening %s/%s %d", do_tcp ? "tcp" : "", do_udp ? "udp" : "", myport ); #else @@ -360,7 +369,7 @@ char **argv; FD_ZERO( &readfds ); if ( do_tcp ) FD_SET( tcps, &readfds ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( do_udp ) FD_SET( udps, &readfds ); #endif @@ -372,7 +381,7 @@ char **argv; continue; } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( do_udp && FD_ISSET( udps, &readfds ) ) { do_queries( udps, 1 ); } @@ -393,10 +402,31 @@ char **argv; hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), sizeof(from.sin_addr.s_addr), AF_INET ); + +#ifdef HAVE_TCPD + if ( !hosts_ctl("ldapd", (hp == NULL) ? "unknown" : hp->h_name, + inet_ntoa( from.sin_addr ), STRING_UNKNOWN ) { + + Debug( LDAP_DEBUG_ARGS, "connection from %s (%s) denied.\n", + (hp == NULL) ? "unknown" : hp->h_name, + inet_ntoa( from.sin_addr ), 0 ); + + if ( dosyslog ) { + syslog( LOG_NOTICE, "connection from %s (%s) denied.", + (hp == NULL) ? "unknown" : hp->h_name, + inet_ntoa( from.sin_addr ) ); + } + + close(ns); + continue; + } +#endif /* TCP_WRAPPERS */ + Debug( LDAP_DEBUG_ARGS, "connection from %s (%s)\n", (hp == NULL) ? "unknown" : hp->h_name, inet_ntoa( from.sin_addr ), 0 ); + if ( dosyslog ) { syslog( LOG_INFO, "connection from %s (%s)", (hp == NULL) ? "unknown" : hp->h_name, @@ -462,10 +492,10 @@ do_queries( int rc, i; struct timeval timeout; Sockbuf sb; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS struct sockaddr saddr, faddr; struct sockaddr *saddrlist[ 1 ]; -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ Debug( LDAP_DEBUG_TRACE, "do_queries%s\n", udp ? " udp" : "", 0, 0 ); @@ -487,7 +517,7 @@ do_queries( (void) memset( (void *) &sb, '\0', sizeof( sb ) ); sb.sb_sd = clientsock; sb.sb_naddr = ( udp ) ? 1 : 0; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS sb.sb_addrs = (void **)saddrlist; sb.sb_fromaddr = &faddr; sb.sb_useaddr = saddrlist[ 0 ] = &saddr; @@ -611,18 +641,20 @@ static set_socket( return( s ); } -static SIG_FN wait4child() +static RETSIGTYPE wait4child() { - WAITSTATUSTYPE status; +#ifndef HAVE_WAITPID + WAITSTATUSTYPE status; +#endif Debug( LDAP_DEBUG_TRACE, "parent: catching child status\n", 0, 0, 0 ); -#ifdef USE_WAITPID - while( waitpid( (pid_t) -1, 0, WAIT_FLAGS ) > 0 ) +#ifdef HAVE_WAITPID + while( waitpid( (pid_t) -1, NULL, WAIT_FLAGS ) > 0 ) ; /* NULL */ #else - while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 ) - ; /* NULL */ + while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 ) + ; /* NULL */ #endif (void) SIGNAL( SIGCHLD, (void *) wait4child ); @@ -648,7 +680,7 @@ log_and_exit( int exitcode ) } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS static int udp_init( int port, diff --git a/servers/ldapd/message.c b/servers/ldapd/message.c index 19e07f64a4..4456295c2e 100644 --- a/servers/ldapd/message.c +++ b/servers/ldapd/message.c @@ -10,13 +10,16 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include -#include + +#include +#include + #include #include + #include "lber.h" #include "ldap.h" #include "common.h" @@ -49,7 +52,7 @@ struct msg *add_msg( new->m_conn->c_refcnt++; new->m_next = NULL; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS new->m_cldap = udp; new->m_searchbase = NULLDN; @@ -106,11 +109,11 @@ del_msg( struct msg *m ) conn_free( cur->m_conn ); modlist_free( cur->m_mods ); ber_free( cur->m_ber, 1 ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( cur->m_searchbase != NULLDN ) { dn_free( cur->m_searchbase ); } -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ free( (char *) cur ); return( 0 ); @@ -146,7 +149,7 @@ send_msg( } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS struct msg * get_cldap_msg( int msgid, @@ -169,4 +172,4 @@ get_cldap_msg( return( tmp ); } -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ diff --git a/servers/ldapd/modify.c b/servers/ldapd/modify.c index bbfd5ed82a..d2197c4039 100644 --- a/servers/ldapd/modify.c +++ b/servers/ldapd/modify.c @@ -10,16 +10,20 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include + +#include +#include + #include #include #include #include #include #include -#include -#include + #include "lber.h" #include "ldap.h" #include "common.h" @@ -39,7 +43,7 @@ extern short ldap_rtl_syntax; extern short ldap_octetstring_syntax; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 extern int ldap_compat; #define MODTAG (ldap_compat == 20 ? OLD_LDAP_RES_MODIFY : LDAP_RES_MODIFY) #else diff --git a/servers/ldapd/modrdn.c b/servers/ldapd/modrdn.c index d3d939eeb5..33ae4f8406 100644 --- a/servers/ldapd/modrdn.c +++ b/servers/ldapd/modrdn.c @@ -10,20 +10,24 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include + +#include + #include #include #include #include #include #include -#include -#include + #include "lber.h" #include "ldap.h" #include "common.h" -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 extern int ldap_compat; #define MODRDNTAG (ldap_compat == 20 ? OLD_LDAP_RES_MODRDN : LDAP_RES_MODRDN) #else diff --git a/servers/ldapd/proto-ldapd.h b/servers/ldapd/proto-ldapd.h index 9556c84e3d..a317c1ccfd 100644 --- a/servers/ldapd/proto-ldapd.h +++ b/servers/ldapd/proto-ldapd.h @@ -1,158 +1,160 @@ -#ifndef _PROTO_LDAPD -#define _PROTO_LDAPD +#ifndef _PROTO_LDAPD_H +#define _PROTO_LDAPD_H + +#include /* * abandon.c */ -int do_abandon( struct conn *dsaconn, BerElement *ber, int msgid ); +int do_abandon LDAP_P(( struct conn *dsaconn, BerElement *ber, int msgid )); /* * add.c */ -int do_add( Sockbuf *clientsb, struct msg *m, BerElement *ber ); +int do_add LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber )); /* * association.c */ -struct conn *conn_dup( struct conn *cn ); -int conn_init(); -void conn_free( struct conn *conn ); -void conn_del( struct conn *conn ); -void conn_badfds(); -struct conn *conn_getfd( fd_set *fds ); -void conn_add( struct conn *new ); -struct conn *conn_find( struct conn *c ); -void conn_add( struct conn *new ); -void conn_close(); -int isclosed( int ad ); +struct conn *conn_dup LDAP_P(( struct conn *cn )); +int conn_init LDAP_P(()); +void conn_free LDAP_P(( struct conn *conn )); +void conn_del LDAP_P(( struct conn *conn )); +void conn_badfds LDAP_P(()); +struct conn *conn_getfd LDAP_P(( fd_set *fds )); +void conn_add LDAP_P(( struct conn *new )); +struct conn *conn_find LDAP_P(( struct conn *c )); +void conn_add LDAP_P(( struct conn *new )); +void conn_close LDAP_P(()); +int isclosed LDAP_P(( int ad )); /* * bind.c */ -int do_bind( Sockbuf *clientsb, struct msg *m, BerElement *ber, int *bound ); -int do_bind_real( struct conn *dsaconn, int *bound, char **matched ); +int do_bind LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber, int *bound )); +int do_bind_real LDAP_P(( struct conn *dsaconn, int *bound, char **matched )); /* * certificate.c */ -int ldap_certif_print( PS ps, struct certificate *parm, int format ); -void ldap_print_algid( PS ps, struct alg_id *parm, int format ); -struct certificate *ldap_str2cert( char *str ); -void ldap_str2alg( char *str, struct alg_id *alg ); -void certif_init(); +int ldap_certif_print LDAP_P(( PS ps, struct certificate *parm, int format )); +void ldap_print_algid LDAP_P(( PS ps, struct alg_id *parm, int format )); +struct certificate *ldap_str2cert LDAP_P(( char *str )); +void ldap_str2alg LDAP_P(( char *str, struct alg_id *alg )); +void certif_init LDAP_P(()); /* * compare.c */ -int do_compare( Sockbuf *clientsb, struct msg *m, BerElement *ber ); +int do_compare LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber )); /* * delete.c */ -int do_delete( Sockbuf *clientsb, struct msg *m, BerElement *ber ); +int do_delete LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber )); /* * error.c */ -void print_error( struct DSError *e ); -int x500err2ldaperr( struct DSError *e, char **matched ); +void print_error LDAP_P(( struct DSError *e )); +int x500err2ldaperr LDAP_P(( struct DSError *e, char **matched )); /* * kerberos.c */ -int kerberosv4_ldap_auth( char *cred, long len ); +int kerberosv4_ldap_auth LDAP_P(( char *cred, long len )); /* * main.c */ -void log_and_exit( int exitcode ); +void log_and_exit LDAP_P(( int exitcode )); /* * message.c */ -struct msg *add_msg( int msgid, int msgtype, BerElement *ber, - struct conn *dsaconn, int udp, struct sockaddr *clientaddr ); -struct msg *get_msg( int uniqid ); -int del_msg( struct msg *m ); -void send_msg( struct conn *conn, Sockbuf *clientsb, int err, char *str ); -struct msg * get_cldap_msg( int msgid, int msgtype, struct sockaddr *fromaddr ); +struct msg *add_msg LDAP_P(( int msgid, int msgtype, BerElement *ber, + struct conn *dsaconn, int udp, struct sockaddr *clientaddr )); +struct msg *get_msg LDAP_P(( int uniqid )); +int del_msg LDAP_P(( struct msg *m )); +void send_msg LDAP_P(( struct conn *conn, Sockbuf *clientsb, int err, char *str )); +struct msg * get_cldap_msg LDAP_P(( int msgid, int msgtype, struct sockaddr *fromaddr )); /* * modify.c */ -int do_modify( Sockbuf *clientsb, struct msg *m, BerElement *ber ); -Attr_Sequence get_as( Sockbuf *clientsb, unsigned long op, struct msg *m, - char *type, struct berval **bvals ); -void modlist_free( LDAPMod *mods ); +int do_modify LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber )); +Attr_Sequence get_as LDAP_P(( Sockbuf *clientsb, unsigned long op, struct msg *m, + char *type, struct berval **bvals )); +void modlist_free LDAP_P(( LDAPMod *mods )); /* * modrdn.c */ -int do_modrdn( Sockbuf *clientsb, struct msg *m, BerElement *ber ); +int do_modrdn LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber )); /* * request.c */ -void client_request( Sockbuf *clientsb, struct conn *dsaconn, int udp ); -int do_request( Sockbuf *clientsb, struct msg *m, BerElement *ber, - int *bound ); -int initiate_dap_operation( int op, struct msg *m, void *arg ); +void client_request LDAP_P(( Sockbuf *clientsb, struct conn *dsaconn, int udp )); +int do_request LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber, + int *bound )); +int initiate_dap_operation LDAP_P(( int op, struct msg *m, void *arg )); /* * result.c */ -void dsa_response( struct conn *dsaconn, Sockbuf *clientsb ); -int send_ldap_msgresult( Sockbuf *sb, unsigned long tag, struct msg *m, - int err, char *matched, char *text ); -int send_ldap_result( Sockbuf *sb, unsigned long tag, int msgid, int err, - char *matched, char *text ); +void dsa_response LDAP_P(( struct conn *dsaconn, Sockbuf *clientsb )); +int send_ldap_msgresult LDAP_P(( Sockbuf *sb, unsigned long tag, struct msg *m, + int err, char *matched, char *text )); +int send_ldap_result LDAP_P(( Sockbuf *sb, unsigned long tag, int msgid, int err, + char *matched, char *text )); /* * search.c */ -int do_search( Sockbuf *clientsb, struct msg *m, BerElement *ber ); +int do_search LDAP_P(( Sockbuf *clientsb, struct msg *m, BerElement *ber )); /* * syntax.c */ -void get_syntaxes(); -int dn_print_real( PS ps, DN dn, int format); -void ldap_dn_print( PS ps, DN dn, DN base, int format); -int encode_dn( BerElement *ber, DN dn, DN base); -int encode_attrs( BerElement *ber, Attr_Sequence as ); -AttributeValue bv_octet2AttrV( struct berval *bv ); -AttributeValue bv_asn2AttrV( struct berval *bv ); -AttributeValue ldap_strdn2AttrV( char *dnstr ); -DN ldap_str2dn( char *str ); -RDN ldap_str2rdn( char *rdnstr ); -AttributeValue ldap_str_at2AttrV( char *str, AttributeType type ); -AttributeValue ldap_str2AttrV( char *value, short syntax ); +void get_syntaxes LDAP_P(()); +int dn_print_real LDAP_P(( PS ps, DN dn, int format)); +void ldap_dn_print LDAP_P(( PS ps, DN dn, DN base, int format)); +int encode_dn LDAP_P(( BerElement *ber, DN dn, DN base)); +int encode_attrs LDAP_P(( BerElement *ber, Attr_Sequence as )); +AttributeValue bv_octet2AttrV LDAP_P(( struct berval *bv )); +AttributeValue bv_asn2AttrV LDAP_P(( struct berval *bv )); +AttributeValue ldap_strdn2AttrV LDAP_P(( char *dnstr )); +DN ldap_str2dn LDAP_P(( char *str )); +RDN ldap_str2rdn LDAP_P(( char *rdnstr )); +AttributeValue ldap_str_at2AttrV LDAP_P(( char *str, AttributeType type )); +AttributeValue ldap_str2AttrV LDAP_P(( char *value, short syntax )); /* * util.c */ -void bprint( char *data, int len ); -void charlist_free( char **cl ); -int get_ava( BerElement *ber, AVA *tava ); -int chase_referral( Sockbuf *clientsb, struct msg *m, struct DSError *err, - char **matched ); +void bprint LDAP_P(( char *data, int len )); +void charlist_free LDAP_P(( char **cl )); +int get_ava LDAP_P(( BerElement *ber, AVA *tava )); +int chase_referral LDAP_P(( Sockbuf *clientsb, struct msg *m, struct DSError *err, + char **matched )); #endif /* _proto_ldapd */ diff --git a/servers/ldapd/request.c b/servers/ldapd/request.c index 51b1d13fa1..77d59eb2f5 100644 --- a/servers/ldapd/request.c +++ b/servers/ldapd/request.c @@ -10,25 +10,22 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include +#include + #include #include #include #include -#ifdef __hpux -#include -#else -#include -#endif + #include "lber.h" #include "ldap.h" #include "common.h" @@ -74,7 +71,7 @@ client_request( static int bound; extern char *bound_dn, *bound_pw; struct PSAPaddr *psap_cpy(); -#ifdef COMPAT +#ifdef LDAP_COMPAT extern int ldap_compat; #endif @@ -92,7 +89,7 @@ client_request( log_and_exit( 1 ); } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( udp && dosyslog ) { syslog( LOG_INFO, "UDP request from unknown (%s)", inet_ntoa( ((struct sockaddr_in *) @@ -105,7 +102,7 @@ client_request( trace_ber( tag, len, ber.ber_buf, stderr, 1, 1 ); #endif -#ifdef COMPAT +#ifdef LDAP_COMPAT /* * This tag should be a normal SEQUENCE tag. In release 2.0 this * tag is 0x10. In the new stuff this is 0x30. To distinguish @@ -159,7 +156,7 @@ client_request( return; } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( udp ) { char *logdn = NULL; @@ -172,16 +169,16 @@ client_request( free( logdn ); } } -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) tag = ber_skip_tag( &ber, &len ); else #endif tag = ber_peek_tag( &ber, &len ); if ( !udp && bound == 0 && tag != LDAP_REQ_BIND -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 && tag != OLD_LDAP_REQ_BIND #endif ) { @@ -191,7 +188,7 @@ client_request( return; } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if (udp && tag != LDAP_REQ_SEARCH && tag != LDAP_REQ_ABANDON ) { send_ldap_result( clientsb, tag, msgid, LDAP_OPERATIONS_ERROR, NULL, "Only search is supported over UDP/CLDAP" ); @@ -216,7 +213,7 @@ client_request( copyofber = ber_dup( &ber ); m = add_msg( msgid, tag, copyofber, dsaconn, udp, -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS (struct sockaddr *)clientsb->sb_fromaddr ); #else NULL ); @@ -257,17 +254,17 @@ do_request( Debug( LDAP_DEBUG_TRACE, "do_request\n", 0, 0, 0 ); switch ( m->m_msgtype ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_BIND: #endif case LDAP_REQ_BIND: resp_required = do_bind( clientsb, m, ber, bound ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_UNBIND: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_UNBIND_30: #endif case LDAP_REQ_UNBIND: @@ -275,55 +272,55 @@ do_request( log_and_exit( 0 ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_ADD: #endif case LDAP_REQ_ADD: resp_required = do_add( clientsb, m, ber ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_DELETE: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_DELETE_30: #endif case LDAP_REQ_DELETE: resp_required = do_delete( clientsb, m, ber ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_MODRDN: #endif case LDAP_REQ_MODRDN: resp_required = do_modrdn( clientsb, m, ber ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_MODIFY: #endif case LDAP_REQ_MODIFY: resp_required = do_modify( clientsb, m, ber ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_COMPARE: #endif case LDAP_REQ_COMPARE: resp_required = do_compare( clientsb, m, ber ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_SEARCH: #endif case LDAP_REQ_SEARCH: resp_required = do_search( clientsb, m, ber ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_ABANDON: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_ABANDON_30: #endif case LDAP_REQ_ABANDON: diff --git a/servers/ldapd/result.c b/servers/ldapd/result.c index 3f77032342..22eb9b933c 100644 --- a/servers/ldapd/result.c +++ b/servers/ldapd/result.c @@ -10,25 +10,24 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include -#include + +#include +#include +#include + #include #include #include -#ifdef __hpux -#include -#else -#include -#endif + #include "lber.h" #include "ldap.h" #include "common.h" extern int dosyslog; -#ifdef COMPAT +#ifdef LDAP_COMPAT extern int ldap_compat; #endif @@ -131,7 +130,7 @@ dsa_response( return; } if ( m->m_msgtype == LDAP_REQ_SEARCH -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 || m->m_msgtype == OLD_LDAP_REQ_SEARCH #endif ) @@ -154,7 +153,7 @@ dsa_response( int bound, rc; switch ( m->m_msgtype ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_ADD: case OLD_LDAP_REQ_MODIFY: case OLD_LDAP_REQ_MODRDN: @@ -162,7 +161,7 @@ dsa_response( case OLD_LDAP_REQ_COMPARE: case OLD_LDAP_REQ_SEARCH: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_DELETE_30: #endif case LDAP_REQ_ADD: @@ -283,7 +282,7 @@ send_ldap_msgresult( char *text ) { -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) { SAFEMEMCPY( (char *)sb->sb_useaddr, &m->m_clientaddr, sizeof( struct sockaddr )); @@ -308,19 +307,19 @@ send_ldap_result( { BerElement *ber; int rc; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int cldap; #endif extern int version; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS cldap = ( sb->sb_naddr > 0 ); #endif Debug( LDAP_DEBUG_TRACE, "send_ldap_result\n", 0, 0, 0 ); if ( tag == LBER_DEFAULT ) -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 tag = ldap_compat == 20 ? OLD_LBER_SEQUENCE : LBER_SEQUENCE; #else tag = LBER_SEQUENCE; @@ -332,20 +331,20 @@ send_ldap_result( } if ( version != 1 ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 if ( ldap_compat == 20 ) { rc = ber_printf( ber, "t{it{tess}}", OLD_LBER_SEQUENCE, msgid, tag, LBER_INTEGER, err, matched ? matched : "", text ); } else #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) { rc = ber_printf( ber, "{it{{ess}}}", msgid, tag, err, matched ? matched : "", text ); } else #endif -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( cldap ) { rc = ber_printf( ber, "{is{t{ess}}}", msgid, "", tag, err, matched ? matched : "", text ); diff --git a/servers/ldapd/search.c b/servers/ldapd/search.c index b250d6371a..c923ce4720 100644 --- a/servers/ldapd/search.c +++ b/servers/ldapd/search.c @@ -10,16 +10,20 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include + +#include +#include + #include #include #include #include #include #include -#include -#include + #include "lber.h" #include "ldap.h" #include "common.h" @@ -28,7 +32,7 @@ static get_filter(); static get_filter_list(); static get_substring_filter(); -#ifdef COMPAT +#ifdef LDAP_COMPAT extern int version; extern int ldap_compat; #define SEARCHRESTAG (ldap_compat == 20 ? OLD_LDAP_RES_SEARCH_RESULT : LDAP_RES_SEARCH_RESULT) @@ -182,11 +186,11 @@ do_search( rc = initiate_dap_operation( OP_SEARCH, m, &sa ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) m->m_searchbase = sa.sra_baseobject; else -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ dn_free( sa.sra_baseobject ); filter_free( sa.sra_filter ); @@ -240,14 +244,14 @@ static get_filter( BerElement *ber, Filter *filt ) err = 0; switch (tag = ber_peek_tag( ber, &len )) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_EQUALITY: #endif case LDAP_FILTER_EQUALITY: Debug( LDAP_DEBUG_ARGS, "EQUALITY\n", 0, 0, 0 ); f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_EQUALITY; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -258,7 +262,7 @@ static get_filter( BerElement *ber, Filter *filt ) } break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_SUBSTRINGS: #endif case LDAP_FILTER_SUBSTRINGS: @@ -266,14 +270,14 @@ static get_filter( BerElement *ber, Filter *filt ) err = get_substring_filter( ber, f ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_GE: #endif case LDAP_FILTER_GE: Debug( LDAP_DEBUG_ARGS, "GE\n", 0, 0, 0 ); f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_GREATEROREQUAL; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -283,14 +287,14 @@ static get_filter( BerElement *ber, Filter *filt ) } break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_LE: #endif case LDAP_FILTER_LE: Debug( LDAP_DEBUG_ARGS, "LE\n", 0, 0, 0 ); f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_LESSOREQUAL; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -301,10 +305,10 @@ static get_filter( BerElement *ber, Filter *filt ) } break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_PRESENT: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_FILTER_PRESENT_30: #endif case LDAP_FILTER_PRESENT: @@ -312,7 +316,7 @@ static get_filter( BerElement *ber, Filter *filt ) f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_PRESENT; len = sizeof(typestr); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -323,14 +327,14 @@ static get_filter( BerElement *ber, Filter *filt ) return( LDAP_UNDEFINED_TYPE ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_APPROX: #endif case LDAP_FILTER_APPROX: Debug( LDAP_DEBUG_ARGS, "APPROX\n", 0, 0, 0 ); f->flt_type = FILTER_ITEM; f->FUITEM.fi_type = FILTERITEM_APPROX; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -341,7 +345,7 @@ static get_filter( BerElement *ber, Filter *filt ) } break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_AND: #endif case LDAP_FILTER_AND: @@ -350,7 +354,7 @@ static get_filter( BerElement *ber, Filter *filt ) err = get_filter_list( ber, f ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_OR: #endif case LDAP_FILTER_OR: @@ -359,7 +363,7 @@ static get_filter( BerElement *ber, Filter *filt ) err = get_filter_list( ber, f ); break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_FILTER_NOT: #endif case LDAP_FILTER_NOT: @@ -389,7 +393,7 @@ static get_filter_list( BerElement *ber, Filter f ) Debug( LDAP_DEBUG_TRACE, "get_filter_list\n", 0, 0, 0 ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -422,7 +426,7 @@ static get_substring_filter( BerElement *ber, Filter f ) Debug( LDAP_DEBUG_TRACE, "get_substring_filter\n", 0, 0, 0 ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) (void) ber_skip_tag( ber, &len ); #endif @@ -444,7 +448,7 @@ static get_substring_filter( BerElement *ber, Filter f ) tag = ber_next_element( ber, &len, last ) ) { AV_Sequence avs, any_end; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) { if ( ber_scanf( ber, "{a}", &valstr ) == LBER_ERROR ) { return( LDAP_PROTOCOL_ERROR ); @@ -466,10 +470,10 @@ static get_substring_filter( BerElement *ber, Filter f ) return( LDAP_OPERATIONS_ERROR ); switch ( tag ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_SUBSTRING_INITIAL: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_INITIAL_30: #endif case LDAP_SUBSTRING_INITIAL: @@ -482,10 +486,10 @@ static get_substring_filter( BerElement *ber, Filter f ) f->FUITEM.UNSUB.fi_sub_initial = avs; break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_SUBSTRING_ANY: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_ANY_30: #endif case LDAP_SUBSTRING_ANY: @@ -500,10 +504,10 @@ static get_substring_filter( BerElement *ber, Filter f ) any_end = avs; break; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_SUBSTRING_FINAL: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_FINAL_30: #endif case LDAP_SUBSTRING_FINAL: @@ -546,7 +550,7 @@ search_result( correlate_search_results( sr ); } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) { if ((ber = der_alloc()) == NULLBER ) { send_ldap_msgresult( sb, SEARCHRESTAG, m, @@ -565,9 +569,9 @@ search_result( for ( e = sr->CSR_entries; e != NULLENTRYINFO; e = e->ent_next ) { Debug( LDAP_DEBUG_ARGS, "\tentry:\n", 0, 0, 0 ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( !m->m_cldap ) -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ if ( (ber = der_alloc()) == NULLBER ) { send_ldap_msgresult( sb, SEARCHRESTAG, m, @@ -575,7 +579,7 @@ search_result( return; } -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 if ( version == 1 ) { if ( ber_printf( ber, "t{it{", OLD_LBER_SEQUENCE, m->m_msgid, OLD_LDAP_RES_SEARCH_ENTRY ) == -1 ) { @@ -585,7 +589,7 @@ search_result( } } else #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) { if ( ber_printf( ber, "{it{{", m->m_msgid, LDAP_RES_SEARCH_ENTRY ) == -1 ) { @@ -595,11 +599,11 @@ search_result( } } else #endif -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) rc = ber_printf( ber, "t{", LDAP_RES_SEARCH_ENTRY ); else -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ rc = ber_printf( ber, "{it{", m->m_msgid, LDAP_RES_SEARCH_ENTRY ); @@ -609,10 +613,10 @@ search_result( return; } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) rc = encode_dn( ber, e->ent_dn, m->m_searchbase ); -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ else rc = encode_dn( ber, e->ent_dn, NULLDN ); @@ -628,7 +632,7 @@ search_result( return; } -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 if ( version == 1 ) { if ( ber_printf( ber, "}}" ) == -1 ) { send_ldap_msgresult( sb, SEARCHRESTAG, m, @@ -638,7 +642,7 @@ search_result( } } else #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) { if ( ber_printf( ber, "}}}" ) == -1 ) { send_ldap_msgresult( sb, SEARCHRESTAG, m, @@ -648,11 +652,11 @@ search_result( } } else #endif -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) rc = ber_printf( ber, "}" ); else -#endif /* CLDAP */ +#endif /* LDAP_CONNECTIONLESS */ rc = ber_printf( ber, "}}" ); if ( rc == -1 ) { @@ -667,7 +671,7 @@ search_result( ber->ber_buf, stderr, 0, 0 ); #endif -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( !m->m_cldap ) #endif (void) ber_flush( sb, ber, 1 ); @@ -688,7 +692,7 @@ search_result( Debug( LDAP_DEBUG_ARGS, "\tresult:\n", 0, 0, 0 ); -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) { if ( ber_printf( ber, "t{ess}}}", SEARCHRESTAG, rc, "", "" ) == -1 ) { diff --git a/servers/ldapd/setproctitle.c b/servers/ldapd/setproctitle.c index e1022ee75b..a3f4bc3a3e 100644 --- a/servers/ldapd/setproctitle.c +++ b/servers/ldapd/setproctitle.c @@ -1,3 +1,5 @@ +#include "portable.h" + #ifndef NOSETPROCTITLE /* * Copyright (c) 1990,1991 Regents of the University of Michigan. diff --git a/servers/ldapd/syntax.c b/servers/ldapd/syntax.c index 8569478eeb..5124e1400f 100644 --- a/servers/ldapd/syntax.c +++ b/servers/ldapd/syntax.c @@ -10,17 +10,21 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include + +#include +#include +#include + #include #include #include #include #include #include -#include -#include + #include "lber.h" #include "ldap.h" #include "common.h" @@ -544,7 +548,7 @@ int encode_attrs( BerElement *ber, Attr_Sequence as ) { PS ps; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 extern int ldap_compat; #endif @@ -555,7 +559,7 @@ encode_attrs( BerElement *ber, Attr_Sequence as ) if ( str_setup( ps, NULLCP, 0, 0 ) == NOTOK ) return( -1 ); -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 if ( ber_printf( ber, "t{", ldap_compat == 20 ? OLD_LBER_SEQUENCE : LBER_SEQUENCE ) == -1 ) { #else @@ -570,7 +574,7 @@ encode_attrs( BerElement *ber, Attr_Sequence as ) AttrT_print( ps, as->attr_type, EDBOUT ); *ps->ps_ptr = '\0'; -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 if ( ber_printf( ber, "t{st[", ldap_compat == 20 ? OLD_LBER_SEQUENCE : LBER_SEQUENCE, ps->ps_base, ldap_compat == 20 ? OLD_LBER_SET : LBER_SET ) == -1 ) { diff --git a/servers/ldapd/util.c b/servers/ldapd/util.c index 27ecea9a5a..965d1cd78c 100644 --- a/servers/ldapd/util.c +++ b/servers/ldapd/util.c @@ -10,15 +10,20 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include + +#include +#include +#include +#include + #include -#include -#include + #include #include + #include "lber.h" #include "ldap.h" #include "common.h"