From c71ef36188533ef5ae8c8ad4c7c08d62c3ca5899 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Fri, 26 Mar 2004 18:04:41 +0000 Subject: [PATCH] krb5_fcc_generate_new should use mkstemp Change krb5_fcc_generate_new to use mkstemp rather than mktemp. Ticket: new Status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16214 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/ChangeLog | 4 ++++ src/include/configure.in | 1 + src/lib/krb5/ccache/ChangeLog | 4 ++++ src/lib/krb5/ccache/cc_file.c | 10 ++++++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 6b2ba91ab..25f8eb8c7 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,7 @@ +2004-03-25 Sam Hartman + + * configure.in: Check for mkstemp + 2004-03-08 Ken Raeburn * Makefile.in (LOCAL_SUBDIRS): Renamed from MY_SUBDIRS. diff --git a/src/include/configure.in b/src/include/configure.in index 3aad0dc48..75bf3ea32 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -10,6 +10,7 @@ AC_PROG_AWK AC_PROG_LEX AC_C_CONST 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) +AC_CHECK_FUNCS( mkstemp) AC_HEADER_STDARG AC_CHECK_HEADERS(unistd.h paths.h regex.h regexp.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h) dnl diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index 631313b29..282ba0dca 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,7 @@ +2004-03-25 Sam Hartman + + * cc_file.c (krb5_fcc_generate_new): Use mkstemp not mktemp when possible + 2004-03-18 Jeffrey Altman * cc_mslsa.c: diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index 4fe6221b8..365e1a6fb 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -1991,9 +1991,8 @@ static krb5_error_code KRB5_CALLCONV krb5_fcc_generate_new (krb5_context context, krb5_ccache *id) { krb5_ccache lid; -#ifndef USE_STDIO int ret; -#else +#ifdef USE_STDIO FILE *f; #endif krb5_error_code retcode = 0; @@ -2009,7 +2008,14 @@ 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) { -- 2.26.2