mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
include portable.h
This commit is contained in:
parent
c7fe14a916
commit
b76c56ba3f
@ -5,6 +5,9 @@
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* define this if toupper() requires tolower() check */
|
||||
#undef C_UPPER_LOWER
|
||||
|
||||
/* define this if sys_errlist is not defined in stdio.h or errno.h */
|
||||
#undef DECL_SYS_ERRLIST
|
||||
|
||||
|
34
aclocal.m4
vendored
34
aclocal.m4
vendored
@ -113,7 +113,7 @@ AC_DEFUN([OL_BERKELEY_DB2],
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_berkeley_db2 = yes ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB2)
|
||||
AC_DEFINE(HAVE_BERKELEY_DB2,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
@ -179,7 +179,7 @@ AC_DEFUN([OL_BERKELEY_DB],
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_berkeley_db = yes ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB)
|
||||
AC_DEFINE(HAVE_BERKELEY_DB,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
@ -224,7 +224,7 @@ AC_DEFUN([OL_GDBM],
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_gdbm = yes ; then
|
||||
AC_DEFINE(HAVE_GDBM)
|
||||
AC_DEFINE(HAVE_GDBM,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
@ -280,7 +280,7 @@ AC_DEFUN([OL_NDBM],
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_ndbm = yes ; then
|
||||
AC_DEFINE(HAVE_NDBM)
|
||||
AC_DEFINE(HAVE_NDBM,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
@ -340,6 +340,30 @@ AC_CACHE_CHECK([for LinuxThreads], [ol_cv_linux_threads], [
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if toupper() requires islower() to be called first
|
||||
AC_DEFUN([OL_C_UPPER_LOWER],
|
||||
[
|
||||
AC_MSG_CHECKING([if toupper() requires islower()])
|
||||
AC_CACHE_VAL(ol_cv_c_upper_lower,[
|
||||
AC_TRY_RUN([
|
||||
#include <ctypes.h>
|
||||
main()
|
||||
{
|
||||
if ('C' == toupper('C'))
|
||||
exit 0;
|
||||
else
|
||||
exit 1;
|
||||
}],
|
||||
[ol_cv_c_upper_lower=no],
|
||||
[ol_cv_c_upper_lower=yes],
|
||||
[ol_cv_c_upper_lower=safe])])
|
||||
AC_MSG_RESULT($ol_cv_c_upper_lower)
|
||||
if test $ol_cv_c_upper_lower != no ; then
|
||||
AC_DEFINE(C_UPPER_LOWER,1)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
|
||||
dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
|
||||
@ -359,7 +383,7 @@ AC_MSG_RESULT($ol_cv_dcl_sys_errlist)
|
||||
|
||||
# It's possible (for near-UNIX clones) that sys_errlist doesn't exist
|
||||
if test $ol_cv_dcl_sys_errlist = no ; then
|
||||
AC_DEFINE(DECL_SYS_ERRLIST)
|
||||
AC_DEFINE(DECL_SYS_ERRLIST,1)
|
||||
AC_MSG_CHECKING([existence of sys_errlist])
|
||||
AC_CACHE_VAL(ol_cv_have_sys_errlist,[
|
||||
AC_TRY_LINK([#include <errno.h>],
|
||||
|
155
configure
vendored
155
configure
vendored
@ -5430,103 +5430,58 @@ EOF
|
||||
fi
|
||||
|
||||
|
||||
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
|
||||
echo "configure:5435: checking whether byte ordering is bigendian" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
|
||||
|
||||
echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
|
||||
echo "configure:5436: 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
|
||||
ac_cv_c_bigendian=unknown
|
||||
# See if sys/param.h defines the BYTE_ORDER macro.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5442 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
int main() {
|
||||
|
||||
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
|
||||
bogus endian macros
|
||||
#endif
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
# It does; now see whether it defined to BIG_ENDIAN or not.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5457 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
int main() {
|
||||
|
||||
#if BYTE_ORDER != BIG_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_bigendian=yes
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
ac_cv_c_bigendian=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
fi
|
||||
rm -f conftest*
|
||||
if test $ac_cv_c_bigendian = unknown; then
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
if test "$cross_compiling" = yes; then
|
||||
ol_cv_c_upper_lower=safe
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5488 "configure"
|
||||
#line 5445 "configure"
|
||||
#include "confdefs.h"
|
||||
main () {
|
||||
/* Are we little or big endian? From Harbison&Steele. */
|
||||
union
|
||||
{
|
||||
long l;
|
||||
char c[sizeof (long)];
|
||||
} u;
|
||||
u.l = 1;
|
||||
exit (u.c[sizeof (long) - 1] == 1);
|
||||
|
||||
#include <ctypes.h>
|
||||
main()
|
||||
{
|
||||
if ('C' == toupper('C'))
|
||||
exit 0;
|
||||
else
|
||||
exit 1;
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:5501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:5457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
ac_cv_c_bigendian=no
|
||||
ol_cv_c_upper_lower=no
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -fr conftest*
|
||||
ac_cv_c_bigendian=yes
|
||||
ol_cv_c_upper_lower=yes
|
||||
fi
|
||||
rm -fr conftest*
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$ac_t""$ac_cv_c_bigendian" 1>&6
|
||||
if test $ac_cv_c_bigendian = yes; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define WORDS_BIGENDIAN 1
|
||||
echo "$ac_t""$ol_cv_c_upper_lower" 1>&6
|
||||
if test $ol_cv_c_upper_lower != no ; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define C_UPPER_LOWER 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for working const""... $ac_c" 1>&6
|
||||
echo "configure:5525: checking for working const" >&5
|
||||
echo "configure:5480: 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 <<EOF
|
||||
#line 5530 "configure"
|
||||
#line 5485 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
@ -5575,7 +5530,7 @@ ccp = (char const *const *) p;
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:5534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_const=yes
|
||||
else
|
||||
@ -5598,7 +5553,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
|
||||
echo "configure:5602: checking for 8-bit clean memcmp" >&5
|
||||
echo "configure:5557: 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
|
||||
@ -5606,7 +5561,7 @@ else
|
||||
ac_cv_func_memcmp_clean=no
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5610 "configure"
|
||||
#line 5565 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
main()
|
||||
@ -5616,7 +5571,7 @@ main()
|
||||
}
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:5620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:5575: \"$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
|
||||
@ -5634,12 +5589,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:5638: checking for strftime" >&5
|
||||
echo "configure:5593: 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 <<EOF
|
||||
#line 5643 "configure"
|
||||
#line 5598 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char strftime(); below. */
|
||||
@ -5662,7 +5617,7 @@ strftime();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_strftime=yes"
|
||||
else
|
||||
@ -5684,7 +5639,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:5688: checking for strftime in -lintl" >&5
|
||||
echo "configure:5643: 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
|
||||
@ -5692,7 +5647,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lintl $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5696 "configure"
|
||||
#line 5651 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -5703,7 +5658,7 @@ int main() {
|
||||
strftime()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5662: \"$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
|
||||
@ -5730,12 +5685,12 @@ fi
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
|
||||
echo "configure:5734: checking for vprintf" >&5
|
||||
echo "configure:5689: 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 <<EOF
|
||||
#line 5739 "configure"
|
||||
#line 5694 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char vprintf(); below. */
|
||||
@ -5758,7 +5713,7 @@ vprintf();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_vprintf=yes"
|
||||
else
|
||||
@ -5782,12 +5737,12 @@ fi
|
||||
|
||||
if test "$ac_cv_func_vprintf" != yes; then
|
||||
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
|
||||
echo "configure:5786: checking for _doprnt" >&5
|
||||
echo "configure:5741: 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 <<EOF
|
||||
#line 5791 "configure"
|
||||
#line 5746 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char _doprnt(); below. */
|
||||
@ -5810,7 +5765,7 @@ _doprnt();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func__doprnt=yes"
|
||||
else
|
||||
@ -5835,7 +5790,7 @@ fi
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6
|
||||
echo "configure:5839: checking for wait3 that fills in rusage" >&5
|
||||
echo "configure:5794: 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
|
||||
@ -5843,7 +5798,7 @@ else
|
||||
ac_cv_func_wait3_rusage=no
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5847 "configure"
|
||||
#line 5802 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
@ -5874,7 +5829,7 @@ main() {
|
||||
}
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:5878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:5833: \"$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
|
||||
@ -5926,12 +5881,12 @@ for ac_func in \
|
||||
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:5930: checking for $ac_func" >&5
|
||||
echo "configure:5885: 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 <<EOF
|
||||
#line 5935 "configure"
|
||||
#line 5890 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -5954,7 +5909,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@ -5982,12 +5937,12 @@ done
|
||||
for ac_func in getopt strdup
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:5986: checking for $ac_func" >&5
|
||||
echo "configure:5941: 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 <<EOF
|
||||
#line 5991 "configure"
|
||||
#line 5946 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -6010,7 +5965,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:6014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
@ -6040,13 +5995,13 @@ done
|
||||
# Check Configuration
|
||||
|
||||
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
|
||||
echo "configure:6044: checking declaration of sys_errlist" >&5
|
||||
echo "configure:5999: 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 <<EOF
|
||||
#line 6050 "configure"
|
||||
#line 6005 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@ -6056,7 +6011,7 @@ int main() {
|
||||
char *c = (char *) *sys_errlist
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:6060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:6015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ol_cv_dcl_sys_errlist=yes
|
||||
else
|
||||
@ -6077,20 +6032,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:6081: checking existence of sys_errlist" >&5
|
||||
echo "configure:6036: 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 <<EOF
|
||||
#line 6087 "configure"
|
||||
#line 6042 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <errno.h>
|
||||
int main() {
|
||||
char *c = (char *) *sys_errlist
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:6094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:6049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
ol_cv_have_sys_errlist=yes
|
||||
else
|
||||
|
@ -716,7 +716,7 @@ AC_STRUCT_ST_BLKSIZE
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
OL_C_UPPER_LOWER
|
||||
AC_C_CONST
|
||||
|
||||
dnl AC_CHECK_SIZEOF(short)
|
||||
|
@ -104,9 +104,8 @@ is provided ``as is'' without express or implied warranty.
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define if your processor stores words with the most significant
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
/* define this if toupper() requires tolower() check */
|
||||
#undef C_UPPER_LOWER
|
||||
|
||||
/* define this if sys_errlist is not defined in stdio.h or errno.h */
|
||||
#undef DECL_SYS_ERRLIST
|
||||
|
@ -12,9 +12,11 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <ac/socket.h>
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
extern Backend *select_backend();
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* acl.c - routines to parse and check acl's */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* acl.c - routines to parse and check acl's */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -7,12 +8,13 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include "regex.h"
|
||||
#include <unistd.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include "portable.h"
|
||||
|
||||
extern Filter *str2filter();
|
||||
extern char *re_comp();
|
||||
extern struct acl *global_acl;
|
||||
extern char **str2charray();
|
||||
extern char *dn_upcase();
|
||||
@ -26,6 +28,62 @@ static void print_acl();
|
||||
static void print_access();
|
||||
#endif
|
||||
|
||||
int
|
||||
regtest(char *fname, int lineno, char *pat) {
|
||||
int e;
|
||||
regex_t re;
|
||||
|
||||
char buf[512];
|
||||
int size;
|
||||
|
||||
char *sp;
|
||||
char *dp;
|
||||
int flag;
|
||||
|
||||
sp = pat;
|
||||
dp = buf;
|
||||
size = 0;
|
||||
buf[0] = '\0';
|
||||
|
||||
for (size = 0, flag = 0; (size < sizeof(buf)) && *sp; sp++) {
|
||||
if (flag) {
|
||||
if (*sp == '$'|| (*sp >= '0' && *sp <= '9')) {
|
||||
*dp++ = *sp;
|
||||
size++;
|
||||
}
|
||||
flag = 0;
|
||||
|
||||
} else {
|
||||
if (*sp == '$') {
|
||||
flag = 1;
|
||||
} else {
|
||||
*dp++ = *sp;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*dp = '\0';
|
||||
if ( size >= (sizeof(buf)-1) ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" too large\n",
|
||||
fname, lineno, pat, 0 );
|
||||
acl_usage();
|
||||
}
|
||||
|
||||
if ((e = regcomp(&re, buf, REG_EXTENDED|REG_ICASE))) {
|
||||
char error[512];
|
||||
regerror(e, &re, error, sizeof(error));
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" bad because of %s\n",
|
||||
fname, lineno, pat, error );
|
||||
acl_usage();
|
||||
return(0);
|
||||
}
|
||||
regfree(&re);
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
parse_acl(
|
||||
Backend *be,
|
||||
@ -58,6 +116,17 @@ parse_acl(
|
||||
}
|
||||
|
||||
if ( strcasecmp( argv[i], "*" ) == 0 ) {
|
||||
int e;
|
||||
if ((e = regcomp( &a->acl_dnre, ".*",
|
||||
REG_EXTENDED|REG_ICASE)))
|
||||
{
|
||||
char buf[512];
|
||||
regerror(e, &a->acl_dnre, buf, sizeof(buf));
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" bad because of %s\n",
|
||||
fname, lineno, right, buf );
|
||||
acl_usage();
|
||||
}
|
||||
a->acl_dnpat = strdup( ".*" );
|
||||
continue;
|
||||
}
|
||||
@ -79,14 +148,19 @@ parse_acl(
|
||||
acl_usage();
|
||||
}
|
||||
} else if ( strcasecmp( left, "dn" ) == 0 ) {
|
||||
if ( (e = re_comp( right )) != NULL ) {
|
||||
int e;
|
||||
if ((e = regcomp(&a->acl_dnre, right,
|
||||
REG_EXTENDED|REG_ICASE))) {
|
||||
char buf[512];
|
||||
regerror(e, &a->acl_dnre, buf, sizeof(buf));
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" bad because of %s\n",
|
||||
fname, lineno, right, e );
|
||||
"%s: line %d: regular expression \"%s\" bad because of %s\n",
|
||||
fname, lineno, right, buf );
|
||||
acl_usage();
|
||||
|
||||
} else {
|
||||
a->acl_dnpat = dn_upcase(strdup( right ));
|
||||
}
|
||||
a->acl_dnpat = dn_upcase( strdup(
|
||||
right ) );
|
||||
} else if ( strncasecmp( left, "attr", 4 )
|
||||
== 0 ) {
|
||||
char **alist;
|
||||
@ -96,7 +170,7 @@ parse_acl(
|
||||
free( alist );
|
||||
} else {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: expecting <what> got \"%s\"\n",
|
||||
"%s: line %d: expecting <what> got \"%s\"\n",
|
||||
fname, lineno, left );
|
||||
acl_usage();
|
||||
}
|
||||
@ -106,7 +180,7 @@ parse_acl(
|
||||
} else if ( strcasecmp( argv[i], "by" ) == 0 ) {
|
||||
if ( a == NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: to clause required before by clause in access line\n",
|
||||
"%s: line %d: to clause required before by clause in access line\n",
|
||||
fname, lineno );
|
||||
acl_usage();
|
||||
}
|
||||
@ -131,38 +205,27 @@ parse_acl(
|
||||
} else if ( strcasecmp( argv[i], "self" ) == 0 ) {
|
||||
b->a_dnpat = strdup( "self" );
|
||||
} else if ( strcasecmp( left, "dn" ) == 0 ) {
|
||||
if ( (e = re_comp( right )) != NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" bad: %s\n",
|
||||
fname, lineno, right, e );
|
||||
acl_usage();
|
||||
}
|
||||
regtest(fname, lineno, right);
|
||||
b->a_dnpat = dn_upcase( strdup( right ) );
|
||||
} else if ( strcasecmp( left, "dnattr" )
|
||||
== 0 ) {
|
||||
} else if ( strcasecmp( left, "dnattr" ) == 0 ) {
|
||||
b->a_dnattr = strdup( right );
|
||||
} else if ( strcasecmp( left, "domain" )
|
||||
== 0 ) {
|
||||
char *s;
|
||||
|
||||
if ( (e = re_comp( right )) != NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" bad: %s\n",
|
||||
fname, lineno, right, e );
|
||||
acl_usage();
|
||||
}
|
||||
#ifdef ACLGROUP
|
||||
} else if ( strcasecmp( left, "group" ) == 0 ) {
|
||||
regtest(fname, lineno, right);
|
||||
b->a_group = dn_upcase(strdup( right ));
|
||||
#endif /* ACLGROUP */
|
||||
} else if ( strcasecmp( left, "domain" ) == 0 ) {
|
||||
char *s;
|
||||
regtest(fname, lineno, right);
|
||||
b->a_domainpat = strdup( right );
|
||||
|
||||
/* normalize the domain */
|
||||
for ( s = b->a_domainpat; *s; s++ ) {
|
||||
*s = TOLOWER( *s );
|
||||
}
|
||||
} else if ( strcasecmp( left, "addr" ) == 0 ) {
|
||||
if ( (e = re_comp( right )) != NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: regular expression \"%s\" bad: %s\n",
|
||||
fname, lineno, right, e );
|
||||
acl_usage();
|
||||
}
|
||||
regtest(fname, lineno, right);
|
||||
b->a_addrpat = strdup( right );
|
||||
} else {
|
||||
fprintf( stderr,
|
||||
@ -198,16 +261,15 @@ parse_acl(
|
||||
|
||||
/* if we have no real access clause, complain and do nothing */
|
||||
if ( a == NULL ) {
|
||||
|
||||
fprintf( stderr,
|
||||
"%s: line %d: warning: no access clause(s) specified in access line\n",
|
||||
"%s: line %d: warning: no access clause(s) specified in access line\n",
|
||||
fname, lineno );
|
||||
|
||||
} else {
|
||||
|
||||
if ( a->acl_access == NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: warning: no by clause(s) specified in access line\n",
|
||||
"%s: line %d: warning: no by clause(s) specified in access line\n",
|
||||
fname, lineno );
|
||||
}
|
||||
|
||||
@ -373,4 +435,4 @@ print_acl( struct acl *a )
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* attr.c - routines for dealing with attributes */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* ava.c - routines for dealing with attribute value assertions */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* abandon.c - ldbm backend abandon routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
ldbm_back_abandon()
|
||||
{
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* add.c - ldap ldbm back-end add routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* attr.c - backend routines for dealing with attributes */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -5,8 +5,16 @@
|
||||
|
||||
#include "ldbm.h"
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define DEFAULT_CACHE_SIZE 1000
|
||||
#define DEFAULT_DBCACHE_SIZE 100000
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
# define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE)
|
||||
#else
|
||||
# define DEFAULT_DBCACHE_SIZE 100000
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DB_DIRECTORY "/usr/tmp"
|
||||
#define DEFAULT_MODE 0600
|
||||
|
||||
@ -102,13 +110,14 @@ struct ldbminfo {
|
||||
struct cache li_cache;
|
||||
Avlnode *li_attrs;
|
||||
int li_dbcachesize;
|
||||
int li_flush_wrt;
|
||||
struct dbcache li_dbcache[MAXDBCACHE];
|
||||
pthread_mutex_t li_dbcache_mutex;
|
||||
pthread_cond_t li_dbcache_cv;
|
||||
};
|
||||
|
||||
#ifdef NEEDPROTOS
|
||||
#include "proto-back-ldbm.h"
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#endif /* _back_ldbm_h_ */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* bind.c - ldbm backend bind and unbind routines */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* cache.c - routines to maintain an in-core cache of entries */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* close.c - close ldbm backend */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* compare.c - ldbm backend compare routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* config.c - ldbm backend configuration file routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -77,6 +79,10 @@ ldbm_back_config(
|
||||
}
|
||||
li->li_dbcachesize = atoi( argv[1] );
|
||||
|
||||
/* flush on writes */
|
||||
} else if ( strcasecmp( argv[0], "flushwrites" ) == 0 ) {
|
||||
li->li_flush_wrt = 1;
|
||||
|
||||
/* anything else */
|
||||
} else {
|
||||
fprintf( stderr,
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ldbmcache.c - maintain a cache of open ldbm files */
|
||||
|
||||
#define DISABLE_BRIDGE /* disable LDAP_BRIDGE code */
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* delete.c - ldbm backend delete routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* dn2id.c - routines to deal with the dn2id index */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* filterindex.c - generate the list of candidate entries from a filter */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* compare.c - ldbm backend compare routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* id2children.c - routines to deal with the id2children index */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -23,6 +25,11 @@ id2children_add(
|
||||
IDList *idl;
|
||||
char buf[20];
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &key, 0, sizeof( key ) );
|
||||
memset( &data, 0, sizeof( data ) );
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %d, %d )\n", p ? p->e_id
|
||||
: 0, e->e_id, 0 );
|
||||
|
||||
@ -63,6 +70,10 @@ has_children(
|
||||
IDList *idl;
|
||||
char buf[20];
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &key, 0, sizeof( key ) );
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> has_children( %d )\n", p->e_id , 0, 0 );
|
||||
|
||||
if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* id2entry.c - routines to deal with the id2entry index */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* idl.c - ldap id list handling routines */
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* index.c - routines for dealing with attribute indexes */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -105,6 +107,10 @@ index_read(
|
||||
char *realval, *tmpval;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &key, 0, sizeof( key ) );
|
||||
#endif
|
||||
|
||||
prefix = index2prefix( indextype );
|
||||
Debug( LDAP_DEBUG_TRACE, "=> index_read( \"%s\" \"%c\" \"%s\" )\n",
|
||||
type, prefix, val );
|
||||
@ -130,25 +136,26 @@ index_read(
|
||||
realval = val;
|
||||
tmpval = NULL;
|
||||
if ( prefix != '\0' ) {
|
||||
int len;
|
||||
int len = strlen( val );
|
||||
|
||||
if ( (len = strlen( val )) < sizeof(buf) ) {
|
||||
buf[0] = prefix;
|
||||
strcpy( &buf[1], val );
|
||||
if ( (len + 2) < sizeof(buf) ) {
|
||||
realval = buf;
|
||||
} else {
|
||||
/* value + prefix + null */
|
||||
tmpval = (char *) ch_malloc( len + 2 );
|
||||
tmpval[0] = prefix;
|
||||
strcat( &tmpval[1], val );
|
||||
realval = tmpval;
|
||||
}
|
||||
realval[0] = prefix;
|
||||
strcpy( &realval[1], val );
|
||||
}
|
||||
|
||||
key.dptr = realval;
|
||||
key.dsize = strlen( realval ) + 1;
|
||||
|
||||
idl = idl_fetch( be, db, key );
|
||||
if ( tmpval != NULL ) {
|
||||
free( tmpval );
|
||||
}
|
||||
|
||||
ldbm_cache_close( be, db );
|
||||
|
||||
@ -174,6 +181,10 @@ add_value(
|
||||
char *realval, *tmpval, *s;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &key, 0, sizeof( key ) );
|
||||
#endif
|
||||
|
||||
prefix = index2prefix( indextype );
|
||||
Debug( LDAP_DEBUG_TRACE, "=> add_value( \"%c%s\" )\n", prefix, val, 0 );
|
||||
|
||||
@ -181,19 +192,17 @@ add_value(
|
||||
tmpval = NULL;
|
||||
idl = NULL;
|
||||
if ( prefix != '\0' ) {
|
||||
int len;
|
||||
int len = strlen( val );
|
||||
|
||||
if ( (len = strlen( val )) < sizeof(buf) ) {
|
||||
buf[0] = prefix;
|
||||
strcpy( &buf[1], val );
|
||||
if ( (len + 2) < sizeof(buf) ) {
|
||||
realval = buf;
|
||||
} else {
|
||||
/* value + prefix + null */
|
||||
tmpval = (char *) ch_malloc( len + 2 );
|
||||
tmpval[0] = prefix;
|
||||
strcat( &tmpval[1], val );
|
||||
realval = tmpval;
|
||||
}
|
||||
realval[0] = prefix;
|
||||
strcpy( &realval[1], val );
|
||||
}
|
||||
|
||||
key.dptr = realval;
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* init.c - initialize ldbm backend */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -15,6 +17,10 @@ ldbm_back_init(
|
||||
char *argv[ 4 ];
|
||||
int i;
|
||||
|
||||
#ifdef LDAP_CRYPT
|
||||
extern pthread_mutex_t crypt_mutex;
|
||||
#endif /* LDAP_CRYPT */
|
||||
|
||||
/* allocate backend-specific stuff */
|
||||
li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) );
|
||||
|
||||
@ -59,6 +65,9 @@ ldbm_back_init(
|
||||
pthread_mutex_init( &li->li_cache.c_mutex, pthread_mutexattr_default );
|
||||
pthread_mutex_init( &li->li_nextid_mutex, pthread_mutexattr_default );
|
||||
pthread_mutex_init( &li->li_dbcache_mutex, pthread_mutexattr_default );
|
||||
#ifdef LDAP_CRYPT
|
||||
pthread_mutex_init( &crypt_mutex, pthread_mutexattr_default );
|
||||
#endif /* LDAP_CRYPT */
|
||||
pthread_cond_init( &li->li_dbcache_cv, pthread_condattr_default );
|
||||
for ( i = 0; i < MAXDBCACHE; i++ ) {
|
||||
pthread_mutex_init( &li->li_dbcache[i].dbc_mutex,
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* kerberos.c - ldbm backend kerberos bind routines */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* modify.c - ldbm backend modify routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* modrdn.c - ldbm backend modrdn routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* id.c - keep track of the next id to be given out */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,112 +1,117 @@
|
||||
#ifndef _PROTO_BACK_LDBM
|
||||
#define _PROTO_BACK_LDBM
|
||||
|
||||
#include <ldap_cdefs.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* attr.c
|
||||
*/
|
||||
|
||||
void attr_masks( struct ldbminfo *li, char *type, int *indexmask,
|
||||
int *syntaxmask );
|
||||
void attr_index_config( struct ldbminfo *li, char *fname, int lineno,
|
||||
int argc, char **argv, int init );
|
||||
void attr_masks LDAP_P(( struct ldbminfo *li, char *type, int *indexmask,
|
||||
int *syntaxmask ));
|
||||
void attr_index_config LDAP_P(( struct ldbminfo *li, char *fname, int lineno,
|
||||
int argc, char **argv, int init ));
|
||||
|
||||
/*
|
||||
* cache.c
|
||||
*/
|
||||
|
||||
void cache_set_state( struct cache *cache, Entry *e, int state );
|
||||
void cache_return_entry_r( struct cache *cache, Entry *e );
|
||||
void cache_return_entry_w( struct cache *cache, Entry *e );
|
||||
int cache_add_entry_lock( struct cache *cache, Entry *e, int state );
|
||||
ID cache_find_entry_dn2id( Backend *be, struct cache *cache, char *dn );
|
||||
Entry * cache_find_entry_id( struct cache *cache, ID id, int rw );
|
||||
int cache_delete_entry( struct cache *cache, Entry *e );
|
||||
void cache_set_state LDAP_P(( struct cache *cache, Entry *e, int state ));
|
||||
void cache_return_entry_r LDAP_P(( struct cache *cache, Entry *e ));
|
||||
void cache_return_entry_w LDAP_P(( struct cache *cache, Entry *e ));
|
||||
int cache_add_entry_lock LDAP_P(( struct cache *cache, Entry *e, int state ));
|
||||
ID cache_find_entry_dn2id LDAP_P(( Backend *be, struct cache *cache, char *dn ));
|
||||
Entry * cache_find_entry_id LDAP_P(( struct cache *cache, ID id, int rw ));
|
||||
int cache_delete_entry LDAP_P(( struct cache *cache, Entry *e ));
|
||||
|
||||
/*
|
||||
* dbcache.c
|
||||
*/
|
||||
|
||||
struct dbcache * ldbm_cache_open( Backend *be, char *name, char *suffix,
|
||||
int flags );
|
||||
void ldbm_cache_close( Backend *be, struct dbcache *db );
|
||||
void ldbm_cache_flush_all( Backend *be );
|
||||
Datum ldbm_cache_fetch( struct dbcache *db, Datum key );
|
||||
int ldbm_cache_store( struct dbcache *db, Datum key, Datum data, int flags );
|
||||
int ldbm_cache_delete( struct dbcache *db, Datum key );
|
||||
struct dbcache * ldbm_cache_open LDAP_P(( Backend *be, char *name, char *suffix,
|
||||
int flags ));
|
||||
void ldbm_cache_close LDAP_P(( Backend *be, struct dbcache *db ));
|
||||
void ldbm_cache_flush_all LDAP_P(( Backend *be ));
|
||||
Datum ldbm_cache_fetch LDAP_P(( struct dbcache *db, Datum key ));
|
||||
int ldbm_cache_store LDAP_P(( struct dbcache *db, Datum key, Datum data, int flags ));
|
||||
int ldbm_cache_delete LDAP_P(( struct dbcache *db, Datum key ));
|
||||
|
||||
/*
|
||||
* dn2id.c
|
||||
*/
|
||||
|
||||
int dn2id_add( Backend *be, char *dn, ID id );
|
||||
ID dn2id( Backend *be, char *dn );
|
||||
int dn2id_delete( Backend *be, char *dn );
|
||||
/*Entry * dn2entry( Backend *be, char *dn, char **matched );*/
|
||||
Entry * dn2entry_r( Backend *be, char *dn, char **matched );
|
||||
Entry * dn2entry_w( Backend *be, char *dn, char **matched );
|
||||
int dn2id_add LDAP_P(( Backend *be, char *dn, ID id ));
|
||||
ID dn2id LDAP_P(( Backend *be, char *dn ));
|
||||
int dn2id_delete LDAP_P(( Backend *be, char *dn ));
|
||||
/*Entry * dn2entry LDAP_P(( Backend *be, char *dn, char **matched ));*/
|
||||
Entry * dn2entry_r LDAP_P(( Backend *be, char *dn, char **matched ));
|
||||
Entry * dn2entry_w LDAP_P(( Backend *be, char *dn, char **matched ));
|
||||
|
||||
/*
|
||||
* filterindex.c
|
||||
*/
|
||||
|
||||
IDList * filter_candidates( Backend *be, Filter *f );
|
||||
IDList * filter_candidates LDAP_P(( Backend *be, Filter *f ));
|
||||
|
||||
/*
|
||||
* id2children.c
|
||||
*/
|
||||
|
||||
int id2children_add( Backend *be, Entry *p, Entry *e );
|
||||
int has_children( Backend *be, Entry *p );
|
||||
int id2children_add LDAP_P(( Backend *be, Entry *p, Entry *e ));
|
||||
int has_children LDAP_P(( Backend *be, Entry *p ));
|
||||
|
||||
/*
|
||||
* id2entry.c
|
||||
*/
|
||||
|
||||
int id2entry_add( Backend *be, Entry *e );
|
||||
int id2entry_delete( Backend *be, Entry *e );
|
||||
Entry * id2entry( Backend *be, ID id, int rw );
|
||||
Entry * id2entry_r( Backend *be, ID id );
|
||||
Entry * id2entry_w( Backend *be, ID id );
|
||||
int id2entry_add LDAP_P(( Backend *be, Entry *e ));
|
||||
int id2entry_delete LDAP_P(( Backend *be, Entry *e ));
|
||||
Entry * id2entry LDAP_P(( Backend *be, ID id, int rw ));
|
||||
Entry * id2entry_r LDAP_P(( Backend *be, ID id ));
|
||||
Entry * id2entry_w LDAP_P(( Backend *be, ID id ));
|
||||
|
||||
/*
|
||||
* idl.c
|
||||
*/
|
||||
|
||||
IDList * idl_alloc( int nids );
|
||||
IDList * idl_allids( Backend *be );
|
||||
void idl_free( IDList *idl );
|
||||
IDList * idl_fetch( Backend *be, struct dbcache *db, Datum key );
|
||||
int idl_insert_key( Backend *be, struct dbcache *db, Datum key, ID id );
|
||||
int idl_insert( IDList **idl, ID id, int maxids );
|
||||
IDList * idl_intersection( Backend *be, IDList *a, IDList *b );
|
||||
IDList * idl_union( Backend *be, IDList *a, IDList *b );
|
||||
IDList * idl_notin( Backend *be, IDList *a, IDList *b );
|
||||
ID idl_firstid( IDList *idl );
|
||||
ID idl_nextid( IDList *idl, ID id );
|
||||
IDList * idl_alloc LDAP_P(( int nids ));
|
||||
IDList * idl_allids LDAP_P(( Backend *be ));
|
||||
void idl_free LDAP_P(( IDList *idl ));
|
||||
IDList * idl_fetch LDAP_P(( Backend *be, struct dbcache *db, Datum key ));
|
||||
int idl_insert_key LDAP_P(( Backend *be, struct dbcache *db, Datum key, ID id ));
|
||||
int idl_insert LDAP_P(( IDList **idl, ID id, int maxids ));
|
||||
IDList * idl_intersection LDAP_P(( Backend *be, IDList *a, IDList *b ));
|
||||
IDList * idl_union LDAP_P(( Backend *be, IDList *a, IDList *b ));
|
||||
IDList * idl_notin LDAP_P(( Backend *be, IDList *a, IDList *b ));
|
||||
ID idl_firstid LDAP_P(( IDList *idl ));
|
||||
ID idl_nextid LDAP_P(( IDList *idl, ID id ));
|
||||
|
||||
/*
|
||||
* index.c
|
||||
*/
|
||||
|
||||
int index_add_entry( Backend *be, Entry *e );
|
||||
int index_add_mods( Backend *be, LDAPMod *mods, ID id );
|
||||
IDList * index_read( Backend *be, char *type, int indextype, char *val );
|
||||
int index_add_values( Backend *be, char *type, struct berval **vals, ID id );
|
||||
int index_add_entry LDAP_P(( Backend *be, Entry *e ));
|
||||
int index_add_mods LDAP_P(( Backend *be, LDAPMod *mods, ID id ));
|
||||
IDList * index_read LDAP_P(( Backend *be, char *type, int indextype, char *val ));
|
||||
int index_add_values LDAP_P(( Backend *be, char *type, struct berval **vals, ID id ));
|
||||
|
||||
/*
|
||||
* kerberos.c
|
||||
*/
|
||||
|
||||
#ifdef KERBEROS
|
||||
/* krbv4_ldap_auth( Backend *be, struct berval *cred, AUTH_DAT *ad ); */
|
||||
#ifdef HAVE_KERBEROS
|
||||
/* krbv4_ldap_auth LDAP_P(( Backend *be, struct berval *cred, AUTH_DAT *ad )); */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* nextid.c
|
||||
*/
|
||||
|
||||
ID next_id( Backend *be );
|
||||
void next_id_return( Backend *be, ID id );
|
||||
ID next_id_get( Backend *be );
|
||||
ID next_id LDAP_P(( Backend *be ));
|
||||
void next_id_return LDAP_P(( Backend *be, ID id ));
|
||||
ID next_id_get LDAP_P(( Backend *be ));
|
||||
|
||||
LDAP_END_DECL
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* search.c - ldbm backend search function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* unbind.c - handle an ldap unbind operation */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* config.c - passwd backend configuration file routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* search.c - /etc/passwd backend search function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* abandon.c - shell backend abandon function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* add.c - shell backend add function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* bind.c - shell backend bind function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* compare.c - shell backend compare function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* config.c - shell backend configuration file routine */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* delete.c - shell backend delete function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* fork.c - fork and exec a process, connecting stdin/out w/pipes */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* init.c - initialize shell backend */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* modify.c - shell backend modify function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* modrdn.c - shell backend modrdn function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* result.c - shell backend result reading function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* search.c - shell backend search function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,12 @@
|
||||
/* shell.h - shell backend header file */
|
||||
|
||||
#ifndef SLAPD_SHELL_H
|
||||
#define SLAPD_SHELL_H
|
||||
|
||||
#include <ldap_cdefs.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
struct shellinfo {
|
||||
char **si_bind; /* cmd + args to exec for bind */
|
||||
char **si_unbind; /* cmd + args to exec for unbind */
|
||||
@ -11,3 +18,7 @@ struct shellinfo {
|
||||
char **si_delete; /* cmd + args to exec for delete */
|
||||
char **si_abandon; /* cmd + args to exec for abandon */
|
||||
};
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* unbind.c - shell backend unbind function */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* backend.c - routines for dealing with back-end databases */
|
||||
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -21,6 +23,7 @@ extern int ldbm_back_abandon();
|
||||
extern int ldbm_back_config();
|
||||
extern int ldbm_back_init();
|
||||
extern int ldbm_back_close();
|
||||
extern int ldbm_back_group();
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_PASSWD
|
||||
@ -86,6 +89,9 @@ new_backend(
|
||||
be->be_config = ldbm_back_config;
|
||||
be->be_init = ldbm_back_init;
|
||||
be->be_close = ldbm_back_close;
|
||||
#ifdef ACLGROUP
|
||||
be->be_group = ldbm_back_group;
|
||||
#endif
|
||||
be->be_type = "ldbm";
|
||||
foundit = 1;
|
||||
}
|
||||
@ -105,6 +111,9 @@ new_backend(
|
||||
be->be_config = passwd_back_config;
|
||||
be->be_init = NULL;
|
||||
be->be_close = NULL;
|
||||
#ifdef ACLGROUP
|
||||
be->be_group = NULL;
|
||||
#endif
|
||||
be->be_type = "passwd";
|
||||
foundit = 1;
|
||||
}
|
||||
@ -124,6 +133,9 @@ new_backend(
|
||||
be->be_config = shell_back_config;
|
||||
be->be_init = shell_back_init;
|
||||
be->be_close = NULL;
|
||||
#ifdef ACLGROUP
|
||||
be->be_group = NULL;
|
||||
#endif
|
||||
be->be_type = "shell";
|
||||
foundit = 1;
|
||||
}
|
||||
@ -149,7 +161,20 @@ select_backend( char * dn )
|
||||
dnlen = strlen( dn );
|
||||
for ( i = 0; i < nbackends; i++ ) {
|
||||
for ( j = 0; backends[i].be_suffix != NULL &&
|
||||
backends[i].be_suffix[j] != NULL; j++ ) {
|
||||
backends[i].be_suffix[j] != NULL; j++ )
|
||||
{
|
||||
#ifdef LDAP_ALLOW_NULL_SEARCH_BASE
|
||||
/* Add greg@greg.rim.or.jp
|
||||
* It's quick hack for cheap client
|
||||
* Some browser offer a NULL base at ldap_search
|
||||
*/
|
||||
if(dnlen == 0) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"select_backend: use default backend\n", 0, 0, 0 );
|
||||
return (&backends[i]);
|
||||
}
|
||||
#endif /* LDAP_ALLOW_NULL_SEARCH_BASE */
|
||||
|
||||
len = strlen( backends[i].be_suffix[j] );
|
||||
|
||||
if ( len > dnlen ) {
|
||||
@ -231,3 +256,14 @@ be_unbind(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ACLGROUP
|
||||
int
|
||||
be_group(Backend *be, char *bdn, char *edn)
|
||||
{
|
||||
if (be->be_group)
|
||||
return(be->be_group(be, bdn, edn));
|
||||
else
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -12,6 +12,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* ch_malloc.c - malloc routines that test returns from malloc and friends */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* charray.c - routines for dealing with char * arrays */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -113,6 +115,9 @@ str2charray( char *str, char *brkstr )
|
||||
char *s;
|
||||
int i;
|
||||
|
||||
/* protect the input string from strtok */
|
||||
str = strdup( str );
|
||||
|
||||
i = 1;
|
||||
for ( s = str; *s; s++ ) {
|
||||
if ( strchr( brkstr, *s ) != NULL ) {
|
||||
@ -128,5 +133,6 @@ str2charray( char *str, char *brkstr )
|
||||
}
|
||||
res[i] = NULL;
|
||||
|
||||
free( str );
|
||||
return( res );
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* config.c - configuration file handling routines */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -5,7 +5,6 @@
|
||||
* Added locking of new_conn_mutex when traversing the c[] array.
|
||||
*/
|
||||
|
||||
#define DISABLE_BRIDGE /* disable bridge code */
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef SVR4
|
||||
@ -39,6 +41,12 @@ detach()
|
||||
nbits = getdtablesize();
|
||||
#endif /* USE_SYSCONF */
|
||||
|
||||
#ifdef FD_SETSIZE
|
||||
if ( nbits > FD_SETSIZE ) {
|
||||
nbits = FD_SETSIZE;
|
||||
}
|
||||
#endif /* FD_SETSIZE */
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
if ( ldap_debug == 0 ) {
|
||||
#endif
|
||||
|
@ -1,12 +1,13 @@
|
||||
/* dn.c - routines for dealing with distinguished names */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include "portable.h"
|
||||
#include "slap.h"
|
||||
|
||||
static char **dn_explode();
|
||||
@ -206,7 +207,7 @@ dn_parent(
|
||||
}
|
||||
}
|
||||
|
||||
return( NULL );
|
||||
return( strdup("") );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* entry.c - routines for dealing with entries */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* filter.c - routines for parsing and dealing with filters */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -135,6 +137,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr )
|
||||
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 );
|
||||
if ( (err = get_filter_list( conn, ber, &f->f_and, &ftmp ))
|
||||
== 0 ) {
|
||||
if (ftmp == NULL) ftmp = strdup("");
|
||||
*fstr = ch_malloc( 4 + strlen( ftmp ) );
|
||||
sprintf( *fstr, "(&%s)", ftmp );
|
||||
free( ftmp );
|
||||
@ -145,6 +148,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr )
|
||||
Debug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 );
|
||||
if ( (err = get_filter_list( conn, ber, &f->f_or, &ftmp ))
|
||||
== 0 ) {
|
||||
if (ftmp == NULL) ftmp = strdup("");
|
||||
*fstr = ch_malloc( 4 + strlen( ftmp ) );
|
||||
sprintf( *fstr, "(|%s)", ftmp );
|
||||
free( ftmp );
|
||||
@ -155,6 +159,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr )
|
||||
Debug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 );
|
||||
(void) ber_skip_tag( ber, &len );
|
||||
if ( (err = get_filter( conn, ber, &f->f_not, &ftmp )) == 0 ) {
|
||||
if (ftmp == NULL) ftmp = strdup("");
|
||||
*fstr = ch_malloc( 4 + strlen( ftmp ) );
|
||||
sprintf( *fstr, "(!%s)", ftmp );
|
||||
free( ftmp );
|
||||
|
@ -1,25 +1,18 @@
|
||||
/* filterentry.c - apply a filter to an entry */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef sunos5
|
||||
#include "regexpr.h"
|
||||
#else
|
||||
#include "regex.h"
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include "slap.h"
|
||||
|
||||
extern Attribute *attr_find();
|
||||
extern char *first_word();
|
||||
extern char *next_word();
|
||||
extern char *phonetic();
|
||||
extern char *re_comp();
|
||||
|
||||
#ifndef sunos5
|
||||
extern pthread_mutex_t regex_mutex;
|
||||
#endif
|
||||
|
||||
static int test_filter_list();
|
||||
static int test_substring_filter();
|
||||
@ -223,11 +216,12 @@ test_approx_filter(
|
||||
w2 = next_word( w2 ) ) {
|
||||
c2 = phonetic( w2 );
|
||||
if ( strcmp( c1, c2 ) == 0 ) {
|
||||
free( c2 );
|
||||
break;
|
||||
}
|
||||
free( c2 );
|
||||
}
|
||||
free( c1 );
|
||||
free( c2 );
|
||||
|
||||
/*
|
||||
* if we stopped because we ran out of words
|
||||
@ -322,6 +316,7 @@ test_substring_filter(
|
||||
char pat[BUFSIZ];
|
||||
char buf[BUFSIZ];
|
||||
struct berval *val;
|
||||
regex_t re;
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "begin test_substring_filter\n", 0, 0, 0 );
|
||||
|
||||
@ -389,19 +384,16 @@ test_substring_filter(
|
||||
}
|
||||
|
||||
/* compile the regex */
|
||||
#ifdef sunos5
|
||||
if ( (p = compile( pat, NULL, NULL )) == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "compile failed (%s)\n", p, 0, 0 );
|
||||
Debug( LDAP_DEBUG_FILTER, "test_substring_filter: regcomp pat: %s\n",
|
||||
pat, 0, 0 );
|
||||
if ((rc = regcomp(&re, pat, 0))) {
|
||||
char error[512];
|
||||
|
||||
regerror(rc, &re, error, sizeof(error));
|
||||
Debug( LDAP_DEBUG_ANY, "regcomp failed (%s) %s\n",
|
||||
p, error, 0 );
|
||||
return( -1 );
|
||||
}
|
||||
#else /* sunos5 */
|
||||
pthread_mutex_lock( ®ex_mutex );
|
||||
if ( (p = re_comp( pat )) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "re_comp failed (%s)\n", p, 0, 0 );
|
||||
pthread_mutex_unlock( ®ex_mutex );
|
||||
return( -1 );
|
||||
}
|
||||
#endif /* sunos5 */
|
||||
|
||||
/* for each value in the attribute see if regex matches */
|
||||
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
|
||||
@ -417,29 +409,18 @@ test_substring_filter(
|
||||
}
|
||||
value_normalize( realval, a->a_syntax );
|
||||
|
||||
#ifdef sunos5
|
||||
rc = step( realval, p );
|
||||
#else /* sunos5 */
|
||||
rc = re_exec( realval );
|
||||
#endif /* sunos5 */
|
||||
rc = !regexec(&re, realval, 0, NULL, 0);
|
||||
|
||||
if ( tmp != NULL ) {
|
||||
free( tmp );
|
||||
}
|
||||
if ( rc == 1 ) {
|
||||
#ifdef sunos5
|
||||
free( p );
|
||||
#else /* sunos5 */
|
||||
pthread_mutex_unlock( ®ex_mutex );
|
||||
#endif /* sunos5 */
|
||||
regfree(&re);
|
||||
return( 0 );
|
||||
}
|
||||
}
|
||||
#ifdef sunos5
|
||||
free( p );
|
||||
#else /* sunos5 */
|
||||
pthread_mutex_unlock( ®ex_mutex );
|
||||
#endif /* sunos5 */
|
||||
|
||||
regfree(&re);
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "end test_substring_filter 1\n", 0, 0, 0 );
|
||||
return( 1 );
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* init.c - initialize various things */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
@ -18,9 +20,6 @@ extern pthread_mutex_t entry2str_mutex;
|
||||
extern pthread_mutex_t replog_mutex;
|
||||
extern pthread_mutex_t ops_mutex;
|
||||
extern pthread_mutex_t num_sent_mutex;
|
||||
#ifndef sunos5
|
||||
extern pthread_mutex_t regex_mutex;
|
||||
#endif
|
||||
|
||||
init()
|
||||
{
|
||||
@ -31,7 +30,4 @@ init()
|
||||
pthread_mutex_init( &replog_mutex, pthread_mutexattr_default );
|
||||
pthread_mutex_init( &ops_mutex, pthread_mutexattr_default );
|
||||
pthread_mutex_init( &num_sent_mutex, pthread_mutexattr_default );
|
||||
#ifndef sunos5
|
||||
pthread_mutex_init( ®ex_mutex, pthread_mutexattr_default );
|
||||
#endif
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* lock.c - routines to open and apply an advisory lock to a file */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -10,16 +12,17 @@
|
||||
#include "slap.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
extern void daemon();
|
||||
extern void slapd_daemon();
|
||||
extern int lber_debug;
|
||||
|
||||
extern char Versionstr[];
|
||||
|
||||
|
||||
/*
|
||||
* read-only global variables or variables only written by the listener
|
||||
* thread (after they are initialized) - no need to protect them with a mutex.
|
||||
*/
|
||||
int ldap_debug;
|
||||
int ldap_debug = 0;
|
||||
#ifdef LDAP_DEBUG
|
||||
int ldap_syslog = LDAP_DEBUG_STATS;
|
||||
#else
|
||||
@ -55,15 +58,12 @@ pthread_mutex_t num_sent_mutex;
|
||||
*/
|
||||
pthread_mutex_t entry2str_mutex;
|
||||
pthread_mutex_t replog_mutex;
|
||||
#ifndef sunos5
|
||||
pthread_mutex_t regex_mutex;
|
||||
#endif
|
||||
|
||||
static
|
||||
usage( name )
|
||||
char *name;
|
||||
{
|
||||
fprintf( stderr, "usage: %s [-d debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
|
||||
fprintf( stderr, "usage: %s [-d ?|debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
|
||||
}
|
||||
|
||||
main( argc, argv )
|
||||
@ -105,19 +105,19 @@ main( argc, argv )
|
||||
LDAP_DEBUG_CONFIG );
|
||||
printf( "\tLDAP_DEBUG_ACL\t\t%d\n",
|
||||
LDAP_DEBUG_ACL );
|
||||
printf( "\tLDAP_DEBUG_STATS\t\t%d\n",
|
||||
printf( "\tLDAP_DEBUG_STATS\t%d\n",
|
||||
LDAP_DEBUG_STATS );
|
||||
printf( "\tLDAP_DEBUG_STATS2\t\t%d\n",
|
||||
printf( "\tLDAP_DEBUG_STATS2\t%d\n",
|
||||
LDAP_DEBUG_STATS2 );
|
||||
printf( "\tLDAP_DEBUG_SHELL\t\t%d\n",
|
||||
printf( "\tLDAP_DEBUG_SHELL\t%d\n",
|
||||
LDAP_DEBUG_SHELL );
|
||||
printf( "\tLDAP_DEBUG_PARSE\t\t%d\n",
|
||||
printf( "\tLDAP_DEBUG_PARSE\t%d\n",
|
||||
LDAP_DEBUG_PARSE );
|
||||
printf( "\tLDAP_DEBUG_ANY\t\t%d\n",
|
||||
LDAP_DEBUG_ANY );
|
||||
exit( 0 );
|
||||
} else {
|
||||
ldap_debug = atoi( optarg );
|
||||
ldap_debug |= atoi( optarg );
|
||||
lber_debug = (ldap_debug & LDAP_DEBUG_BER);
|
||||
}
|
||||
break;
|
||||
@ -184,12 +184,27 @@ main( argc, argv )
|
||||
pthread_attr_init( &attr );
|
||||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
|
||||
|
||||
if ( pthread_create( &listener_tid, attr, (void *) daemon,
|
||||
#ifndef THREAD_MIT_PTHREADS
|
||||
/* POSIX_THREADS or compatible
|
||||
* This is a draft 10 or standard pthreads implementation
|
||||
*/
|
||||
if ( pthread_create( &listener_tid, &attr, (void *) slapd_daemon,
|
||||
(void *) port ) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"listener pthread_create failed\n", 0, 0, 0 );
|
||||
exit( 1 );
|
||||
}
|
||||
#else /* !THREAD_MIT_PTHREADS */
|
||||
/*
|
||||
* This is a draft 4 or earlier pthreads implementation
|
||||
*/
|
||||
if ( pthread_create( &listener_tid, attr, (void *) slapd_daemon,
|
||||
(void *) port ) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"listener pthread_create failed\n", 0, 0, 0 );
|
||||
exit( 1 );
|
||||
}
|
||||
#endif /* !THREAD_MIT_PTHREADS */
|
||||
pthread_attr_destroy( &attr );
|
||||
pthread_join( listener_tid, (void *) &status );
|
||||
pthread_exit( 0 );
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -17,6 +17,8 @@
|
||||
* Added locking of currenttime_mutex to protect call(s) to localtime().
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* operation.c - routines to deal with pending ldap operations */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* phonetic.c - routines to do phonetic matching */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -1,213 +1,215 @@
|
||||
#ifndef _PROTO_SLAP
|
||||
#define _PROTO_SLAP
|
||||
|
||||
#include <ldap_cdefs.h>
|
||||
|
||||
/*
|
||||
* acl.c
|
||||
*/
|
||||
|
||||
int access_allowed( Backend *be, Connection *conn, Operation *op, Entry *e,
|
||||
char *attr, struct berval *val, char *dn, int access );
|
||||
int access_allowed LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
|
||||
char *attr, struct berval *val, char *dn, int access ));
|
||||
|
||||
struct acl * acl_get_applicable( Backend *be, Operation *op, Entry *e,
|
||||
char *attr, char *edn, int nmatches, regmatch_t *matches );
|
||||
int acl_access_allowed( struct acl *a, Backend *be, Connection *conn, Entry *e,
|
||||
struct acl * acl_get_applicable LDAP_P(( Backend *be, Operation *op, Entry *e,
|
||||
char *attr, char *edn, int nmatches, regmatch_t *matches ));
|
||||
int acl_access_allowed LDAP_P(( struct acl *a, Backend *be, Connection *conn, Entry *e,
|
||||
struct berval *val, Operation *op, int access, char *edn,
|
||||
regmatch_t *matches );
|
||||
regmatch_t *matches ));
|
||||
|
||||
int acl_check_mods( Backend *be, Connection *conn, Operation *op, Entry *e,
|
||||
LDAPMod *mods );
|
||||
int acl_check_mods LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
|
||||
LDAPMod *mods ));
|
||||
|
||||
/*
|
||||
* aclparse.c
|
||||
*/
|
||||
|
||||
void parse_acl( Backend *be, char *fname, int lineno, int argc, char **argv );
|
||||
char * access2str( int access );
|
||||
int str2access( char *str );
|
||||
void parse_acl LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv ));
|
||||
char * access2str LDAP_P(( int access ));
|
||||
int str2access LDAP_P(( char *str ));
|
||||
|
||||
/*
|
||||
* attr.c
|
||||
*/
|
||||
|
||||
void attr_free( Attribute *a );
|
||||
char * attr_normalize( char *s );
|
||||
int attr_merge_fast( Entry *e, char *type, struct berval **vals, int nvals,
|
||||
int naddvals, int *maxvals, Attribute ***a );
|
||||
int attr_merge( Entry *e, char *type, struct berval **vals );
|
||||
Attribute * attr_find( Attribute *a, char *type );
|
||||
int attr_delete( Attribute **attrs, char *type );
|
||||
int attr_syntax( char *type );
|
||||
void attr_syntax_config( char *fname, int lineno, int argc, char **argv );
|
||||
void attr_free LDAP_P(( Attribute *a ));
|
||||
char * attr_normalize LDAP_P(( char *s ));
|
||||
int attr_merge_fast LDAP_P(( Entry *e, char *type, struct berval **vals, int nvals,
|
||||
int naddvals, int *maxvals, Attribute ***a ));
|
||||
int attr_merge LDAP_P(( Entry *e, char *type, struct berval **vals ));
|
||||
Attribute * attr_find LDAP_P(( Attribute *a, char *type ));
|
||||
int attr_delete LDAP_P(( Attribute **attrs, char *type ));
|
||||
int attr_syntax LDAP_P(( char *type ));
|
||||
void attr_syntax_config LDAP_P(( char *fname, int lineno, int argc, char **argv ));
|
||||
|
||||
/*
|
||||
* ava.c
|
||||
*/
|
||||
|
||||
int get_ava( BerElement *ber, Ava *ava );
|
||||
void ava_free( Ava *ava, int freeit );
|
||||
int get_ava LDAP_P(( BerElement *ber, Ava *ava ));
|
||||
void ava_free LDAP_P(( Ava *ava, int freeit ));
|
||||
|
||||
/*
|
||||
* backend.c
|
||||
*/
|
||||
|
||||
Backend * new_backend( char *type );
|
||||
Backend * select_backend( char * dn );
|
||||
int be_issuffix( Backend *be, char *suffix );
|
||||
int be_isroot( Backend *be, char *dn );
|
||||
int be_isroot_pw( Backend *be, char *dn, struct berval *cred );
|
||||
void be_close();
|
||||
Backend * new_backend LDAP_P(( char *type ));
|
||||
Backend * select_backend LDAP_P(( char * dn ));
|
||||
int be_issuffix LDAP_P(( Backend *be, char *suffix ));
|
||||
int be_isroot LDAP_P(( Backend *be, char *dn ));
|
||||
int be_isroot_pw LDAP_P(( Backend *be, char *dn, struct berval *cred ));
|
||||
void be_close LDAP_P(());
|
||||
|
||||
/*
|
||||
* ch_malloc.c
|
||||
*/
|
||||
|
||||
char * ch_malloc( unsigned long size );
|
||||
char * ch_realloc( char *block, unsigned long size );
|
||||
char * ch_calloc( unsigned long nelem, unsigned long size );
|
||||
char * ch_malloc LDAP_P(( unsigned long size ));
|
||||
char * ch_realloc LDAP_P(( char *block, unsigned long size ));
|
||||
char * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size ));
|
||||
|
||||
/*
|
||||
* charray.c
|
||||
*/
|
||||
|
||||
void charray_add( char ***a, char *s );
|
||||
void charray_merge( char ***a, char **s );
|
||||
void charray_free( char **array );
|
||||
int charray_inlist( char **a, char *s );
|
||||
char ** charray_dup( char **a );
|
||||
char ** str2charray( char *str, char *brkstr );
|
||||
void charray_add LDAP_P(( char ***a, char *s ));
|
||||
void charray_merge LDAP_P(( char ***a, char **s ));
|
||||
void charray_free LDAP_P(( char **array ));
|
||||
int charray_inlist LDAP_P(( char **a, char *s ));
|
||||
char ** charray_dup LDAP_P(( char **a ));
|
||||
char ** str2charray LDAP_P(( char *str, char *brkstr ));
|
||||
|
||||
/*
|
||||
* config.c
|
||||
*/
|
||||
|
||||
void read_config( char *fname, Backend **bep, FILE *pfp );
|
||||
void read_config LDAP_P(( char *fname, Backend **bep, FILE *pfp ));
|
||||
|
||||
/*
|
||||
* connection.c
|
||||
*/
|
||||
|
||||
void connection_activity( Connection *conn );
|
||||
void connection_activity LDAP_P(( Connection *conn ));
|
||||
|
||||
/*
|
||||
* dn.c
|
||||
*/
|
||||
|
||||
char * dn_normalize( char *dn );
|
||||
char * dn_normalize_case( char *dn );
|
||||
char * dn_parent( Backend *be, char *dn );
|
||||
int dn_issuffix( char *dn, char *suffix );
|
||||
int dn_type( char *dn );
|
||||
char * dn_upcase( char *dn );
|
||||
char * dn_normalize LDAP_P(( char *dn ));
|
||||
char * dn_normalize_case LDAP_P(( char *dn ));
|
||||
char * dn_parent LDAP_P(( Backend *be, char *dn ));
|
||||
int dn_issuffix LDAP_P(( char *dn, char *suffix ));
|
||||
int dn_type LDAP_P(( char *dn ));
|
||||
char * dn_upcase LDAP_P(( char *dn ));
|
||||
|
||||
/*
|
||||
* entry.c
|
||||
*/
|
||||
|
||||
Entry * str2entry( char *s );
|
||||
char * entry2str( Entry *e, int *len, int printid );
|
||||
void entry_free( Entry *e );
|
||||
Entry * str2entry LDAP_P(( char *s ));
|
||||
char * entry2str LDAP_P(( Entry *e, int *len, int printid ));
|
||||
void entry_free LDAP_P(( Entry *e ));
|
||||
|
||||
int entry_rdwr_lock( Entry *e, int rw );
|
||||
int entry_rdwr_rlock( Entry *e );
|
||||
int entry_rdwr_wlock( Entry *e );
|
||||
int entry_rdwr_unlock( Entry *e, int rw );
|
||||
int entry_rdwr_runlock( Entry *e );
|
||||
int entry_rdwr_wunlock( Entry *e );
|
||||
int entry_rdwr_init( Entry *e );
|
||||
int entry_rdwr_lock LDAP_P(( Entry *e, int rw ));
|
||||
int entry_rdwr_rlock LDAP_P(( Entry *e ));
|
||||
int entry_rdwr_wlock LDAP_P(( Entry *e ));
|
||||
int entry_rdwr_unlock LDAP_P(( Entry *e, int rw ));
|
||||
int entry_rdwr_runlock LDAP_P(( Entry *e ));
|
||||
int entry_rdwr_wunlock LDAP_P(( Entry *e ));
|
||||
int entry_rdwr_init LDAP_P(( Entry *e ));
|
||||
|
||||
/*
|
||||
* filter.c
|
||||
*/
|
||||
|
||||
int get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr );
|
||||
void filter_free( Filter *f );
|
||||
void filter_print( Filter *f );
|
||||
int get_filter LDAP_P(( Connection *conn, BerElement *ber, Filter **filt, char **fstr ));
|
||||
void filter_free LDAP_P(( Filter *f ));
|
||||
void filter_print LDAP_P(( Filter *f ));
|
||||
|
||||
/*
|
||||
* filterentry.c
|
||||
*/
|
||||
|
||||
int test_filter( Backend *be, Connection *conn, Operation *op, Entry *e,
|
||||
Filter *f );
|
||||
int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
|
||||
Filter *f ));
|
||||
|
||||
/*
|
||||
* lock.c
|
||||
*/
|
||||
|
||||
FILE * lock_fopen( char *fname, char *type, FILE **lfp );
|
||||
int lock_fclose( FILE *fp, FILE *lfp );
|
||||
FILE * lock_fopen LDAP_P(( char *fname, char *type, FILE **lfp ));
|
||||
int lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
|
||||
|
||||
/*
|
||||
* monitor.c
|
||||
*/
|
||||
|
||||
void monitor_info( Connection *conn, Operation *op );
|
||||
void monitor_info LDAP_P(( Connection *conn, Operation *op ));
|
||||
|
||||
/*
|
||||
* operation.c
|
||||
*/
|
||||
|
||||
void op_free( Operation *op );
|
||||
Operation * op_add( Operation **olist, BerElement *ber, unsigned long msgid,
|
||||
unsigned long tag, char *dn, int id, int connid );
|
||||
void op_delete( Operation **olist, Operation *op );
|
||||
void op_free LDAP_P(( Operation *op ));
|
||||
Operation * op_add LDAP_P(( Operation **olist, BerElement *ber, unsigned long msgid,
|
||||
unsigned long tag, char *dn, int id, int connid ));
|
||||
void op_delete LDAP_P(( Operation **olist, Operation *op ));
|
||||
|
||||
/*
|
||||
* phonetic.c
|
||||
*/
|
||||
|
||||
char * first_word( char *s );
|
||||
char * next_word( char *s );
|
||||
char * word_dup( char *w );
|
||||
char * phonetic( char *s );
|
||||
char * first_word LDAP_P(( char *s ));
|
||||
char * next_word LDAP_P(( char *s ));
|
||||
char * word_dup LDAP_P(( char *w ));
|
||||
char * phonetic LDAP_P(( char *s ));
|
||||
|
||||
/*
|
||||
* repl.c
|
||||
*/
|
||||
|
||||
void replog( Backend *be, int optype, char *dn, void *change, int flag );
|
||||
void replog LDAP_P(( Backend *be, int optype, char *dn, void *change, int flag ));
|
||||
|
||||
/*
|
||||
* result.c
|
||||
*/
|
||||
|
||||
void send_ldap_result( Connection *conn, Operation *op, int err, char *matched,
|
||||
char *text );
|
||||
void send_ldap_search_result( Connection *conn, Operation *op, int err,
|
||||
char *matched, char *text, int nentries );
|
||||
void close_connection( Connection *conn, int opconnid, int opid );
|
||||
void send_ldap_result LDAP_P(( Connection *conn, Operation *op, int err, char *matched,
|
||||
char *text ));
|
||||
void send_ldap_search_result LDAP_P(( Connection *conn, Operation *op, int err,
|
||||
char *matched, char *text, int nentries ));
|
||||
void close_connection LDAP_P(( Connection *conn, int opconnid, int opid ));
|
||||
|
||||
/*
|
||||
* schema.c
|
||||
*/
|
||||
|
||||
int oc_schema_check( Entry *e );
|
||||
int oc_schema_check LDAP_P(( Entry *e ));
|
||||
|
||||
/*
|
||||
* schemaparse.c
|
||||
*/
|
||||
|
||||
void parse_oc( Backend *be, char *fname, int lineno, int argc, char **argv );
|
||||
void parse_oc LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv ));
|
||||
|
||||
/*
|
||||
* str2filter.c
|
||||
*/
|
||||
|
||||
Filter * str2filter( char *str );
|
||||
Filter * str2filter LDAP_P(( char *str ));
|
||||
|
||||
/*
|
||||
* value.c
|
||||
*/
|
||||
|
||||
int value_add_fast( struct berval ***vals, struct berval **addvals, int nvals,
|
||||
int naddvals, int *maxvals );
|
||||
int value_add( struct berval ***vals, struct berval **addvals );
|
||||
void value_normalize( char *s, int syntax );
|
||||
int value_cmp( struct berval *v1, struct berval *v2, int syntax,
|
||||
int normalize );
|
||||
int value_ncmp( struct berval *v1, struct berval *v2, int syntax, int len,
|
||||
int normalize );
|
||||
int value_find( struct berval **vals, struct berval *v, int syntax,
|
||||
int normalize );
|
||||
int value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals,
|
||||
int naddvals, int *maxvals ));
|
||||
int value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
|
||||
void value_normalize LDAP_P(( char *s, int syntax ));
|
||||
int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax,
|
||||
int normalize ));
|
||||
int value_ncmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int len,
|
||||
int normalize ));
|
||||
int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax,
|
||||
int normalize ));
|
||||
|
||||
#endif /* _proto_slap */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* repl.c - log modifications for replication purposes */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* result.c - routines to send ldap results, errors, and referrals */
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* schema.c - routines to enforce schema definitions */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -76,6 +78,11 @@ oc_check_required( Entry *e, char *ocname )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* check for empty oc_required */
|
||||
if(oc->oc_required == NULL) {
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* for each required attribute */
|
||||
for ( i = 0; oc->oc_required[i] != NULL; i++ ) {
|
||||
/* see if it's in the entry */
|
||||
@ -111,14 +118,16 @@ oc_check_allowed( char *type, struct berval **ocl )
|
||||
/* if we know about the oc */
|
||||
if ( (oc = oc_find( ocl[i]->bv_val )) != NULL ) {
|
||||
/* does it require the type? */
|
||||
for ( j = 0; oc->oc_required[j] != NULL; j++ ) {
|
||||
for ( j = 0; oc->oc_required != NULL &&
|
||||
oc->oc_required[j] != NULL; j++ ) {
|
||||
if ( strcasecmp( oc->oc_required[j], type )
|
||||
== 0 ) {
|
||||
return( 0 );
|
||||
}
|
||||
}
|
||||
/* does it allow the type? */
|
||||
for ( j = 0; oc->oc_allowed[j] != NULL; j++ ) {
|
||||
for ( j = 0; oc->oc_allowed != NULL &&
|
||||
oc->oc_allowed[j] != NULL; j++ ) {
|
||||
if ( strcasecmp( oc->oc_allowed[j], type )
|
||||
== 0 || strcmp( oc->oc_allowed[j], "*" )
|
||||
== 0 )
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* schemaparse.c - routines to parse config file objectclass definitions */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -13,6 +13,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -14,6 +14,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -12,6 +12,12 @@
|
||||
is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef SHELLUTIL_H
|
||||
#define SHELLUTIL_H
|
||||
|
||||
#include <ldap_cdefs.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define MAXLINELEN 512
|
||||
|
||||
@ -94,3 +100,6 @@ char *estrdup( char *s );
|
||||
*/
|
||||
extern int debugflg;
|
||||
extern char *progname;
|
||||
|
||||
LDAP_END_DECL
|
||||
#endif
|
||||
|
@ -3,11 +3,14 @@
|
||||
#ifndef _SLDAPD_H_
|
||||
#define _SLDAPD_H_
|
||||
|
||||
#define LDAP_SYSLOG
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <syslog.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/regex.h>
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
@ -27,6 +30,8 @@
|
||||
|
||||
#define MAXREMATCHES 10
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* represents an attribute value assertion (i.e., attr=value)
|
||||
*/
|
||||
@ -134,7 +139,7 @@ struct access {
|
||||
char *a_dnattr;
|
||||
long a_access;
|
||||
|
||||
#ifdef ACLGROUP
|
||||
#ifdef SLAPD_ACLGROUP
|
||||
char *a_group;
|
||||
#endif
|
||||
|
||||
@ -226,7 +231,7 @@ typedef struct op {
|
||||
/* LDAP_AUTH_* */
|
||||
int o_opid; /* id of this operation */
|
||||
int o_connid; /* id of conn initiating this op */
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
int o_cldap; /* != 0 if this came in via CLDAP */
|
||||
struct sockaddr o_clientaddr; /* client address if via CLDAP */
|
||||
char o_searchbase; /* search base if via CLDAP */
|
||||
@ -248,7 +253,7 @@ typedef struct conn {
|
||||
char *c_dn; /* current DN bound to this conn */
|
||||
pthread_mutex_t c_dnmutex; /* mutex for c_dn field */
|
||||
int c_authtype; /* auth method used to bind c_dn */
|
||||
#ifdef COMPAT
|
||||
#ifdef LDAP_COMPAT
|
||||
int c_version; /* for compatibility w/2.0, 3.0 */
|
||||
#endif
|
||||
char *c_addr; /* address of client on this conn */
|
||||
@ -280,8 +285,8 @@ typedef struct conn {
|
||||
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )
|
||||
#endif
|
||||
|
||||
#ifdef NEEDPROTOS
|
||||
#include "proto-slap.h"
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#endif /* _slap_h_ */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* str2filter.c - parse an rfc 1588 string filter */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "portable.h"
|
||||
|
||||
#if defined( ultrix ) || defined( nextstep )
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
char *strdup( char *s )
|
||||
{
|
||||
char *p;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "portable.h"
|
||||
|
||||
#if defined( nextstep )
|
||||
|
||||
#include <string.h>
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* centipede.c - generate and install indexing information (view w/tabstop=4) */
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@ -556,6 +558,11 @@ diff_centroids(
|
||||
int amax, acur, dmax, dcur;
|
||||
char **vals;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
DBC *ocursorp;
|
||||
DBC *ncursorp;
|
||||
#endif /* LDBM_USE_DB2 */
|
||||
|
||||
if ( verbose ) {
|
||||
printf( "Generating mods for differential %s centroid...", attr );
|
||||
fflush( stdout );
|
||||
@ -600,8 +607,14 @@ diff_centroids(
|
||||
|
||||
olast.dptr = NULL;
|
||||
nlast.dptr = NULL;
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( okey = ldbm_firstkey( oldbm, &ocursorp ),
|
||||
nkey = ldbm_firstkey( nldbm, &ncursorp );
|
||||
okey.dptr != NULL && nkey.dptr != NULL; )
|
||||
#else
|
||||
for ( okey = ldbm_firstkey( oldbm ), nkey = ldbm_firstkey( nldbm );
|
||||
okey.dptr != NULL && nkey.dptr != NULL; )
|
||||
#endif
|
||||
{
|
||||
rc = strcmp( okey.dptr, nkey.dptr );
|
||||
|
||||
@ -616,8 +629,13 @@ diff_centroids(
|
||||
}
|
||||
nlast = nkey;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
okey = ldbm_nextkey( oldbm, olast, ocursorp );
|
||||
nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
|
||||
#else
|
||||
okey = ldbm_nextkey( oldbm, olast );
|
||||
nkey = ldbm_nextkey( nldbm, nlast );
|
||||
#endif
|
||||
} else if ( rc > 0 ) {
|
||||
/* new value is not in old centroid - add it */
|
||||
if ( charray_add_dup( &avals, &acur, &amax, nkey.dptr ) == NULL ) {
|
||||
@ -629,7 +647,12 @@ diff_centroids(
|
||||
ldbm_datum_free( nldbm, nlast );
|
||||
}
|
||||
nlast = nkey;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
|
||||
#else
|
||||
nkey = ldbm_nextkey( nldbm, nlast );
|
||||
#endif
|
||||
} else {
|
||||
/* old value is not in new centroid - delete it */
|
||||
if ( charray_add_dup( &dvals, &dcur, &dmax, okey.dptr ) == NULL ) {
|
||||
@ -641,7 +664,12 @@ diff_centroids(
|
||||
ldbm_datum_free( oldbm, olast );
|
||||
}
|
||||
olast = okey;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
okey = ldbm_nextkey( oldbm, olast, ocursorp );
|
||||
#else
|
||||
okey = ldbm_nextkey( oldbm, olast );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,7 +679,11 @@ diff_centroids(
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
okey = ldbm_nextkey( oldbm, olast, ocursorp );
|
||||
#else
|
||||
okey = ldbm_nextkey( oldbm, olast );
|
||||
#endif
|
||||
if ( olast.dptr != NULL ) {
|
||||
ldbm_datum_free( oldbm, olast );
|
||||
}
|
||||
@ -666,7 +698,11 @@ diff_centroids(
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
|
||||
#else
|
||||
nkey = ldbm_nextkey( nldbm, nlast );
|
||||
#endif
|
||||
if ( nlast.dptr != NULL ) {
|
||||
ldbm_datum_free( nldbm, nlast );
|
||||
}
|
||||
@ -687,8 +723,14 @@ diff_centroids(
|
||||
|
||||
/* generate list of values to add */
|
||||
lastkey.dptr = NULL;
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( key = ldbm_firstkey( nldbm, &ncursorp ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( nldbm, lastkey, ncursorp ) )
|
||||
#else
|
||||
for ( key = ldbm_firstkey( nldbm ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( nldbm, lastkey ) ) {
|
||||
key = ldbm_nextkey( nldbm, lastkey ) )
|
||||
#endif
|
||||
{
|
||||
/* see if it's in the old one */
|
||||
data = ldbm_fetch( oldbm, key );
|
||||
|
||||
@ -712,8 +754,14 @@ diff_centroids(
|
||||
|
||||
/* generate list of values to delete */
|
||||
lastkey.dptr = NULL;
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( key = ldbm_firstkey( oldbm, &ocursorp ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( oldbm, lastkey, ocursorp ) )
|
||||
#else
|
||||
for ( key = ldbm_firstkey( oldbm ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( oldbm, lastkey ) ) {
|
||||
key = ldbm_nextkey( oldbm, lastkey ) )
|
||||
#endif
|
||||
{
|
||||
/* see if it's in the new one */
|
||||
data = ldbm_fetch( nldbm, key );
|
||||
|
||||
@ -773,6 +821,10 @@ full_centroid(
|
||||
char **vals;
|
||||
int vcur, vmax;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
DBC *cursorp;
|
||||
#endif
|
||||
|
||||
if ( verbose ) {
|
||||
printf( "Generating mods for full %s centroid...", attr );
|
||||
fflush( stdout );
|
||||
@ -800,8 +852,14 @@ full_centroid(
|
||||
lastkey.dptr = NULL;
|
||||
vals = NULL;
|
||||
vcur = vmax = 0;
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( key = ldbm_firstkey( ldbm, &cursorp ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( ldbm, lastkey, cursorp ) )
|
||||
#else
|
||||
for ( key = ldbm_firstkey( ldbm ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( ldbm, lastkey ) ) {
|
||||
key = ldbm_nextkey( ldbm, lastkey ) )
|
||||
#endif
|
||||
{
|
||||
if ( charray_add_dup( &vals, &vcur, &vmax, key.dptr ) == NULL ) {
|
||||
ldap_mods_free( mods, 1 );
|
||||
return( NULL );
|
||||
|
@ -16,6 +16,8 @@
|
||||
* slapd/slurpd locking conventions.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -10,17 +10,23 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef LDAPSYNTAX_H
|
||||
#define LDAPSYNTAX_H 1
|
||||
|
||||
#include <ldap_cdefs.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/* XXX: the "master" LINE_WIDTH #define is in ../slap.h */
|
||||
#define LINE_WIDTH 76 /* for lines in string rep of an entry */
|
||||
|
||||
#ifdef NEEDPROTOS
|
||||
/*
|
||||
* function prototypes
|
||||
*/
|
||||
|
||||
int init_syntaxes( void );
|
||||
int av2ldif( FILE *outfp, AV_Sequence av, DN dn, short syntax,
|
||||
char *attrname, PS str_ps );
|
||||
int init_syntaxes LDAP_P(( void ));
|
||||
int av2ldif LDAP_P(( FILE *outfp, AV_Sequence av, DN dn, short syntax,
|
||||
char *attrname, PS str_ps ));
|
||||
|
||||
#endif /* NEEDPROTOS */
|
||||
LDAP_END_DECL
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@ -24,6 +26,10 @@ main( argc, argv )
|
||||
char *file, *s;
|
||||
int printid = 1;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
DBC *cursorp;
|
||||
#endif
|
||||
|
||||
if ( argc < 2 || argc > 3 || ( argc == 3 && strcmp( argv[1], "-n" )
|
||||
!= 0 )) {
|
||||
usage( argv[0] );
|
||||
@ -41,8 +47,15 @@ main( argc, argv )
|
||||
}
|
||||
|
||||
last.dptr = NULL;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( key = ldbm_firstkey( dbp, &cursorp ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( dbp, last, cursorp ) )
|
||||
#else
|
||||
for ( key = ldbm_firstkey( dbp ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( dbp, last ) ) {
|
||||
key = ldbm_nextkey( dbp, last ) )
|
||||
#endif
|
||||
{
|
||||
if ( last.dptr != NULL )
|
||||
ldbm_datum_free( dbp, last );
|
||||
data = ldbm_fetch( dbp, key );
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
@ -24,7 +26,7 @@ main( argc, argv )
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
char *type, *out;
|
||||
int binary = 0;
|
||||
int len, binary = 0;
|
||||
|
||||
if (argc < 2 || argc > 3 ) {
|
||||
usage( argv[0] );
|
||||
@ -79,7 +81,9 @@ main( argc, argv )
|
||||
}
|
||||
|
||||
/* not binary: one value per line... */
|
||||
while ( gets( buf ) != NULL ) {
|
||||
while ( fgets( buf, sizeof(buf), stdin ) != NULL ) {
|
||||
if( buf[len=strlen(buf)] == '\n') buf[len] = '\0';
|
||||
|
||||
if (( out = ldif_type_and_value( type, buf, strlen( buf ) ))
|
||||
== NULL ) {
|
||||
perror( "ldif_type_and_value" );
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/socket.h>
|
||||
|
||||
#include "../slap.h"
|
||||
|
||||
#include "ldapconfig.h"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user