summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2007-06-20 03:53:37 +0000
committerKen Raeburn <raeburn@mit.edu>2007-06-20 03:53:37 +0000
commit56da8ce661eaf5b6555db9be3a572cf27ce8894f (patch)
tree3c8aab6089766c909fb4bf222e2bbda438056143 /src
parent86e638b30cb0c56e9d0fd0b213be0696191eb297 (diff)
downloadkrb5-56da8ce661eaf5b6555db9be3a572cf27ce8894f.tar.gz
krb5-56da8ce661eaf5b6555db9be3a572cf27ce8894f.tar.xz
krb5-56da8ce661eaf5b6555db9be3a572cf27ce8894f.zip
Move (BSD-licensed) mkstemp from libdb2 to libkrb5support, and rename
the function to krb5int_mkstemp. Generate the symbol export list for libkrb5support at build time. Declare krb5int_mkstemp in k5-platform.h. Change cc_file.c to use mkstemp unconditionally. Make libdb2.so (built for testing only) link against the libkrb5support, and use krb5int_mkstemp if mkstemp is not available. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19600 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/configure.in13
-rw-r--r--src/include/k5-platform.h3
-rw-r--r--src/lib/krb5/ccache/cc_file.c4
-rw-r--r--src/plugins/kdb/db2/libdb2/Makefile.in6
-rw-r--r--src/plugins/kdb/db2/libdb2/clib/Makefile.in2
-rw-r--r--src/plugins/kdb/db2/libdb2/configure.in4
-rw-r--r--src/util/support/Makefile.in19
-rw-r--r--src/util/support/libkrb5support-fixed.exports (renamed from src/util/support/libkrb5support.exports)0
-rw-r--r--src/util/support/mkstemp.c (renamed from src/plugins/kdb/db2/libdb2/clib/mkstemp.c)13
9 files changed, 46 insertions, 18 deletions
diff --git a/src/configure.in b/src/configure.in
index 947be9be1f..be7d093075 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -159,6 +159,19 @@ AC_PROG_LEX
AC_C_CONST
AC_HEADER_DIRENT
AC_CHECK_FUNCS(strdup setvbuf inet_ntoa inet_aton seteuid setresuid setreuid setegid setresgid setregid setsid flock fchmod chmod strftime strptime geteuid setenv unsetenv getenv gethostbyname2 getifaddrs gmtime_r localtime_r pthread_mutex_lock sched_yield bswap16 bswap64 mkstemp getusershell lstat access ftime getcwd srand48 srand srandom stat strchr strerror strerror_r strstr timezone umask waitpid sem_init sem_trywait daemon)
+dnl
+EXTRA_SUPPORT_SYMS=
+AC_CHECK_FUNC(mkstemp,
+[MKSTEMP_ST_OBJ=
+MKSTEMP_OBJ=],
+[MKSTEMP_ST_OBJ='mkstemp.o'
+MKSTEMP_OBJ='$(OUTPRE)mkstemp.$(OBJEXT)'
+EXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_mkstemp"
+AC_DEFINE(mkstemp,krb5int_mkstemp,[Define to krb5int_mkstemp if the OS does not provide it.])])
+AC_SUBST(MKSTEMP_OBJ)
+AC_SUBST(MKSTEMP_ST_OBJ)
+AC_SUBST(EXTRA_SUPPORT_SYMS)
+dnl
AC_HEADER_STDARG
DECLARE_SYS_ERRLIST
AC_CHECK_HEADERS(unistd.h paths.h regex.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h sched.h byteswap.h machine/endian.h machine/byte_order.h sys/bswap.h endian.h pwd.h arpa/inet.h alloca.h dlfcn.h limits.h pthread.h semaphore.h krb_db.h kdc.h)
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 6cf4465066..fe248b3480 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -832,5 +832,8 @@ k5_asprintf(char **ret, const char *format, ...)
}
#endif
+#ifndef HAVE_MKSTEMP
+extern int krb5int_mkstemp(char *);
+#endif
#endif /* K5_PLATFORM_H */
diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c
index 84d278765a..2858323317 100644
--- a/src/lib/krb5/ccache/cc_file.c
+++ b/src/lib/krb5/ccache/cc_file.c
@@ -1964,14 +1964,10 @@ krb5_fcc_generate_new (krb5_context context, krb5_ccache *id)
(void) strcpy(scratch, TKT_ROOT);
(void) strcat(scratch, "XXXXXX");
-#ifdef HAVE_MKSTEMP
ret = mkstemp(scratch);
if (ret == -1) {
return krb5_fcc_interpret(context, errno);
} else close(ret);
-#else /*HAVE_MKSTEMP*/
- mktemp(scratch);
-#endif
lid->data = (krb5_pointer) malloc(sizeof(krb5_fcc_data));
if (lid->data == NULL) {
diff --git a/src/plugins/kdb/db2/libdb2/Makefile.in b/src/plugins/kdb/db2/libdb2/Makefile.in
index 77326a2392..83a1180f3f 100644
--- a/src/plugins/kdb/db2/libdb2/Makefile.in
+++ b/src/plugins/kdb/db2/libdb2/Makefile.in
@@ -15,6 +15,11 @@ RELDIR=../plugins/kdb/db2/libdb2
HDRDIR=$(BUILDTOP)/include
HDRS = $(HDRDIR)/db.h $(HDRDIR)/db-config.h $(HDRDIR)/db-ndbm.h
+SHLIB_EXPDEPS=$(SUPPORT_DEPLIB)
+SHLIB_EXPLIBS=$(SUPPORT_LIB)
+SHLIB_DIRS=-L$(TOPLIBD)
+SHLIB_RDIRS=$(KRB5_LIBDIR)
+
AUTOCONF_HEADER=$(srcdir)/include/config.h.in
all-unix:: includes all-libs
@@ -40,5 +45,4 @@ $(srcdir)/include/autoconf.stmp: $(srcdir)/configure.in $(SRCTOP)/aclocal.m4
clean-includes::
$(RM) $(HDRS) include/*.stmp
-@libnodeps_frag@
@lib_frag@
diff --git a/src/plugins/kdb/db2/libdb2/clib/Makefile.in b/src/plugins/kdb/db2/libdb2/clib/Makefile.in
index 1053b49454..7c43c6dc56 100644
--- a/src/plugins/kdb/db2/libdb2/clib/Makefile.in
+++ b/src/plugins/kdb/db2/libdb2/clib/Makefile.in
@@ -2,7 +2,7 @@ thisconfigdir=./..
myfulldir=plugins/kdb/db2/libdb2/clib
mydir=clib
BUILDTOP=$(REL)..$(S)..$(S)..$(S)..$(S)..
-STLIBOBJS=@MEMMOVE_OBJ@ @MKSTEMP_OBJ@ @STRERROR_OBJ@
+STLIBOBJS=@MEMMOVE_OBJ@ @STRERROR_OBJ@
LOCALINCLUDES=-I../include
diff --git a/src/plugins/kdb/db2/libdb2/configure.in b/src/plugins/kdb/db2/libdb2/configure.in
index a1b00d3213..10c3bd752a 100644
--- a/src/plugins/kdb/db2/libdb2/configure.in
+++ b/src/plugins/kdb/db2/libdb2/configure.in
@@ -77,9 +77,7 @@ AC_DEFINE(MEMMOVE,1,[Define if memmove.o is compiled in])])
AC_SUBST(MEMMOVE_OBJ)
AC_CHECK_FUNC(mkstemp, ,
-[MKSTEMP_OBJ=mkstemp.o
-AC_DEFINE(mkstemp, kdb2__mkstemp,[Define to \`kdb2__mkstemp' to provide private mkstemp function])])
-AC_SUBST(MKSTEMP_OBJ)
+[AC_DEFINE(mkstemp, krb5int_mkstemp,[Define to \`krb5int_mkstemp' to use private mkstemp function])])
AC_CHECK_FUNC(strerror, ,
[STRERROR_OBJ=strerror.o
diff --git a/src/util/support/Makefile.in b/src/util/support/Makefile.in
index 78c322ec00..a89dd4d4c8 100644
--- a/src/util/support/Makefile.in
+++ b/src/util/support/Makefile.in
@@ -31,7 +31,8 @@ STLIBOBJS= \
plugins.o \
errors.o \
gmt_mktime.o \
- fake-addrinfo.o
+ fake-addrinfo.o \
+ @MKSTEMP_ST_OBJ@
LIBOBJS= \
$(OUTPRE)threads.$(OBJEXT) \
@@ -39,7 +40,8 @@ LIBOBJS= \
$(OUTPRE)plugins.$(OBJEXT) \
$(OUTPRE)errors.$(OBJEXT) \
$(OUTPRE)gmt_mktime.$(OBJEXT) \
- $(OUTPRE)fake-addrinfo.$(OBJEXT)
+ $(OUTPRE)fake-addrinfo.$(OBJEXT) \
+ @MKSTEMP_OBJ@
STOBJLISTS=OBJS.ST
@@ -52,7 +54,9 @@ SRCS=\
$(srcdir)/init-addrinfo.c \
$(srcdir)/errors.c \
$(srcdir)/gmt_mktime.c \
- $(srcdir)/fake-addrinfo.c
+ $(srcdir)/fake-addrinfo.c \
+ $(srcdir)/mkstemp.c
+
SHLIB_EXPDEPS =
# Add -lm if dumping thread stats, for sqrt.
SHLIB_EXPLIBS= $(LIBS) $(DL_LIB)
@@ -76,6 +80,15 @@ $(BUILDTOP)/include/autoconf.h: $(SRCTOP)/include/autoconf.h.in
t_mktime: gmt_mktime.c
$(CC) $(ALL_CFLAGS) -DTEST_LEAP -o t_mktime $(srcdir)/gmt_mktime.c
+SHLIB_EXPORT_FILE=libkrb5support.exports
+
+libkrb5support.exports: $(srcdir)/libkrb5support-fixed.exports Makefile
+ cat $(srcdir)/libkrb5support-fixed.exports > new-exports
+ for i in @EXTRA_SUPPORT_SYMS@ .; do \
+ if test "$$i" != .; then echo $$i >> new-exports; else :; fi ; \
+ done
+ $(MV) new-exports libkrb5support.exports
+
@lib_frag@
@libobj_frag@
diff --git a/src/util/support/libkrb5support.exports b/src/util/support/libkrb5support-fixed.exports
index 850db8c641..850db8c641 100644
--- a/src/util/support/libkrb5support.exports
+++ b/src/util/support/libkrb5support-fixed.exports
diff --git a/src/plugins/kdb/db2/libdb2/clib/mkstemp.c b/src/util/support/mkstemp.c
index 71dc7d17a1..b671c6b566 100644
--- a/src/plugins/kdb/db2/libdb2/clib/mkstemp.c
+++ b/src/util/support/mkstemp.c
@@ -35,9 +35,7 @@
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "k5-platform.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -45,14 +43,17 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
-static int _gettemp();
+static int _gettemp(char *, int *);
-mkstemp(path)
+int mkstemp(path)
char *path;
{
int fd;
@@ -60,7 +61,7 @@ mkstemp(path)
return (_gettemp(path, &fd) ? fd : -1);
}
-static
+static int
_gettemp(path, doopen)
char *path;
register int *doopen;