[svn] GnuPG - r4845 - branches/STABLE-BRANCH-1-4/g10

svn author dshaw cvs at cvs.gnupg.org
Fri Oct 3 21:54:31 CEST 2008


Author: dshaw
Date: 2008-10-03 21:54:30 +0200 (Fri, 03 Oct 2008)
New Revision: 4845

Modified:
   branches/STABLE-BRANCH-1-4/g10/ChangeLog
   branches/STABLE-BRANCH-1-4/g10/keyedit.c
   branches/STABLE-BRANCH-1-4/g10/keylist.c
   branches/STABLE-BRANCH-1-4/g10/main.h
   branches/STABLE-BRANCH-1-4/g10/mainproc.c
   branches/STABLE-BRANCH-1-4/g10/misc.c
   branches/STABLE-BRANCH-1-4/g10/photoid.c
   branches/STABLE-BRANCH-1-4/g10/photoid.h
   branches/STABLE-BRANCH-1-4/g10/pkclist.c
Log:
* 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.


Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog	2008-10-03 19:54:30 UTC (rev 4845)
@@ -1,3 +1,12 @@
+2008-10-03  David Shaw  <dshaw at 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-24  David Shaw  <dshaw at jabberwocky.com>
 
 	* keyedit.c (keyedit_menu): Fix bug where a modified keyring loses

Modified: branches/STABLE-BRANCH-1-4/g10/keyedit.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keyedit.c	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/keyedit.c	2008-10-03 19:54:30 UTC (rev 4845)
@@ -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.
  *
@@ -5094,7 +5094,7 @@
 				   "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);
 		    }
 		}
 	    }

Modified: branches/STABLE-BRANCH-1-4/g10/keylist.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keylist.c	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/keylist.c	2008-10-03 19:54:30 UTC (rev 4845)
@@ -1,6 +1,6 @@
 /* keylist.c
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- *               2004, 2005 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.
  *
@@ -839,7 +839,7 @@
 	    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 )
 	  {

Modified: branches/STABLE-BRANCH-1-4/g10/main.h
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/main.h	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/main.h	2008-10-03 19:54:30 UTC (rev 4845)
@@ -1,6 +1,6 @@
 /* main.h
- * 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.
  *
@@ -96,6 +96,8 @@
   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);

Modified: branches/STABLE-BRANCH-1-4/g10/mainproc.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/mainproc.c	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/mainproc.c	2008-10-03 19:54:30 UTC (rev 4845)
@@ -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.
  *
@@ -1800,7 +1800,8 @@
 
 		    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,

Modified: branches/STABLE-BRANCH-1-4/g10/misc.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/misc.c	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/misc.c	2008-10-03 19:54:30 UTC (rev 4845)
@@ -1,6 +1,6 @@
 /* misc.c -  miscellaneous functions
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- *               2005 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.
  *
@@ -503,8 +503,6 @@
 
   while(*ch!='\0')
     {
-      char *str=NULL;
-
       if(!done)
 	{
 	  /* 8192 is way bigger than we'll need here */
@@ -613,22 +611,46 @@
 	      }
 	      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)
 		{

Modified: branches/STABLE-BRANCH-1-4/g10/photoid.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/photoid.c	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/photoid.c	2008-10-03 19:54:30 UTC (rev 4845)
@@ -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.
  *
@@ -39,6 +39,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 *
@@ -158,7 +159,7 @@
          "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)? ")))
 	    {
@@ -289,8 +290,10 @@
 }
 #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;
@@ -301,6 +304,8 @@
   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);

Modified: branches/STABLE-BRANCH-1-4/g10/photoid.h
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/photoid.h	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/photoid.h	2008-10-03 19:54:30 UTC (rev 4845)
@@ -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_ */

Modified: branches/STABLE-BRANCH-1-4/g10/pkclist.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/pkclist.c	2008-10-01 16:17:39 UTC (rev 4844)
+++ branches/STABLE-BRANCH-1-4/g10/pkclist.c	2008-10-03 19:54:30 UTC (rev 4845)
@@ -239,7 +239,8 @@
 		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);




More information about the Gnupg-commits mailing list