aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/directive.c8
-rw-r--r--src/getopt.m42
-rw-r--r--src/gpg.c14
-rw-r--r--src/process.c2
-rw-r--r--src/triplet.c16
-rw-r--r--src/verify.c11
-rw-r--r--src/wydawca.h28
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
@@ -589,5 +589,5 @@ external_check (struct file_triplet *trp)
-/* Process the directives from TRP, using given SPOOL */
+/* Process the directives from TRP */
int
-process_directives (struct file_triplet *trp, const struct spool *spool)
+process_directives (struct file_triplet *trp)
{
@@ -596,3 +596,5 @@ process_directives (struct file_triplet *trp, const struct spool *spool)
char *relative_dir;
+ const struct spool *spool;
+ ASGN_SPOOL (spool, trp, return 1);
UPDATE_STATS (STAT_COMPLETE_TRIPLETS);
@@ -627,3 +629,3 @@ process_directives (struct file_triplet *trp, const struct spool *spool)
case filename_dir:
- rc = verify_detached_signature (trp, spool);
+ rc = verify_detached_signature (trp);
if (rc == 0)
diff --git a/src/getopt.m4 b/src/getopt.m4
index b615ec3..fc50ff9 100644
--- a/src/getopt.m4
+++ b/src/getopt.m4
@@ -248,3 +248,3 @@ print_help(void)
gettext (args_doc));
- if (doc && doc[0])
+ if (doc[0])
print_option_descr(gettext (doc), 0, RMARGIN);
diff --git a/src/gpg.c b/src/gpg.c
index cca5048..979d0c0 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -217,6 +217,4 @@ gpg_verify_signature (gpgme_ctx_t ctx, gpgme_signature_t sig,
/* Verify the directive file from TRP using public key PUBKEY */
-/* FIXME: spool currently unused */
int
-verify_directive_signature (struct file_triplet *trp,
- const struct spool *spool)
+verify_directive_signature (struct file_triplet *trp)
{
@@ -227,3 +225,3 @@ verify_directive_signature (struct file_triplet *trp,
struct uploader_info *uptr;
-
+
create_gpg_homedir ();
@@ -261,3 +259,3 @@ verify_directive_signature (struct file_triplet *trp,
UPDATE_STATS (STAT_BAD_SIGNATURE);
- notify (spool->notification, trp, ev_bad_directive_signature);
+ notify (trp->spool->notification, trp, ev_bad_directive_signature);
rc = 1;
@@ -285,4 +283,3 @@ verify_directive_signature (struct file_triplet *trp,
int
-verify_detached_signature (struct file_triplet *trp,
- const struct spool *spool)
+verify_detached_signature (struct file_triplet *trp)
{
@@ -290,3 +287,6 @@ verify_detached_signature (struct file_triplet *trp,
const char *argv[5];
+ const struct spool *spool;
+ ASGN_SPOOL (spool, trp, return 1);
+
fail_if_err (gpgme_get_engine_info (&info));
diff --git a/src/process.c b/src/process.c
index 23641cd..676e565 100644
--- a/src/process.c
+++ b/src/process.c
@@ -204,3 +204,3 @@ scan_spool_unlocked (const struct spool *spool, int uc, uid_t *uv)
- register_file (&finfo);
+ register_file (&finfo, spool);
}
diff --git a/src/triplet.c b/src/triplet.c
index 0744daa..efe4a0b 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -62,3 +62,3 @@ hash_triplet_free (void *data)
void
-register_file (struct file_info *finfo)
+register_file (struct file_info *finfo, const struct spool *spool)
{
@@ -71,3 +71,4 @@ register_file (struct file_info *finfo)
tp->name[finfo->root_len] = 0;
-
+ tp->spool = spool;
+
if (! ((triplet_table
@@ -125,3 +126,3 @@ check_triplet_state (struct file_triplet *trp)
{
- if (verify_directive_file (trp, trp->spool))
+ if (verify_directive_file (trp))
return triplet_bad;
@@ -178,5 +179,2 @@ triplet_processor (void *data, void *proc_data)
struct file_triplet *trp = data;
- const struct spool *spool = proc_data;
-
- trp->spool = spool;
@@ -195,3 +193,3 @@ triplet_processor (void *data, void *proc_data)
logmsg (LOG_DEBUG, _("processing triplet `%s'"), trp->name);
- if (process_directives (trp, spool))
+ if (process_directives (trp))
remove_triplet (trp);
@@ -212,3 +210,3 @@ triplet_processor (void *data, void *proc_data)
- if (triplet_expired_p (trp, spool->file_sweep_time))
+ if (triplet_expired_p (trp, trp->spool->file_sweep_time))
{
@@ -230,3 +228,3 @@ enumerate_triplets (const struct spool *spool)
{
- hash_do_for_each (triplet_table, triplet_processor, (void*) spool);
+ hash_do_for_each (triplet_table, triplet_processor, NULL);
hash_clear (triplet_table);
diff --git a/src/verify.c b/src/verify.c
index 7520466..01c61ea 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -195,11 +195,14 @@ uploader_find_frp (struct uploader_info *list, const char *fpr)
int
-verify_directive_file (struct file_triplet *trp, const struct spool *spool)
+verify_directive_file (struct file_triplet *trp)
{
char *command;
- struct dictionary *dict = spool->dictionary[project_uploader_dict];
int rc;
void *md;
-
size_t nrows, ncols, i;
struct uploader_info *head, *tail;
+ const struct spool *spool;
+ struct dictionary *dict;
+
+ ASGN_SPOOL (spool, trp, return 1);
+ dict = spool->dictionary[project_uploader_dict];
@@ -303,3 +306,3 @@ verify_directive_file (struct file_triplet *trp, const struct spool *spool)
- if (verify_directive_signature (trp, spool))
+ if (verify_directive_signature (trp))
{
diff --git a/src/wydawca.h b/src/wydawca.h
index 54ecf00..b44b5d7 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -240,2 +240,16 @@ struct spool
+#define ASGN_SPOOL(spool, trp, faction) \
+ do \
+ { \
+ spool = (trp)->spool; \
+ if (!spool) \
+ { \
+ logmsg (LOG_CRIT, \
+ _("INTERNAL ERROR at %s:%d: spool not defined for %s"),\
+ __FILE__, __LINE__, (trp)->name); \
+ faction; \
+ } \
+ } \
+ while (0)
+
@@ -403,3 +417,3 @@ void register_spool (struct spool *spool);
struct spool *wydawca_find_spool (const char *name);
-void register_file (struct file_info *finfo);
+void register_file (struct file_info *finfo, const struct spool *spool);
void enumerate_triplets (const struct spool *);
@@ -430,8 +444,5 @@ unsigned dictionary_num_cols (struct dictionary *dict);
/* Verification functions */
-int verify_directive_file (struct file_triplet *trp,
- const struct spool *spool);
-int verify_directive_signature (struct file_triplet *trp,
- const struct spool *spool);
-int verify_detached_signature (struct file_triplet *trp,
- const struct spool *spool);
+int verify_directive_file (struct file_triplet *trp);
+int verify_directive_signature (struct file_triplet *trp);
+int verify_detached_signature (struct file_triplet *trp);
int fill_project_name (struct file_triplet *trp);
@@ -452,4 +463,3 @@ int directive_next (struct file_triplet *trp, int n,
const char **pkey, const char **pval);
-int process_directives (struct file_triplet *trp,
- const struct spool *spool);
+int process_directives (struct file_triplet *trp);

Return to:

Send suggestions and report system problems to the System administrator.