From e7ee775130ce4bc4197874487c33517289715453 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 31 Mar 1995 21:48:37 +0000 Subject: [PATCH] * rc_dfl.c (krb5_rc_dfl_expunage): Close the old, temporary reply cache after we're done expunging it. * rc_io.c (krb5_rc_io_move): Make duplicate copies of the filename and the file descriptor (via malloc/strcpy and dup), so that the old rc_io object can be cleanly closed without affecting the new rc_io object. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5327 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/ChangeLog | 10 ++++++++++ src/lib/krb5/rcache/rc_dfl.c | 1 + src/lib/krb5/rcache/rc_io.c | 7 +++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/krb5/rcache/ChangeLog b/src/lib/krb5/rcache/ChangeLog index 8818198ec..01150216d 100644 --- a/src/lib/krb5/rcache/ChangeLog +++ b/src/lib/krb5/rcache/ChangeLog @@ -1,3 +1,13 @@ +Fri Mar 31 16:44:34 1995 Theodore Y. Ts'o (tytso@dcl) + + * rc_dfl.c (krb5_rc_dfl_expunage): Close the old, temporary reply + cache after we're done expunging it. + + * rc_io.c (krb5_rc_io_move): Make duplicate copies of the filename + and the file descriptor (via malloc/strcpy and dup), so + that the old rc_io object can be cleanly closed without + affecting the new rc_io object. + Fri Mar 17 20:27:41 1995 John Gilmore (gnu at toad.com) * Makefile.in (LDFLAGS): Eliminate duplicate of config/pre.in. diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index a6476109b..aecbb37e9 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -590,6 +590,7 @@ krb5_rcache id; return KRB5_RC_IO; if (krb5_rc_io_move(context, &t->d, &((struct dfl_data *)tmp->data)->d)) return KRB5_RC_IO; + (void) krb5_rc_dfl_close(context, tmp); #endif return 0; } diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index dd59ea084..8d61d5724 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -235,8 +235,11 @@ krb5_error_code INTERFACE krb5_rc_io_move (context, new, old) if (rename(old->fn,new->fn) == -1) /* MUST be atomic! */ return KRB5_RC_IO_UNKNOWN; (void) krb5_rc_io_close(context, new); - new->fn = old->fn; - new->fd = old->fd; + new->fn = malloc(strlen(old->fn)+1); + if (new->fn == 0) + return ENOMEM; + strcpy(new->fn, old->fn); + new->fd = dup(old->fd); return 0; } -- 2.26.2