diff options
author | dm <dm@cvs.openbsd.org> | 1997-02-12 00:56:11 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1997-02-12 00:56:11 +0000 |
commit | 214b582cf6d696698a458ca3059111f126683eb0 (patch) | |
tree | 442bd3af8783ed7880f82fa08201037d99bcad50 | |
parent | 09a91f60962ba426a9ca9b64f6c5bcabd93d1dae (diff) |
Delete old ticket file in addition to wiping if there is one.
-rw-r--r-- | kerberosIV/krb/in_tkt.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/kerberosIV/krb/in_tkt.c b/kerberosIV/krb/in_tkt.c index 0bb8926c209..9eb958d6b90 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 |