OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/lmtp2nntp_config.c versions 1.18 and 1.19
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.18 -> 1.19

--- lmtp2nntp_config.c   2002/01/30 16:41:02     1.18
+++ lmtp2nntp_config.c   2002/01/31 09:03:58     1.19
@@ -159,15 +159,14 @@
             || (ov->data.s == NULL)
               ) throw(0,0,0);
         log1(ctx, TRACE, "--childsmax = \"%s\"", ov->data.s);
+
         if ((ctx->option_childsmax = atoi(ov->data.s)) <= 0) {
-            log1(ctx, ERROR, "number (%d) out of range for option --childsmax\n", ctx->option_childsmax);
+            log1(ctx, ERROR, "option --childsmax, number (%d) out of range",
+                 ctx->option_childsmax);
             throw(0,0,0);
         }
     }
     catch (ex) {
-        log1(ctx, ERROR, "caught class  %s\n", ex.ex_class  == NULL ? "N/A" : (char *)ex.ex_class );
-        log1(ctx, ERROR, "caught object %s\n", ex.ex_object == NULL ? "N/A" : (char *)ex.ex_object);
-        log1(ctx, ERROR, "caught value  %s\n", ex.ex_value  == NULL ? "N/A" : (char *)ex.ex_value );
         rethrow;
     }
 
@@ -178,6 +177,7 @@
             || (ov->data.f != 1)
               ) throw(0,0,0);
         log1(ctx, TRACE, "--daemonize = %d", ov->data.f);
+
         ctx->option_daemon = TRUE;
     }
     catch (ex)
@@ -190,6 +190,7 @@
             || (ov->data.f != 1)
               ) throw(0,0,0);
         log1(ctx, TRACE, "--kill = %d", ov->data.f);
+
         ctx->option_killflag = TRUE;
     }
     catch (ex)
@@ -202,6 +203,7 @@
             || (ov->data.s == NULL)
               ) throw(0,0,0);
         log1(ctx, TRACE, "--pidfile = \"%s\"", ov->data.s);
+
         ctx->option_pidfile = ov->data.s;
     }
     catch (ex)
@@ -209,67 +211,51 @@
 
     /* --acl MULTI */
     try {
-        int i;
         char *cp;
-        struct acl *acl;
+        int i;
 
         if (   (val_get(ctx->val, "option.acl", &ov) != VAL_OK)
             || ((ov->ndata >= 1) && (ov->data.m == NULL))
               ) throw(0,0,0);
+        log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
         for (i = 0; i < ov->ndata; i++)
             log2(ctx, TRACE, "--acl[%d] = \"%s\"", i, (ov->data.m)[i]);
-        log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
-        if ((acl = (struct acl *)malloc(ov->ndata * sizeof(struct acl))) == NULL) throw(0,0,0);
+
+        if ((ctx->pacl = (struct acl *)malloc(ov->ndata * sizeof(struct acl))) == NULL) throw(0,0,0);
         for (i = 0; i < ov->ndata; i++) {
             cp = (ov->data.m)[i];
             log2(ctx, DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
-            //ctx->option_acl[ctx->option_aclc].acl = strdup(cp);
+            if (cp[0] == '!') {
+                ctx->pacl[i].acl = strdup(cp + 1);
+                ctx->pacl[i].not = TRUE;
+            }
+            else {
+                ctx->pacl[i].acl = strdup(cp);
+                ctx->pacl[i].not = TRUE;
+            }
+            log2(ctx, DEBUG, "ctx->pacl[%d].not = %s", i, ctx->pacl[i].not == TRUE ? "TRUE" : "FALSE");
+            log2(ctx, DEBUG, "ctx->pacl[%d].acl = %s", i, ctx->pacl[i].acl);
+            if ((cp = strrchr(ctx->pacl[i].acl, '/')) != NULL)
+                *cp++ = NUL;
+            else
+                cp = "-1";
+            ctx->pacl[i].prefixlen = atoi(cp);
+            log2(ctx, DEBUG, "ctx->pacl[%d].prefixlen = %d", i, ctx->pacl[i].prefixlen);
+            if ((rc = sa_addr_create(&(ctx->pacl[i].saa))) != SA_OK) {
+                log1(ctx, ERROR, "option --acl, create address (internal) failed with \"%s\"",
+                     sa_error(rc));
+                throw(0,0,0);
+                }
+            if ((rc = sa_addr_u2a(ctx->pacl[i].saa, "inet://%s:0", ctx->pacl[i].acl)) != SA_OK) {
+                log2(ctx, ERROR, "option --acl, parsing address (%s) failed with \"%s\"",
+                     ctx->pacl[i].acl, sa_error(rc));
+                throw(0,0,0);
+                }
         }
-
+        ctx->nacl = i;
     }
     catch (ex)
         rethrow;
-#if 0
-
-                if (argz_create_sep(optarg, ',', &azACL, &asACL) != 0)
-                    CU(ERR_EXECUTION);
-                cp = NULL;
-                while ((cp = argz_next(azACL, asACL, cp)) != NULL) {
-                    if (ctx->option_aclc >= MAXACLS) {
-                        fprintf(stderr, "%s:Error: Too many ACL (%d) using option -a\n", ctx->progname, ctx->option_aclc);
-                        CU(ERR_EXECUTION);
-                    }
-
-
-
-                    ctx->option_acl[ctx->option_aclc].acl = strdup(cp);
-                    if (cp[0] == '!') {
-                        ctx->option_acl[ctx->option_aclc].not = TRUE;
-                        cpAddr = strdup(cp+1);
-                    }
-                    else {
-                        cpAddr = strdup(cp);
-                    }
-                    if ((cpPrefixLen = strrchr(cpAddr, '/')) != NULL)
-                        *cpPrefixLen++ = NUL;
-                    else
-                        cpPrefixLen = "-1";
-                    ctx->option_acl[ctx->option_aclc].prefixlen = atoi(cpPrefixLen);
-                    if ((rc = sa_addr_create(&ctx->option_acl[ctx->option_aclc].saa)) != SA_OK) {
-                        fprintf(stderr, "%s:Error: Creating address failed for -a option (%d)\n", 
-                                ctx->progname, rc);
-                    }
-                    if ((rc = sa_addr_u2a(ctx->option_acl[ctx->option_aclc].saa, "inet://%s:0", cpAddr)) != SA_OK) {
-                        fprintf(stderr, "%s:Error: Parsing host address failed for \"%s:0\" (%d)\n", 
-                                ctx->progname, cpAddr, rc);
-                        CU(ERR_EXECUTION);
-                    }
-                    ctx->option_aclc++;
-                    free(cpAddr);
-                }
-                free(azACL);
-#endif
-
 
 CUS:
     return;

CVSTrac 2.0.1