Sorry, Absolutely not. I am not putting in a knob for this

        If you're crazy enough to run an MTA on a non-standard port
you know enough to recompile.

        -Bob

* Joachim Schipper <[EMAIL PROTECTED]> [2007-03-18 16:16]:
> On Sun, Mar 18, 2007 at 08:57:32PM +0000, Stuart Henderson wrote:
> > On 2007/03/18 16:35, Peter wrote:
> > > On OpenBSD 4.0, how do I specify what port spamlogd should consider SMTP? 
> > >  My 
> > > MTA is running on a non-standard port.
> > 
> > edit /usr/src/libexec/spamlogd/spamlogd.c and recompile -
> > it's hardcoded "ip and port 25 ..."
> 
> Would something like the following not do the trick?
> 
> (Warning to the original poster: please wait for a while for more
> clueful people to tell me I screwed up before actually trying to run
> with this diff - there is no obvious reason why it wouldn't work, but I
> didn't test it, can not claim familiarity with this code, and still have
> a lot to learn. Stuart seems to think the general idea would work,
> though.)
> 
> Another warning: this diff is against the version in my (-current)
> source tree, which is rather recent. So it might not be the newest, but
> it's certainly removed somewhat from the 4.0 spamlogd.
> 
>               Joachim
> 
> Index: spamlogd.8
> ===================================================================
> RCS file: /var/nfs/cvsync/src/libexec/spamlogd/spamlogd.8,v
> retrieving revision 1.12
> diff -u -b -B -u -r1.12 spamlogd.8
> --- spamlogd.8        4 Mar 2007 09:58:22 -0000       1.12
> +++ spamlogd.8        18 Mar 2007 21:23:52 -0000
> @@ -37,7 +37,7 @@
>  updates the
>  .Pa /var/db/spamd
>  whitelist entries whenever a connection
> -to port 25 is logged to the
> +to the specified port (port 25 by default) is logged to the
>  .Xr pflog 4
>  interface.
>  The source addresses of inbound connections are whitelisted
> @@ -77,6 +77,9 @@
>  interface to listen for connection notifications.
>  The default is to watch for connections logged on
>  .Dq pflog0 .
> +.It Fl p mailport
> +port on which incoming mail will arrive.
> +The default is to watch for connections to port 25.
>  .It Fl Y Ar synctarget
>  Add a target to receive synchronisation messages; see
>  .Sx SYNCHRONISATION
> Index: spamlogd.c
> ===================================================================
> RCS file: /var/nfs/cvsync/src/libexec/spamlogd/spamlogd.c,v
> retrieving revision 1.19
> diff -u -b -B -u -r1.19 spamlogd.c
> --- spamlogd.c        5 Mar 2007 14:55:09 -0000       1.19
> +++ spamlogd.c        18 Mar 2007 21:21:52 -0000
> @@ -70,6 +70,7 @@
>  u_int8_t              flag_inbound = 0;
>  char                 *networkif = NULL;
>  char                 *pflogif = "pflog0";
> +int                   mailport = 25;
>  char                  errbuf[PCAP_ERRBUF_SIZE];
>  pcap_t                       *hpcap = NULL;
>  struct syslog_data    sdata  = SYSLOG_DATA_INIT;
> @@ -109,8 +110,9 @@
>  init_pcap(void)
>  {
>       struct bpf_program      bpfp;
> -     char    filter[PCAPFSIZ] = "ip and port 25 and action pass "
> -                 "and tcp[13]&0x12=0x2";
> +     char    filter[PCAPFSIZ];
> +
> +     snprintf(filter, sizeof(filter), "ip and port %d and action pass and 
> tcp[13]&0x12=0x2", mailport);
>  
>       if ((hpcap = pcap_open_live(pflogif, PCAPSNAP, 1, PCAPTIMO,
>           errbuf)) == NULL) {
> @@ -299,6 +301,7 @@
>       struct servent *ent;
>       char *sync_iface = NULL;
>       char *sync_baddr = NULL;
> +     const char *errstr;
>  
>       if ((ent = getservbyname("spamd-sync", "udp")) == NULL)
>               errx(1, "Can't find service \"spamd-sync\" in /etc/services");
> @@ -317,6 +320,11 @@
>                       break;
>               case 'l':
>                       pflogif = optarg;
> +                     break;
> +             case 'p':
> +                     mailport = strtonum(optarg, 0, 65535, &errstr);
> +                     if (errstr)
> +                             errx(1, "The mail port is %s: %s", errstr, 
> optarg);
>                       break;
>               case 'Y':
>                       if (sync_addhost(optarg, sync_port) != 0)
> 

-- 
#!/usr/bin/perl
if ((not 0 && not 1) !=  (! 0 && ! 1)) {
   print "Larry and Tom must smoke some really primo stuff...\n"; 
}

Reply via email to