Re: qconfirm: manual confirmation-only mode?

clemens fischer <[email protected]>
Newsgroups gmane.comp.misc.pape.general
Message-ID <[email protected]>
Gerrit Pape:

>  I don't think the 'manual' feature should be a different mode, but
>  simply an option.  You may want to use it for the message mode and
>  sender mode.

sorry for posting late. i already made qconfirm-checks "mode"-variable a
bitfield, but wanted to test *before posting* this time.

this patch is two or three days old, i think, it works and provides the
following benefits:

adds a `-M' option, which makes qconfirm-check queue emails only.
confirmations, sneak previews, drops etc. must be done manually.

this avoids problems with list-washers, who clean up their for-sell
lists by adding valid, bouncing emails. also, mini-isps could offer
customers the option of holding unknown senders until approved, without
making this procedure public.

finally, the qconfirm tests in the distribution could now be enhanced.
currently qconfirm-check isn't tested aside from checking the version
string.

>  diff -u -r1.55 qconfirm-check.c

thanks for the diff, i had something similiar, now here's mine:

%%%
--- qconfirm-check.c	Tue Feb 22 16:48:20 2005
+++ src/qconfirm-check.c	Sat Feb 26 09:41:20 2005
@@ -27,15 +27,17 @@
 #include "getline.h"
 #include "seek.h"
 
-#define USAGE " [-mnbD] [-d dir ] [-i bytes ] [-t sec ] [prog]"
+// -ino: 20050222-1651
+#define USAGE " [-MmnbD] [-d dir ] [-i bytes ] [-t sec ] [prog]"
 #define VERSION "$Id: qconfirm-check.c,v 1.55 2004/12/12 16:52:22 pape Exp $"
 #define FATAL "qconfirm-check: fatal: "
 #define WARNING "qconfirm-check: warning: "
 #define INFO "qconfirm-check: info: "
 #define EXTRA "qconfirm-check: extra: "
 
-#define MODE_SENDER 0
-#define MODE_INODE 1
+#define MODE_SENDER 1
+#define MODE_INODE 2
+#define MODE_MANUAL 4
 
 const char *progname;
 
@@ -75,7 +77,7 @@
 char *qconfirm_accept;
 char *qconfirm_accept_prog;
 char *mid;
-int mode =MODE_SENDER;
+unsigned int mode =MODE_SENDER;
 unsigned long timeout =TIMEOUT;
 unsigned long size =SIZE;
 int ack =1;
@@ -84,6 +86,11 @@
 struct stat msg_st;
 int fdmsg;
 
+// -ino: 20050222-1651
+// invariant:  extension==0 && mid==0 && fd==fd: ack,
+//             extension==0 && mid==0 && fd==-1: manual ack,
+//             extension!=0 && mid==0 && fd==0: remind,
+//             extension!=0 && mid!=0 && fd==0: req
 int inject_qconfirm_msg (int fd_msg, char *extension, char *mid, int fd) {
   buffer b;
   buffer m;
@@ -93,6 +100,10 @@
   int r;
   int c;
   
+  if (mode & MODE_MANUAL) {
+    return(1);
+  }
+  
   if (open_qmail_inject(&fd_inj, sender) == -1) {close(fd_msg); return(-1); }
   buffer_init(&b, buffer_unixwrite, fd_inj, b_space, sizeof b_space);
   buffer_init(&m, buffer_unixread, fd_msg, m_space, sizeof m_space);
@@ -263,9 +274,11 @@
 
   qconfirm_dir =env_get("QCONFIRM_DIR");
 
-  while ((opt =getopt(argc, argv, "Vmnbd:Di:t:")) != opteof) {
+  // -ino: 20050222-1651
+  while ((opt =getopt(argc, argv, "MVmnbd:Di:t:")) != opteof) {
     switch(opt) {
-    case 'm': mode =MODE_INODE; break;
+    case 'M': mode |=MODE_MANUAL; break;
+    case 'm': mode = (mode | MODE_INODE) & ~MODE_SENDER; break;
     case 'n': ack =0; break;
     case 'b': badmailfrom =1; break;
     case 'D': wildhost =0; break;
@@ -334,7 +347,7 @@
   }
 
   /* create id */
-  if (mode == MODE_SENDER) {
+  if (mode & MODE_SENDER) {
     /* setlock */
     if (! stralloc_copys(&sa, qconfirm_dir)) die_nomem();
     if (! stralloc_cats(&sa, "/.lock")) die_nomem();
@@ -366,17 +379,17 @@
       close(fd);
     }
     /* ok */
-    if (mode == MODE_SENDER) {
+    if (mode & MODE_SENDER) {
       if ((fd =open_trunc(fn_ok.s)) == -1) warn("unable to trunc: ", fn_ok.s);
       close(fd);
     }
-    if (mode == MODE_INODE)
+    if (mode & MODE_INODE)
       if (unlink(fn_ok.s) == -1) warn_unlink(fn_ok.s);
     ok(fn_ok.s);
   }
   if (errno != error_noent) fatal("unable to stat: ", fn_ok.s);
   
-  if (mode == MODE_SENDER) {
+  if (mode & MODE_SENDER) {
     /* check -default */
     for (i =id.len; i >= 0; --i) {
       if (! i || (id.s[i -1] == '-')) {
@@ -536,7 +549,7 @@
   }
   if (errno != error_noent) fatal("unable to open: ", fn_pending.s);
 
-  if (badmailfrom && (mode == MODE_SENDER)) {
+  if (badmailfrom && (mode & MODE_SENDER)) {
     /* check bad/ */
     if (! stralloc_copys(&sa, qconfirm_dir)) die_nomem();
     if (! stralloc_cats(&sa, "/bad/")) die_nomem();
%%%

i'd appreciate this or something like it to be included in the
distribution.

regards,

  clemens
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.