diff options
-rw-r--r-- | src/directive.c | 8 | ||||
-rw-r--r-- | src/getopt.m4 | 2 | ||||
-rw-r--r-- | src/gpg.c | 14 | ||||
-rw-r--r-- | src/process.c | 2 | ||||
-rw-r--r-- | src/triplet.c | 16 | ||||
-rw-r--r-- | src/verify.c | 11 | ||||
-rw-r--r-- | src/wydawca.h | 28 |
7 files changed, 47 insertions, 34 deletions
diff --git a/src/directive.c b/src/directive.c index 401397d..93830b1 100644 --- a/src/directive.c +++ b/src/directive.c | |||
@@ -587,14 +587,16 @@ external_check (struct file_triplet *trp) | |||
587 | return rc; | 587 | return rc; |
588 | } | 588 | } |
589 | 589 | ||
590 | /* Process the directives from TRP, using given SPOOL */ | 590 | /* Process the directives from TRP */ |
591 | int | 591 | int |
592 | process_directives (struct file_triplet *trp, const struct spool *spool) | 592 | process_directives (struct file_triplet *trp) |
593 | { | 593 | { |
594 | int rc, n; | 594 | int rc, n; |
595 | const char *key, *val; | 595 | const char *key, *val; |
596 | char *relative_dir; | 596 | char *relative_dir; |
597 | const struct spool *spool; | ||
597 | 598 | ||
599 | ASGN_SPOOL (spool, trp, return 1); | ||
598 | UPDATE_STATS (STAT_COMPLETE_TRIPLETS); | 600 | UPDATE_STATS (STAT_COMPLETE_TRIPLETS); |
599 | timer_start ("triplet"); | 601 | timer_start ("triplet"); |
600 | report_init (); | 602 | report_init (); |
@@ -625,7 +627,7 @@ process_directives (struct file_triplet *trp, const struct spool *spool) | |||
625 | break; | 627 | break; |
626 | 628 | ||
627 | case filename_dir: | 629 | case filename_dir: |
628 | rc = verify_detached_signature (trp, spool); | 630 | rc = verify_detached_signature (trp); |
629 | if (rc == 0) | 631 | if (rc == 0) |
630 | { | 632 | { |
631 | if (external_check (trp)) | 633 | if (external_check (trp)) |
diff --git a/src/getopt.m4 b/src/getopt.m4 index b615ec3..fc50ff9 100644 --- a/src/getopt.m4 +++ b/src/getopt.m4 | |||
@@ -246,7 +246,7 @@ print_help(void) | |||
246 | 246 | ||
247 | printf ("%s %s [%s]... %s\n", _("Usage:"), [<$2>], _("[<OPTION>]"), | 247 | printf ("%s %s [%s]... %s\n", _("Usage:"), [<$2>], _("[<OPTION>]"), |
248 | gettext (args_doc)); | 248 | gettext (args_doc)); |
249 | if (doc && doc[0]) | 249 | if (doc[0]) |
250 | print_option_descr(gettext (doc), 0, RMARGIN); | 250 | print_option_descr(gettext (doc), 0, RMARGIN); |
251 | putchar ('\n'); | 251 | putchar ('\n'); |
252 | 252 | ||
@@ -215,17 +215,15 @@ gpg_verify_signature (gpgme_ctx_t ctx, gpgme_signature_t sig, | |||
215 | } | 215 | } |
216 | 216 | ||
217 | /* Verify the directive file from TRP using public key PUBKEY */ | 217 | /* Verify the directive file from TRP using public key PUBKEY */ |
218 | /* FIXME: spool currently unused */ | ||
219 | int | 218 | int |
220 | verify_directive_signature (struct file_triplet *trp, | 219 | verify_directive_signature (struct file_triplet *trp) |
221 | const struct spool *spool) | ||
222 | { | 220 | { |
223 | gpgme_ctx_t ctx; | 221 | gpgme_ctx_t ctx; |
224 | gpgme_data_t key_data, directive_data, plain; | 222 | gpgme_data_t key_data, directive_data, plain; |
225 | gpgme_error_t ec; | 223 | gpgme_error_t ec; |
226 | int rc; | 224 | int rc; |
227 | struct uploader_info *uptr; | 225 | struct uploader_info *uptr; |
228 | 226 | ||
229 | create_gpg_homedir (); | 227 | create_gpg_homedir (); |
230 | fail_if_err (gpgme_new (&ctx)); | 228 | fail_if_err (gpgme_new (&ctx)); |
231 | 229 | ||
@@ -259,7 +257,7 @@ verify_directive_signature (struct file_triplet *trp, | |||
259 | if (!gpg_verify_signature (ctx, result->signatures, trp)) | 257 | if (!gpg_verify_signature (ctx, result->signatures, trp)) |
260 | { | 258 | { |
261 | UPDATE_STATS (STAT_BAD_SIGNATURE); | 259 | UPDATE_STATS (STAT_BAD_SIGNATURE); |
262 | notify (spool->notification, trp, ev_bad_directive_signature); | 260 | notify (trp->spool->notification, trp, ev_bad_directive_signature); |
263 | rc = 1; | 261 | rc = 1; |
264 | } | 262 | } |
265 | else | 263 | else |
@@ -283,12 +281,14 @@ verify_directive_signature (struct file_triplet *trp, | |||
283 | NOTE: It is assumed that the public key is already registered (by | 281 | NOTE: It is assumed that the public key is already registered (by |
284 | a previous call to verify_directive_signature). */ | 282 | a previous call to verify_directive_signature). */ |
285 | int | 283 | int |
286 | verify_detached_signature (struct file_triplet *trp, | 284 | verify_detached_signature (struct file_triplet *trp) |
287 | const struct spool *spool) | ||
288 | { | 285 | { |
289 | gpgme_engine_info_t info; | 286 | gpgme_engine_info_t info; |
290 | const char *argv[5]; | 287 | const char *argv[5]; |
288 | const struct spool *spool; | ||
291 | 289 | ||
290 | ASGN_SPOOL (spool, trp, return 1); | ||
291 | |||
292 | fail_if_err (gpgme_get_engine_info (&info)); | 292 | fail_if_err (gpgme_get_engine_info (&info)); |
293 | while (info && info->protocol != GPGME_PROTOCOL_OpenPGP) | 293 | while (info && info->protocol != GPGME_PROTOCOL_OpenPGP) |
294 | info = info->next; | 294 | info = info->next; |
diff --git a/src/process.c b/src/process.c index 23641cd..676e565 100644 --- a/src/process.c +++ b/src/process.c | |||
@@ -202,7 +202,7 @@ scan_spool_unlocked (const struct spool *spool, int uc, uid_t *uv) | |||
202 | logmsg (LOG_DEBUG, _("found file %s: %s, stem: %.*s"), ent->d_name, | 202 | logmsg (LOG_DEBUG, _("found file %s: %s, stem: %.*s"), ent->d_name, |
203 | file_type_str (finfo.type), finfo.root_len, finfo.name); | 203 | file_type_str (finfo.type), finfo.root_len, finfo.name); |
204 | 204 | ||
205 | register_file (&finfo); | 205 | register_file (&finfo, spool); |
206 | } | 206 | } |
207 | 207 | ||
208 | closedir (dir); | 208 | closedir (dir); |
diff --git a/src/triplet.c b/src/triplet.c index 0744daa..efe4a0b 100644 --- a/src/triplet.c +++ b/src/triplet.c | |||
@@ -60,7 +60,7 @@ hash_triplet_free (void *data) | |||
60 | 60 | ||
61 | /* Register a file in the triplet table */ | 61 | /* Register a file in the triplet table */ |
62 | void | 62 | void |
63 | register_file (struct file_info *finfo) | 63 | register_file (struct file_info *finfo, const struct spool *spool) |
64 | { | 64 | { |
65 | struct file_triplet *tp, *ret; | 65 | struct file_triplet *tp, *ret; |
66 | 66 | ||
@@ -69,7 +69,8 @@ register_file (struct file_info *finfo) | |||
69 | tp->name = (char*)(tp + 1); | 69 | tp->name = (char*)(tp + 1); |
70 | memcpy (tp->name, finfo->name, finfo->root_len); | 70 | memcpy (tp->name, finfo->name, finfo->root_len); |
71 | tp->name[finfo->root_len] = 0; | 71 | tp->name[finfo->root_len] = 0; |
72 | 72 | tp->spool = spool; | |
73 | |||
73 | if (! ((triplet_table | 74 | if (! ((triplet_table |
74 | || (triplet_table = hash_initialize (0, 0, | 75 | || (triplet_table = hash_initialize (0, 0, |
75 | hash_triplet_hasher, | 76 | hash_triplet_hasher, |
@@ -123,7 +124,7 @@ check_triplet_state (struct file_triplet *trp) | |||
123 | { | 124 | { |
124 | if (trp->file[file_directive].name) | 125 | if (trp->file[file_directive].name) |
125 | { | 126 | { |
126 | if (verify_directive_file (trp, trp->spool)) | 127 | if (verify_directive_file (trp)) |
127 | return triplet_bad; | 128 | return triplet_bad; |
128 | 129 | ||
129 | if (trp->file[file_dist].name == 0 | 130 | if (trp->file[file_dist].name == 0 |
@@ -176,9 +177,6 @@ static bool | |||
176 | triplet_processor (void *data, void *proc_data) | 177 | triplet_processor (void *data, void *proc_data) |
177 | { | 178 | { |
178 | struct file_triplet *trp = data; | 179 | struct file_triplet *trp = data; |
179 | const struct spool *spool = proc_data; | ||
180 | |||
181 | trp->spool = spool; | ||
182 | 180 | ||
183 | if (debug_level) | 181 | if (debug_level) |
184 | logmsg (LOG_DEBUG, "FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s", | 182 | logmsg (LOG_DEBUG, "FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s", |
@@ -193,7 +191,7 @@ triplet_processor (void *data, void *proc_data) | |||
193 | case triplet_complete: | 191 | case triplet_complete: |
194 | if (debug_level) | 192 | if (debug_level) |
195 | logmsg (LOG_DEBUG, _("processing triplet `%s'"), trp->name); | 193 | logmsg (LOG_DEBUG, _("processing triplet `%s'"), trp->name); |
196 | if (process_directives (trp, spool)) | 194 | if (process_directives (trp)) |
197 | remove_triplet (trp); | 195 | remove_triplet (trp); |
198 | return true; | 196 | return true; |
199 | 197 | ||
@@ -210,7 +208,7 @@ triplet_processor (void *data, void *proc_data) | |||
210 | return true; | 208 | return true; |
211 | } | 209 | } |
212 | 210 | ||
213 | if (triplet_expired_p (trp, spool->file_sweep_time)) | 211 | if (triplet_expired_p (trp, trp->spool->file_sweep_time)) |
214 | { | 212 | { |
215 | UPDATE_STATS (STAT_EXPIRED_TRIPLETS); | 213 | UPDATE_STATS (STAT_EXPIRED_TRIPLETS); |
216 | remove_triplet (trp); | 214 | remove_triplet (trp); |
@@ -228,7 +226,7 @@ enumerate_triplets (const struct spool *spool) | |||
228 | spool->tag, mu_url_to_string (spool->dest_url)); | 226 | spool->tag, mu_url_to_string (spool->dest_url)); |
229 | if (triplet_table) | 227 | if (triplet_table) |
230 | { | 228 | { |
231 | hash_do_for_each (triplet_table, triplet_processor, (void*) spool); | 229 | hash_do_for_each (triplet_table, triplet_processor, NULL); |
232 | hash_clear (triplet_table); | 230 | hash_clear (triplet_table); |
233 | } | 231 | } |
234 | } | 232 | } |
diff --git a/src/verify.c b/src/verify.c index 7520466..01c61ea 100644 --- a/src/verify.c +++ b/src/verify.c | |||
@@ -193,15 +193,18 @@ uploader_find_frp (struct uploader_info *list, const char *fpr) | |||
193 | } | 193 | } |
194 | 194 | ||
195 | int | 195 | int |
196 | verify_directive_file (struct file_triplet *trp, const struct spool *spool) | 196 | verify_directive_file (struct file_triplet *trp) |
197 | { | 197 | { |
198 | char *command; | 198 | char *command; |
199 | struct dictionary *dict = spool->dictionary[project_uploader_dict]; | ||
200 | int rc; | 199 | int rc; |
201 | void *md; | 200 | void *md; |
202 | |||
203 | size_t nrows, ncols, i; | 201 | size_t nrows, ncols, i; |
204 | struct uploader_info *head, *tail; | 202 | struct uploader_info *head, *tail; |
203 | const struct spool *spool; | ||
204 | struct dictionary *dict; | ||
205 | |||
206 | ASGN_SPOOL (spool, trp, return 1); | ||
207 | dict = spool->dictionary[project_uploader_dict]; | ||
205 | 208 | ||
206 | if (!trp->file[file_directive].name) | 209 | if (!trp->file[file_directive].name) |
207 | return 1; | 210 | return 1; |
@@ -301,7 +304,7 @@ verify_directive_file (struct file_triplet *trp, const struct spool *spool) | |||
301 | trp->uploader_list = head; | 304 | trp->uploader_list = head; |
302 | trp->uploader = NULL; | 305 | trp->uploader = NULL; |
303 | 306 | ||
304 | if (verify_directive_signature (trp, spool)) | 307 | if (verify_directive_signature (trp)) |
305 | { | 308 | { |