diff options
author | David Shaw <dshaw@jabberwocky.com> | 2008-10-03 22:00:46 +0200 |
---|---|---|
committer | David Shaw <dshaw@jabberwocky.com> | 2008-10-03 22:00:46 +0200 |
commit | 1b86ee9806f4fbb37a4499717c003b0eb837183a (patch) | |
tree | 292b46efca6716eae193fbb9501b6a7f5a9d1f35 /g10 | |
parent | Add /daatfile command to gpg-connect-agent. (diff) | |
download | gnupg2-1b86ee9806f4fbb37a4499717c003b0eb837183a.tar.xz gnupg2-1b86ee9806f4fbb37a4499717c003b0eb837183a.zip |
* main.h, mainproc.c (check_sig_and_print), keylist.c
(list_keyblock_print), pkclist.c (do_edit_ownertrust), keyedit.c
(menu_showphoto), photoid.c (generate_photo_id, show_photos), misc.c
(pct_expando): Add %v and %V expandos so that displaying photo IDs can
show the attribute validity tag (%v) and string (%V). Originally by
Daniel Gillmor.
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 9 | ||||
-rw-r--r-- | g10/keyedit.c | 6 | ||||
-rw-r--r-- | g10/keylist.c | 6 | ||||
-rw-r--r-- | g10/main.h | 6 | ||||
-rw-r--r-- | g10/mainproc.c | 7 | ||||
-rw-r--r-- | g10/misc.c | 52 | ||||
-rw-r--r-- | g10/photoid.c | 13 | ||||
-rw-r--r-- | g10/photoid.h | 6 | ||||
-rw-r--r-- | g10/pkclist.c | 3 |
9 files changed, 74 insertions, 34 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 0c8c54e6d..4b25d8316 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +2008-10-03 David Shaw <dshaw@jabberwocky.com> + + * main.h, mainproc.c (check_sig_and_print), + keylist.c (list_keyblock_print), pkclist.c (do_edit_ownertrust), + keyedit.c (menu_showphoto), photoid.c (generate_photo_id, + show_photos), misc.c (pct_expando): Add %v and %V expandos so + that displaying photo IDs can show the attribute validity + tag (%v) and string (%V). Originally by Daniel Gillmor. + 2008-09-29 Werner Koch <wk@g10code.com> * gpg.c (main): Remove -sat kludge. Note that we printed a diff --git a/g10/keyedit.c b/g10/keyedit.c index ee2088ce2..a1fa78fa0 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1,6 +1,6 @@ /* keyedit.c - keyedit stuff - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -5103,7 +5103,7 @@ menu_showphoto( KBNODE keyblock ) "key %s (uid %d)\n"), image_type_to_string(type,1), (ulong)size,keystr_from_pk(pk),count); - show_photos(&uid->attribs[i],1,pk,NULL); + show_photos(&uid->attribs[i],1,pk,NULL,uid); } } } diff --git a/g10/keylist.c b/g10/keylist.c index 2de516b00..5f86a38e4 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1,6 +1,6 @@ /* keylist.c - print keys - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, - * 2004, 2005, 2008 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -882,7 +882,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque ) putchar('\n'); if((opt.list_options&LIST_SHOW_PHOTOS) && uid->attribs!=NULL) - show_photos(uid->attribs,uid->numattribs,pk,sk); + show_photos(uid->attribs,uid->numattribs,pk,sk,uid); } else if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) { diff --git a/g10/main.h b/g10/main.h index f34e4b381..d6b5a967e 100644 --- a/g10/main.h +++ b/g10/main.h @@ -1,6 +1,6 @@ /* main.h - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -101,6 +101,8 @@ struct expando_args PKT_public_key *pk; PKT_secret_key *sk; byte imagetype; + int validity_info; + const char *validity_string; }; char *pct_expando(const char *string,struct expando_args *args); diff --git a/g10/mainproc.c b/g10/mainproc.c index 3756e2f96..4678c1bfd 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1,6 +1,6 @@ /* mainproc.c - handle packets - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - * 2007 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1826,7 +1826,8 @@ check_sig_and_print( CTX c, KBNODE node ) if(opt.verify_options&VERIFY_SHOW_PHOTOS) show_photos(un->pkt->pkt.user_id->attribs, - un->pkt->pkt.user_id->numattribs,pk,NULL); + un->pkt->pkt.user_id->numattribs, + pk,NULL,un->pkt->pkt.user_id); } p=utf8_to_native(un->pkt->pkt.user_id->name, diff --git a/g10/misc.c b/g10/misc.c index 2e2c70722..a9d4f0547 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1,6 +1,6 @@ /* misc.c - miscellaneous functions - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, - * 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + * 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -550,8 +550,6 @@ pct_expando(const char *string,struct expando_args *args) while(*ch!='\0') { - char *str=NULL; - if(!done) { /* 8192 is way bigger than we'll need here */ @@ -660,22 +658,46 @@ pct_expando(const char *string,struct expando_args *args) } break; - case 't': /* e.g. "jpg" */ - str=image_type_to_string(args->imagetype,0); - /* fall through */ - - case 'T': /* e.g. "image/jpeg" */ - if(str==NULL) - str=image_type_to_string(args->imagetype,2); - - if(idx+strlen(str)<maxlen) + case 'v': /* validity letters */ + if(args->validity_info && idx+1<maxlen) { - strcpy(&ret[idx],str); - idx+=strlen(str); + ret[idx++]=args->validity_info; + ret[idx]='\0'; done=1; } break; + /* The text string types */ + case 't': + case 'T': + case 'V': + { + const char *str=NULL; + + switch(*(ch+1)) + { + case 't': /* e.g. "jpg" */ + str=image_type_to_string(args->imagetype,0); + break; + + case 'T': /* e.g. "image/jpeg" */ + str=image_type_to_string(args->imagetype,2); + break; + + case 'V': /* e.g. "full", "expired", etc. */ + str=args->validity_string; + break; + } + + if(str && idx+strlen(str)<maxlen) + { + strcpy(&ret[idx],str); + idx+=strlen(str); + done=1; + } + } + break; + case '%': if(idx+1<maxlen) { diff --git a/g10/photoid.c b/g10/photoid.c index f330f2eab..80a60635d 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -1,5 +1,5 @@ /* photoid.c - photo ID handling code - * Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2005, 2006, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -40,6 +40,7 @@ #include "main.h" #include "photoid.h" #include "ttyio.h" +#include "trustdb.h" /* Generate a new photo id packet, or return NULL if canceled */ PKT_user_id * @@ -159,7 +160,7 @@ generate_photo_id(PKT_public_key *pk,const char *photo_name) "user" may not be able to dismiss a viewer window! */ if(opt.command_fd==-1) { - show_photos(uid->attribs,uid->numattribs,pk,NULL); + show_photos(uid->attribs,uid->numattribs,pk,NULL,uid); switch(cpr_get_answer_yes_no_quit("photoid.jpeg.okay", _("Is this photo correct (y/N/q)? "))) { @@ -282,8 +283,10 @@ static const char *get_default_photo_command(void) } #endif -void show_photos(const struct user_attribute *attrs, - int count,PKT_public_key *pk,PKT_secret_key *sk) +void +show_photos(const struct user_attribute *attrs, + int count,PKT_public_key *pk,PKT_secret_key *sk, + PKT_user_id *uid) { #ifndef DISABLE_PHOTO_VIEWER int i; @@ -294,6 +297,8 @@ void show_photos(const struct user_attribute *attrs, memset(&args,0,sizeof(args)); args.pk=pk; args.sk=sk; + args.validity_info=get_validity_info(pk,uid); + args.validity_string=get_validity_string(pk,uid); if(pk) keyid_from_pk(pk,kid); diff --git a/g10/photoid.h b/g10/photoid.h index 88da4fb10..58728edac 100644 --- a/g10/photoid.h +++ b/g10/photoid.h @@ -1,5 +1,5 @@ /* photoid.h - * Copyright (C) 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2005, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -27,7 +27,7 @@ PKT_user_id *generate_photo_id(PKT_public_key *pk,const char *filename); int parse_image_header(const struct user_attribute *attr,byte *type,u32 *len); char *image_type_to_string(byte type,int style); -void show_photos(const struct user_attribute *attrs, - int count,PKT_public_key *pk,PKT_secret_key *sk); +void show_photos(const struct user_attribute *attrs,int count, + PKT_public_key *pk,PKT_secret_key *sk,PKT_user_id *uid); #endif /* !_PHOTOID_H_ */ diff --git a/g10/pkclist.c b/g10/pkclist.c index 56d39f7d2..3203a7ea6 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -236,7 +236,8 @@ do_edit_ownertrust (PKT_public_key *pk, int mode, if((opt.verify_options&VERIFY_SHOW_PHOTOS) && un->pkt->pkt.user_id->attrib_data) show_photos(un->pkt->pkt.user_id->attribs, - un->pkt->pkt.user_id->numattribs,pk,NULL); + un->pkt->pkt.user_id->numattribs,pk,NULL, + un->pkt->pkt.user_id); p=utf8_to_native(un->pkt->pkt.user_id->name, un->pkt->pkt.user_id->len,0); |