mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
* 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.
This commit is contained in:
parent
af7c1fa134
commit
1b86ee9806
@ -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>
|
2008-09-29 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg.c (main): Remove -sat kludge. Note that we printed a
|
* gpg.c (main): Remove -sat kludge. Note that we printed a
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* keyedit.c - keyedit stuff
|
/* keyedit.c - keyedit stuff
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||||
* 2006, 2007 Free Software Foundation, Inc.
|
* 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -5103,7 +5103,7 @@ menu_showphoto( KBNODE keyblock )
|
|||||||
"key %s (uid %d)\n"),
|
"key %s (uid %d)\n"),
|
||||||
image_type_to_string(type,1),
|
image_type_to_string(type,1),
|
||||||
(ulong)size,keystr_from_pk(pk),count);
|
(ulong)size,keystr_from_pk(pk),count);
|
||||||
show_photos(&uid->attribs[i],1,pk,NULL);
|
show_photos(&uid->attribs[i],1,pk,NULL,uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* keylist.c - print keys
|
/* keylist.c - print keys
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||||
* 2004, 2005, 2008 Free Software Foundation, Inc.
|
* 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -882,7 +882,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
if((opt.list_options&LIST_SHOW_PHOTOS) && uid->attribs!=NULL)
|
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 )
|
else if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY )
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* main.h
|
/* main.h
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||||
* 2006 Free Software Foundation, Inc.
|
* 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -101,6 +101,8 @@ struct expando_args
|
|||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
PKT_secret_key *sk;
|
PKT_secret_key *sk;
|
||||||
byte imagetype;
|
byte imagetype;
|
||||||
|
int validity_info;
|
||||||
|
const char *validity_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
char *pct_expando(const char *string,struct expando_args *args);
|
char *pct_expando(const char *string,struct expando_args *args);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* mainproc.c - handle packets
|
/* mainproc.c - handle packets
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||||
* 2007 Free Software Foundation, Inc.
|
* 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* 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)
|
if(opt.verify_options&VERIFY_SHOW_PHOTOS)
|
||||||
show_photos(un->pkt->pkt.user_id->attribs,
|
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,
|
p=utf8_to_native(un->pkt->pkt.user_id->name,
|
||||||
|
52
g10/misc.c
52
g10/misc.c
@ -1,6 +1,6 @@
|
|||||||
/* misc.c - miscellaneous functions
|
/* misc.c - miscellaneous functions
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||||
* 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
* 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -550,8 +550,6 @@ pct_expando(const char *string,struct expando_args *args)
|
|||||||
|
|
||||||
while(*ch!='\0')
|
while(*ch!='\0')
|
||||||
{
|
{
|
||||||
char *str=NULL;
|
|
||||||
|
|
||||||
if(!done)
|
if(!done)
|
||||||
{
|
{
|
||||||
/* 8192 is way bigger than we'll need here */
|
/* 8192 is way bigger than we'll need here */
|
||||||
@ -660,22 +658,46 @@ pct_expando(const char *string,struct expando_args *args)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't': /* e.g. "jpg" */
|
case 'v': /* validity letters */
|
||||||
str=image_type_to_string(args->imagetype,0);
|
if(args->validity_info && idx+1<maxlen)
|
||||||
/* fall through */
|
|
||||||
|
|
||||||
case 'T': /* e.g. "image/jpeg" */
|
|
||||||
if(str==NULL)
|
|
||||||
str=image_type_to_string(args->imagetype,2);
|
|
||||||
|
|
||||||
if(idx+strlen(str)<maxlen)
|
|
||||||
{
|
{
|
||||||
strcpy(&ret[idx],str);
|
ret[idx++]=args->validity_info;
|
||||||
idx+=strlen(str);
|
ret[idx]='\0';
|
||||||
done=1;
|
done=1;
|
||||||
}
|
}
|
||||||
break;
|
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 '%':
|
case '%':
|
||||||
if(idx+1<maxlen)
|
if(idx+1<maxlen)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* photoid.c - photo ID handling code
|
/* 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.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -40,6 +40,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "photoid.h"
|
#include "photoid.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
|
#include "trustdb.h"
|
||||||
|
|
||||||
/* Generate a new photo id packet, or return NULL if canceled */
|
/* Generate a new photo id packet, or return NULL if canceled */
|
||||||
PKT_user_id *
|
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! */
|
"user" may not be able to dismiss a viewer window! */
|
||||||
if(opt.command_fd==-1)
|
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",
|
switch(cpr_get_answer_yes_no_quit("photoid.jpeg.okay",
|
||||||
_("Is this photo correct (y/N/q)? ")))
|
_("Is this photo correct (y/N/q)? ")))
|
||||||
{
|
{
|
||||||
@ -282,8 +283,10 @@ static const char *get_default_photo_command(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void show_photos(const struct user_attribute *attrs,
|
void
|
||||||
int count,PKT_public_key *pk,PKT_secret_key *sk)
|
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
|
#ifndef DISABLE_PHOTO_VIEWER
|
||||||
int i;
|
int i;
|
||||||
@ -294,6 +297,8 @@ void show_photos(const struct user_attribute *attrs,
|
|||||||
memset(&args,0,sizeof(args));
|
memset(&args,0,sizeof(args));
|
||||||
args.pk=pk;
|
args.pk=pk;
|
||||||
args.sk=sk;
|
args.sk=sk;
|
||||||
|
args.validity_info=get_validity_info(pk,uid);
|
||||||
|
args.validity_string=get_validity_string(pk,uid);
|
||||||
|
|
||||||
if(pk)
|
if(pk)
|
||||||
keyid_from_pk(pk,kid);
|
keyid_from_pk(pk,kid);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* photoid.h
|
/* 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.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@
|
|||||||
PKT_user_id *generate_photo_id(PKT_public_key *pk,const char *filename);
|
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);
|
int parse_image_header(const struct user_attribute *attr,byte *type,u32 *len);
|
||||||
char *image_type_to_string(byte type,int style);
|
char *image_type_to_string(byte type,int style);
|
||||||
void show_photos(const struct user_attribute *attrs,
|
void show_photos(const struct user_attribute *attrs,int count,
|
||||||
int count,PKT_public_key *pk,PKT_secret_key *sk);
|
PKT_public_key *pk,PKT_secret_key *sk,PKT_user_id *uid);
|
||||||
|
|
||||||
#endif /* !_PHOTOID_H_ */
|
#endif /* !_PHOTOID_H_ */
|
||||||
|
@ -236,7 +236,8 @@ do_edit_ownertrust (PKT_public_key *pk, int mode,
|
|||||||
if((opt.verify_options&VERIFY_SHOW_PHOTOS)
|
if((opt.verify_options&VERIFY_SHOW_PHOTOS)
|
||||||
&& un->pkt->pkt.user_id->attrib_data)
|
&& un->pkt->pkt.user_id->attrib_data)
|
||||||
show_photos(un->pkt->pkt.user_id->attribs,
|
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,
|
p=utf8_to_native(un->pkt->pkt.user_id->name,
|
||||||
un->pkt->pkt.user_id->len,0);
|
un->pkt->pkt.user_id->len,0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user