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
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)
}
#endif
+#ifndef HAVE_MKSTEMP
+extern int krb5int_mkstemp(char *);
+#endif
#endif /* K5_PLATFORM_H */
(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) {
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
clean-includes::
$(RM) $(HDRS) include/*.stmp
-@libnodeps_frag@
@lib_frag@
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
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
plugins.o \
errors.o \
gmt_mktime.o \
- fake-addrinfo.o
+ fake-addrinfo.o \
+ @MKSTEMP_ST_OBJ@
LIBOBJS= \
$(OUTPRE)threads.$(OBJEXT) \
$(OUTPRE)plugins.$(OBJEXT) \
$(OUTPRE)errors.$(OBJEXT) \
$(OUTPRE)gmt_mktime.$(OBJEXT) \
- $(OUTPRE)fake-addrinfo.$(OBJEXT)
+ $(OUTPRE)fake-addrinfo.$(OBJEXT) \
+ @MKSTEMP_OBJ@
STOBJLISTS=OBJS.ST
$(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)
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@
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>
#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;
return (_gettemp(path, &fd) ? fd : -1);
}
-static
+static int
_gettemp(path, doopen)
char *path;
register int *doopen;