]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-namei-protect-against-extra-files-20070911
authorChaskiel M Grundman <cg2v@andrew.cmu.edu>
Tue, 11 Sep 2007 16:40:26 +0000 (16:40 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 11 Sep 2007 16:40:26 +0000 (16:40 +0000)
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)

(cherry picked from commit c22f945bb783ba003c12ce73574568a9c4b80304)

src/vol/namei_ops.c

index c818603b5d451b0a584964b3d10062566ab562d7..240e4be27242cdfe036f167f870222d9be840142 100644 (file)
@@ -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 */