mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* photoid.c (show_photos): Use the long keyid as the filename for the
photo. Use the short keyid as the filename on 8.3 systems. * exec.h, exec.c (make_tempdir, exec_write, exec_finish): Allow caller to specify filename. This should make things easier on windows and macs where the file extension is required, but a whole filename is even better. * keyedit.c (show_key_with_all_names, show_prefs): Show proper prefs for a v4 key uid with no selfsig at all. * misc.c (check_permissions): Don't check permissions on non-normal files (pipes, character devices, etc.)
This commit is contained in:
parent
0a66b9aaae
commit
435ecaa5b0
6 changed files with 73 additions and 30 deletions
|
@ -220,33 +220,51 @@ void show_photos(const struct user_attribute *attrs,
|
|||
int i;
|
||||
struct expando_args args;
|
||||
u32 len;
|
||||
u32 kid[2];
|
||||
|
||||
memset(&args,0,sizeof(args));
|
||||
args.pk=pk;
|
||||
|
||||
keyid_from_pk(pk,kid);
|
||||
|
||||
for(i=0;i<count;i++)
|
||||
if(attrs[i].type==ATTRIB_IMAGE &&
|
||||
parse_image_header(&attrs[i],&args.imagetype,&len))
|
||||
{
|
||||
char *command;
|
||||
char *command,*name;
|
||||
struct exec_info *spawn;
|
||||
int offset=attrs[i].len-len;
|
||||
|
||||
/* Notice we are not using the byte for image encoding type
|
||||
for more than cosmetics. Most external image viewers can
|
||||
handle a multitude of types, and even if one cannot
|
||||
understand a partcular type, we have no way to know which.
|
||||
The spec specifically permits this, by the way. -dms */
|
||||
|
||||
/* make command grow */
|
||||
command=pct_expando(opt.photo_viewer?
|
||||
opt.photo_viewer:DEFAULT_PHOTO_COMMAND,&args);
|
||||
if(!command)
|
||||
goto fail;
|
||||
|
||||
if(exec_write(&spawn,NULL,command,
|
||||
image_type_to_string(args.imagetype,0),1,1)!=0)
|
||||
goto fail;
|
||||
name=m_alloc(16+strlen(EXTSEP_S)+
|
||||
strlen(image_type_to_string(args.imagetype,0))+1);
|
||||
|
||||
/* Make the filename. Notice we are not using the image
|
||||
encoding type for more than cosmetics. Most external image
|
||||
viewers can handle a multitude of types, and even if one
|
||||
cannot understand a partcular type, we have no way to know
|
||||
which. The spec permits this, by the way. -dms */
|
||||
|
||||
#ifdef USE_ONLY_8DOT3
|
||||
sprintf(name,"%08lX" EXTSEP_S "%s",(ulong)kid[1],
|
||||
image_type_to_string(args.imagetype,0));
|
||||
#else
|
||||
sprintf(name,"%08lX%08lX" EXTSEP_S "%s",(ulong)kid[0],(ulong)kid[1],
|
||||
image_type_to_string(args.imagetype,0));
|
||||
#endif
|
||||
|
||||
if(exec_write(&spawn,NULL,command,name,1,1)!=0)
|
||||
{
|
||||
m_free(name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
m_free(name);
|
||||
|
||||
fwrite(&attrs[i].data[offset],attrs[i].len-offset,1,spawn->tochild);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue