Index: ossp-pkg/lmtp2nntp/00TODO RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/00TODO,v rcsdiff -q -kk '-r1.24' '-r1.25' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/00TODO,v' 2>/dev/null --- 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] + +use L2 for logging, grab ID through RFC1891 ENVID, 6.2 +[B<-i> I] +[B<-l> I] + +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 **** Index: ossp-pkg/lmtp2nntp/lmtp2nntp.c RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp.c,v rcsdiff -q -kk '-r1.37' '-r1.38' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp.c,v' 2>/dev/null --- 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[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] */ 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) Index: ossp-pkg/lmtp2nntp/lmtp2nntp.pod RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp.pod,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp.pod,v' 2>/dev/null --- 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 [I ...] B -[B<-o> I] +[B<-b> I] [B<-i> I] [B<-l> I]