[torqueusers] bug in chk_file_sec 2.1.6 with file symlinks

Garrick Staples garrick at clusterresources.com
Tue Dec 5 23:03:35 MST 2006


Mind trying this out?

Index: src/lib/Liblog/chk_file_sec.c
===================================================================
--- src/lib/Liblog/chk_file_sec.c       (revision 1150)
+++ src/lib/Liblog/chk_file_sec.c       (working copy)
@@ -192,10 +192,24 @@
       pc[1] = '\0';
       }
 
-    /* append symlink string to end of directory */
+    /* now figure out how to follow the symlink */
 
-    strcat(shorter,symlink);
+    if (stat(path,&sbuf) == -1) 
+      {
+      rc = errno;
 
+      goto chkerr;
+      }
+
+    if (S_ISDIR(sbuf.st_mode) != 0)
+      {
+      strcat(shorter,symlink);
+      }
+    else
+      {
+      strcpy(shorter,symlink);
+      }
+    
     return(chk_file_sec(shorter,isdir,sticky,disallow,fullpath));
     }
 



More information about the torqueusers mailing list