summaryrefslogtreecommitdiffabout
path: root/src/verify.c
Side-by-side diff
Diffstat (limited to 'src/verify.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/verify.c175
1 files changed, 89 insertions, 86 deletions
diff --git a/src/verify.c b/src/verify.c
index 1409889..4a108bc 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -199,13 +199,13 @@ uploader_find_frp (struct uploader_info *list, const char *fpr)
if (list->fpr && strcmp (list->fpr, fpr) == 0)
break;
return list;
}
int
-verify_directive_file (struct file_triplet *trp)
+verify_directive_file (struct file_triplet *trp, int noath)
{
char *command;
int rc;
void *md;
size_t nrows, ncols, i;
struct uploader_info *head, *tail;
@@ -217,111 +217,114 @@ verify_directive_file (struct file_triplet *trp)
if (!trp->file[file_directive].name)
return 1;
if (fill_project_name (trp))
return 1;
-
- md = dictionary_open (dict);
- if (!md)
- return 1;
-
- command = triplet_expand_dictionary_query (dict, md, trp);
-
- rc = dictionary_lookup (dict, md, command);
- free (command);
- if (rc)
- {
- logmsg (LOG_ERR, _("cannot get uploaders for %s"), trp->name);
- dictionary_close (dict, md);
- return 1;
- }
-
- nrows = dictionary_num_rows (dict);
- if (nrows == 0)
- {
- logmsg (LOG_ERR, _("found no uploaders for %s"), trp->name);
- dictionary_close (dict, md);
- return 1;
- }
- ncols = dictionary_num_cols (dict);
- if (ncols < 4)
+ if (!noath)
{
- logmsg (LOG_ERR,
- _("project-uploader dictionary error: too few columns (%lu)"),
- (unsigned long) ncols);
- dictionary_close (dict, md);
- return 1;
- }
+ md = dictionary_open (dict);
+ if (!md)
+ return 1;
- head = tail = NULL;
- for (i = 0; i < nrows; i++)
- {
- const char *p;
- struct uploader_info info, *ptr;
+ command = triplet_expand_dictionary_query (dict, md, trp);
- memset (&info, 0, sizeof (info));
- p = dictionary_result (dict, md, i, 0);
- if (p)
- info.name = triplet_strdup (trp, p);
- p = dictionary_result (dict, md, i, 1);
- if (p)
- info.realname = triplet_strdup (trp, p);
- p = dictionary_result (dict, md, i, 2);
- if (p)
- info.email = triplet_strdup (trp, p);
- p = dictionary_result (dict, md, i, 3);
- if (p)
- info.gpg_key = triplet_strdup (trp, p);
+ rc = dictionary_lookup (dict, md, command);
+ free (command);
+ if (rc)
+ {
+ logmsg (LOG_ERR, _("cannot get uploaders for %s"), trp->name);
+ dictionary_close (dict, md);
+ return 1;
+ }
- if (debug_level > 3)
+ nrows = dictionary_num_rows (dict);
+ if (nrows == 0)
{
- logmsg (LOG_DEBUG, _("name: %s"), SP (info.name));
- logmsg (LOG_DEBUG, _("realname: %s"), SP (info.realname));
- logmsg (LOG_DEBUG, _("gpg-key: %s"), SP (info.gpg_key));
- logmsg (LOG_DEBUG, _("email: %s"), SP (info.email));
+ logmsg (LOG_ERR, _("found no uploaders for %s"), trp->name);
+ dictionary_close (dict, md);
+ return 1;
}
- if (!info.name || !info.realname || !info.gpg_key || !info.email)
+ ncols = dictionary_num_cols (dict);
+ if (ncols < 4)
{
logmsg (LOG_ERR,
- _("project-uploader dictionary error: malformed row %lu"),
- (unsigned long) i);
- /* FIXME: Memory not reclaimed */
- continue;
+ _("project-uploader dictionary error: too few columns (%lu)"),
+ (unsigned long) ncols);
+ dictionary_close (dict, md);
+ return 1;
}
-
- ptr = new_uploader_info (&info);
- if (tail)
- tail->next = ptr;
- else
- head = ptr;
- tail = ptr;
- }
+
+ head = tail = NULL;
+ for (i = 0; i < nrows; i++)
+ {
+ const char *p;
+ struct uploader_info info, *ptr;
- dictionary_close (dict, md);
-
- if (!head)
- {
- logmsg (LOG_ERR, _("no valid uploaders found for %s"), trp->name);
- return 1;
- }
-
- trp->uploader_list = head;
- trp->uploader = NULL;
+ memset (&info, 0, sizeof (info));
+ p = dictionary_result (dict, md, i, 0);
+ if (p)
+ info.name = triplet_strdup (trp, p);
+ p = dictionary_result (dict, md, i, 1);
+ if (p)
+ info.realname = triplet_strdup (trp, p);
+ p = dictionary_result (dict, md, i, 2);
+ if (p)
+ info.email = triplet_strdup (trp, p);
+ p = dictionary_result (dict, md, i, 3);
+ if (p)
+ info.gpg_key = triplet_strdup (trp, p);
+
+ if (debug_level > 3)
+ {
+ logmsg (LOG_DEBUG, _("name: %s"), SP (info.name));
+ logmsg (LOG_DEBUG, _("realname: %s"), SP (info.realname));
+ logmsg (LOG_DEBUG, _("gpg-key: %s"), SP (info.gpg_key));
+ logmsg (LOG_DEBUG, _("email: %s"), SP (info.email));
+ }
+
+ if (!info.name || !info.realname || !info.gpg_key || !info.email)
+ {
+ logmsg (LOG_ERR,
+ _("project-uploader dictionary error: malformed row %lu"),
+ (unsigned long) i);
+ /* FIXME: Memory not reclaimed */
+ continue;
+ }
+
+ ptr = new_uploader_info (&info);
+ if (tail)
+ tail->next = ptr;
+ else
+ head = ptr;
+ tail = ptr;
+ }
+
+ dictionary_close (dict, md);
- if (verify_directive_signature (trp))
- {
- /*FIXME: Update stats */
- logmsg (LOG_ERR, _("invalid signature for %s"),
- trp->name ? trp->name : "[unknown]");
- return 1;
+ if (!head)
+ {
+ logmsg (LOG_ERR, _("no valid uploaders found for %s"), trp->name);
+ return 1;
+ }
+
+ trp->uploader_list = head;
+ trp->uploader = NULL;
+
+ if (verify_directive_signature (trp))
+ {
+ /*FIXME: Update stats */
+ logmsg (LOG_ERR, _("invalid signature for %s"),
+ trp->name ? trp->name : "[unknown]");
+ return 1;
+ }
+ else if (debug_level)
+ logmsg (LOG_DEBUG, _("%s: directive file signature OK"), trp->name);
}
- else if (debug_level)
- logmsg (LOG_DEBUG, _("%s: directive file signature OK"), trp->name);
if (debug_level > 1)
{
int i;
for (i = 0; trp->directive[i]; i++)
logmsg (LOG_DEBUG, "directive[%d] = %s", i, trp->directive[i]);

Return to:

Send suggestions and report system problems to the System administrator.