OSSP CVS Repository

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

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.29 -> 1.30

--- lmtp2nntp_config.c   2002/01/31 15:03:51     1.29
+++ lmtp2nntp_config.c   2002/01/31 15:09:25     1.30
@@ -564,6 +564,34 @@
     }
     catch (ex)
         rethrow;
+
+    /* --restrictheader SINGLE */
+    try {
+        char *cp;
+
+        if (   (val_get(ctx->val, "option.restrictheader", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--restrictheader = \"%s\"", ov->data.s);
+
+        ctx->option_restrictheader = strdup(ov->data.s);
+        /* protect ourselfs from the substitution of backreferences.
+         * Missing varargs would cause segfaults.  Rewrite capturing
+         * brackets to clustering syntax. Use poor man's s///g
+         * simulator as current str library doesn't support global
+         * substitution */
+        while (str_parse(ctx->option_restrictheader, "s/(.*?)\\((?!\\?:)(.*)/$1(?:$2/", &cp) > 0) {
+            free(ctx->option_restrictheader);
+            ctx->option_restrictheader = cp;
+        }
+        if (str_parse("<>", ctx->option_restrictheader) == -1) {
+            log1(ctx, ERROR, "option --restrictheader, illegal regex (%s)", ctx->option_restrictheader);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
 CUS:
     return;
 }

CVSTrac 2.0.1