mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Factored common gpgconf constants out
Fixed W32 compare_filenames
This commit is contained in:
parent
c850656d28
commit
ebd36b6344
1
THANKS
1
THANKS
@ -214,6 +214,7 @@ Sean MacLennan seanm at netwinder.org
|
||||
Sebastian Klemke packet at convergence.de
|
||||
Serge Munhoven munhoven at mema.ucl.ac.be
|
||||
SL Baur steve at xemacs.org
|
||||
Sten Lindgren ged at solace dot miun dot se
|
||||
Stefan Bellon sbellon at sbellon.de
|
||||
Dr.Stefan.Dalibor Dr.Stefan.Dalibor at bfa.de
|
||||
Stefan Karrmann S.Karrmann at gmx.net
|
||||
|
7
TODO
7
TODO
@ -125,3 +125,10 @@
|
||||
** Migrate OpenPGP keys to another system
|
||||
|
||||
|
||||
* do_add_recipient
|
||||
Prints wrong error message even when decrypting.
|
||||
*Decrypt* does even not work in this case.
|
||||
|
||||
* Duplicate certifciates
|
||||
This may happen and lead to an Ambiguous Name error. Solution is to
|
||||
check the certs for identity beforethorwin this error.
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpg-agent.c: Include gc-opt-flags.h and remove their definition
|
||||
here.
|
||||
|
||||
2007-07-13 Werner Koch <wk@g10code.com>
|
||||
|
||||
* genkey.c (check_passphrase_constraints): Require a confirmation
|
||||
|
@ -48,6 +48,7 @@
|
||||
# include "../jnlib/w32-afunix.h"
|
||||
#endif
|
||||
#include "setenv.h"
|
||||
#include "gc-opt-flags.h"
|
||||
|
||||
|
||||
enum cmd_and_opt_values
|
||||
@ -698,24 +699,6 @@ main (int argc, char **argv )
|
||||
char *filename_esc;
|
||||
|
||||
/* List options and default values in the GPG Conf format. */
|
||||
|
||||
/* The following list is taken from gnupg/tools/gpgconf-comp.c. */
|
||||
/* Option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING
|
||||
FLAGS, AS THEY ARE PART OF THE EXTERNAL INTERFACE. */
|
||||
#define GC_OPT_FLAG_NONE 0UL
|
||||
/* The RUNTIME flag for an option indicates that the option can be
|
||||
changed at runtime. */
|
||||
#define GC_OPT_FLAG_RUNTIME (1UL << 3)
|
||||
/* The DEFAULT flag for an option indicates that the option has a
|
||||
default value. */
|
||||
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
|
||||
/* The DEF_DESC flag for an option indicates that the option has a
|
||||
default, which is described by the value of the default field. */
|
||||
#define GC_OPT_FLAG_DEF_DESC (1UL << 5)
|
||||
/* The NO_ARG_DESC flag for an option indicates that the argument has
|
||||
a default, which is described by the value of the ARGDEF field. */
|
||||
#define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6)
|
||||
|
||||
filename = make_filename (opt.homedir, "gpg-agent.conf", NULL );
|
||||
filename_esc = percent_escape (filename, NULL);
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gc-opt-flags.h: New.
|
||||
|
||||
2007-08-01 Werner Koch <wk@g10code.com>
|
||||
|
||||
* estream-printf.c (read_dummy_value): Removed as it is useless now.
|
||||
|
@ -33,6 +33,7 @@ common_sources = \
|
||||
util.h i18n.c i18n.h \
|
||||
errors.h \
|
||||
openpgpdefs.h \
|
||||
gc-opt-flags.h \
|
||||
keyserver.h \
|
||||
sexp-parse.h \
|
||||
init.c init.h \
|
||||
|
40
common/gc-opt-flags.h
Normal file
40
common/gc-opt-flags.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* gc-opt-flags.h - gpgconf constants used by the backends.
|
||||
* Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is free software; as a special exception the author gives
|
||||
* unlimited permission to copy and/or distribute it, with or without
|
||||
* modifications, as long as this notice is preserved.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY, to the extent permitted by law; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef GNUPG_GC_OPT_FLAGS_H
|
||||
#define GNUPG_GC_OPT_FLAGS_H
|
||||
|
||||
/* Public option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE
|
||||
EXISTING FLAGS, AS THEY ARE PART OF THE EXTERNAL INTERFACE. See
|
||||
gnupg/tools/gpgconf-comp.c for details. */
|
||||
|
||||
#define GC_OPT_FLAG_NONE 0UL
|
||||
|
||||
/* The RUNTIME flag for an option indicates that the option can be
|
||||
changed at runtime. */
|
||||
#define GC_OPT_FLAG_RUNTIME (1UL << 3)
|
||||
|
||||
/* The DEFAULT flag for an option indicates that the option has a
|
||||
default value. */
|
||||
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
|
||||
|
||||
/* The DEF_DESC flag for an option indicates that the option has a
|
||||
default, which is described by the value of the default field. */
|
||||
#define GC_OPT_FLAG_DEF_DESC (1UL << 5)
|
||||
|
||||
/* The NO_ARG_DESC flag for an option indicates that the argument has
|
||||
a default, which is described by the value of the ARGDEF field. */
|
||||
#define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6)
|
||||
|
||||
|
||||
#endif /*GNUPG_GC_OPT_FLAGS_H*/
|
@ -1,3 +1,7 @@
|
||||
2007-07-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
* scdaemon.texi (Scdaemon Commands): Remove obsolete --print-atr.
|
||||
|
||||
2007-07-17 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgsm.texi (Input and Output): Document --default-key.
|
||||
|
@ -93,11 +93,6 @@ may be used to get the name of that extra socket.
|
||||
Run the program in the background. This option is required to prevent
|
||||
it from being accidently running in the background.
|
||||
|
||||
@item --print-atr
|
||||
@opindex print-atr
|
||||
This is mainly a debugging command, used to print the ATR
|
||||
(Answer-To-Reset) of a card and exit immediately.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpg.c: Include gc-opt-flags.h and remove their definition here.
|
||||
|
||||
2007-07-17 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpg.c (gpgconf_list): Declare --encrypt-to and --default-key.
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "status.h"
|
||||
#include "keyserver-internal.h"
|
||||
#include "exec.h"
|
||||
|
||||
#include "gc-opt-flags.h"
|
||||
|
||||
#if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__)
|
||||
#define MY_O_BINARY O_BINARY
|
||||
@ -1457,10 +1457,6 @@ gpgconf_list (const char *configfile)
|
||||
{
|
||||
char *configfile_esc = percent_escape (configfile, NULL);
|
||||
|
||||
/* The following definitions are taken from gnupg/tools/gpgconf-comp.c. */
|
||||
#define GC_OPT_FLAG_NONE 0UL
|
||||
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
|
||||
|
||||
printf ("gpgconf-gpg.conf:%lu:\"%s\n",
|
||||
GC_OPT_FLAG_DEFAULT, configfile_esc ? configfile_esc : "/dev/null");
|
||||
printf ("verbose:%lu:\n", GC_OPT_FLAG_NONE);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* t-stringhelp.c (test_compare_filenames): New.
|
||||
|
||||
* stringhelp.c (compare_filenames) [HAVE_DRIVE_LETTERS]: Fixed
|
||||
comparison to take slash and backslash in account.
|
||||
(make_filename): Avoid mixing / and \.
|
||||
|
||||
2007-07-04 Werner Koch <wk@g10code.com>
|
||||
|
||||
* utf8conv.c (load_libiconv): Remove URL from translatble string.
|
||||
|
@ -313,13 +313,27 @@ make_filename( const char *first_part, ... )
|
||||
n += strlen (home);
|
||||
|
||||
name = jnlib_xmalloc (n);
|
||||
p = home ? stpcpy(stpcpy(name,home), first_part+1)
|
||||
: stpcpy(name, first_part);
|
||||
p = (home
|
||||
? stpcpy (stpcpy (name,home), first_part + 1)
|
||||
: stpcpy(name, first_part));
|
||||
|
||||
va_start (arg_ptr, first_part) ;
|
||||
while ( (s = va_arg(arg_ptr, const char *)) )
|
||||
p = stpcpy (stpcpy (p,"/"), s);
|
||||
va_end(arg_ptr);
|
||||
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
/* We better avoid mixing slashes and backslashes and prefer
|
||||
backslashes. There is usual no problem with mixing them, however
|
||||
a very few W32 API calls can't grok plain slashes. Printing
|
||||
filenames with mixed slashes also looks a bit strange. */
|
||||
if (strchr (name, '\\'))
|
||||
{
|
||||
for (p=name; *p; p++)
|
||||
if (*p == '/')
|
||||
*p = '\\';
|
||||
}
|
||||
#endif /*HAVE_DRIVE_LETTERS*/
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -327,11 +341,22 @@ make_filename( const char *first_part, ... )
|
||||
int
|
||||
compare_filenames (const char *a, const char *b)
|
||||
{
|
||||
/* ? check whether this is an absolute filename and
|
||||
* resolve symlinks?
|
||||
*/
|
||||
/* ? check whether this is an absolute filename and resolve
|
||||
symlinks? */
|
||||
#ifdef HAVE_DRIVE_LETTERS
|
||||
return stricmp(a,b);
|
||||
for ( ; *a && *b; a++, b++ )
|
||||
{
|
||||
if (*a != *b
|
||||
&& (toupper (*(const unsigned char*)a)
|
||||
!= toupper (*(const unsigned char*)b) )
|
||||
&& !((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/')))
|
||||
break;
|
||||
}
|
||||
if ((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/'))
|
||||
return 0;
|
||||
else
|
||||
return (toupper (*(const unsigned char*)a)
|
||||
- toupper (*(const unsigned char*)b));
|
||||
#else
|
||||
return strcmp(a,b);
|
||||
#endif
|
||||
|
@ -80,12 +80,49 @@ test_percent_escape (void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_compare_filenames (void)
|
||||
{
|
||||
struct {
|
||||
const char *a;
|
||||
const char *b;
|
||||
int result;
|
||||
} tests[] = {
|
||||
{ "", "", 0 },
|
||||
{ "", "a", -1 },
|
||||
{ "a", "", 1 },
|
||||
{ "a", "a", 0 },
|
||||
{ "a", "aa", -1 },
|
||||
{ "aa", "a", 1 },
|
||||
{ "a", "b", -1 },
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
{ "a", "A", 0 },
|
||||
{ "A", "a", 0 },
|
||||
{ "foo/bar", "foo\\bar", 0 },
|
||||
{ "foo\\bar", "foo/bar", 0 },
|
||||
{ "foo\\", "foo/", 0 },
|
||||
{ "foo/", "foo\\", 0 },
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
{ NULL, NULL, 0}
|
||||
};
|
||||
int testno, result;
|
||||
|
||||
for (testno=0; tests[testno].a; testno++)
|
||||
{
|
||||
result = compare_filenames (tests[testno].a, tests[testno].b);
|
||||
result = result < 0? -1 : result > 0? 1 : 0;
|
||||
if (result != tests[testno].result)
|
||||
fail (testno);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
test_percent_escape ();
|
||||
test_compare_filenames ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* scdaemon.c: Include gc-opt-flags.h and remove their definition
|
||||
here.
|
||||
|
||||
2007-08-01 Werner Koch <wk@g10code.com>
|
||||
|
||||
* apdu.c (send_le): Implement exact length hack. Suggested by
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* scdaemon.c - The GnuPG Smartcard Daemon
|
||||
* Copyright (C) 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2001, 2002, 2004, 2005,
|
||||
* 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -51,6 +52,8 @@
|
||||
#endif
|
||||
#include "ccid-driver.h"
|
||||
#include "mkdtemp.h"
|
||||
#include "gc-opt-flags.h"
|
||||
|
||||
|
||||
enum cmd_and_opt_values
|
||||
{ aNull = 0,
|
||||
@ -545,22 +548,6 @@ main (int argc, char **argv )
|
||||
char *filename = NULL;
|
||||
char *filename_esc;
|
||||
|
||||
/* The following list is taken from gnupg/tools/gpgconf-comp.c. */
|
||||
/* Option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING
|
||||
FLAGS, AS THEY ARE PART OF THE EXTERNAL INTERFACE. */
|
||||
#define GC_OPT_FLAG_NONE 0UL
|
||||
/* The RUNTIME flag for an option indicates that the option can be
|
||||
changed at runtime. */
|
||||
#define GC_OPT_FLAG_RUNTIME (1UL << 3)
|
||||
/* The DEFAULT flag for an option indicates that the option has a
|
||||
default value. */
|
||||
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
|
||||
/* The DEF_DESC flag for an option indicates that the option has a
|
||||
default, which is described by the value of the default field. */
|
||||
#define GC_OPT_FLAG_DEF_DESC (1UL << 5)
|
||||
/* The NO_ARG_DESC flag for an option indicates that the argument has
|
||||
a default, which is described by the value of the ARGDEF field. */
|
||||
#define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6)
|
||||
if (!config_filename)
|
||||
filename = make_filename (opt.homedir, "scdaemon.conf", NULL );
|
||||
filename_esc = percent_escape (filename, NULL);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgsm.c (main): Factored GC_OPT_FLAGS out to gc-opt-flags.h.
|
||||
|
||||
2007-07-17 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgsm.c (main): Implement --default-key.
|
||||
|
30
sm/gpgsm.c
30
sm/gpgsm.c
@ -36,6 +36,7 @@
|
||||
#include "i18n.h"
|
||||
#include "keydb.h"
|
||||
#include "sysutils.h"
|
||||
#include "gc-opt-flags.h"
|
||||
|
||||
|
||||
#ifndef O_BINARY
|
||||
@ -1292,17 +1293,18 @@ main ( int argc, char **argv)
|
||||
gpgsm_exit(2);
|
||||
|
||||
/* Set the random seed file. */
|
||||
if (use_random_seed) {
|
||||
if (use_random_seed)
|
||||
{
|
||||
char *p = make_filename (opt.homedir, "random_seed", NULL);
|
||||
gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE, p);
|
||||
xfree(p);
|
||||
}
|
||||
|
||||
|
||||
if (!cmd && opt.fingerprint && !with_fpr)
|
||||
set_cmd (&cmd, aListKeys);
|
||||
|
||||
if (!nrings && default_keyring) /* Add default keybox. */
|
||||
/* Add default keybox. */
|
||||
if (!nrings && default_keyring)
|
||||
{
|
||||
int created;
|
||||
|
||||
@ -1353,7 +1355,7 @@ main ( int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Build the recipient list. We first add the regular ones and then
|
||||
the encrypt-to ones because the underlying function will silenty
|
||||
the encrypt-to ones because the underlying function will silently
|
||||
ignore duplicates and we can't allow to keep a duplicate which is
|
||||
flagged as encrypt-to as the actually encrypt function would then
|
||||
complain about no (regular) recipients. */
|
||||
@ -1369,7 +1371,7 @@ main ( int argc, char **argv)
|
||||
}
|
||||
|
||||
if (log_get_errorcount(0))
|
||||
gpgsm_exit(1); /* must stop for invalid recipients */
|
||||
gpgsm_exit(1); /* Must stop for invalid recipients. */
|
||||
|
||||
fname = argc? *argv : NULL;
|
||||
|
||||
@ -1377,24 +1379,6 @@ main ( int argc, char **argv)
|
||||
{
|
||||
case aGPGConfList:
|
||||
{ /* List options and default values in the GPG Conf format. */
|
||||
|
||||
/* The following list is taken from gnupg/tools/gpgconf-comp.c. */
|
||||
/* Option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING
|
||||
FLAGS, AS THEY ARE PART OF THE EXTERNAL INTERFACE. */
|
||||
#define GC_OPT_FLAG_NONE 0UL
|
||||
/* The RUNTIME flag for an option indicates that the option can be
|
||||
changed at runtime. */
|
||||
#define GC_OPT_FLAG_RUNTIME (1UL << 3)
|
||||
/* The DEFAULT flag for an option indicates that the option has a
|
||||
default value. */
|
||||
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
|
||||
/* The DEF_DESC flag for an option indicates that the option has a
|
||||
default, which is described by the value of the default field. */
|
||||
#define GC_OPT_FLAG_DEF_DESC (1UL << 5)
|
||||
/* The NO_ARG_DESC flag for an option indicates that the argument has
|
||||
a default, which is described by the value of the ARGDEF field. */
|
||||
#define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6)
|
||||
|
||||
char *config_filename_esc = percent_escape (opt.config_filename, NULL);
|
||||
|
||||
printf ("gpgconf-gpgsm.conf:%lu:\"%s\n",
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-08-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgconf-comp.c: Factor the public GC_OPT_FLAG constants out and
|
||||
include gc-opt-flags.h.
|
||||
|
||||
2007-07-17 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgconf-comp.c: Add --encrypt-to and --default-key to gpg and
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "util.h"
|
||||
#include "i18n.h"
|
||||
|
||||
#include "gc-opt-flags.h"
|
||||
#include "gpgconf.h"
|
||||
|
||||
|
||||
@ -308,9 +309,12 @@ static struct
|
||||
};
|
||||
|
||||
|
||||
/* Option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING
|
||||
FLAGS, AS THEY ARE PART OF THE EXTERNAL INTERFACE. */
|
||||
#define GC_OPT_FLAG_NONE 0UL
|
||||
/* Option flags. The flags which are used by the backends are defined
|
||||
by gc-opt-flags.h, included above.
|
||||
|
||||
YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING FLAGS, AS THEY ARE
|
||||
PART OF THE EXTERNAL INTERFACE. */
|
||||
|
||||
/* Some entries in the option list are not options, but mark the
|
||||
beginning of a new group of options. These entries have the GROUP
|
||||
flag set. */
|
||||
@ -322,26 +326,13 @@ static struct
|
||||
several times. A comma separated list of arguments is used as the
|
||||
argument value. */
|
||||
#define GC_OPT_FLAG_LIST (1UL << 2)
|
||||
/* The RUNTIME flag for an option indicates that the option can be
|
||||
changed at runtime. */
|
||||
#define GC_OPT_FLAG_RUNTIME (1UL << 3)
|
||||
|
||||
/* The following flags are incorporated from the backend. */
|
||||
/* The DEFAULT flag for an option indicates that the option has a
|
||||
default value. */
|
||||
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
|
||||
/* The DEF_DESC flag for an option indicates that the option has a
|
||||
default, which is described by the value of the default field. */
|
||||
#define GC_OPT_FLAG_DEF_DESC (1UL << 5)
|
||||
/* The NO_ARG_DESC flag for an option indicates that the argument has
|
||||
a default, which is described by the value of the ARGDEF field. */
|
||||
#define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6)
|
||||
/* The NO_CHANGE flag for an option indicates that the user should not
|
||||
be allowed to chnage this option using the standard gpgconf method.
|
||||
Frontends using gpgconf should grey out such otions, so that only
|
||||
Frontends using gpgconf should grey out such options, so that only
|
||||
the current value is displayed. */
|
||||
#define GC_OPT_FLAG_NO_CHANGE (1UL <<7)
|
||||
|
||||
|
||||
/* A human-readable description for each flag. */
|
||||
static struct
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user