From 4913c0b1fceed6c02adfc8d1c09e4e672bd8a9ee Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Sat, 24 Feb 1996 23:55:04 +0000 Subject: [PATCH] Use Windows path separator, if appropriate. Under Windows also use the environment variables TEMP and TMP for the replay cache. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7526 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/ChangeLog | 6 ++++++ src/lib/krb5/rcache/rc_io.c | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/lib/krb5/rcache/ChangeLog b/src/lib/krb5/rcache/ChangeLog index a4201c083..df2c6d9e8 100644 --- a/src/lib/krb5/rcache/ChangeLog +++ b/src/lib/krb5/rcache/ChangeLog @@ -1,3 +1,9 @@ +Sat Feb 24 18:53:33 1996 Theodore Y. Ts'o + + * rc_io.c (krb5_rc_io_creat, krb5_rc_io_open): Use Windows path + separator, if appropriate. Under Windows also use the + environment variables TEMP and TMP for the replay cache. + Fri Dec 1 17:07:24 1995 Theodore Y. Ts'o * rc_io.c (krb5_rc_io_creat): In case of permission problems, diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index fa0bdc0ae..dd5d8e73a 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -11,6 +11,11 @@ * I/O functions for the replay cache default implementation. */ +#ifdef _WINDOWS +# define PATH_SEPARATOR "\\" +#else +# define PATH_SEPARATOR "/" +#endif #define KRB5_RC_VNO 0x0501 /* krb5, rcache v 1 */ #define NEED_SOCKETS @@ -55,11 +60,17 @@ static void getdir() if (!dirlen) { if (!(dir = getenv("KRB5RCACHEDIR"))) +#ifdef _WINDOWS + if (!(dir = getenv("TEMP"))) + if (!(dir = getenv("TMP"))) + dir = "C:\\"; +#else if (!(dir = getenv("TMPDIR"))) #ifdef RCTMPDIR dir = RCTMPDIR; #else dir = "/tmp"; +#endif #endif dirlen = strlen(dir) + 1; } @@ -80,7 +91,7 @@ krb5_error_code krb5_rc_io_creat (context, d, fn) if (!(d->fn = malloc(strlen(*fn) + dirlen + 1))) return KRB5_RC_IO_MALLOC; (void) strcpy(d->fn,dir); - (void) strcat(d->fn,"/"); + (void) strcat(d->fn,PATH_SEPARATOR); (void) strcat(d->fn,*fn); d->fd = THREEPARAMOPEN(d->fn,O_WRONLY | O_CREAT | O_TRUNC | O_EXCL | O_BINARY,0600); } @@ -93,7 +104,7 @@ krb5_error_code krb5_rc_io_creat (context, d, fn) if (fn) if (!(*fn = malloc(35))) { FREE(d->fn); return KRB5_RC_IO_MALLOC; } - (void) sprintf(d->fn,"%s/krb5_RC%d",dir,UNIQUE); + (void) sprintf(d->fn,"%s%skrb5_RC%d",dir,PATH_SEPARATOR,UNIQUE); c = d->fn + strlen(d->fn); (void) strcpy(c,"aaa"); while ((d->fd = THREEPARAMOPEN(d->fn,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY,0600)) == -1) @@ -165,7 +176,7 @@ krb5_error_code krb5_rc_io_open (context, d, fn) if (!(d->fn = malloc(strlen(fn) + dirlen + 1))) return KRB5_RC_IO_MALLOC; (void) strcpy(d->fn,dir); - (void) strcat(d->fn,"/"); + (void) strcat(d->fn,PATH_SEPARATOR); (void) strcat(d->fn,fn); #ifdef NO_USERID -- 2.26.2