merge of DB-NEW

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10453 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-08-09 08:41:49 +00:00
parent 7e967c7282
commit 334c7ffa33
12 changed files with 169 additions and 75 deletions

View File

@@ -48,14 +48,6 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg }
#define SGTTY
#endif
/*
* Define NDBM if you are using the 4.3 ndbm library (which is part of
* libc). If not defined, 4.2 dbm will be assumed.
*/
#if defined(HAVE_DBM_FIRSTKEY)
#define NDBM
#endif
/* telnet stuff ----------------------------------------------- */
#if defined(ENCRYPTION) && !defined(AUTHENTICATION)

View File

@@ -52,5 +52,4 @@ LDADD = ../common/libcommon.a \
$(LIB_krb5) \
$(LIB_krb4) \
$(LIB_des) \
$(LIB_roken) \
$(DBLIB)
$(LIB_roken)

View File

@@ -10,7 +10,4 @@ otpprint_SOURCES = otpprint.c otp_locl.h
man_MANS = otp.1 otpprint.1
LDADD = \
$(top_builddir)/lib/otp/libotp.la \
$(LIB_des) \
$(LIB_roken) \
$(DBLIB)
$(top_builddir)/lib/otp/libotp.la

130
cf/db.m4
View File

@@ -9,32 +9,140 @@ if test "$withval" = no; then
berkeley_db=""
fi
])
db_type=unknown
if test "$berkeley_db"; then
AC_CHECK_HEADERS([ \
db.h \
db_185.h \
])
fi
AC_FIND_FUNC_NO_LIBS2(dbopen, $berkeley_db, [
dnl db_create is used by db3
AC_FIND_FUNC_NO_LIBS(db_create, $berkeley_db, [
#include <stdio.h>
#include <db.h>
],[NULL, NULL, 0])
if test "$ac_cv_func_db_create" = "yes"; then
db_type=db3
if test "$ac_cv_funclib_db_create" != "yes"; then
DBLIB="$ac_cv_funclib_db_create"
else
DBLIB=""
fi
AC_DEFINE(HAVE_DB3, 1, [define if you have a berkeley db3 library])
else
dnl dbopen is used by db1/db2
AC_FIND_FUNC_NO_LIBS(dbopen, $berkeley_db, [
#include <stdio.h>
#if defined(HAVE_DB_185_H)
#include <db_185.h>
#elif defined(HAVE_DB_H)
#include <db.h>
#else
#error no db.h
#endif
],[NULL, 0, 0, 0, NULL])
AC_FIND_FUNC_NO_LIBS(dbm_firstkey, $berkeley_db gdbm ndbm)
AC_FIND_FUNC_NO_LIBS(db_create, $berkeley_db)
DBLIB="$LIB_dbopen"
if test "$LIB_dbopen" != "$LIB_db_create"; then
DBLIB="$DBLIB $LIB_db_create"
if test "$ac_cv_func_dbopen" = "yes"; then
db_type=db1
if test "$ac_cv_funclib_dbopen" != "yes"; then
DBLIB="$ac_cv_funclib_dbopen"
else
DBLIB=""
fi
AC_DEFINE(HAVE_DB1, 1, [define if you have a berkeley db1/2 library])
fi
if test "$LIB_dbopen" != "$LIB_dbm_firstkey"; then
DBLIB="$DBLIB $LIB_dbm_firstkey"
fi
AC_SUBST(DBLIB)dnl
dnl test for ndbm compatability
AC_FIND_FUNC_NO_LIBS2(dbm_firstkey, $ac_cv_funclib_dbopen, [
#include <stdio.h>
#define DB_DBM_HSEARCH 1
#include <db.h>
DBM *dbm;
],[NULL])
if test "$ac_cv_func_dbm_firstkey" = "yes"; then
if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
else
LIB_NDBM=""
fi
AC_DEFINE(HAVE_DB_NDBM, 1, [define if you have ndbm compat in db])
else
$as_unset ac_cv_func_dbm_firstkey
$as_unset ac_cv_funclib_dbm_firstkey
fi
fi # berkeley db
if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
AC_CHECK_HEADERS([ \
dbm.h \
ndbm.h \
])
AC_FIND_FUNC_NO_LIBS(dbm_firstkey, ndbm, [
#include <stdio.h>
#if defined(HAVE_DBM_H)
#include <dbm.h>
#elif defined(HAVE_NDBM_H)
#include <ndbm.h>
#else
#error no ndbm.h
#endif
DBM *dbm;
],[NULL])
if test "$ac_cv_func_dbm_firstkey" = "yes"; then
if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
else
LIB_NDBM=""
fi
AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
if test "$db_type" = "unknown"; then
db_type=ndbm
DBLIB="$LIB_NDBM"
fi
else
$as_unset ac_cv_func_dbm_firstkey
$as_unset ac_cv_funclib_dbm_firstkey
AC_CHECK_HEADERS([ \
gdbm/ndbm.h \
])
AC_FIND_FUNC_NO_LIBS(dbm_firstkey, gdbm, [
#include <stdio.h>
#include <gdbm/ndbm.h>
DBM *dbm;
],[NULL])
if test "$ac_cv_func_dbm_firstkey" = "yes"; then
if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
else
LIB_NDBM=""
fi
AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
if test "$db_type" = "unknown"; then
db_type=ndbm
DBLIB="$LIB_NDBM"
fi
fi
fi
fi # unknown
AC_SUBST(DBLIB)dnl
AC_SUBST(LIB_NDBM)dnl
])

View File

@@ -251,20 +251,17 @@ AC_CHECK_HEADERS([\
bsdsetjmp.h \
crypt.h \
curses.h \
dbm.h \
dirent.h \
dlfcn.h \
err.h \
errno.h \
fcntl.h \
fnmatch.h \
gdbm/ndbm.h \
grp.h \
inttypes.h \
io.h \
limits.h \
maillock.h \
ndbm.h \
net/if.h \
netdb.h \
netinet/in.h \
@@ -279,7 +276,6 @@ AC_CHECK_HEADERS([\
pty.h \
pwd.h \
resolv.h \
rpcsvc/dbm.h \
sac.h \
security/pam_modules.h \
sgtty.h \

View File

@@ -35,7 +35,13 @@
RCSID("$Id$");
#if defined(HAVE_DB_H) && DB_VERSION_MAJOR < 3
#if HAVE_DB1
#if defined(HAVE_DB_185_H)
#include <db_185.h>
#elif defined(HAVE_DB_H)
#include <db.h>
#endif
static krb5_error_code
DB_close(krb5_context context, HDB *db)
@@ -290,4 +296,4 @@ hdb_db_create(krb5_context context, HDB **db,
return 0;
}
#endif
#endif /* HAVE_DB1 */

View File

@@ -35,7 +35,10 @@
RCSID("$Id$");
#if defined(HAVE_DB_H) && DB_VERSION_MAJOR == 3
#if HAVE_DB3
#include <db.h>
static krb5_error_code
DB_close(krb5_context context, HDB *db)
{
@@ -322,4 +325,4 @@ hdb_db_create(krb5_context context, HDB **db,
(*db)->destroy = DB_destroy;
return 0;
}
#endif
#endif /* HAVE_DB3 */

View File

@@ -41,18 +41,18 @@ struct hdb_method {
};
static struct hdb_method methods[] = {
#ifdef HAVE_DB_H
#if HAVE_DB1 || HAVE_DB3
{"db:", hdb_db_create},
#endif
#if defined(HAVE_NDBM_H) || defined(HAVE_GDBM_NDBM_H)
#if HAVE_NDBM
{"ndbm:", hdb_ndbm_create},
#endif
#ifdef OPENLDAP
{"ldap:", hdb_ldap_create},
#endif
#ifdef HAVE_DB_H
#if HAVE_DB1 || HAVE_DB3
{"", hdb_db_create},
#elif defined(HAVE_NDBM_H)
#elif defined(HAVE_NDBM)
{"", hdb_ndbm_create},
#elif defined(OPENLDAP)
{"", hdb_ldap_create},

View File

@@ -65,16 +65,4 @@
#include <hdb.h>
#include <hdb-private.h>
#if defined(HAVE_DB_185_H)
#include <db_185.h>
#elif defined(HAVE_DB_H)
#include <db.h>
#endif
#if defined(HAVE_NDBM_H)
#include <ndbm.h>
#elif defined(HAVE_GDBM_NDBM_H)
#include <gdbm/ndbm.h>
#endif
#endif /* __HDB_LOCL_H__ */

View File

@@ -35,7 +35,15 @@
RCSID("$Id$");
#if defined(HAVE_NDBM_H) || defined(HAVE_GDBM_NDBM_H)
#if HAVE_NDBM
#if defined(HAVE_GDBM_NDBM_H)
#include <gdbm/ndbm.h>
#elif defined(HAVE_DBM_H)
#include <dbm.h>
#elif defined(HAVE_NDBM_H)
#include <ndbm.h>
#endif
struct ndbm_db {
DBM *db;
@@ -350,4 +358,4 @@ hdb_ndbm_create(krb5_context context, HDB **db,
return 0;
}
#endif
#endif /* HAVE_NDBM */

View File

@@ -6,16 +6,15 @@ INCLUDES += $(INCLUDE_krb4)
noinst_PROGRAMS = otptest
otptest_LDADD = libotp.la \
$(LIB_des) \
$(LIB_roken) \
$(DBLIB)
check_PROGRAMS = otptest
otptest_LDADD = libotp.la
include_HEADERS = otp.h
lib_LTLIBRARIES = libotp.la
libotp_la_LDFLAGS = -version-info 1:2:1
libotp_la_LIBADD = $(LIB_des) ../roken/libroken.la
libotp_la_LIBADD = $(LIB_des) $(LIB_roken) $(LIB_NDBM)
libotp_la_SOURCES = \
otp.c \

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995 - 2000 Kungliga Tekniska H<>gskolan
* Copyright (c) 1995 - 2001 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,23 +38,20 @@
#ifndef __XDBM_H__
#define __XDBM_H__
#if defined(HAVE_DB_H)
#if HAVE_DB_NDBM
#define DB_DBM_HSEARCH 1
#include <db.h>
#endif
#ifndef DBM_INSERT
#if defined(HAVE_NDBM_H)
#include <ndbm.h>
#elif defined(HAVE_GDBM_NDBM_H)
#elif HAVE_NDBM
#if defined(HAVE_GDBM_NDBM_H)
#include <gdbm/ndbm.h>
#elif defined(HAVE_DBM_H)
#include <dbm.h>
#elif defined(HAVE_RPCSVC_DBM_H)
#include <rpcsvc/dbm.h>
#endif
#elif defined(HAVE_NDBM_H)
#include <ndbm.h>
#endif
#endif /* HAVE_NDBM */
#if 0
/* Macros to convert ndbm names to dbm names.
* Note that dbm_nextkey() cannot be simply converted using a macro, since
* it is invoked giving the database, and nextkey() needs the previous key.
@@ -75,5 +72,6 @@ typedef char DBM;
#else
#define dbm_next(db,key) dbm_nextkey(db)
#endif
#endif
#endif /* __XDBM_H__ */