OSSP CVS Repository

ossp - Check-in [781]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 781
Date: 2001-Aug-28 15:12:58 (local)
2001-Aug-28 13:12:58 (UTC)
User:thl
Branch:
Comment: option -h now understands multiple hosts as comma separated list; .cvsignore test/dmalloc.log; program is now called "mail to news gateway" consequently - including case; parts of usage() and .pod can now be created from source; test suite and 00TODO updated;
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/.cvsignore      1.8 -> 1.9     1 inserted, 0 deleted
ossp-pkg/lmtp2nntp/00TODO      1.18 -> 1.19     2 inserted, 1 deleted
ossp-pkg/lmtp2nntp/Makefile.in      1.9 -> 1.10     2 inserted, 1 deleted
ossp-pkg/lmtp2nntp/README      1.3 -> 1.4     1 inserted, 1 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.31 -> 1.32     74 inserted, 52 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.pod      1.7 -> 1.8     16 inserted, 11 deleted
ossp-pkg/lmtp2nntp/test/run.sh      1.10 -> 1.11     3 inserted, 2 deleted

ossp-pkg/lmtp2nntp/.cvsignore 1.8 -> 1.9

--- .cvsignore   2001/08/28 11:31:22     1.8
+++ .cvsignore   2001/08/28 13:12:58     1.9
@@ -10,3 +10,4 @@
 lmtp2nntp.1
 lmtp2nntp-*.tar.gz
 dmalloc.log
+test/dmalloc.log


ossp-pkg/lmtp2nntp/00TODO 1.18 -> 1.19

--- 00TODO       2001/08/28 11:31:22     1.18
+++ 00TODO       2001/08/28 13:12:58     1.19
@@ -4,9 +4,10 @@
 whatsup draufleiten
 RFC1891 ENVID
 RFC1891 6.2
--h needs to understand multiple hosts as comma separated list
 ID logging problem
 lmtp_response segfaults when a physical line ('\n' terminated) of the logical line input exceeds LMTP_LINE_MAXLEN.
+something segfaults when NNTP unreachable data with very long lines is read as commands
+manpage header reads "User Contributed Perl Documentation" - Perl!?
 
     **** LMTP REDESIGN ****
 


ossp-pkg/lmtp2nntp/Makefile.in 1.9 -> 1.10

--- Makefile.in  2001/08/23 09:12:30     1.9
+++ Makefile.in  2001/08/28 13:12:58     1.10
@@ -32,7 +32,7 @@
 lmtp2nntp.1: lmtp2nntp.pod
         VS=`$(SHTOOL) version -lc -dshort version.c`; \
         VL=`$(SHTOOL) version -lc -dlong version.c`; \
-        $(POD2MAN) --section=1 --center="Mail to News Gateway" \
+        $(POD2MAN) --section=1 --center="mail to news gateway" \
                --release="$$VS" --date="$$VL" \
                lmtp2nntp.pod >lmtp2nntp.1 
 
@@ -43,6 +43,7 @@
 
 clean:
         -rm -f *.core
+    -rm -f dmalloc.log test/dmalloc.log
         -rm -f $(PROG)
         -rm -f $(OBJS)
 


ossp-pkg/lmtp2nntp/README 1.3 -> 1.4

--- README       2001/08/28 11:31:22     1.3
+++ README       2001/08/28 13:12:58     1.4
@@ -1,3 +1,3 @@
 
-  OSSP lmtp2nntp - Mail to News Gateway
+  OSSP lmtp2nntp - mail to news gateway
 


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.31 -> 1.32

--- lmtp2nntp.c  2001/08/28 11:31:22     1.31
+++ lmtp2nntp.c  2001/08/28 13:12:58     1.32
@@ -124,24 +124,33 @@
  */
 static void usage(char *command)
 {
+    /*  use
+     *  perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "$_ " };}'
+     *  to pull the USAGE string out of this source
+     */
     fprintf(stderr, 
-            "USAGE: %s [-p protocol] [-l logtarget] "
-            "[-h host[:port]] [-m mode] [-t] [-v] newsgroup [newsgroup ...]\n",
+            "USAGE: %s "
+            "lmtp2nntp [-d deliverymode] [-g groupmode] [-h host[:port]] "
+            "[-t tracefile] [-v] [-V] newsgroup [newsgroup ...]"
+            "\n",
             command);
     return;
 }
 
 int main(int argc, char **argv)
 {
-    int rc = 0;
-    lmtp_t *lmtp;
-    lmtp_io_t lmtp_io;
+    int          rc = 0;
+    lmtp_t      *lmtp;
+    lmtp_io_t    lmtp_io;
     lmtp2nntp_t *ctx;
-    int i;             /* general purpose scratch int, index ... */
-    char *progname;
-    char *cpHost;
-    char *cpPort;
-    sa_t *sa;
+    int          i;             /* general purpose scratch int, index ... */
+    char        *cp;            /* general purpose character pointer */
+    char        *progname;
+    char        *azHosts;
+    size_t       asHosts;
+    char        *cpHost;
+    char        *cpPort;
+    sa_t        *sa;
 
     progname = argv[0];
 
@@ -187,10 +196,17 @@
     }
 #endif
 
+    /*POD B<lmtp2nntp> */
+
+    /*  use
+     *  perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "$_\n" };}'
+     *  to pull the POD SYNOPSIS header directly out of this source
+     */
+
     /* read in the arguments */
     while ((i = getopt(argc, argv, "d:g:h:t:vV")) != -1) {
         switch (i) {
-            case 'd': /* -d deliverymode */
+            case 'd': /*POD [B<-d> I<deliverymode>] */
                 if      (strcasecmp(optarg, "post") == 0)
                     ctx->option_deliverymode = DELIVERYMODE_POST;
                 else if (strcasecmp(optarg, "feed") == 0)
@@ -230,7 +246,7 @@
                         }
                     }
                 break;
-            case 'g': /* -g groupmode */
+            case 'g': /*POD [B<-g> I<groupmode>] */
                 if      (strcasecmp(optarg, "arg") == 0)
                     ctx->option_groupmode = GROUPMODE_ARG;
                 else if (strcasecmp(optarg, "envelope") == 0)
@@ -242,55 +258,61 @@
                     exit(ERR_EXECUTION);
                 }
                 break;
-            case 'h': /* -h host */
-                if (ctx->nsc >= MAXNEWSSERVICES) {
-                    fprintf(stderr, "%s:Error: Too many services (%d) using option -h\n", progname, ctx->nsc);
+            case 'h': /*POD [B<-h> I<host>[I<:port>]] */
+                if (argz_create_sep(optarg, ',', &azHosts, &asHosts) != 0)
                     exit(ERR_EXECUTION);
-                }
+                cp = NULL;
+                while ((cp = argz_next(azHosts, asHosts, cp)) != NULL) {
+                    if (ctx->nsc >= MAXNEWSSERVICES) {
+                        fprintf(stderr, "%s:Error: Too many services (%d) using option -h\n", progname, ctx->nsc);
+                        exit(ERR_EXECUTION);
+                    }
 
-                /* parse host[:port] string into host and port */
-                cpHost = strdup(optarg);
-                if ((cpPort = strrchr(cpHost, ':')) != NULL) {
-                    *cpPort++ = NUL;
-                    cpPort = strdup(cpPort);
-                }
-                else 
-                    cpPort = strdup("nntp");
-                ctx->ns[ctx->nsc].h = cpHost;
-                ctx->ns[ctx->nsc].p = cpPort;
-
-                if ((sa = sa_create(SA_IP, "tcp",
-                                    ctx->ns[ctx->nsc].h,
-                                    ctx->ns[ctx->nsc].p)) == NULL) {
-                    fprintf(stderr, "%s:Error: creating TCP socket address failed for \"%s:%s\": %s\n", 
-                            progname, 
-                            ctx->ns[ctx->nsc].h, 
-                            ctx->ns[ctx->nsc].p, 
-                            strerror(errno));
-                    exit(ERR_EXECUTION);
-                }
-                ctx->ns[ctx->nsc].sa = sa;
-                if ((ctx->ns[ctx->nsc].s =
-                     socket(sa->sa_buf->sa_family, SOCK_STREAM, sa->sa_proto)) == -1) {
-                    fprintf(stderr, "%s:Error: Creating TCP socket failed for \"%s:%s\": %s\n", 
-                            progname, 
-                            ctx->ns[ctx->nsc].h, 
-                            ctx->ns[ctx->nsc].p, 
-                            strerror(errno));
-                    exit(ERR_EXECUTION);
+                    /* parse host[:port] string into host and port */
+                    cpHost = strdup(cp);
+                    if ((cpPort = strrchr(cpHost, ':')) != NULL) {
+                        *cpPort++ = NUL;
+                        cpPort = strdup(cpPort);
+                    }
+                    else 
+                        cpPort = strdup("nntp");
+                    ctx->ns[ctx->nsc].h = cpHost;
+                    ctx->ns[ctx->nsc].p = cpPort;
+
+                    if ((sa = sa_create(SA_IP, "tcp",
+                                        ctx->ns[ctx->nsc].h,
+                                        ctx->ns[ctx->nsc].p)) == NULL) {
+                        fprintf(stderr, "%s:Error: creating TCP socket address failed for \"%s:%s\": %s\n", 
+                                progname, 
+                                ctx->ns[ctx->nsc].h, 
+                                ctx->ns[ctx->nsc].p, 
+                                strerror(errno));
+                        exit(ERR_EXECUTION);
+                    }
+                    ctx->ns[ctx->nsc].sa = sa;
+                    if ((ctx->ns[ctx->nsc].s =
+                         socket(sa->sa_buf->sa_family, SOCK_STREAM, sa->sa_proto)) == -1) {
+                        fprintf(stderr, "%s:Error: Creating TCP socket failed for \"%s:%s\": %s\n", 
+                                progname, 
+                                ctx->ns[ctx->nsc].h, 
+                                ctx->ns[ctx->nsc].p, 
+                                strerror(errno));
+                        exit(ERR_EXECUTION);
+                    }
+                    ctx->ns[ctx->nsc].nntp = NULL;
+                    ctx->nsc++;
                 }
-                ctx->ns[ctx->nsc].nntp = NULL;
-                ctx->nsc++;
+                free(azHosts);
                 break;
-            case 't': /* -t (tracing) */
+            case 't': /*POD [B<-t> I<tracefile>] */
                 ctx->option_tracing = TRUE;
                 trace_read (-1, optarg, 0);
                 trace_write(-1, optarg, 0);
                 break;
-            case 'v': /* -v (verbose) */
+            case 'v': /*POD [B<-v>] (verbose)*/
                 ctx->option_verbose = TRUE;
                 break;
-            case 'V': /* -V (version) */
+            case 'V': /*POD [B<-V>] (version)*/
                 fprintf(stdout, "%s\n", lmtp2nntp_version.v_gnu);
                 exit(0);
                 break;
@@ -300,7 +322,7 @@
                 exit(ERR_EXECUTION);
         }
     }
-    /* remaining arguments are Groupargs */
+    /*POD I<newsgroup> [I<newsgroup> ...] */
     for (i = optind; i < argc; i++) {
         argz_add(&ctx->azGroupargs, &ctx->asGroupargs, argv[i]);
     }


ossp-pkg/lmtp2nntp/lmtp2nntp.pod 1.7 -> 1.8

--- lmtp2nntp.pod        2001/08/28 11:29:40     1.7
+++ lmtp2nntp.pod        2001/08/28 13:12:58     1.8
@@ -3,24 +3,25 @@
 
 =head1 NAME
 
-B<lmtp2nntp> - mail to nntp gateway
+B<lmtp2nntp> - mail to news gateway
 
 =head1 SYNOPSIS
 
-B<lmtp2nntp> 
-[B<-o> I<origin>]
-[B<-j> I<hostname>]
-[B<-i> I<messageid>]
-[B<-t> I<timeout>]
-[B<-p> I<protocol>]
-[B<-l> I<logtarget>]
-[B<-h> I<host>[I<:port>]]
+B<lmtp2nntp>
 [B<-d> I<deliverymode>]
 [B<-g> I<groupmode>]
+[B<-h> I<host>[I<:port>]]
 [B<-t> I<tracefile>]
 [B<-v>]
-I<newsgroup> 
-[I<newsgroup> ...]
+[B<-V>]
+I<newsgroup> [I<newsgroup> ...]
+B<FIXME NOT YET IMPLEMENTED>
+[B<-o> I<origin>]
+[B<-j> I<hostname>]
+[B<-i> I<messageid>]
+[B<-T> I<timeout>]
+[B<-l> I<logtarget>]
+
 
 =head1 DESCRIPTION
 
@@ -202,6 +203,10 @@
      Freed. October 1996. (Format: TXT=10460 bytes) (Status: PROPOSED
      STANDARD)
 
+2606 Reserved Top Level DNS Names. D. Eastlake, A. Panitz. June 1999.
+     (Format: TXT=8008 bytes) (Also BCP0032) (Status: BEST CURRENT
+     PRACTICE)
+
 2821 Simple Mail Transfer Protocol. J. Klensin, Editor. April 2001.
      (Format: TXT=192504 bytes) (Obsoletes RFC0821, RFC0974, RFC1869)
      (Status: PROPOSED STANDARD)


ossp-pkg/lmtp2nntp/test/run.sh 1.10 -> 1.11

--- run.sh       2001/08/27 13:45:53     1.10
+++ run.sh       2001/08/28 13:12:59     1.11
@@ -42,9 +42,10 @@
 lmtp()
 {
     newmsg lmtp
+    set -x
     cat /tmp/testmessage \
-     | ../lmtp2nntp -t /tmp/tracing -d $1 -g $2 -h dev16 $3 >/dev/null; echo $?
-  echo ../lmtp2nntp -t /tmp/tracing -d $1 -g $2 -h dev16 $3
+     | ../lmtp2nntp -t /tmp/tracing -d $1 -g $2 -h dev16,141.1.23.116:nntp -h dev16.de.cw.net:119 $3 >/dev/null; echo $?
+    set +x
 #   cat /tmp/testmessage \
 #    | ../lmtp2nntp -t /tmp/tracing -d $1 -g $2 -h dev16 $3 >/dev/null; echo $?
 }

CVSTrac 2.0.1