From e4dc0bb1a0df98634ca244c8bff8fe93dc18570e Mon Sep 17 00:00:00 2001 From: dm Date: Wed, 12 Feb 1997 00:56:10 +0000 Subject: [PATCH] Delete old ticket file in addition to wiping if there is one. --- kerberosIV/krb/in_tkt.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kerberosIV/krb/in_tkt.c b/kerberosIV/krb/in_tkt.c index 6bea0ff6f56..62131815c9c 100644 --- a/kerberosIV/krb/in_tkt.c +++ b/kerberosIV/krb/in_tkt.c @@ -64,7 +64,7 @@ in_tkt(pname, pinst) metoo = geteuid(); if (lstat(file,&buf) == 0) { if (buf.st_uid != me || !(buf.st_mode & S_IFREG) || - buf.st_mode & 077) { + buf.st_mode & 077 || buf.st_nlink != 1) { if (krb_debug) fprintf(stderr,"Error initializing %s",file); return(KFAILURE); @@ -76,14 +76,12 @@ in_tkt(pname, pinst) bzero(charbuf, sizeof(charbuf)); for (i = 0; i < buf.st_size; i += sizeof(charbuf)) - if (write(fd, charbuf, sizeof(charbuf)) != sizeof(charbuf)) { - (void) fsync(fd); - (void) close(fd); - goto out; - } + if (write(fd, charbuf, sizeof(charbuf)) != sizeof(charbuf)) + break; (void) fsync(fd); (void) close(fd); + (void) unlink (file); } out: /* arrange so the file is owned by the ruid -- 2.20.1