OSSP CVS Repository

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

Check-in Number: 826
Date: 2001-Sep-03 17:06:29 (local)
2001-Sep-03 15:06:29 (UTC)
User:thl
Branch:
Comment: tried to add -b option w/o success. Binding to a given port, which should only be a side effect anyway) works but binding to given address currently fails for unknown reason.
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/00TODO      1.24 -> 1.25     17 inserted, 11 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.37 -> 1.38     48 inserted, 2 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.pod      1.13 -> 1.14     1 inserted, 1 deleted

ossp-pkg/lmtp2nntp/00TODO 1.24 -> 1.25

--- 00TODO       2001/08/30 13:38:04     1.24
+++ 00TODO       2001/09/03 15:06:29     1.25
@@ -1,18 +1,24 @@
 
 whatsup draufleiten
-ID logging, RFC1891 ENVID, 6.2
 
-    **** LMTP REDESIGN ****
 
-RESULT:
-- robust checking and handling of NNTP protocol errors
-- logging into a single file -> write(2) !fwrite(3), (optional) syslog
-- invoked as mailer using LMTP, providing useful return status
-- invoked as command line (lowpri)
-- queuing is not supported for command line and a client issue for LMTP
-- remove To: and Cc: headers
-- allow crosspostings only through command line
-- new manpage
+[B<-b> I<bindaddress>]
+
+use L2 for logging, grab ID through RFC1891 ENVID, 6.2
+[B<-i> I<messageid>]
+[B<-l> I<logtarget>]
+
+CU/CUS
+
+str debugging
+
+check str library version
+- openpkg (package time)
+- autoconf, (autoconf time)
+- str.h, #err (compile time)
+- STR_VERSION (run time)
+
+check gcc3 compatiblity
 
     **** DEVELOPMENT INFORMATION ****
 


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.37 -> 1.38

--- lmtp2nntp.c  2001/08/30 11:53:25     1.37
+++ lmtp2nntp.c  2001/09/03 15:06:29     1.38
@@ -97,6 +97,9 @@
     char           *option_deliverymodefakedsn;
     int             option_maxmessagesize;
     int             option_waittime;
+    char           *cpBindh;
+    char           *cpBindp;
+    sa_t           *saBind;
     int             nsc;
     struct ns       ns[MAXNEWSSERVICES];
     char           *azGroupargs;
@@ -176,6 +179,9 @@
     ctx->option_deliverymodefakedsn    = "5.7.1"; /* Delivery not authorized, message refused */
     ctx->option_maxmessagesize = 8 * 1024 * 1024;
     ctx->option_waittime = -1;
+    ctx->cpBindh = NULL;
+    ctx->cpBindp = NULL;
+    ctx->saBind = NULL;
     ctx->nsc = 0;
     for (i=0; i < MAXNEWSSERVICES; i++) {
         ctx->ns[i].h = NULL;
@@ -194,7 +200,7 @@
         exit(ERR_EXECUTION);
     }
 
-#if 1
+#if 0
     {
         char buf[1000];
         int bufused = 0;
@@ -217,12 +223,43 @@
      */
 
     /* read in the arguments */
-    while ((i = getopt(argc, argv, "Vd:g:h:m:n:t:vw:")) != -1) {
+    while ((i = getopt(argc, argv, "Vb:d:g:h:m:n:t:vw:")) != -1) {
         switch (i) {
             case 'V': /*POD [B<-V>] (version)*/
                 fprintf(stdout, "%s\n", lmtp2nntp_version.v_gnu);
                 exit(0);
                 break;
+            case 'b': /*POD [B<-b> I<bindaddr>[I<:port>] */
+                /* parse host[:port] string into host and port */
+                ctx->cpBindh = strdup(optarg);
+                if ((ctx->cpBindp = strrchr(ctx->cpBindh, ':')) != NULL) {
+                    *ctx->cpBindp++ = NUL;
+                    ctx->cpBindp = strdup(ctx->cpBindp);
+                }
+                else 
+                    ctx->cpBindp = strdup("0");
+
+                fprintf(stderr, "DEBUG: creating TCP socket address for \"%s:%s\"\n", ctx->cpBindh, ctx->cpBindp);
+                if ((ctx->saBind = sa_create(SA_IP, "tcp", ctx->cpBindh, ctx->cpBindp)) == NULL) {
+                    fprintf(stderr, "%s:Error: creating TCP socket address failed for \"%s:%s\": %s\n", 
+                            progname, 
+                            ctx->cpBindh, 
+                            ctx->cpBindp, 
+                            strerror(errno));
+                    exit(ERR_EXECUTION);
+                }
+                fprintf(stderr, "DEBUG: saBind->sa_len=%d\n",
+                ctx->saBind->sa_buf->sa_len);
+                fprintf(stderr, "DEBUG: saBind->sa_family=%d\n", (int)ctx->saBind->sa_buf->sa_family);
+                for (i=0; i<14; i++)
+                fprintf(stderr, "DEBUG: saBind->sa_data[%2d]=%2x %d\n", i,
+                (unsigned int)(unsigned char)ctx->saBind->sa_buf->sa_data[i],
+                (unsigned int)(unsigned char)ctx->saBind->sa_buf->sa_data[i]);
+                ctx->saBind->sa_buf->sa_data[ 7]='0'; //DEBUG
+                ctx->saBind->sa_buf->sa_data[ 8]='0'; //DEBUG
+                ctx->saBind->sa_buf->sa_data[ 9]='0'; //DEBUG
+                ctx->saBind->sa_buf->sa_data[10]='0'; //DEBUG
+                break;
             case 'd': /*POD [B<-d> I<deliverymode>] */
                 if      (strcasecmp(optarg, "post") == 0)
                     ctx->option_deliverymode = DELIVERYMODE_POST;
@@ -553,6 +590,11 @@
     i = 0;
     do {
         bOk = TRUE;
+        if (bOk && (ctx->saBind != NULL) &&
+                   bind(ctx->ns[i].s, ctx->saBind->sa_buf, ctx->saBind->sa_len) < 0) {
+            bOk = FALSE;
+            fprintf(stderr, "DEBUG: errno=%d\n", errno);
+        }
         if (ctx->option_waittime > 0) {
             if (connect_nonb(ctx->ns[i].s, ctx->ns[i].sa->sa_buf, ctx->ns[i].sa->sa_len, 
                          ctx->option_waittime) < 0) {
@@ -631,6 +673,10 @@
         if (ctx->ns[i].h != NULL)
             free(ctx->ns[i].h);
     }
+    if (ctx->cpBindh != NULL)
+        free(ctx->cpBindh);
+    if (ctx->cpBindp != NULL)
+        free(ctx->cpBindp);
 }
 
 static int helo_rfc0821domain(char *msg, char **domain)


ossp-pkg/lmtp2nntp/lmtp2nntp.pod 1.13 -> 1.14

--- lmtp2nntp.pod        2001/08/30 13:56:38     1.13
+++ lmtp2nntp.pod        2001/09/03 15:06:29     1.14
@@ -20,7 +20,7 @@
 I<newsgroup> [I<newsgroup> ...]
 
 B<FIXME NOT YET IMPLEMENTED>
-[B<-o> I<origin>]
+[B<-b> I<bindaddress>]
 [B<-i> I<messageid>]
 [B<-l> I<logtarget>]
 

CVSTrac 2.0.1