--- lmtp2nntp_main.c 2002/01/30 16:41:02 1.12
+++ lmtp2nntp_main.c 2002/01/31 09:03:58 1.13
@@ -447,13 +447,8 @@
ctx->ns[i].rc = LMTP_ERR_UNKNOWN;
ctx->ns[i].l2 = NULL;
}
- ctx->option_aclc = 0;
- for (i = 0; i < MAXACLS; i++) {
- ctx->option_acl[i].acl = NULL;
- ctx->option_acl[i].not = FALSE;
- ctx->option_acl[i].saa = NULL;
- ctx->option_acl[i].prefixlen = 0;
- }
+ ctx->nacl = 0;
+ ctx->pacl = NULL;
ctx->azGroupargs = NULL;
ctx->asGroupargs = 0;
initsession(&ctx->session);
@@ -824,51 +819,51 @@
/* if no positive ACL exists (option -a) add a wildcard match-all for IPv4 and IPv6 */
bOk = FALSE;
- for (i = 0; i < ctx->option_aclc; i++) {
- if (!ctx->option_acl[i].not) {
+ for (i = 0; i < ctx->nacl; i++) {
+ if (!ctx->pacl[i].not) {
bOk = TRUE;
break;
}
}
if (!bOk) {
- if (ctx->option_aclc >= MAXACLS) {
- fprintf(stderr, "%s:Error: Too many ACL (%d) using option -a (no space for additional fake IPv4 ACL)\n", ctx->progname, ctx->option_aclc);
+ if (ctx->nacl >= MAXACLS) {
+ fprintf(stderr, "%s:Error: Too many ACL (%d) using option -a (no space for additional fake IPv4 ACL)\n", ctx->progname, ctx->nacl);
CU(ERR_EXECUTION);
}
- ctx->option_acl[ctx->option_aclc].acl = "0.0.0.0";
- ctx->option_acl[ctx->option_aclc].not = FALSE;
- ctx->option_acl[ctx->option_aclc].prefixlen = 0;
- if ((rc = sa_addr_create(&ctx->option_acl[ctx->option_aclc].saa)) != SA_OK) {
+ ctx->pacl[ctx->nacl].acl = "0.0.0.0";
+ ctx->pacl[ctx->nacl].not = FALSE;
+ ctx->pacl[ctx->nacl].prefixlen = 0;
+ if ((rc = sa_addr_create(&ctx->pacl[ctx->nacl].saa)) != SA_OK) {
fprintf(stderr, "%s:Error: Creating fake 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", ctx->option_acl[ctx->option_aclc].acl)) != SA_OK) {
+ if ((rc = sa_addr_u2a(ctx->pacl[ctx->nacl].saa, "inet://%s:0", ctx->pacl[ctx->nacl].acl)) != SA_OK) {
fprintf(stderr, "%s:Error: Parsing host address failed for \"%s:0\" (%s)\n",
- ctx->progname, ctx->option_acl[ctx->option_aclc].acl,
+ ctx->progname, ctx->pacl[ctx->nacl].acl,
sa_error(rc));
CU(ERR_EXECUTION);
}
- ctx->option_aclc++;
+ ctx->nacl++;
}
if (!bOk) {
- if (ctx->option_aclc >= MAXACLS) {
- fprintf(stderr, "%s:Error: Too many ACL (%d) using option -a (no space for additional fake IPv6 ACL)\n", ctx->progname, ctx->option_aclc);
+ if (ctx->nacl >= MAXACLS) {
+ fprintf(stderr, "%s:Error: Too many ACL (%d) using option -a (no space for additional fake IPv6 ACL)\n", ctx->progname, ctx->nacl);
CU(ERR_EXECUTION);
}
- ctx->option_acl[ctx->option_aclc].acl = "[::]";
- ctx->option_acl[ctx->option_aclc].not = FALSE;
- ctx->option_acl[ctx->option_aclc].prefixlen = 0;
- if ((rc = sa_addr_create(&ctx->option_acl[ctx->option_aclc].saa)) != SA_OK) {
+ ctx->pacl[ctx->nacl].acl = "[::]";
+ ctx->pacl[ctx->nacl].not = FALSE;
+ ctx->pacl[ctx->nacl].prefixlen = 0;
+ if ((rc = sa_addr_create(&ctx->pacl[ctx->nacl].saa)) != SA_OK) {
fprintf(stderr, "%s:Error: Creating fake 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", ctx->option_acl[ctx->option_aclc].acl)) != SA_OK) {
+ if ((rc = sa_addr_u2a(ctx->pacl[ctx->nacl].saa, "inet://%s:0", ctx->pacl[ctx->nacl].acl)) != SA_OK) {
fprintf(stderr, "%s:Error: Parsing host address failed for \"%s:0\" (%s)\n",
- ctx->progname, ctx->option_acl[ctx->option_aclc].acl,
+ ctx->progname, ctx->pacl[ctx->nacl].acl,
sa_error(rc));
CU(ERR_EXECUTION);
}
- ctx->option_aclc++;
+ ctx->nacl++;
}
if (getuid() != ctx->option_uid) {
@@ -987,38 +982,38 @@
/* Access Control List */
bOk = FALSE;
/* check positive matches */
- for (i = 0; i < ctx->option_aclc; i++) {
+ for (i = 0; i < ctx->nacl; i++) {
char *cpA1;
char *cpA2;
- if (ctx->option_acl[i].not)
+ if (ctx->pacl[i].not)
continue;
- sa_addr_a2u(ctx->option_acl[i].saa, &cpA1);
+ sa_addr_a2u(ctx->pacl[i].saa, &cpA1);
sa_addr_a2u(ctx->saaIO, &cpA2);
- if (sa_addr_match(ctx->saaIO, ctx->option_acl[i].saa, ctx->option_acl[i].prefixlen) == SA_OK) {
- log4(ctx, TRACE, "positive/inclusive ACL \"%s\" (%s/%d) matches %s: YES (stop comparison)", ctx->option_acl[i].acl, cpA1, ctx->option_acl[i].prefixlen, cpA2);
+ if (sa_addr_match(ctx->saaIO, ctx->pacl[i].saa, ctx->pacl[i].prefixlen) == SA_OK) {
+ log4(ctx, TRACE, "positive/inclusive ACL \"%s\" (%s/%d) matches %s: YES (stop comparison)", ctx->pacl[i].acl, cpA1, ctx->pacl[i].prefixlen, cpA2);
bOk = TRUE;
break;
}
else
- log4(ctx, TRACE, "positive/inclusive ACL \"%s\" (%s/%d) matches %s: NO", ctx->option_acl[i].acl, cpA1, ctx->option_acl[i].prefixlen, cpA2);
+ log4(ctx, TRACE, "positive/inclusive ACL \"%s\" (%s/%d) matches %s: NO", ctx->pacl[i].acl, cpA1, ctx->pacl[i].prefixlen, cpA2);
free(cpA1);
free(cpA2);
}
/* check negative matches */
- for (i = 0; i < ctx->option_aclc; i++) {
+ for (i = 0; i < ctx->nacl; i++) {
char *cpA1;
char *cpA2;
- if (!ctx->option_acl[i].not)
+ if (!ctx->pacl[i].not)
continue;
- sa_addr_a2u(ctx->option_acl[i].saa, &cpA1);
+ sa_addr_a2u(ctx->pacl[i].saa, &cpA1);
sa_addr_a2u(ctx->saaIO, &cpA2);
- if (sa_addr_match(ctx->saaIO, ctx->option_acl[i].saa, ctx->option_acl[i].prefixlen) == SA_OK) {
- log4(ctx, TRACE, "negative/exclusive ACL \"%s\" (not %s/%d) matches %s: YES (stop comparison)", ctx->option_acl[i].acl, cpA1, ctx->option_acl[i].prefixlen, cpA2);
+ if (sa_addr_match(ctx->saaIO, ctx->pacl[i].saa, ctx->pacl[i].prefixlen) == SA_OK) {
+ log4(ctx, TRACE, "negative/exclusive ACL \"%s\" (not %s/%d) matches %s: YES (stop comparison)", ctx->pacl[i].acl, cpA1, ctx->pacl[i].prefixlen, cpA2);
bOk = FALSE;
break;
}
else {
- log4(ctx, TRACE, "negative/exclusive ACL \"%s\" (not %s/%d) matches %s: NO", ctx->option_acl[i].acl, cpA1, ctx->option_acl[i].prefixlen, cpA2);
+ log4(ctx, TRACE, "negative/exclusive ACL \"%s\" (not %s/%d) matches %s: NO", ctx->pacl[i].acl, cpA1, ctx->pacl[i].prefixlen, cpA2);
}
}
if (bOk) {
|