From: Chaskiel M Grundman Date: Tue, 11 Sep 2007 16:37:01 +0000 (+0000) Subject: namei-protect-against-extra-files-20070911 X-Git-Tag: BP-openafs-windows-kdfs-ifs~497 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c22f945bb783ba003c12ce73574568a9c4b80304;p=packages%2Fo%2Fopenafs.git namei-protect-against-extra-files-20070911 if someone is monkeying in the filesystem, sometimes they shoot themselves. save them if they renamed foo to foo.bak (where foo is a full 64 bits) --- diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index c818603b5..240e4be27 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1447,6 +1447,7 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid) char fpath[512]; struct afs_stat status; int parm, tag; + lb64_string_t check; (void)strcpy(fpath, dpath); (void)strcat(fpath, "/"); @@ -1459,6 +1460,10 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid) info->byteCount = status.st_size; info->inodeNumber = (Inode) flipbase64_to_int64(name); + int64_to_flipbase64(check, info->inodeNumber); + if (strcmp(name, check)) + return -1; + GetOGMFromStat(&status, &parm, &tag); if ((info->inodeNumber & NAMEI_INODESPECIAL) == NAMEI_INODESPECIAL) { /* p1 - vid, p2 - -1, p3 - type, p4 - rwvid */