]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
hfaxd: PrivateRecvQ to allow private recvq listing
authorAidan Van Dyk <aidan@ifax.com>
Mon, 22 Sep 2008 19:44:07 +0000 (19:44 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 22 Sep 2008 19:44:07 +0000 (19:44 +0000)
hfaxd/HylaFAXServer.c++
hfaxd/HylaFAXServer.h
hfaxd/RecvQueue.c++

index e1a37d619f13a54494c8370f1fa33d281e5afd67..9a4b452574b169a6222cb5845e4d8b27d5eca34f 100644 (file)
@@ -652,6 +652,7 @@ HylaFAXServer::numbertag HylaFAXServer::numbers[] = {
 HylaFAXServer::booltag HylaFAXServer::booleans[] = {
 { "allowsorting",      &HylaFAXServer::allowSorting,           true },
 { "publicjobq",                &HylaFAXServer::publicJobQ,             false },
+{ "publicrecvq",       &HylaFAXServer::publicRecvQ,            false },
 };
 
 void
index 723bf713f9301ea9148d3ecb5cf83dbb1948df7c..f326c927c3047acad95889a095b7e102b71ca5e8 100644 (file)
@@ -234,6 +234,7 @@ protected:
     time_t     denyTime;               // time to deny service
     u_int      jobProtection;          // Protection to use on Jobs
     bool       publicJobQ;             // Public/protection on recvq?
+    bool       publicRecvQ;            // Public/protection on recvq?
     bool       allowSorting;           // Allow client to make us sort
     /*
      * User authentication and login-related state.
index 0a4065b2567de6a63bf3537ffe83ef497fb7c125..407452e46bb38025bb9baef256c2ca961d651fea 100644 (file)
@@ -210,9 +210,9 @@ HylaFAXServer::getRecvDocStatus(RecvInfo& ri)
 }
 
 bool
-HylaFAXServer::isVisibleRecvQFile(const char* filename, const struct stat&)
+HylaFAXServer::isVisibleRecvQFile(const char* filename, const struct stat& sb)
 {
-    return (strncmp(filename, "fax", 3) == 0);
+    return (strncmp(filename, "fax", 3) == 0) && (publicRecvQ || checkFileRights(R_OK, sb) );
 }
 
 RecvInfo*
@@ -253,11 +253,14 @@ HylaFAXServer::listRecvQ(FILE* fd, const SpoolDir& sd, DIR* dir)
     struct dirent* dp;
     while ((dp = readdir(dir))) {
        struct stat sb;
-       if (!isVisibleRecvQFile(dp->d_name, sb))
-           continue;
        fxStr qfile(path | dp->d_name);
        RecvInfo* rip;
-       if (FileCache::update(qfile, sb) && (rip = getRecvInfo(qfile, sb))) {
+       if (!FileCache::update(qfile, sb))
+           continue;
+       if (!isVisibleRecvQFile(dp->d_name, sb))
+           continue;
+       rip = getRecvInfo(qfile, sb);
+       if (rip) {
            if (recvSortFormat.length() == 0) {
                Rprintf(fd, recvFormat, *rip, sb);
                fputs("\r\n", fd);