OSSP CVS Repository

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

Check-in Number: 1900
Date: 2002-Feb-27 10:55:55 (local)
2002-Feb-27 09:55:55 (UTC)
User:thl
Branch:
Comment: support for useless but possible --headerrule :match:header: where "header" doesn't matter as the absence of a value causes deletion of any matching header anyway. However, previously the program segfaulted.
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_config.c      1.54 -> 1.55     29 inserted, 22 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.54 -> 1.55

--- lmtp2nntp_config.c   2002/02/27 09:34:41     1.54
+++ lmtp2nntp_config.c   2002/02/27 09:55:55     1.55
@@ -1625,30 +1625,37 @@
                         log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
                         hdNew->name = res_ptr; //FIXME rename ->header to ->name
                     }
-                    /* expanding regex references into header value */
-                    {
-                        var_rc_t var_rc;
-                        char *res_ptr;
-                        log1(ctx, DEBUG, "expanding regex references in header value '%s'", hrI->val);
-                        if ((var_rc = var_expand(hrI->val, strlen(hrI->val), &res_ptr, NULL,
-                                                 regex_lookup, regex_ctx, &regex_lookup_cfg, TRUE)) != VAR_OK) {
-                            log2(ctx, ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(var_rc));
-                        }
-                        log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
-                        cp = res_ptr;
+                    if (hrI->val == NULL) {
+                        log0(ctx, DEBUG, "marking deleted");
+                        /*FIXME clean up data.s and data.m */
+                        hdNew->ndata = 0;
                     }
-                    /* expanding header and other variables into header value */
-                    {
-                        var_rc_t var_rc;
-                        char *res_ptr;
-                        log1(ctx, DEBUG, "expanding variables in header value '%s'", hrI->val);
-                        if ((var_rc = var_expand(cp, strlen(cp), &res_ptr, NULL,
-                                                 ctx_lookup, ctx, &ctx_lookup_cfg, TRUE)) != VAR_OK) {
-                            log2(ctx, ERROR, "expansion of '%s' failed: %s", cp, var_strerror(var_rc));
+                    else {
+                        /* expanding regex references into header value */
+                        {
+                            var_rc_t var_rc;
+                            char *res_ptr;
+                            log1(ctx, DEBUG, "expanding regex references in header value '%s'", hrI->val);
+                            if ((var_rc = var_expand(hrI->val, strlen(hrI->val), &res_ptr, NULL,
+                                                     regex_lookup, regex_ctx, &regex_lookup_cfg, TRUE)) != VAR_OK) {
+                                log2(ctx, ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(var_rc));
+                            }
+                            log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
+                            cp = res_ptr;
+                        }
+                        /* expanding header and other variables into header value */
+                        if (hrI->val != NULL) {
+                            var_rc_t var_rc;
+                            char *res_ptr;
+                            log1(ctx, DEBUG, "expanding variables in header value '%s'", hrI->val);
+                            if ((var_rc = var_expand(cp, strlen(cp), &res_ptr, NULL,
+                                                     ctx_lookup, ctx, &ctx_lookup_cfg, TRUE)) != VAR_OK) {
+                                log2(ctx, ERROR, "expansion of '%s' failed: %s", cp, var_strerror(var_rc));
+                            }
+                            log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
+                            hdNew->data.s = res_ptr;
+                            hdNew->ndata = 1;
                         }
-                        log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
-                        hdNew->data.s = res_ptr;
-                        hdNew->ndata = 1;
                     }
                     /*FIXME clean up data.m */
                     headerreplace(hdI, hdNew);

CVSTrac 2.0.1