Minor changes in sieve.
* libmu_sieve/runtime.c (mu_sieve_abort): Jump with code MU_ERR_FAILURE. * libmu_sieve/tests.c (retrieve_address): Tolerate empty addresses. (retrieve_header): Return reasonable error code. * maidag/script.c (script_apply): If the script failed, return 0.
Showing
3 changed files
with
13 additions
and
14 deletions
... | @@ -157,7 +157,7 @@ _mu_i_sv_instr_brnz (mu_sieve_machine_t mach) | ... | @@ -157,7 +157,7 @@ _mu_i_sv_instr_brnz (mu_sieve_machine_t mach) |
157 | void | 157 | void |
158 | mu_sieve_abort (mu_sieve_machine_t mach) | 158 | mu_sieve_abort (mu_sieve_machine_t mach) |
159 | { | 159 | { |
160 | longjmp (mach->errbuf, 1); | 160 | longjmp (mach->errbuf, MU_ERR_FAILURE); |
161 | } | 161 | } |
162 | 162 | ||
163 | void | 163 | void | ... | ... |
... | @@ -67,6 +67,8 @@ retrieve_address (void *item, void *data, size_t idx, char **pval) | ... | @@ -67,6 +67,8 @@ retrieve_address (void *item, void *data, size_t idx, char **pval) |
67 | rc = mu_header_aget_value ((mu_header_t)ap->data, (char*)item, &val); | 67 | rc = mu_header_aget_value ((mu_header_t)ap->data, (char*)item, &val); |
68 | if (rc) | 68 | if (rc) |
69 | return rc; | 69 | return rc; |
70 | if (mu_str_skip_class (val, MU_CTYPE_BLANK)[0] == 0) | ||
71 | return MU_ERR_NOENT; | ||
70 | rc = mu_address_create (&ap->addr, val); | 72 | rc = mu_address_create (&ap->addr, val); |
71 | free (val); | 73 | free (val); |
72 | if (rc) | 74 | if (rc) |
... | @@ -150,11 +152,7 @@ retrieve_header (void *item, void *data, size_t idx, char **pval) | ... | @@ -150,11 +152,7 @@ retrieve_header (void *item, void *data, size_t idx, char **pval) |
150 | { | 152 | { |
151 | int i = hc->index++; | 153 | int i = hc->index++; |
152 | if (mu_c_strcasecmp (hname, (char*)item) == 0) | 154 | if (mu_c_strcasecmp (hname, (char*)item) == 0) |
153 | { | 155 | return mu_header_aget_field_value_unfold (hc->header, i, pval); |
154 | if (mu_header_aget_field_value_unfold (hc->header, i, pval)) | ||
155 | return -1; | ||
156 | return 0; | ||
157 | } | ||
158 | } | 156 | } |
159 | 157 | ||
160 | hc->header = NULL; | 158 | hc->header = NULL; | ... | ... |
... | @@ -98,13 +98,6 @@ apply_script (void *item, void *data) | ... | @@ -98,13 +98,6 @@ apply_script (void *item, void *data) |
98 | 98 | ||
99 | free (progfile); | 99 | free (progfile); |
100 | 100 | ||
101 | if (rc == 0) | ||
102 | { | ||
103 | mu_attribute_t attr; | ||
104 | mu_message_get_attribute (clos->msg, &attr); | ||
105 | rc = mu_attribute_is_deleted (attr); | ||
106 | } | ||
107 | |||
108 | return rc; | 101 | return rc; |
109 | } | 102 | } |
110 | 103 | ||
... | @@ -129,7 +122,15 @@ script_apply (mu_message_t msg, struct mu_auth_data *auth) | ... | @@ -129,7 +122,15 @@ script_apply (mu_message_t msg, struct mu_auth_data *auth) |
129 | rc = mu_list_foreach (script_list, apply_script, &clos); | 122 | rc = mu_list_foreach (script_list, apply_script, &clos); |
130 | chdir ("/"); | 123 | chdir ("/"); |
131 | switch_user_id (auth, 0); | 124 | switch_user_id (auth, 0); |
132 | } | 125 | if (rc == 0) |
126 | { | ||
127 | mu_attribute_t attr; | ||
128 | mu_message_get_attribute (msg, &attr); | ||
129 | rc = mu_attribute_is_deleted (attr); | ||
130 | } | ||
131 | else | ||
132 | rc = 0; | ||
133 | } | ||
133 | } | 134 | } |
134 | return rc; | 135 | return rc; |
135 | } | 136 | } | ... | ... |
-
Please register or sign in to post a comment