OSSP CVS Repository

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

Check-in Number: 1816
Date: 2002-Feb-06 14:51:38 (local)
2002-Feb-06 13:51:38 (UTC)
User:thl
Branch:
Comment: Fixed bug in --destionation and main() not initializing data correctly causing segfaults. Deactivated leftover code from the static ns array with nsc counter where memcpy segfaults. Fixed bug in option_register() not strdup()ing the default value causing free() to fail on cleanup. Added '-b -' to test.sh cause defaultng to stdio does not currenly work. Deactivated l2_channel_destroy() because it's cleanup fails and it hangs in a infinite loop in user space.
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_config.c      1.43 -> 1.44     4 inserted, 1 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_main.c      1.37 -> 1.38     14 inserted, 5 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_option.c      1.12 -> 1.13     12 inserted, 7 deleted
ossp-pkg/lmtp2nntp/test.sh      1.10 -> 1.11     8 inserted, 8 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.43 -> 1.44

--- lmtp2nntp_config.c   2002/02/05 15:58:21     1.43
+++ lmtp2nntp_config.c   2002/02/06 13:51:38     1.44
@@ -490,9 +490,12 @@
                     log2(ctx, ERROR, "option --destination, creating TCP socket (%s) failed with \"%s\"", cp /*FIXME again, option vs. config */, sa_error(rc));
                     throw(0,0,0);
                 }
+                ctx->pns[i].nntp = NULL;
+                ctx->pns[i].rc = NNTP_OK;
+                ctx->pns[i].l2 = ctx->l2;
                 free(cp);
+                ctx->nns = i;
             }
-            ctx->nns = i;
         }
     }
     catch (ex)


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

--- lmtp2nntp_main.c     2002/02/05 14:56:47     1.37
+++ lmtp2nntp_main.c     2002/02/06 13:51:38     1.38
@@ -344,7 +344,6 @@
     ctx->ctx.vp = ctx;
     ctx->val = NULL;
     ctx->progname = NULL;
-    ctx->option_childsmax = 0;
     ctx->option_groupmode = GROUPMODE_UNDEF;
     ctx->option_operationmode = OPERATIONMODE_UNDEF;
     ctx->option_operationmodefakestatus = NULL;
@@ -364,6 +363,9 @@
     ctx->option_killflag = FALSE;
     ctx->option_uid = getuid();
     ctx->option_daemon = FALSE;
+    ctx->nacl = 0;
+    ctx->pacl = NULL;
+    ctx->option_childsmax = 0;
     ctx->active_childs = 0;
     ctx->l2_env = NULL;
     ctx->l2 = NULL;
@@ -371,14 +373,17 @@
     ctx->saServerbind = NULL;
     ctx->saaClientbind = NULL;
     ctx->saClientbind = NULL;
+    ctx->saaIO = NULL;
+    ctx->saIO = NULL;
+    ctx->fdIOi = -1;
+    ctx->fdIOo = -1;
     ctx->nns = 0;
     ctx->pns = NULL;
-    ctx->nacl = 0;
-    ctx->pacl = NULL;
     ctx->azGroupargs = NULL;
     ctx->asGroupargs = 0;
     initsession(&ctx->session);
     ctx->msg = NULL;
+    memset(&ctx->uname, 0, sizeof(struct utsname));
     
     /* fill in application context */
     if (val_create(&ctx->val) != VAL_OK)
@@ -623,7 +628,7 @@
     /* graceful shutdown */
     CUS:
     log0(ctx, NOTICE, "graceful shutdown shortly before exit - no more logging");
-    l2_channel_destroy(ctx->l2);
+    //l2_channel_destroy(ctx->l2);
     l2_env_destroy(ctx->l2_env);
     if (ctx->saServerbind)
         sa_destroy(ctx->saServerbind);
@@ -791,11 +796,15 @@
         }
         else {
             log1(ctx, WARNING, "NNTP session establishment to ${option.destination}[${i}] failed", i); //FIXME
-            log1(ctx, DEBUG, "removing ns[%d] from list", i);
+            log1(ctx, DEBUG, "FIXME-CURRENTLY-NOT removing ns[%d] from list", i);
             lmtp_gfs_ns(&ctx->pns[i]);
+            /*FIXME #1 this code is a leftover from the static ns array with nsc counter
+              FIXME #2 this code removes the newsservice forever!? What is the scope, what should the scope be - gateway, child process, session, posting lifetime? What is the intention of the user?
             if (i < --ctx->nns) {
                 memcpy(&ctx->pns[i], &ctx->pns[i+1], (ctx->nns - i ) * sizeof(struct ns));
             }
+            */
+            i++; //FIXME this is just to avoid infinite loop
         }
     } while (i < ctx->nns);
 


ossp-pkg/lmtp2nntp/lmtp2nntp_option.c 1.12 -> 1.13

--- lmtp2nntp_option.c   2002/02/05 14:56:47     1.12
+++ lmtp2nntp_option.c   2002/02/06 13:51:38     1.13
@@ -152,14 +152,18 @@
     oc->val          = o->vo;
     oc->number       = o->pi + 1; /* 0 is a reserved val in popt, so offset 1 */
     switch (type) {
-        case OPT_FLAG:   oc->data.f       = 0;    break;
-        case OPT_SINGLE: oc->data.s       = def;  break;
-        case OPT_MULTI:  oc->data.m       = NULL; break;
+        case OPT_FLAG:   oc->data.f       = 0;
+            break;
+        case OPT_SINGLE: oc->data.s       = def == NULL ? NULL : strdup(def);
+            break;
+        case OPT_MULTI:  oc->data.m       = NULL;
+            break;
     }
     oc->ndata        = (type == OPT_SINGLE && def != NULL) ? 1 : 0;
-    if (   (                      oc->longname   == NULL)
-        || (descrip    != NULL && oc->descrip    == NULL)
-        || (argdescrip != NULL && oc->argdescrip == NULL)
+    if (   (                                            oc->longname   == NULL)
+        || (                      descrip    != NULL && oc->descrip    == NULL)
+        || (                      argdescrip != NULL && oc->argdescrip == NULL)
+        || (type == OPT_SINGLE && def        != NULL && oc->data.s     == NULL)
           )
         CU(OPTION_ERR_MEM);
 
@@ -666,8 +670,9 @@
 
     oc = o->first;
     while (oc != NULL) {
-        if (oc->type == OPT_SINGLE && oc->data.s != NULL)
+        if (oc->type == OPT_SINGLE && oc->data.s != NULL) {
             free(oc->data.s);
+        }
         if (oc->type == OPT_MULTI  && oc->data.m != NULL) {
             for (i = 0; i < oc->ndata; i++)
                 if (oc->data.m[i] == NULL)


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

--- test.sh      2002/02/05 14:56:47     1.10
+++ test.sh      2002/02/06 13:51:38     1.11
@@ -16,10 +16,10 @@
 Message-Id: <200108141251.f7ECpmn74812@dev.de.cw.net>
 From: Thomas Lotterer <Thomas.Lotterer@example.com>
 Received: from cw.example.com (cw.example.com [10.1.1.32])
-    by gateway.example.com (8.9.2/8.9.2/$Revision: 1.10 $) with SMTP id NAA08840
+    by gateway.example.com (8.9.2/8.9.2/$Revision: 1.11 $) with SMTP id NAA08840
     for <thomas.lotterer@gateway.example.com>; Mon, 2 Apr 2001 13:20:25 +0200 (MET DST)
 Received: from history (history.example.org [195.143.102.41])
-    by cw.example.com (8.11.0/8.11.0/$Revision: 1.10 $) with ESMTP id f32BKPb12235
+    by cw.example.com (8.11.0/8.11.0/$Revision: 1.11 $) with ESMTP id f32BKPb12235
     for <thomas.lotterer@example.com>; Mon, 2 Apr 2001 13:20:25 +0200
 Received: from example.org (littlemua.example.org [195.143.103.160])
         by history (8.8.8/8.8.8) with ESMTP id LAA12678;
@@ -160,7 +160,7 @@
 echon "checking whether a valid fake posting succeeds ... "
 prolog
 newmsg
-./lmtp2nntp <${STDIN} -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ; RC=$
+./lmtp2nntp <${STDIN} -b - -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ; RC=$
 RC="";
 if [ 1 -eq `egrep <${STDOUT} '^220[- ]LMTP Service ready'       | wc -l` ]; then RC="${RC}init "; fi
 if [ 1 -eq `egrep <${STDOUT} '^250[- ].*pleased to meet you'    | wc -l` ]; then RC="${RC}LHLO "; fi
@@ -182,7 +182,7 @@
 echon "checking whether -m option blocks invalid sender ... "
 prolog
 newmsg
-( MFILT=".*@is.invalid" ; ./lmtp2nntp <${STDIN} -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
+( MFILT=".*@is.invalid" ; ./lmtp2nntp <${STDIN} -b - -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
 RC="";
 if [ 1 -eq `egrep <${STDOUT} '^220[- ]LMTP Service ready'       | wc -l` ]; then RC="${RC}init "; fi
 if [ 1 -eq `egrep <${STDOUT} '^250[- ].+pleased to meet you'    | wc -l` ]; then RC="${RC}LHLO "; fi
@@ -204,7 +204,7 @@
 echon "checking whether -s option rejects article with invalid size ... "
 prolog
 newmsg
-./lmtp2nntp <${STDIN} -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 100 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ; RC=$?
+./lmtp2nntp <${STDIN} -b - -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 100 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ; RC=$?
 RC="";
 if [ 1 -eq `egrep <${STDOUT} '^220[- ]LMTP Service ready'       | wc -l` ]; then RC="${RC}init "; fi
 if [ 1 -eq `egrep <${STDOUT} '^250[- ].*pleased to meet you'    | wc -l` ]; then RC="${RC}LHLO "; fi
@@ -226,7 +226,7 @@
 echon "checking whether -c option fails on invalid local host address ... "
 prolog
 newmsg
-( LOCAL="10.255.255.255" ; ./lmtp2nntp <${STDIN} -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
+( LOCAL="10.255.255.255" ; ./lmtp2nntp <${STDIN} -b - -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
 RC="";
 if [ 1 -eq `egrep <${STDOUT} '^220[- ]LMTP Service ready'       | wc -l` ]; then RC="${RC}init "; fi
 if [ 1 -eq `egrep <${L2FILE} 'error.+binding'                   | wc -l` ]; then RC="${RC}bind "; fi
@@ -243,7 +243,7 @@
 echon "checking whether -g envelope option blocks invalid group ... "
 prolog
 newmsg
-( GROUP="foo.*" ; ./lmtp2nntp <${STDIN} -c ${LOCAL} -o 250/2.0.0 -g envelope -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
+( GROUP="foo.*" ; ./lmtp2nntp <${STDIN} -b - -c ${LOCAL} -o 250/2.0.0 -g envelope -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
 RC="";
 if [ 1 -eq `egrep <${STDOUT} '^220[- ]LMTP Service ready'       | wc -l` ]; then RC="${RC}init "; fi
 if [ 1 -eq `egrep <${STDOUT} '^250[- ].*pleased to meet you'    | wc -l` ]; then RC="${RC}LHLO "; fi
@@ -266,7 +266,7 @@
 echon "checking whether -d option times out for invalid host ... "
 prolog
 newmsg
-( HOST="10.255.255.255" ; ./lmtp2nntp <${STDIN} -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
+( HOST="10.255.255.255" ; ./lmtp2nntp <${STDIN} -b - -c ${LOCAL} -o 250/2.0.0 -g arg -d ${HOST} ${LOG} -m "${MFILT}" -n ${NODE} -s 1500 --timeoutnntpconnect=1 ${GROUP} >${STDOUT} 2>${STDERR} ) ; RC=$?
 RC="";
 if [ 1 -eq `egrep <${STDOUT} '^220[- ]LMTP Service ready'       | wc -l` ]; then RC="${RC}init "; fi
 if [ 1 -eq `egrep <${L2FILE} 'warning.+connect.+failed'         | wc -l` ]; then RC="${RC}conn "; fi

CVSTrac 2.0.1