check access rights of dump/purge/regs dirs
authorMiloš Mulač <mulac@civ.zcu.cz>
Tue, 15 Aug 2006 11:51:07 +0000 (11:51 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Tue, 15 Aug 2006 11:51:07 +0000 (11:51 +0000)
org.glite.lb.server/src/bkserverd.c

index c112ac1..2bb3840 100644 (file)
@@ -1461,13 +1461,22 @@ static int check_mkdir(const char *dir)
                        return 1;
                }
        }
-       else if (S_ISDIR(sbuf.st_mode)) return 0;
-       else {
+
+       if (!S_ISDIR(sbuf.st_mode))
+       {
                dprintf(("[%d] %s: not a directory\n", getpid(),dir));
                if (!debug) syslog(LOG_CRIT,"%s: not a directory",dir);
                return 1;
        }
 
+       if (access(dir, R_OK | W_OK))
+       {
+               dprintf(("[%d] %s: directory is not readable/writable\n", getpid(),dir));
+               if (!debug) syslog(LOG_CRIT,"%s: directory is not readable/writable",dir);
+               return 1;
+       }
+               
+
        return 0;
 }