--- lmtp2nntp_config.c 2002/01/31 10:40:07 1.21
+++ lmtp2nntp_config.c 2002/01/31 13:44:05 1.22
@@ -381,6 +381,48 @@
catch (ex)
rethrow;
+ /* --destination MULTI */
+ try {
+ char *cp;
+ int i;
+
+ if ( (val_get(ctx->val, "option.destination", &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, "--destination[%d] = \"%s\"", i, (ov->data.m)[i]);
+
+ 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);
+ if (strrchr(cp, ':') == NULL)
+ cp = str_concat(cp, ":nntp", NULL); //FIXME is this a config var/val?
+ else
+ cp = str_concat(cp, NULL); /* prepare for free() */
+ log1(ctx, DEBUG, "cp = \"%s\"", cp);
+ if ((rc = sa_addr_create(&ctx->ns[i].saa)) != SA_OK) {
+ log1(ctx, ERROR, "option --destination, create address (internal) failed with \"%s\"",
+ sa_error(rc));
+ throw(0,0,0);
+ }
+ if ((rc = sa_addr_u2a(ctx->ns[i].saa, "inet://%s", cp)) != SA_OK) {
+ log2(ctx, ERROR, "option --destination, parsing host address (%s) failed with \"%s\"",
+ cp /*FIXME again, option vs. config */, sa_error(rc));
+ throw(0,0,0);
+ }
+ if ((rc = sa_create(&ctx->ns[i].sa)) != SA_OK) {
+ 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);
+ }
+ free(cp);
+ }
+ ctx->nns = i;
+ }
+ catch (ex)
+ rethrow;
CUS:
return;
}
|