aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c10
-rw-r--r--src/gpg.c107
-rw-r--r--src/job.c7
-rw-r--r--src/triplet.c3
-rw-r--r--src/verify.c3
-rw-r--r--src/watcher.c16
-rw-r--r--src/wydawca.c2
-rw-r--r--src/wydawca.h3
8 files changed, 99 insertions, 52 deletions
diff --git a/src/config.c b/src/config.c
index 66d5fb7..509b0d5 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1160,2 +1160,6 @@ static struct grecs_keyword spool_kw[] = {
cb_interval },
+ { "inotify", NULL, N_("Enable or disable inotify for this spool"),
+ grecs_type_bool, GRECS_DFLT,
+ NULL, offsetof(struct spool, inotify_enable), },
+
{ "dictionary", N_("ident"), N_("Define data dictionary"),
@@ -1202,2 +1206,3 @@ cb_spool (enum grecs_callback_command cmd,
spool->file_sweep_time = file_sweep_time;
+ spool->inotify_enable = 1;
for (i = 0; i < NITEMS (spool->dictionary); i++)
@@ -1420,3 +1425,6 @@ static struct grecs_keyword wydawca_kw[] = {
grecs_type_string, GRECS_DFLT, &pidfile },
-
+
+ { "inotify", NULL, N_("Enable or disable inotify support"),
+ grecs_type_bool, GRECS_DFLT, &inotify_enable },
+
{ "user", N_("name"), N_("Run with UID and GID of this user"),
diff --git a/src/gpg.c b/src/gpg.c
index 8979e9c..814be6f 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -149,2 +149,53 @@ create_gpg_homedir ()
static int
+checksig (gpgme_signature_t sig, const char *uid, struct file_triplet *trp)
+{
+ switch (gpg_err_code (sig->status))
+ {
+ case GPG_ERR_NO_ERROR:
+ if (debug_level)
+ logmsg (LOG_NOTICE, _("Good signature from %s"), uid);
+ trp->uploader = uploader_find_frp (trp->uploader_list, sig->fpr);
+ if (!trp->uploader)
+ {
+ logmsg (LOG_ERR,
+ _("good signature from %s, "
+ "but the uploader info for %s not found"),
+ uid, sig->fpr);
+ return 1;
+ }
+ break;
+
+ case GPG_ERR_BAD_SIGNATURE:
+ UPDATE_STATS (STAT_BAD_SIGNATURE);
+ logmsg (LOG_ERR, _("BAD signature from %s"), uid);
+ return 0;
+
+ case GPG_ERR_NO_PUBKEY:
+ UPDATE_STATS (STAT_ACCESS_VIOLATIONS);
+ logmsg (LOG_ERR, _("No public key"));
+ return 0;
+
+ case GPG_ERR_NO_DATA:
+ UPDATE_STATS (STAT_BAD_TRIPLETS);
+ logmsg (LOG_ERR, _("No signature"));
+ return 0;
+
+ case GPG_ERR_SIG_EXPIRED:
+ UPDATE_STATS (STAT_BAD_SIGNATURE);
+ logmsg (LOG_ERR, _("Expired signature from %s"), uid);
+ return 0;
+
+ case GPG_ERR_KEY_EXPIRED:
+ UPDATE_STATS (STAT_BAD_SIGNATURE);
+ logmsg (LOG_ERR, _("Key expired (%s)"), uid);
+ return 0;
+
+ default:
+ logmsg (LOG_ERR, _("Unknown signature error"));
+ return 0;
+ }
+ return -1;
+}
+
+static int
gpg_verify_signature (gpgme_ctx_t ctx, gpgme_signature_t sig,
@@ -159,3 +210,4 @@ gpg_verify_signature (gpgme_ctx_t ctx, gpgme_signature_t sig,
gpgme_key_t key;
-
+ int rc;
+
if (gpgme_get_key (ctx, sig->fpr, &key, 0) == GPG_ERR_NO_ERROR)
@@ -164,48 +216,6 @@ gpg_verify_signature (gpgme_ctx_t ctx, gpgme_signature_t sig,
uid = sig->fpr;
-
- switch (gpg_err_code (sig->status))
- {
- case GPG_ERR_NO_ERROR:
- if (debug_level)
- logmsg (LOG_NOTICE, _("Good signature from %s"), uid);
- trp->uploader = uploader_find_frp (trp->uploader_list, sig->fpr);
- if (!trp->uploader)
- {
- logmsg (LOG_ERR,
- _("good signature from %s, "
- "but the uploader info for %s not found"),
- uid, sig->fpr);
- return 1;
- }
- break;
-
- case GPG_ERR_BAD_SIGNATURE:
- UPDATE_STATS (STAT_BAD_SIGNATURE);
- logmsg (LOG_ERR, _("BAD signature from %s"), uid);
- return 0;
-
- case GPG_ERR_NO_PUBKEY:
- UPDATE_STATS (STAT_ACCESS_VIOLATIONS);
- logmsg (LOG_ERR, _("No public key"));
- return 0;
-
- case GPG_ERR_NO_DATA:
- UPDATE_STATS (STAT_BAD_TRIPLETS);
- logmsg (LOG_ERR, _("No signature"));
- return 0;
-
- case GPG_ERR_SIG_EXPIRED:
- UPDATE_STATS (STAT_BAD_SIGNATURE);
- logmsg (LOG_ERR, _("Expired signature from %s"), uid);
- return 0;
-
- case GPG_ERR_KEY_EXPIRED:
- UPDATE_STATS (STAT_BAD_SIGNATURE);
- logmsg (LOG_ERR, _("Key expired (%s)"), uid);
- return 0;
-
- default:
- logmsg (LOG_ERR, _("Unknown signature error"));
- return 0;
- }
+ rc = checksig (sig, uid, trp);
+ gpgme_key_unref (key);
+ if (rc != -1)
+ return rc;
}
@@ -219,3 +229,3 @@ verify_directive_signature (struct file_triplet *trp)
gpgme_ctx_t ctx;
- gpgme_data_t key_data, directive_data, plain;
+ gpgme_data_t key_data, directive_data, plain = NULL;
gpgme_error_t ec;
@@ -271,2 +281,3 @@ verify_directive_signature (struct file_triplet *trp)
+ gpgme_data_release (plain);
gpgme_data_release (directive_data);
diff --git a/src/job.c b/src/job.c
index 3fae432..315303f 100644
--- a/src/job.c
+++ b/src/job.c
@@ -340,3 +340,8 @@ job_queue_runner ()
else
- job_remove (job);
+ {
+ job_remove (job);
+ free (job);
+ job = next;
+ continue;
+ }
}
diff --git a/src/triplet.c b/src/triplet.c
index 05b7536..aa74de0 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -129,5 +129,6 @@ triplet_lookup (struct spool *spool, const char *name)
key.spool = spool;
+ file_info_cleanup (&finfo);
ret = grecs_symtab_lookup_or_install (triplet_table, &key, NULL);
- file_info_cleanup (&finfo);
+ free (key.name);
diff --git a/src/verify.c b/src/verify.c
index 4a108bc..dee160f 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -98,2 +98,5 @@ fill_project_name (struct file_triplet *trp)
int rc;
+
+ if (trp->blurb)
+ return 0;
diff --git a/src/watcher.c b/src/watcher.c
index f8761ee..c52e3e6 100644
--- a/src/watcher.c
+++ b/src/watcher.c
@@ -85,5 +85,12 @@ create_watcher (struct spool *sp, void *data)
return 0;
+
+ if (!sp->inotify_enable)
+ {
+ if (debug_level > 1)
+ logmsg (LOG_DEBUG, "disabling inotify support for spool %s", sp->tag);
+ return 0;
+ }
if (debug_level > 1)
- logmsg (LOG_DEBUG, "creating watcher %s", path);
+ logmsg (LOG_DEBUG, "spool %s: creating watcher %s", sp->tag, path);
dwp = malloc (sizeof(*dwp));
@@ -115,2 +122,9 @@ watcher_init ()
int ifd, rc;
+
+ if (!inotify_enable)
+ {
+ if (debug_level > 1)
+ logmsg (LOG_DEBUG, "disabling inotify support");
+ return -1;
+ }
diff --git a/src/wydawca.c b/src/wydawca.c
index 521d796..45a5cff 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -55,2 +55,4 @@ unsigned max_directive_version = MAX_DIRECTIVE_VERSION;
+int inotify_enable = 1;
+
void
diff --git a/src/wydawca.h b/src/wydawca.h
index 722fc9b..323d403 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -228,2 +228,3 @@ struct spool
struct virt_tab vtab; /* Virtual method table */
+ int inotify_enable;
@@ -379,2 +380,4 @@ extern struct spool inotify_spool;
+extern int inotify_enable;
+
#define UPDATE_STATS(what) \

Return to:

Send suggestions and report system problems to the System administrator.