OSSP CVS Repository

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

Check-in Number: 1926
Date: 2002-Feb-28 16:57:09 (local)
2002-Feb-28 15:57:09 (UTC)
User:thl
Branch:
Comment: wipe out some debug stuff, reducing FIXMEs
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_config.c      1.62 -> 1.63     3 inserted, 223 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_main.c      1.44 -> 1.45     1 inserted, 77 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.62 -> 1.63

--- lmtp2nntp_config.c   2002/02/28 15:21:02     1.62
+++ lmtp2nntp_config.c   2002/02/28 15:57:09     1.63
@@ -104,30 +104,10 @@
     return L2_OK;
 }
 
-static void headersimulation(lmtp2nntp_t *); //FIXME
 static void msg_headermatrixbuildup(msg_t *msg);
 static void msg_headermatrixteardwn(msg_t *msg);
 static void headerrewrite(lmtp2nntp_t *ctx);
 
-static void extest(void)
-{
-    ex_t ex;
-
-    try {
-        fprintf(stderr, "try\n");
-        throw(0,0,0);
-    }
-    cleanup {
-        fprintf(stderr, "cleanup\n");
-    }
-    catch (ex) {
-        fprintf(stderr, "catch\n");
-        rethrow;
-    }
-    exit(0);
-
-}
-
 static var_syntax_t syntax_regex = {
     '\\',         /* escape        */ 
     '$',          /* varinit       */ 
@@ -146,8 +126,6 @@
     //char *cp;
     int rc;
 
-    //FIXME ex is broken!?  extest();
-
     /* create L2 environment */
     if (l2_env_create(&ctx->l2_env) != L2_OK) {
         fprintf(stderr, "%s:Error: failed to create L2 environment\n", ctx->progname);
@@ -599,7 +577,6 @@
                     hrNew->pcreRegex = NULL;
                     hrNew->pcreExtra = NULL;
                     
-                    //FIXME cp = hrNew->carve = strdupex(cp);
                     /* priority */
                     cpP = cp;
                     if ((cp = strchr(cp, ':')) == NULL) {
@@ -1167,86 +1144,10 @@
     }
     catch (ex)
         rethrow;
-
-
-#if 0
-//void testpcre(void)
-{
-    char       *szRegex;
-    pcre       *pcreRegex;
-    pcre_extra *pcreExtra;
-    const char *szError;
-    int         nErrorOffset;
-    int         iCheck;
-    int         opt;
-    char       *buf;
-    int         buf_size;
-#define OVECSIZE 30
-    int         ovec[OVECSIZE];
-    int         i;
-    const char **cpList;
-
-    //     0         1         2
-    //     012345678901234567890
-    buf = "In-Reply-To: MailTo: Tom & Jerry";
-    buf_size = strlen(buf);
-    szRegex = "(To|Cc|Bcc):.*(Tom|Snoopy).+&(.*)";
-    fprintf(stderr, "DEBUG:          0         1         2         3         4\n");
-    fprintf(stderr, "DEBUG:          01234567890123456789012345678901234567890\n");
-    fprintf(stderr, "DEBUG: buf    =\"%s\"\n", buf);
-    fprintf(stderr, "DEBUG: szRegex=\"%s\"\n", szRegex);
-    /*
-    buf = "In-Reply-To: MailTo: Tom & Jerry";
-    szRegex = "(To|Cc|Bcc):.*(Tom|Snoopy).+&(.*)";
-    iCheck=4 [0]="To: MailTo: Tom & Jerry" [1]="To" [2]="Tom" [3]=" Jerry"
-    */
-
-    /* compile regular expression into finite state machine */
-    opt = 0;
-    // opt |= PCRE_CASELESS;
-    // opt |= PCRE_ANCHORED;
-    if ((pcreRegex = pcre_compile(szRegex, opt, &szError, &nErrorOffset, NULL)) == NULL) {
-        fprintf(stderr, "DEBUG: \"%s\" '%c'\n", szError, szRegex[nErrorOffset]);
-        throw(0,0,0);
-    }
-    /* study finite state machine for more performance */
-    pcreExtra = pcre_study(pcreRegex, 0, &szError);
-    if (szError != NULL) {
-        free(pcreRegex);
-        pcreRegex = NULL;
-        fprintf(stderr, "DEBUG: \"%s\"\n", szError);
-        throw(0,0,0);
-    }
-
-    /* apply filter */
-    iCheck = pcre_exec(pcreRegex, pcreExtra, buf, buf_size, 0, 0, ovec, OVECSIZE);
-    fprintf(stderr, "DEBUG: iCheck=%d\n", iCheck);
-    for (i = 0; i < iCheck; i++)
-        fprintf(stderr, "DEBUG: ovec[%d]=%3d, ovec[%d]=%3d\n", 2*i, ovec[2*i], 2*i+1, ovec[2*i+1]);
-        
-
-    pcre_get_substring_list(buf, ovec, iCheck, &cpList);
-    if (cpList != NULL)
-        for (i = 0; i < iCheck; i++)
-            fprintf(stderr, "DEBUG: list[%d]=\"%s\"\n", i, cpList[i] == NULL ? "(NULL)" : cpList[i]);
-
-    /* destroy channel configuration */
-    if (cpList != NULL)
-        pcre_free_substring_list(cpList);
-    if (pcreRegex != NULL)
-        free(pcreRegex);
-    if (pcreExtra != NULL)
-        free(pcreExtra);
-
-}
-#endif
-
 CUS:
     return;
 }
 
-
-
 static void headerdestroy(headerdata_t *hdC)
 {
     int i;
@@ -1265,9 +1166,9 @@
     if (hdC->name != NULL)
         free(hdC->name);
     if (hdC->prev != NULL && hdC->prev->next == hdC)
-        return; //FIXME still linked, cannot be destroyed
+        throw(0,0,0);
     if (hdC->next != NULL && hdC->next->prev == hdC)
-        return; //FIXME still linked, cannot be destroyed
+        throw(0,0,0);
     free(hdC);
 }
 
@@ -1359,11 +1260,9 @@
 
         cp = NULL;
         while ((cp = argz_next(msg->azHeaders, msg->asHeaders, cp)) != NULL) { /* for each message header */
-            //log2(msg, DEBUG, "FIXME trace loop cp=%.8lx, cp=\"%s\"", cp, cp);
 
             /*FIXME we want O(1) here */
             for (hdP = NULL, hdI = msg->hdFirst; hdI != NULL; hdP = hdI, hdI = hdI->next) { /* for each matrix header */
-                //log2(msg, DEBUG, "FIXME trace loop hdI=%.8lx, hI->name=\"%s\"", hdI, hdI->name);
                 if (hdI->name == NULL || strlen(hdI->name) == 0 || hdI->ndata == 0)
                     continue;
                 if (strcasecmp(cp, hdI->name) == 0)
@@ -1404,23 +1303,6 @@
                 hdI->data.m[hdI->ndata] = NULL;
             }
         }
-#if 0
-        { //FIXME debug code block
-            int i;
-            headerdata_t *hdD;
-
-            log0(msg, DEBUG, "FIXME trace ---------- msg_headermatrixbuildup() ----------");
-            for (hdD = msg->hdFirst; hdD != NULL; hdD = hdD->next) {
-                if (hdD->ndata == 0)
-                    log1(msg, DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
-                if (hdD->ndata == 1)
-                    log2(msg, DEBUG, "hdD->name:hdD->data.s    %s %s", hdD->name, hdD->data.s);
-                if (hdD->ndata > 1)
-                    for (i = 0; i < hdD->ndata; i++)
-                        log3(msg, DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
-            }
-        }
-#endif
     }
     cleanup {
         if (hdNew != NULL)
@@ -1463,57 +1345,16 @@
                 }
             }
         }
-#if 0
-        { //FIXME debug code block
-            int i;
-            headerdata_t *hdD;
-
-            log0(msg, DEBUG, "FIXME trace ---------- msg_headermatrixteardwn() ----------");
-            for (hdD = msg->hdFirst; hdD != NULL; hdD = hdD->next) {
-                if (hdD->ndata == 0)
-                    log1(msg, DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
-                if (hdD->ndata == 1)
-                    log2(msg, DEBUG, "hdD->name:hdD->data.s    %s %s", hdD->name, hdD->data.s);
-                if (hdD->ndata > 1)
-                    for (i = 0; i < hdD->ndata; i++)
-                        log3(msg, DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
-            }
-        }
-#endif
     }
     catch(ex) {
         rethrow;
     }
 }
 
-
 static void headerrewrite(lmtp2nntp_t *ctx)
 {
     headerrule_t *hrI;
     headerdata_t *hdI, *hdNew;
-    /*
-    char *cp;
-    int i;
-    char *cpPri;
-    char *cpRegex;
-    char *cpHeader;
-    char *cpVal;
-    headerrule_t *hrP;
-    hrNew->pri    = atoi(cpPri);
-    hrNew->regex  = cpRegex;
-    hrNew->header = cpHeader;
-    hrNew->val    = cpVal;
-    char       *szRegex;
-    pcre       *pcreRegex;
-    pcre_extra *pcreExtra;
-    const char *szError;
-    int         nErrorOffset;
-    int         opt;
-    char       *buf;
-    int         buf_size;
-    int         ovec[OVECSIZE];
-    const char **cpList;
-    */
     regex_ctx_t *regex_ctx;
 #define OVECSIZE 30
     int            ovec[OVECSIZE];
@@ -1548,7 +1389,6 @@
         throw(0,0,0);
     }
     for (hrI = ctx->option_firstheaderrule; hrI != NULL; hrI = hrI->next) { /* for each rule */
-        //log1(ctx, DEBUG, "FIXME trace loop hrI=%.8lx", hrI);
         { //FIXME debug code block
             int i;
             headerrule_t *hrD;
@@ -1571,7 +1411,6 @@
         if (hrI->regex != NULL) {
             log1(ctx, DEBUG, "rule has regex %s", hrI->regex);
             for (hdI = ctx->msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each header */
-                //log2(ctx, DEBUG, "FIXME trace loop hdI=%.8lx, hI->name=\"%s\"", hdI, hdI->name);
                 if (hdI->name == NULL || strlen(hdI->name) == 0 || hdI->ndata == 0)
                     continue;
                 regex_ctx->nMatch = pcre_exec(hrI->pcreRegex, hrI->pcreExtra, hdI->name, strlen(hdI->name), 0, 0, ovec, OVECSIZE);
@@ -1679,20 +1518,14 @@
             }
             for (hdI = ctx->msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each header */
                 if (hdI->name == NULL || strlen(hdI->name) == 0)
-                    continue; //FIXME header w/o name cannot happen normally
+                    continue;
                 log2(ctx, DEBUG, "hrI->header=%s, hdI->name=%s", hrI->header, hdI->name);
                 if (strcasecmp(hrI->header, hdI->name) == 0)
                     break;
             }
             if (hdI != NULL) {
                 log1(ctx, DEBUG, "replacing header %s", hrI->header);
-                log3(ctx, DEBUG, "ctx->msg->hdFirst=%.8lx, hdI      =%.8lx, hdNew      =%.8lx", ctx->msg->hdFirst, hdI, hdNew);
-                log2(ctx, DEBUG, "                            hdI->prev=%.8lx, hdNew->prev=%.8lx", hdI->prev, hdNew->prev);
-                log2(ctx, DEBUG, "                            hdI->next=%.8lx, hdNew->next=%.8lx", hdI->next, hdNew->next);
                 headerreplace(hdI, hdNew);
-                log3(ctx, DEBUG, "ctx->msg->hdFirst=%.8lx, hdI      =%.8lx, hdNew      =%.8lx", ctx->msg->hdFirst, hdI, hdNew);
-                log2(ctx, DEBUG, "                            hdI->prev=%.8lx, hdNew->prev=%.8lx", hdI->prev, hdNew->prev);
-                log2(ctx, DEBUG, "                            hdI->next=%.8lx, hdNew->next=%.8lx", hdI->next, hdNew->next);
                 if (hdNew->prev == NULL) {
                     log0(ctx, DEBUG, "FIXME trace #1");
                     ctx->msg->hdFirst = hdNew;
@@ -1726,56 +1559,3 @@
         }
     }
 }
-
-static void headersimulation(lmtp2nntp_t *ctx)
-{
-    headerdata_t *hdI, *hdNew;
-    char *replyto[4] = { "foo@example.com", "bar@example.com", "quux@example.com", NULL };
-
-    log0(ctx, DEBUG, "FIXME simulation - GO");
-
-    ctx->msg = msg_create();
-
-    hdNew = headercreate();
-    hdNew->name = "To";
-    hdNew->data.s = "foo@invalid.com";
-    hdNew->ndata = 1;
-    ctx->msg->hdFirst = hdNew;
-    hdNew->prev = NULL;
-    hdI = hdNew;
-
-    hdNew = headercreate();
-    hdNew->name = "Reply-To";
-    hdNew->data.m = replyto;
-    hdNew->ndata = 3;
-    hdI->next = hdNew;
-    hdNew->prev = hdI;
-    hdI = hdNew;
-
-    hdNew = headercreate();
-    hdNew->name = "Subject";
-    hdNew->data.s = "a tiny little test";
-    hdNew->ndata = 1;
-    hdI->next = hdNew;
-    hdNew->prev = hdI;
-    hdI = hdNew;
-
-    hdNew = headercreate();
-    hdNew->name = "Date";
-    hdNew->data.s = "Mon, 18 Feb 2002 09:43:52 +0100";
-    hdNew->ndata = 1;
-    hdI->next = hdNew;
-    hdNew->prev = hdI;
-    hdI = hdNew;
-
-    hdNew = headercreate();
-    hdNew->name = "Message-ID";
-    hdNew->data.s = "<200201172300.AAA29400@procter012.pg-cw.de>";
-    hdNew->ndata = 1;
-    hdI->next = hdNew;
-    hdNew->prev = hdI;
-    hdI = hdNew;
-
-    hdI->next = NULL;
-    headerrewrite(ctx);
-}


ossp-pkg/lmtp2nntp/lmtp2nntp_main.c 1.44 -> 1.45

--- lmtp2nntp_main.c     2002/02/28 14:07:43     1.44
+++ lmtp2nntp_main.c     2002/02/28 15:57:09     1.45
@@ -126,64 +126,6 @@
     "a-zA-Z0-9.-" /* namechars     */ 
 };
 
-#if 0
-static var_rc_t ctx_lookup(
-    void *_ctx, 
-    const char *var_ptr, size_t var_len, int var_idx,
-    const char **val_ptr, size_t *val_len, size_t *val_size)
-{
-    lmtp2nntp_t *ctx = (lmtp2nntp_t *)_ctx;
-    const char *name;
-    size_t len;
-    char *cp;
-    var_rc_t rc;
-
-    log2(ctx, DEBUG, "lookup variable \"%s\" (%d)", 
-         var_ptr /* FIXME: NUL-termination? */, var_len);
-    rc = VAR_ERR_UNDEFINED_VARIABLE;
-    if (strncasecmp(var_ptr, "lmtp2nntp.version", var_len) == 0) {
-    }
-    else if (strncasecmp(var_ptr, "os.name", var_len) == 0) {
-    }
-    else if (strncasecmp(var_ptr, "os.version", var_len) == 0) {
-    }
-    else if (var_len > 8 && strncasecmp(var_ptr, "msg.hdr.", 8) == 0) {
-        name = var_ptr + 8;
-        len = strlen(name);
-        if (ctx == NULL)
-            return VAR_ERR_UNDEFINED_VARIABLE;
-        if (ctx->msg == NULL)
-            return VAR_ERR_UNDEFINED_VARIABLE;
-        if (ctx->msg->azHeaders == NULL)
-            return VAR_ERR_UNDEFINED_VARIABLE;
-        cp = NULL;
-        while ((cp = argz_next(ctx->msg->azHeaders, ctx->msg->asHeaders, cp)) != NULL) {
-            char *cpVar, *cpVal;
-            int nVar, nVal;
-            cpVar = cp;
-            nVar = strlen(cpVar);
-            if ((cp = argz_next(ctx->msg->azHeaders, ctx->msg->asHeaders, cp)) == NULL)
-                break;
-            cpVal = cp;
-            nVal = strlen(cpVal);
-            if (len == (nVar-1) && strncasecmp(cpVar, name, len) == 0 && cpVar[len] == ':') {
-                *val_ptr = cpVal;
-                *val_len = nVal;
-                *val_size = 0;
-                rc = VAR_OK;
-            }
-        }
-    }
-    if (rc == VAR_OK)
-        log4(ctx, DEBUG, "lookup variable \"%s\" (%d) ok: result is \"%s\" (%d)", 
-             var_ptr /* FIXME: NUL-termination? */, var_len, *val_ptr, *val_len);
-    else
-        log3(ctx, DEBUG, "lookup variable \"%s\" (%d) failed: %s", 
-             var_ptr /* FIXME: NUL-termination? */, var_len, var_strerror(rc));
-    return rc;
-}
-#endif
-
 static var_rc_t ctx_lookup(
     var_t *var,
     void *_ctx, 
@@ -200,7 +142,6 @@
     if (strncasecmp(var_ptr, "option.", strlen("option.")) == 0) {
         cp = str_dupex(var_ptr, var_len);
         if (val_get(ctx->val, cp, &ov) == VAL_OK) {
-            //log3(ctx, DEBUG, "FIXME var_idx=%d, ov->type=%d, ov->ndata=%d", var_idx, ov->type, ov->ndata);
             if ((var_idx == 0) && (ov->ndata == 1) && (ov->type == OPT_SINGLE)) { /* request first/only single value */
                 *val_ptr = ov->data.s;
                 *val_len = strlen(ov->data.s);
@@ -231,16 +172,13 @@
         n = strlen(cp);
         cp[n]= ':';
         cp[n + 1] = NUL;
-        log2(ctx, DEBUG, "FIXME var_idx=%d, cp=%s", var_idx, cp);
         for (hdI = ctx->msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each header */
-            log1(ctx, DEBUG, "FIXME hdI->name=%s", hdI->name);
             if (hdI->name == NULL || strlen(hdI->name) == 0)
-                continue; //FIXME header w/o name cannot happen normally
+                continue;
             if (strcasecmp(cp, hdI->name) == 0)
                 break;
         }
         if (hdI != NULL) {
-            log1(ctx, DEBUG, "FIXME hdI->ndata=%d", hdI->ndata);
             if ((var_idx == 0) && (hdI->ndata == 1)) { /* request first/only single value */
                 *val_ptr = hdI->data.s;
                 *val_len = strlen(hdI->data.s);
@@ -263,8 +201,6 @@
     return rc;
 }
 
-
-
 static void lmtp_gfs_ns(struct ns *);
 static void lmtp_gfs_lhlo(lmtp2nntp_t *);
 static void lmtp_gfs_rset(lmtp2nntp_t *);
@@ -501,18 +437,6 @@
     (void)option_create(&o, ctx->val); /* FIXME */
     (void)option_parse(o, argc, argv);
     (void)config_context(ctx);
-
-{
-headerrule_t *hrI;
-fprintf(stderr, "DEBUG: los geht's\n");
-for (hrI = ctx->option_firstheaderrule; hrI != NULL; hrI = hrI->next) {
-    fprintf(stderr, "DEBUG: cpPri    = %d\n", hrI->pri);
-    fprintf(stderr, "DEBUG: cpRegex  = \"%s\"\n", hrI->regex  == NULL ? "(NULL)" : hrI->regex);
-    fprintf(stderr, "DEBUG: cpHeader = \"%s\"\n", hrI->header == NULL ? "(NULL)" : hrI->header);
-    fprintf(stderr, "DEBUG: cpValue  = \"%s\"\n", hrI->val    == NULL ? "(NULL)" : hrI->val);
-}
-fprintf(stderr, "DEBUG: das war's\n");
-}
     CU(0); //FIXME
 
     if (getuid() != ctx->option_uid) {

CVSTrac 2.0.1