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:
@@ -48,14 +48,6 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg }
|
|||||||
#define SGTTY
|
#define SGTTY
|
||||||
#endif
|
#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 ----------------------------------------------- */
|
/* telnet stuff ----------------------------------------------- */
|
||||||
|
|
||||||
#if defined(ENCRYPTION) && !defined(AUTHENTICATION)
|
#if defined(ENCRYPTION) && !defined(AUTHENTICATION)
|
||||||
|
@@ -52,5 +52,4 @@ LDADD = ../common/libcommon.a \
|
|||||||
$(LIB_krb5) \
|
$(LIB_krb5) \
|
||||||
$(LIB_krb4) \
|
$(LIB_krb4) \
|
||||||
$(LIB_des) \
|
$(LIB_des) \
|
||||||
$(LIB_roken) \
|
$(LIB_roken)
|
||||||
$(DBLIB)
|
|
||||||
|
@@ -10,7 +10,4 @@ otpprint_SOURCES = otpprint.c otp_locl.h
|
|||||||
man_MANS = otp.1 otpprint.1
|
man_MANS = otp.1 otpprint.1
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
$(top_builddir)/lib/otp/libotp.la \
|
$(top_builddir)/lib/otp/libotp.la
|
||||||
$(LIB_des) \
|
|
||||||
$(LIB_roken) \
|
|
||||||
$(DBLIB)
|
|
||||||
|
146
cf/db.m4
146
cf/db.m4
@@ -9,32 +9,140 @@ if test "$withval" = no; then
|
|||||||
berkeley_db=""
|
berkeley_db=""
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
db_type=unknown
|
||||||
|
|
||||||
if test "$berkeley_db"; then
|
if test "$berkeley_db"; then
|
||||||
|
|
||||||
AC_CHECK_HEADERS([ \
|
AC_CHECK_HEADERS([ \
|
||||||
db.h \
|
db.h \
|
||||||
db_185.h \
|
db_185.h \
|
||||||
])
|
])
|
||||||
fi
|
|
||||||
|
|
||||||
AC_FIND_FUNC_NO_LIBS2(dbopen, $berkeley_db, [
|
dnl db_create is used by db3
|
||||||
#include <stdio.h>
|
|
||||||
#if defined(HAVE_DB_185_H)
|
|
||||||
#include <db_185.h>
|
|
||||||
#elif defined(HAVE_DB_H)
|
|
||||||
#include <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, [
|
||||||
AC_FIND_FUNC_NO_LIBS(db_create, $berkeley_db)
|
#include <stdio.h>
|
||||||
|
#include <db.h>
|
||||||
|
],[NULL, NULL, 0])
|
||||||
|
|
||||||
DBLIB="$LIB_dbopen"
|
if test "$ac_cv_func_db_create" = "yes"; then
|
||||||
if test "$LIB_dbopen" != "$LIB_db_create"; then
|
db_type=db3
|
||||||
DBLIB="$DBLIB $LIB_db_create"
|
if test "$ac_cv_funclib_db_create" != "yes"; then
|
||||||
fi
|
DBLIB="$ac_cv_funclib_db_create"
|
||||||
if test "$LIB_dbopen" != "$LIB_dbm_firstkey"; then
|
else
|
||||||
DBLIB="$DBLIB $LIB_dbm_firstkey"
|
DBLIB=""
|
||||||
fi
|
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])
|
||||||
|
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
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(DBLIB)dnl
|
||||||
|
AC_SUBST(LIB_NDBM)dnl
|
||||||
])
|
])
|
||||||
|
@@ -251,20 +251,17 @@ AC_CHECK_HEADERS([\
|
|||||||
bsdsetjmp.h \
|
bsdsetjmp.h \
|
||||||
crypt.h \
|
crypt.h \
|
||||||
curses.h \
|
curses.h \
|
||||||
dbm.h \
|
|
||||||
dirent.h \
|
dirent.h \
|
||||||
dlfcn.h \
|
dlfcn.h \
|
||||||
err.h \
|
err.h \
|
||||||
errno.h \
|
errno.h \
|
||||||
fcntl.h \
|
fcntl.h \
|
||||||
fnmatch.h \
|
fnmatch.h \
|
||||||
gdbm/ndbm.h \
|
|
||||||
grp.h \
|
grp.h \
|
||||||
inttypes.h \
|
inttypes.h \
|
||||||
io.h \
|
io.h \
|
||||||
limits.h \
|
limits.h \
|
||||||
maillock.h \
|
maillock.h \
|
||||||
ndbm.h \
|
|
||||||
net/if.h \
|
net/if.h \
|
||||||
netdb.h \
|
netdb.h \
|
||||||
netinet/in.h \
|
netinet/in.h \
|
||||||
@@ -279,7 +276,6 @@ AC_CHECK_HEADERS([\
|
|||||||
pty.h \
|
pty.h \
|
||||||
pwd.h \
|
pwd.h \
|
||||||
resolv.h \
|
resolv.h \
|
||||||
rpcsvc/dbm.h \
|
|
||||||
sac.h \
|
sac.h \
|
||||||
security/pam_modules.h \
|
security/pam_modules.h \
|
||||||
sgtty.h \
|
sgtty.h \
|
||||||
|
10
lib/hdb/db.c
10
lib/hdb/db.c
@@ -35,7 +35,13 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
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
|
static krb5_error_code
|
||||||
DB_close(krb5_context context, HDB *db)
|
DB_close(krb5_context context, HDB *db)
|
||||||
@@ -290,4 +296,4 @@ hdb_db_create(krb5_context context, HDB **db,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* HAVE_DB1 */
|
||||||
|
@@ -35,7 +35,10 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#if defined(HAVE_DB_H) && DB_VERSION_MAJOR == 3
|
#if HAVE_DB3
|
||||||
|
|
||||||
|
#include <db.h>
|
||||||
|
|
||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
DB_close(krb5_context context, HDB *db)
|
DB_close(krb5_context context, HDB *db)
|
||||||
{
|
{
|
||||||
@@ -322,4 +325,4 @@ hdb_db_create(krb5_context context, HDB **db,
|
|||||||
(*db)->destroy = DB_destroy;
|
(*db)->destroy = DB_destroy;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_DB3 */
|
||||||
|
@@ -41,18 +41,18 @@ struct hdb_method {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct hdb_method methods[] = {
|
static struct hdb_method methods[] = {
|
||||||
#ifdef HAVE_DB_H
|
#if HAVE_DB1 || HAVE_DB3
|
||||||
{"db:", hdb_db_create},
|
{"db:", hdb_db_create},
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_NDBM_H) || defined(HAVE_GDBM_NDBM_H)
|
#if HAVE_NDBM
|
||||||
{"ndbm:", hdb_ndbm_create},
|
{"ndbm:", hdb_ndbm_create},
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPENLDAP
|
#ifdef OPENLDAP
|
||||||
{"ldap:", hdb_ldap_create},
|
{"ldap:", hdb_ldap_create},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DB_H
|
#if HAVE_DB1 || HAVE_DB3
|
||||||
{"", hdb_db_create},
|
{"", hdb_db_create},
|
||||||
#elif defined(HAVE_NDBM_H)
|
#elif defined(HAVE_NDBM)
|
||||||
{"", hdb_ndbm_create},
|
{"", hdb_ndbm_create},
|
||||||
#elif defined(OPENLDAP)
|
#elif defined(OPENLDAP)
|
||||||
{"", hdb_ldap_create},
|
{"", hdb_ldap_create},
|
||||||
|
@@ -65,16 +65,4 @@
|
|||||||
#include <hdb.h>
|
#include <hdb.h>
|
||||||
#include <hdb-private.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__ */
|
#endif /* __HDB_LOCL_H__ */
|
||||||
|
@@ -35,7 +35,15 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
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 {
|
struct ndbm_db {
|
||||||
DBM *db;
|
DBM *db;
|
||||||
@@ -350,4 +358,4 @@ hdb_ndbm_create(krb5_context context, HDB **db,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* HAVE_NDBM */
|
||||||
|
@@ -6,16 +6,15 @@ INCLUDES += $(INCLUDE_krb4)
|
|||||||
|
|
||||||
noinst_PROGRAMS = otptest
|
noinst_PROGRAMS = otptest
|
||||||
|
|
||||||
otptest_LDADD = libotp.la \
|
check_PROGRAMS = otptest
|
||||||
$(LIB_des) \
|
|
||||||
$(LIB_roken) \
|
otptest_LDADD = libotp.la
|
||||||
$(DBLIB)
|
|
||||||
|
|
||||||
include_HEADERS = otp.h
|
include_HEADERS = otp.h
|
||||||
|
|
||||||
lib_LTLIBRARIES = libotp.la
|
lib_LTLIBRARIES = libotp.la
|
||||||
libotp_la_LDFLAGS = -version-info 1:2:1
|
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 = \
|
libotp_la_SOURCES = \
|
||||||
otp.c \
|
otp.c \
|
||||||
|
@@ -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).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -38,23 +38,20 @@
|
|||||||
#ifndef __XDBM_H__
|
#ifndef __XDBM_H__
|
||||||
#define __XDBM_H__
|
#define __XDBM_H__
|
||||||
|
|
||||||
#if defined(HAVE_DB_H)
|
#if HAVE_DB_NDBM
|
||||||
#define DB_DBM_HSEARCH 1
|
#define DB_DBM_HSEARCH 1
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
#endif
|
#elif HAVE_NDBM
|
||||||
|
#if defined(HAVE_GDBM_NDBM_H)
|
||||||
#ifndef DBM_INSERT
|
|
||||||
#if defined(HAVE_NDBM_H)
|
|
||||||
#include <ndbm.h>
|
|
||||||
#elif defined(HAVE_GDBM_NDBM_H)
|
|
||||||
#include <gdbm/ndbm.h>
|
#include <gdbm/ndbm.h>
|
||||||
#elif defined(HAVE_DBM_H)
|
#elif defined(HAVE_DBM_H)
|
||||||
#include <dbm.h>
|
#include <dbm.h>
|
||||||
#elif defined(HAVE_RPCSVC_DBM_H)
|
#elif defined(HAVE_NDBM_H)
|
||||||
#include <rpcsvc/dbm.h>
|
#include <ndbm.h>
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* HAVE_NDBM */
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Macros to convert ndbm names to dbm names.
|
/* Macros to convert ndbm names to dbm names.
|
||||||
* Note that dbm_nextkey() cannot be simply converted using a macro, since
|
* Note that dbm_nextkey() cannot be simply converted using a macro, since
|
||||||
* it is invoked giving the database, and nextkey() needs the previous key.
|
* it is invoked giving the database, and nextkey() needs the previous key.
|
||||||
@@ -75,5 +72,6 @@ typedef char DBM;
|
|||||||
#else
|
#else
|
||||||
#define dbm_next(db,key) dbm_nextkey(db)
|
#define dbm_next(db,key) dbm_nextkey(db)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __XDBM_H__ */
|
#endif /* __XDBM_H__ */
|
||||||
|
Reference in New Issue
Block a user