aboutsummaryrefslogtreecommitdiff
path: root/src/gpg.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-08-26 13:03:32 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-08-26 13:03:32 +0000
commitb89ece30bebb5b9dd06e4e061537b6bf068566f2 (patch)
treec7f65b64fccfac2f0e7e134e5f7666a4fb1907d1 /src/gpg.c
parent338c0d9c35c56f35c636df1c1da0852a466e731f (diff)
downloadwydawca-b89ece30bebb5b9dd06e4e061537b6bf068566f2.tar.gz
wydawca-b89ece30bebb5b9dd06e4e061537b6bf068566f2.tar.bz2
Implement project owner notifications.
* wydawca/wydawca.c (syslog_printer): Reduce the number of memory reallocations (make_stat_expansion): Update * wydawca/method.c: Implement a new framework: methods may return 2-dimensional arrays of strings. * wydawca/sql.c, wydawca/sql.h: Implement the new method framework. * wydawca/verify.c (expand_param): kw_expansion may provide expansion functions. An additional argument supplies user-defined data for expansions. (escape_kwexp): Extern (free_kwexp): Improve (get_project_name): New function (make_default_kwexp): New function (check_access_rights): Call get_project_name. Use make_default_kwexp to initialize expansions (verify_directive_file): Use make_default_kwexp to initialize expansions * wydawca/wydawca.h (NITEMS): New macro (enum access_method_type): New members: ncol, nrow (struct directory_pair): New members url,project_owner_method, user_data_method (struct file_info): Replace mtime, uid with struct stat sb (struct file_triplet): New members project, dpair, user_data (TRIPLET_UID): Take into account the changes to struct file_info (enum notification_event): New data type (notify_project_owner, notify_admin, notify): New functions (struct kw_expansion): New members static_p, expand and data. (escape_kwexp,make_default_kwexp): New proto (expand_param): Change signature (triplet_expand_param): New function (method_result): Change prototype (method_num_rows,method_num_cols): New functions * wydawca/config.c: New statements project-owner, user-data, admin-address, mail-user, user-message directory can take an optional argument specifying base URL for notification messages * wydawca/gpg.c (verify_directive_signature): Expand directives even if the signature does not match. Useful for notifications. Add notifications. * wydawca/process.c: Add notifications. * wydawca/directive.c: Add notifications * wydawca/wydawca.rc: Update * wydawca/mail.c, wydawca/mail.h: Implement project owner notifications * wydawca/triplet.c (triplet_expand_param): New function * lib/cfg.c (read_cont_line): Fix counting of input lines. git-svn-id: file:///svnroot/wydawca/trunk@297 6bb4bd81-ecc2-4fd4-a2d4-9571d19c0d33
Diffstat (limited to 'src/gpg.c')
-rw-r--r--src/gpg.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gpg.c b/src/gpg.c
index 3372c7b..eb2a64a 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -224,20 +224,22 @@ verify_directive_signature (struct file_triplet *trp,
224 { 224 {
225 gpgme_verify_result_t result; 225 gpgme_verify_result_t result;
226 226
227 size = gpgme_data_seek (plain, 0, SEEK_END);
228 gpgme_data_seek (plain, 0, SEEK_SET);
229 trp->blurb = xmalloc (size + 1);
230 gpgme_data_read (plain, trp->blurb, size);
231 trp->blurb[size] = 0;
232 gpgme_data_release (plain);
233
234 rc = directive_parse (trp);
235
227 result = gpgme_op_verify_result (ctx); 236 result = gpgme_op_verify_result (ctx);
228 if (gpg_sig_ok_p (ctx, result->signatures)) 237 if (!gpg_sig_ok_p (ctx, result->signatures))
229 { 238 {
230 size = gpgme_data_seek (plain, 0, SEEK_END); 239 UPDATE_STATS (STAT_BAD_SIGNATURE);
231 gpgme_data_seek (plain, 0, SEEK_SET); 240 notify (trp, ev_bad_directive_signature);
232 trp->blurb = xmalloc (size + 1); 241 rc = 1;
233 gpgme_data_read (plain, trp->blurb, size);
234 trp->blurb[size] = 0;
235 gpgme_data_release (plain);
236
237 rc = directive_parse (trp);
238 } 242 }
239 else
240 rc = 1;
241 } 243 }
242 else 244 else
243 { 245 {
@@ -245,7 +247,6 @@ verify_directive_signature (struct file_triplet *trp,
245 UPDATE_STATS (STAT_BAD_SIGNATURE); 247 UPDATE_STATS (STAT_BAD_SIGNATURE);
246 logmsg (LOG_ERR, "%s: directive verification failed: %s", 248 logmsg (LOG_ERR, "%s: directive verification failed: %s",
247 trp->name, gpgme_strerror (ec)); 249 trp->name, gpgme_strerror (ec));
248 /* FIXME: Send mail to the project maintainer */
249 } 250 }
250 251
251 gpgme_data_release (directive_data); 252 gpgme_data_release (directive_data);
@@ -292,6 +293,7 @@ verify_detached_signature (struct file_triplet *trp,
292 case exec_fail: 293 case exec_fail:
293 UPDATE_STATS (STAT_BAD_SIGNATURE); 294 UPDATE_STATS (STAT_BAD_SIGNATURE);
294 logmsg (LOG_ERR, "BAD detached signature for %s", trp->name); 295 logmsg (LOG_ERR, "BAD detached signature for %s", trp->name);
296 notify (trp, ev_bad_detached_signature);
295 break; 297 break;
296 298
297 case exec_error: 299 case exec_error:

Return to:

Send suggestions and report system problems to the System administrator.