procmail
[Top] [All Lists]

Re: Why is softlink / hardlink "BOGUS" ?

1996-05-27 02:04:03

 Hi.

 First of all, thanx to all who replied.

 Second, I came up with the following patch. It allows me not to use
~root/.procmailrc for shared /var/spool/mail on local net. So now I
have /var/spool/mail/root -> /filesystem/local/to/machines/root_mailbox

 and I'm also being able to do the backup my way, having hardlinks to
the mailboxes... oh well... 

 if you see a hazard that could happen and cause a crash or data loss
due to my changes (in my setup : hosts A,B,C,D share /var/spool/mail
on host C, but all have the root's (and only root's) mailbox on their
local filesystem (under /filesystem/local/to/machines/root_mailbox).
Usetrs share /home/ dir from host C as well.)
then please let me know.

 (I'm not subscribed to this list yet)

 Thanx & TTYL,

          Jan

=========================================================

diff -uNr procmail-3.10.orig/config.h procmail-3.10/config.h
--- procmail-3.10.orig/config.h Sun May 26 21:00:36 1996
+++ procmail-3.10/config.h      Sun May 26 20:47:14 1996
@@ -168,6 +168,8 @@
 #define HELPOPT1       'h'              /* options to get command line help */
 #define HELPOPT2       '?'
 
+#define NOLINKSOPT     'l'         /* don't allow sym/hard links to mailbox */
+
 #define VERSIONOPT     'v'                     /* option to display version */
 #define PRESERVOPT     'p'                          /* preserve environment */
 #define TEMPFAILOPT    't'                   /* return EX_TEMPFAIL on error */
diff -uNr procmail-3.10.orig/src/misc.c procmail-3.10/src/misc.c
--- procmail-3.10.orig/src/misc.c       Thu Oct 20 14:14:36 1994
+++ procmail-3.10/src/misc.c    Sun May 26 20:59:53 1996
@@ -27,6 +27,8 @@
 #include "mailfold.h"
 #include "lastdirsep.h"
 
+extern int nolinks;
+
 struct varval strenvvar[]={{"LOCKSLEEP",DEFlocksleep},
  {"LOCKTIMEOUT",DEFlocktimeout},{"SUSPEND",DEFsuspend},
  {"NORESRETRY",DEFnoresretry},{"TIMEOUT",DEFtimeout},{"VERBOSE",DEFverbose},
@@ -645,11 +647,12 @@
                       syslog(LOG_ALERT,renbogus,defdeflock,buf);
            }
         }
-       if(mboxstat>0||mboxstat<0&&(setids(),!lstat(chp,&stbuf)))
+       if(mboxstat>0||mboxstat<0&&
+          (setids(),!(nolinks?lstat(chp,&stbuf):stat(chp,&stbuf))))
           if(!(stbuf.st_mode&S_IWUSR)||             /* recipient can write? */
-             S_ISLNK(stbuf.st_mode)||                  /* no symbolic links */
+             (nolinks && S_ISLNK(stbuf.st_mode))||     /* no symbolic links */
              (S_ISDIR(stbuf.st_mode)?        /* directories, yes, hardlinks */
-               !(stbuf.st_mode&S_IXUSR):stbuf.st_nlink!=1))           /* no */
+               !(stbuf.st_mode&S_IXUSR):(nolinks&&stbuf.st_nlink!=1)))/* no */
              goto bogusbox;            /* can't deliver to this contraption */
           else if(stbuf.st_uid!=uid)                 /* recipient not owner */
 bogusbox:   { ultoan((unsigned long)stbuf.st_ino,        /* i-node numbered */
diff -uNr procmail-3.10.orig/src/procmail.c procmail-3.10/src/procmail.c
--- procmail-3.10.orig/src/procmail.c   Thu Oct 20 14:14:40 1994
+++ procmail-3.10/src/procmail.c        Sun May 26 20:46:16 1996
@@ -57,6 +57,8 @@
 uid_t uid;
 gid_t gid,sgid;
 
+int nolinks;
+
 #if 0
 #define wipetcrc()     (etcrc&&(etcrc=0,closerc(),1))
 #else
@@ -77,7 +79,7 @@
   newid();
   ;{ int presenviron,Deliverymode,override;char*fromwhom=0;
      const char*idhint=0;gid_t egid=getegid();
-     Deliverymode=mailfilter=override=0;
+     Deliverymode=mailfilter=override=0;nolinks=0;
      Openlog(procmailn,LOG_PID,LOG_MAIL);                /* for the syslogd */
      if(argc)                         /* sanity check, any argument at all? */
       { Deliverymode=strncmp(lastdirsep(argv0=argv[0]),procmailn,
@@ -110,6 +112,8 @@
                 case OVERRIDEOPT:override=1;
                    continue;
                 case BERKELEYOPT:berkeley=1;
+                   continue;
+                case NOLINKSOPT:nolinks=1;
                    continue;
                 case TEMPFAILOPT:retval=EX_TEMPFAIL;
                    continue;

<Prev in Thread] Current Thread [Next in Thread>