From 12734daa44c8e63df27fcfb6d26636bac68e4819 Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Mon, 6 May 1996 16:19:33 +0000 Subject: [PATCH] Include the uid in the replay cachename git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7905 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/ChangeLog | 7 +++++++ src/lib/krb5/krb/configure.in | 2 +- src/lib/krb5/krb/srv_rcache.c | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 374796dc9..4d1246968 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -36,6 +36,13 @@ Thu May 2 22:48:56 1996 Mark Eichin that specifies that the "invalid flag" doesn't get checked. (This version is only called from kdc_util.c:kdc_process_tgs_req.) +Wed May 1 14:30:29 1996 Richard Basch + + * srv_rcache.c (krb5_get_server_rcache): include the uid in the + default server replay cachename, for systems with geteuid. + + * configure.in: test if the system has geteuid() + Wed May 1 02:26:53 1996 Mark Eichin * str_conv.c (krb5_string_to_timestamp): double check that diff --git a/src/lib/krb5/krb/configure.in b/src/lib/krb5/krb/configure.in index 7e3e2e9c4..4a3ea5ab9 100644 --- a/src/lib/krb5/krb/configure.in +++ b/src/lib/krb5/krb/configure.in @@ -5,7 +5,7 @@ AC_PROG_ARCHIVE_ADD AC_PROG_RANLIB AC_HEADER_STDARG V5_SHARED_LIB_OBJS -AC_HAVE_FUNCS(strftime strptime) +AC_HAVE_FUNCS(strftime strptime geteuid) KRB5_RUN_FLAGS SubdirLibraryRule([$(OBJS)]) USE_ANAME diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c index 59fd5e2a1..ad9decc71 100644 --- a/src/lib/krb5/krb/srv_rcache.c +++ b/src/lib/krb5/krb/srv_rcache.c @@ -39,6 +39,11 @@ krb5_get_server_rcache(context, piece, rcptr) char tmp[4]; krb5_error_code retval; int len, p, i; + +#ifdef HAVE_GETEUID + unsigned long tens; + unsigned long uid = geteuid(); +#endif rcache = (krb5_rcache) malloc(sizeof(*rcache)); if (!rcache) @@ -55,6 +60,13 @@ krb5_get_server_rcache(context, piece, rcptr) else if (!isgraph(piece->data[i])) len += 3; } + +#ifdef HAVE_GETEUID + len += 2; /* _ */ + for (tens = 1; (uid / tens) > 9 ; tens *= 10) + len++; +#endif + cachename = malloc(len); if (!cachename) { retval = ENOMEM; @@ -78,6 +90,15 @@ krb5_get_server_rcache(context, piece, rcptr) } cachename[p++] = piece->data[i]; } + +#ifdef HAVE_GETEUID + cachename[p++] = '_'; + while (tens) { + cachename[p++] = '0' + ((uid / tens) % 10); + tens /= 10; + } +#endif + cachename[p++] = '\0'; if ((retval = krb5_rc_resolve(context, rcache, cachename))) -- 2.26.2