OSSP CVS Repository

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

Check-in Number: 4469
Date: 2004-Apr-02 10:22:46 (local)
2004-Apr-02 08:22:46 (UTC)
User:thl
Branch:
Comment: default Serverbind to tcp port 24; align two related logbook calls
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_config.c      1.93 -> 1.94     11 inserted, 2 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.93 -> 1.94

--- lmtp2nntp_config.c   2003/02/12 16:16:29     1.93
+++ lmtp2nntp_config.c   2004/04/02 08:22:46     1.94
@@ -361,6 +361,8 @@
 
     /* --bind SINGLE */
     try {
+        char *cp;
+
         if (   (val_get(ctx->val, "option.bind", &ov) != VAL_OK)
             || (ov->ndata <  0)
             || (ov->ndata == 1 && ov->data.s == NULL)
@@ -434,7 +436,13 @@
                 }
             /* otherwise assume INET socket */
                 else {
-                    if ((sa_rc = sa_addr_u2a(ctx->saaServerbind, "inet://%s", ov->data.s)) != SA_OK) {
+                    cp = ov->data.s;
+                    if (strrchr(cp, ':') == NULL)
+                        cp = str_concat(cp, ":24", NULL); /* http://www.iana.org/assignments/port-numbers (and names) */
+                    else
+                        cp = str_concat(cp, NULL); /* prepare for free() */
+                    logbook(ctx->l2, L2_LEVEL_DEBUG, "data.s = \"%s\", cp = \"%s\"", ov->data.s, cp);
+                    if ((sa_rc = sa_addr_u2a(ctx->saaServerbind, "inet://%s", cp)) != SA_OK) {
                         logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, parsing alternate IO guessing INET socket (%s) failed with \"%s\"", ov->data.s, sa_error(sa_rc));
                         throw(0,0,0);
                     }
@@ -442,6 +450,7 @@
                         logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, bind (%s) failed with \"%s\"", ov->data.s, sa_error(sa_rc));
                         throw(0,0,0);
                     }
+                    free(cp);
                 }
             /* for either sockets */
                 if ((sa_rc = sa_listen(ctx->saServerbind, -1)) != SA_OK) {
@@ -496,11 +505,11 @@
             if ((ctx->pns = (struct ns *)malloc(ov->ndata * sizeof(struct ns))) == NULL) throw(0,0,0);
             for (i = 0; i < ov->ndata;) {
                 cp = (ov->data.m)[i];
-                logbook(ctx->l2, L2_LEVEL_DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
                 if (strrchr(cp, ':') == NULL)
                     cp = str_concat(cp, ":nntp", NULL); /* http://www.iana.org/assignments/port-numbers (and names) */
                 else
                     cp = str_concat(cp, NULL); /* prepare for free() */
+                logbook(ctx->l2, L2_LEVEL_DEBUG, "(data.m)[%d] = \"%s\", cp = \"%s\"", i, (ov->data.m)[i], cp);
                 if ((sa_rc = sa_addr_create(&ctx->pns[i].saa)) != SA_OK) {
                     logbook(ctx->l2, L2_LEVEL_ERROR, "option --destination, create address (internal) failed with \"%s\"", sa_error(sa_rc));
                     throw(0,0,0);

CVSTrac 2.0.1