Hey all,

I would appreciate a way to skip the test in verifyIncomingSocketName.
It is a useful thing, but it can be too smart for itself sometimes, at
least IMHO.  It can break things like unattended installs (or even fresh
installs) and also prevent running it on a currently non-sendmail system
if you still have a sendmail.cf laying around (I found this out after
moving my laptop away from sendmail a few months ago).  I agree that it
should be the default to check for socket agreement, but I just want to
be able to bypass it in some circumstances.

The attached patch does so, and my feelings won't be hurt if you come up
with better long and short option names :)

Thanks,

--- clamav-milter/clamav-milter.c.old   2005-06-11 11:37:22.889679067 -0400
+++ clamav-milter/clamav-milter.c       2005-06-11 11:37:02.364168670 -0400
@@ -391,6 +391,7 @@
                                 * claiming to be from us that must be false
                                 * Requires that -o, -l or -f are NOT given
                                 */
+static short   check_socket = 1;
 static short   use_syslog = 0;
 static const   char    *pidFile;
 static int     logVerbose = 0;
@@ -471,6 +472,7 @@
        puts(_("\t--config-file=FILE\t-c FILE\tRead configuration from FILE."));
        puts(_("\t--debug\t\t\t-D\tPrint debug messages."));
        puts(_("\t--detect-forged-local-address\t-L\tReject mails that claim to 
be from us."));
+       puts(_("\t--dont-check-socket\t-Z\tDon't add an entry to syslog that a 
mail is clean."));
        puts(_("\t--dont-log-clean\t-C\tDon't add an entry to syslog that a 
mail is clean."));
        puts(_("\t--dont-scan-on-error\t-d\tPass e-mails through unscanned if a 
system error occurs."));
        puts(_("\t--dont-wait\t\t\tAsk remote end to resend if max-children 
exceeded."));
@@ -567,9 +569,9 @@
        for(;;) {
                int opt_index = 0;
 #ifdef CL_DEBUG
-               const char *args = 
"a:AbB:c:CdDefF:lLm:nNop:PqQ:hHs:St:T:U:VwW:x:0:";
+               const char *args = 
"a:AbB:c:CdDefF:lLm:nNop:PqQ:hHs:St:T:U:VwW:x:0:Z";
 #else
-               const char *args = 
"a:AbB:c:CdDefF:lLm:nNop:PqQ:hHs:St:T:U:VwW:0:";
+               const char *args = 
"a:AbB:c:CdDefF:lLm:nNop:PqQ:hHs:St:T:U:VwW:0:Z";
 #endif

                static struct option long_options[] = {
@@ -591,6 +593,9 @@
                        {
                                "detect-forged-local-address", 0, NULL, 'L'
                        },
+                       {
+                               "dont-check-socket", 0, NULL, 'Z'
+                       },
                        {
                                "dont-log-clean", 0, NULL, 'C'
                        },
@@ -810,6 +815,9 @@
                        case 'x':
                                debug_level = atoi(optarg);
                                break;
+                       case 'Z':
+                               check_socket = 0;
+                               break;
 #endif
                        default:
 #ifdef CL_DEBUG
@@ -830,9 +838,11 @@
        }
        port = argv[optind];

-       if(verifyIncomingSocketName(port) < 0) {
-               fprintf(stderr, _("%s: socket-addr (%s) doesn't agree with 
sendmail.cf\n"), argv[0], port);
-               return EX_CONFIG;
+       if(check_socket) {
+               if(verifyIncomingSocketName(port) < 0) {
+                       fprintf(stderr, _("%s: socket-addr (%s) doesn't agree 
with sendmail.cf\n"), argv[0], port);
+                       return EX_CONFIG;
+               }
        }
        if(strncasecmp(port, "inet:", 5) == 0)
                if(!lflag) {
--- docs/man/clamav-milter.8.old        2005-06-11 11:45:59.845854961 -0400
+++ docs/man/clamav-milter.8    2005-06-11 11:45:48.091716819 -0400
@@ -227,6 +227,11 @@
 When starting, clamav\-milter runs some sanity checks against the sendmail.cf
 file, usually in /etc/sendmail.cf or /etc/mail/sendmail.cf. This directive
 tells clamav\-milter where to find the sendmail.cf file.
+.TP
+\fB\-\-dont-check-socket, \-Z\fR
+When starting, clamav\-milter runs some sanity checks against the sendmail.cf
+file, usually in /etc/sendmail.cf or /etc/mail/sendmail.cf.  This directive
+disables those tests.
 .SH "BUGS"
 There is no support for IPv6.
 .SH "EXAMPLES"

-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | Body by Nautilus, Brain by Mattel.      |
|  [EMAIL PROTECTED]             |                                         |
|  http://www.lobefin.net/~steve |                                         |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to