OSSP CVS Repository

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

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.61 -> 1.62

--- lmtp2nntp_config.c   2002/02/28 14:07:43     1.61
+++ lmtp2nntp_config.c   2002/02/28 15:21:02     1.62
@@ -1589,15 +1589,22 @@
                         var_rc_t var_rc;
                         char *res_ptr;
                         log1(ctx, DEBUG, "expanding regex references in headername '%s'", hrI->header);
-                        //if ((var_rc = var_expand(hrI->header, strlen(hrI->header), &res_ptr, NULL, regex_lookup, regex_ctx, &regex_lookup_cfg, FALSE)) != VAR_OK) {
                         if ((var_rc = var_expand(ctx->config_varregex, hrI->header, strlen(hrI->header), &res_ptr, NULL, FALSE)) != VAR_OK) {
                             log3(ctx, ERROR, "expansion of '%s' failed: %s", hrI->header, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
                         }
                         log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
-                        hdNew->name = res_ptr; //FIXME rename ->header to ->name
+                        if (strlen(res_ptr) == 0) {
+                            log0(ctx, DEBUG, "marking deleted - emtpy headername");
+                            hdNew->name = NULL; //FIXME rename ->header to ->name
+                            /*FIXME clean up data.s and data.m */
+                            hdNew->ndata = 0;
+                        }
+                        else {
+                            hdNew->name = res_ptr; //FIXME rename ->header to ->name
+                        }
                     }
                     if (hrI->val == NULL) {
-                        log0(ctx, DEBUG, "marking deleted");
+                        log0(ctx, DEBUG, "marking deleted - empty headervalue before expansion");
                         /*FIXME clean up data.s and data.m */
                         hdNew->ndata = 0;
                     }
@@ -1607,7 +1614,6 @@
                             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, FALSE)) != VAR_OK) {
                             if ((var_rc = var_expand(ctx->config_varregex, hrI->val, strlen(hrI->val), &res_ptr, NULL, FALSE)) != VAR_OK) {
                                 log3(ctx, ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
                             }
@@ -1619,13 +1625,19 @@
                             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, FALSE)) != VAR_OK) {
                             if ((var_rc = var_expand(ctx->config_varctx, cp, strlen(cp), &res_ptr, NULL, FALSE)) != VAR_OK) {
                                 log3(ctx, ERROR, "expansion of '%s' failed: %s", cp, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
                             }
                             log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
-                            hdNew->data.s = res_ptr;
-                            hdNew->ndata = 1;
+                            if (strlen(res_ptr) == 0) {
+                                log0(ctx, DEBUG, "marking deleted - empty headervalue after expansion");
+                                /*FIXME clean up data.s and data.m */
+                                hdNew->ndata = 0;
+                            }
+                            else {
+                                hdNew->data.s = res_ptr;
+                                hdNew->ndata = 1;
+                            }
                         }
                     }
                     /*FIXME clean up data.m */
@@ -1651,13 +1663,19 @@
                 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, FALSE)) != VAR_OK) {
                 if ((var_rc = var_expand(ctx->config_varctx, hrI->val, strlen(hrI->val), &res_ptr, NULL, FALSE)) != VAR_OK) {
                     log3(ctx, ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
                 }
                 log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
-                hdNew->data.s = res_ptr;
-                hdNew->ndata = 1;
+                if (strlen(res_ptr) == 0) {
+                    log0(ctx, DEBUG, "marking deleted - empty headervalue after expansion");
+                    /*FIXME clean up data.s and data.m */
+                    hdNew->ndata = 0;
+                }
+                else {
+                    hdNew->data.s = res_ptr;
+                    hdNew->ndata = 1;
+                }
             }
             for (hdI = ctx->msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each header */
                 if (hdI->name == NULL || strlen(hdI->name) == 0)

CVSTrac 2.0.1