mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02:00
w32: Almost everywhere include winsock2.h before windows.h.
-- This is required by newer mingw toolchain versions which demand that winsock2.h is included before windows.h. Now, due to the use of socket definitions in pth.h we need to include winsock2.h also in pth.h, now pth.h is often included after an include of windows.h and thus the compiler spits out a warning. To avoid that we include winsock2.h at all places the compiler complains about.
This commit is contained in:
parent
a557a74615
commit
40ca0022a7
@ -38,7 +38,10 @@
|
|||||||
#include <fcntl.h> /* for setmode() */
|
#include <fcntl.h> /* for setmode() */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
#include <windows.h> /* To initialize the sockets. fixme */
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
|
# include <windows.h> /* To initialize the sockets. fixme */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define JNLIB_NEED_LOG_LOGV
|
#define JNLIB_NEED_LOG_LOGV
|
||||||
@ -49,14 +52,14 @@
|
|||||||
#include "sysutils.h"
|
#include "sysutils.h"
|
||||||
|
|
||||||
|
|
||||||
enum cmd_and_opt_values
|
enum cmd_and_opt_values
|
||||||
{ aNull = 0,
|
{ aNull = 0,
|
||||||
oVerbose = 'v',
|
oVerbose = 'v',
|
||||||
oPassphrase = 'P',
|
oPassphrase = 'P',
|
||||||
|
|
||||||
oPreset = 'c',
|
oPreset = 'c',
|
||||||
oForget = 'f',
|
oForget = 'f',
|
||||||
|
|
||||||
oNoVerbose = 500,
|
oNoVerbose = 500,
|
||||||
|
|
||||||
oHomedir,
|
oHomedir,
|
||||||
@ -68,7 +71,7 @@ static const char *opt_homedir;
|
|||||||
static const char *opt_passphrase;
|
static const char *opt_passphrase;
|
||||||
|
|
||||||
static ARGPARSE_OPTS opts[] = {
|
static ARGPARSE_OPTS opts[] = {
|
||||||
|
|
||||||
{ 301, NULL, 0, N_("@Options:\n ") },
|
{ 301, NULL, 0, N_("@Options:\n ") },
|
||||||
|
|
||||||
{ oVerbose, "verbose", 0, "verbose" },
|
{ oVerbose, "verbose", 0, "verbose" },
|
||||||
@ -76,7 +79,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oPreset, "preset", 256, "preset passphrase"},
|
{ oPreset, "preset", 256, "preset passphrase"},
|
||||||
{ oForget, "forget", 256, "forget passphrase"},
|
{ oForget, "forget", 256, "forget passphrase"},
|
||||||
|
|
||||||
{ oHomedir, "homedir", 2, "@" },
|
{ oHomedir, "homedir", 2, "@" },
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,14 +97,14 @@ my_strusage (int level)
|
|||||||
case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break;
|
case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
case 40:
|
case 40:
|
||||||
p = _("Usage: gpg-preset-passphrase [options] KEYGRIP (-h for help)\n");
|
p = _("Usage: gpg-preset-passphrase [options] KEYGRIP (-h for help)\n");
|
||||||
break;
|
break;
|
||||||
case 41:
|
case 41:
|
||||||
p = _("Syntax: gpg-preset-passphrase [options] KEYGRIP\n"
|
p = _("Syntax: gpg-preset-passphrase [options] KEYGRIP\n"
|
||||||
"Password cache maintenance\n");
|
"Password cache maintenance\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: p = NULL;
|
default: p = NULL;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
@ -112,7 +115,7 @@ my_strusage (int level)
|
|||||||
|
|
||||||
/* Include the implementation of map_spwq_error. */
|
/* Include the implementation of map_spwq_error. */
|
||||||
MAP_SPWQ_ERROR_IMPL
|
MAP_SPWQ_ERROR_IMPL
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
preset_passphrase (const char *keygrip)
|
preset_passphrase (const char *keygrip)
|
||||||
@ -210,7 +213,7 @@ main (int argc, char **argv)
|
|||||||
const char *keygrip = NULL;
|
const char *keygrip = NULL;
|
||||||
|
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("gpg-preset-passphrase", 1);
|
log_set_prefix ("gpg-preset-passphrase", 1);
|
||||||
|
|
||||||
/* Make sure that our subsystems are ready. */
|
/* Make sure that our subsystems are ready. */
|
||||||
i18n_init ();
|
i18n_init ();
|
||||||
@ -231,7 +234,7 @@ main (int argc, char **argv)
|
|||||||
case oPreset: cmd = oPreset; break;
|
case oPreset: cmd = oPreset; break;
|
||||||
case oForget: cmd = oForget; break;
|
case oForget: cmd = oForget; break;
|
||||||
case oPassphrase: opt_passphrase = pargs.r.ret_str; break;
|
case oPassphrase: opt_passphrase = pargs.r.ret_str; break;
|
||||||
|
|
||||||
default : pargs.err = 2; break;
|
default : pargs.err = 2; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
161
agent/protect.c
161
agent/protect.c
@ -28,6 +28,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/times.h>
|
# include <sys/times.h>
|
||||||
@ -83,7 +86,7 @@ calibrate_get_time (struct calibrate_time_s *data)
|
|||||||
&data->kernel_time, &data->user_time);
|
&data->kernel_time, &data->user_time);
|
||||||
#else
|
#else
|
||||||
struct tms tmp;
|
struct tms tmp;
|
||||||
|
|
||||||
times (&tmp);
|
times (&tmp);
|
||||||
data->ticks = tmp.tms_utime;
|
data->ticks = tmp.tms_utime;
|
||||||
#endif
|
#endif
|
||||||
@ -94,12 +97,12 @@ static unsigned long
|
|||||||
calibrate_elapsed_time (struct calibrate_time_s *starttime)
|
calibrate_elapsed_time (struct calibrate_time_s *starttime)
|
||||||
{
|
{
|
||||||
struct calibrate_time_s stoptime;
|
struct calibrate_time_s stoptime;
|
||||||
|
|
||||||
calibrate_get_time (&stoptime);
|
calibrate_get_time (&stoptime);
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
{
|
{
|
||||||
unsigned long long t1, t2;
|
unsigned long long t1, t2;
|
||||||
|
|
||||||
t1 = (((unsigned long long)starttime->kernel_time.dwHighDateTime << 32)
|
t1 = (((unsigned long long)starttime->kernel_time.dwHighDateTime << 32)
|
||||||
+ starttime->kernel_time.dwLowDateTime);
|
+ starttime->kernel_time.dwLowDateTime);
|
||||||
t1 += (((unsigned long long)starttime->user_time.dwHighDateTime << 32)
|
t1 += (((unsigned long long)starttime->user_time.dwHighDateTime << 32)
|
||||||
@ -136,7 +139,7 @@ calibrate_s2k_count_one (unsigned long count)
|
|||||||
|
|
||||||
|
|
||||||
/* Measure the time we need to do the hash operations and deduce an
|
/* Measure the time we need to do the hash operations and deduce an
|
||||||
S2K count which requires about 100ms of time. */
|
S2K count which requires about 100ms of time. */
|
||||||
static unsigned long
|
static unsigned long
|
||||||
calibrate_s2k_count (void)
|
calibrate_s2k_count (void)
|
||||||
{
|
{
|
||||||
@ -187,7 +190,7 @@ get_standard_s2k_count (void)
|
|||||||
|
|
||||||
/* Calculate the MIC for a private key S-Exp. SHA1HASH should point to
|
/* Calculate the MIC for a private key S-Exp. SHA1HASH should point to
|
||||||
a 20 byte buffer. This function is suitable for any algorithms. */
|
a 20 byte buffer. This function is suitable for any algorithms. */
|
||||||
static int
|
static int
|
||||||
calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)
|
calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)
|
||||||
{
|
{
|
||||||
const unsigned char *hash_begin, *hash_end;
|
const unsigned char *hash_begin, *hash_end;
|
||||||
@ -200,16 +203,16 @@ calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "private-key"))
|
if (!smatch (&s, n, "private-key"))
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
if (*s != '(')
|
if (*s != '(')
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
hash_begin = s;
|
hash_begin = s;
|
||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n; /* skip over the algorithm name */
|
s += n; /* skip over the algorithm name */
|
||||||
|
|
||||||
while (*s == '(')
|
while (*s == '(')
|
||||||
@ -217,18 +220,18 @@ calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n;
|
s += n;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n;
|
s += n;
|
||||||
if ( *s != ')' )
|
if ( *s != ')' )
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
if (*s != ')')
|
if (*s != ')')
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s++;
|
s++;
|
||||||
hash_end = s;
|
hash_end = s;
|
||||||
|
|
||||||
@ -251,7 +254,7 @@ calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)
|
|||||||
(d #046129F..[some bytes not shown]..81#)
|
(d #046129F..[some bytes not shown]..81#)
|
||||||
(p #00e861b..[some bytes not shown]..f1#)
|
(p #00e861b..[some bytes not shown]..f1#)
|
||||||
(q #00f7a7c..[some bytes not shown]..61#)
|
(q #00f7a7c..[some bytes not shown]..61#)
|
||||||
(u #304559a..[some bytes not shown]..9b#)
|
(u #304559a..[some bytes not shown]..9b#)
|
||||||
|
|
||||||
the returned block is the S-Expression:
|
the returned block is the S-Expression:
|
||||||
|
|
||||||
@ -259,7 +262,7 @@ calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
do_encryption (const unsigned char *protbegin, size_t protlen,
|
do_encryption (const unsigned char *protbegin, size_t protlen,
|
||||||
const char *passphrase, const unsigned char *sha1hash,
|
const char *passphrase, const unsigned char *sha1hash,
|
||||||
unsigned char **result, size_t *resultlen)
|
unsigned char **result, size_t *resultlen)
|
||||||
{
|
{
|
||||||
@ -312,14 +315,14 @@ do_encryption (const unsigned char *protbegin, size_t protlen,
|
|||||||
{
|
{
|
||||||
unsigned char *key;
|
unsigned char *key;
|
||||||
size_t keylen = PROT_CIPHER_KEYLEN;
|
size_t keylen = PROT_CIPHER_KEYLEN;
|
||||||
|
|
||||||
key = gcry_malloc_secure (keylen);
|
key = gcry_malloc_secure (keylen);
|
||||||
if (!key)
|
if (!key)
|
||||||
rc = out_of_core ();
|
rc = out_of_core ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = hash_passphrase (passphrase, GCRY_MD_SHA1,
|
rc = hash_passphrase (passphrase, GCRY_MD_SHA1,
|
||||||
3, iv+2*blklen,
|
3, iv+2*blklen,
|
||||||
get_standard_s2k_count (), key, keylen);
|
get_standard_s2k_count (), key, keylen);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc = gcry_cipher_setkey (hd, key, keylen);
|
rc = gcry_cipher_setkey (hd, key, keylen);
|
||||||
@ -339,7 +342,7 @@ do_encryption (const unsigned char *protbegin, size_t protlen,
|
|||||||
p += 20;
|
p += 20;
|
||||||
*p++ = ')';
|
*p++ = ')';
|
||||||
*p++ = ')';
|
*p++ = ')';
|
||||||
memcpy (p, iv+blklen, blklen);
|
memcpy (p, iv+blklen, blklen);
|
||||||
p += blklen;
|
p += blklen;
|
||||||
assert ( p - outbuf == outlen);
|
assert ( p - outbuf == outlen);
|
||||||
rc = gcry_cipher_encrypt (hd, outbuf, enclen, NULL, 0);
|
rc = gcry_cipher_encrypt (hd, outbuf, enclen, NULL, 0);
|
||||||
@ -357,7 +360,7 @@ do_encryption (const unsigned char *protbegin, size_t protlen,
|
|||||||
(protected openpgp-s2k3-sha1-aes-cbc
|
(protected openpgp-s2k3-sha1-aes-cbc
|
||||||
((sha1 salt no_of_iterations) 16byte_iv)
|
((sha1 salt no_of_iterations) 16byte_iv)
|
||||||
encrypted_octet_string)
|
encrypted_octet_string)
|
||||||
|
|
||||||
in canoncical format of course. We use asprintf and %n modifier
|
in canoncical format of course. We use asprintf and %n modifier
|
||||||
and dummy values as placeholders. */
|
and dummy values as placeholders. */
|
||||||
{
|
{
|
||||||
@ -367,7 +370,7 @@ do_encryption (const unsigned char *protbegin, size_t protlen,
|
|||||||
p = xtryasprintf
|
p = xtryasprintf
|
||||||
("(9:protected%d:%s((4:sha18:%n_8bytes_%u:%s)%d:%n%*s)%d:%n%*s)",
|
("(9:protected%d:%s((4:sha18:%n_8bytes_%u:%s)%d:%n%*s)%d:%n%*s)",
|
||||||
(int)strlen (modestr), modestr,
|
(int)strlen (modestr), modestr,
|
||||||
&saltpos,
|
&saltpos,
|
||||||
(unsigned int)strlen (countbuf), countbuf,
|
(unsigned int)strlen (countbuf), countbuf,
|
||||||
blklen, &ivpos, blklen, "",
|
blklen, &ivpos, blklen, "",
|
||||||
enclen, &encpos, enclen, "");
|
enclen, &encpos, enclen, "");
|
||||||
@ -393,7 +396,7 @@ do_encryption (const unsigned char *protbegin, size_t protlen,
|
|||||||
|
|
||||||
/* Protect the key encoded in canonical format in PLAINKEY. We assume
|
/* Protect the key encoded in canonical format in PLAINKEY. We assume
|
||||||
a valid S-Exp here. */
|
a valid S-Exp here. */
|
||||||
int
|
int
|
||||||
agent_protect (const unsigned char *plainkey, const char *passphrase,
|
agent_protect (const unsigned char *plainkey, const char *passphrase,
|
||||||
unsigned char **result, size_t *resultlen)
|
unsigned char **result, size_t *resultlen)
|
||||||
{
|
{
|
||||||
@ -424,9 +427,9 @@ agent_protect (const unsigned char *plainkey, const char *passphrase,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "private-key"))
|
if (!smatch (&s, n, "private-key"))
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
if (*s != '(')
|
if (*s != '(')
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
depth++;
|
depth++;
|
||||||
@ -434,13 +437,13 @@ agent_protect (const unsigned char *plainkey, const char *passphrase,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
|
|
||||||
for (infidx=0; protect_info[infidx].algo
|
for (infidx=0; protect_info[infidx].algo
|
||||||
&& !smatch (&s, n, protect_info[infidx].algo); infidx++)
|
&& !smatch (&s, n, protect_info[infidx].algo); infidx++)
|
||||||
;
|
;
|
||||||
if (!protect_info[infidx].algo)
|
if (!protect_info[infidx].algo)
|
||||||
return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
|
return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
|
||||||
|
|
||||||
prot_begin = prot_end = NULL;
|
prot_begin = prot_end = NULL;
|
||||||
for (i=0; (c=protect_info[infidx].parmlist[i]); i++)
|
for (i=0; (c=protect_info[infidx].parmlist[i]); i++)
|
||||||
@ -453,23 +456,23 @@ agent_protect (const unsigned char *plainkey, const char *passphrase,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (n != 1 || c != *s)
|
if (n != 1 || c != *s)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n;
|
s += n;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s +=n; /* skip value */
|
s +=n; /* skip value */
|
||||||
if (*s != ')')
|
if (*s != ')')
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
depth--;
|
depth--;
|
||||||
if (i == protect_info[infidx].prot_to)
|
if (i == protect_info[infidx].prot_to)
|
||||||
prot_end = s;
|
prot_end = s;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
if (*s != ')' || !prot_begin || !prot_end )
|
if (*s != ')' || !prot_begin || !prot_end )
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
depth--;
|
depth--;
|
||||||
hash_end = s;
|
hash_end = s;
|
||||||
s++;
|
s++;
|
||||||
@ -481,10 +484,10 @@ agent_protect (const unsigned char *plainkey, const char *passphrase,
|
|||||||
assert (!depth);
|
assert (!depth);
|
||||||
real_end = s-1;
|
real_end = s-1;
|
||||||
|
|
||||||
|
|
||||||
/* Hash the stuff. Because the timestamp_exp won't get protected,
|
/* Hash the stuff. Because the timestamp_exp won't get protected,
|
||||||
we can't simply hash a continuous buffer but need to use several
|
we can't simply hash a continuous buffer but need to use several
|
||||||
md_writes. */
|
md_writes. */
|
||||||
rc = gcry_md_open (&md, GCRY_MD_SHA1, 0 );
|
rc = gcry_md_open (&md, GCRY_MD_SHA1, 0 );
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@ -537,8 +540,8 @@ agent_protect (const unsigned char *plainkey, const char *passphrase,
|
|||||||
|
|
||||||
/* Do the actual decryption and check the return list for consistency. */
|
/* Do the actual decryption and check the return list for consistency. */
|
||||||
static int
|
static int
|
||||||
do_decryption (const unsigned char *protected, size_t protectedlen,
|
do_decryption (const unsigned char *protected, size_t protectedlen,
|
||||||
const char *passphrase,
|
const char *passphrase,
|
||||||
const unsigned char *s2ksalt, unsigned long s2kcount,
|
const unsigned char *s2ksalt, unsigned long s2kcount,
|
||||||
const unsigned char *iv, size_t ivlen,
|
const unsigned char *iv, size_t ivlen,
|
||||||
unsigned char **result)
|
unsigned char **result)
|
||||||
@ -567,7 +570,7 @@ do_decryption (const unsigned char *protected, size_t protectedlen,
|
|||||||
{
|
{
|
||||||
unsigned char *key;
|
unsigned char *key;
|
||||||
size_t keylen = PROT_CIPHER_KEYLEN;
|
size_t keylen = PROT_CIPHER_KEYLEN;
|
||||||
|
|
||||||
key = gcry_malloc_secure (keylen);
|
key = gcry_malloc_secure (keylen);
|
||||||
if (!key)
|
if (!key)
|
||||||
rc = out_of_core ();
|
rc = out_of_core ();
|
||||||
@ -615,7 +618,7 @@ do_decryption (const unsigned char *protected, size_t protectedlen,
|
|||||||
calculation but then be removed. */
|
calculation but then be removed. */
|
||||||
static int
|
static int
|
||||||
merge_lists (const unsigned char *protectedkey,
|
merge_lists (const unsigned char *protectedkey,
|
||||||
size_t replacepos,
|
size_t replacepos,
|
||||||
const unsigned char *cleartext,
|
const unsigned char *cleartext,
|
||||||
unsigned char *sha1hash,
|
unsigned char *sha1hash,
|
||||||
unsigned char **result, size_t *resultlen,
|
unsigned char **result, size_t *resultlen,
|
||||||
@ -626,7 +629,7 @@ merge_lists (const unsigned char *protectedkey,
|
|||||||
const unsigned char *s;
|
const unsigned char *s;
|
||||||
const unsigned char *startpos, *endpos;
|
const unsigned char *startpos, *endpos;
|
||||||
int i, rc;
|
int i, rc;
|
||||||
|
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
*resultlen = 0;
|
*resultlen = 0;
|
||||||
*cutoff = 0;
|
*cutoff = 0;
|
||||||
@ -689,7 +692,7 @@ merge_lists (const unsigned char *protectedkey,
|
|||||||
goto invalid_sexp;
|
goto invalid_sexp;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!smatch (&s, n, "sha1"))
|
if (!smatch (&s, n, "sha1"))
|
||||||
goto invalid_sexp;
|
goto invalid_sexp;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (n != 20)
|
if (n != 20)
|
||||||
goto invalid_sexp;
|
goto invalid_sexp;
|
||||||
@ -702,7 +705,7 @@ merge_lists (const unsigned char *protectedkey,
|
|||||||
/* append the parameter list */
|
/* append the parameter list */
|
||||||
memcpy (p, startpos, endpos - startpos);
|
memcpy (p, startpos, endpos - startpos);
|
||||||
p += endpos - startpos;
|
p += endpos - startpos;
|
||||||
|
|
||||||
/* Skip over the protected list element in the original list. */
|
/* Skip over the protected list element in the original list. */
|
||||||
s = protectedkey + replacepos;
|
s = protectedkey + replacepos;
|
||||||
assert (*s == '(');
|
assert (*s == '(');
|
||||||
@ -740,7 +743,7 @@ merge_lists (const unsigned char *protectedkey,
|
|||||||
*cutoff = p - newlist;
|
*cutoff = p - newlist;
|
||||||
memcpy (p, startpos, endpos - startpos);
|
memcpy (p, startpos, endpos - startpos);
|
||||||
p += endpos - startpos;
|
p += endpos - startpos;
|
||||||
|
|
||||||
|
|
||||||
/* ready */
|
/* ready */
|
||||||
*result = newlist;
|
*result = newlist;
|
||||||
@ -763,14 +766,14 @@ merge_lists (const unsigned char *protectedkey,
|
|||||||
/* Unprotect the key encoded in canonical format. We assume a valid
|
/* Unprotect the key encoded in canonical format. We assume a valid
|
||||||
S-Exp here. If a protected-at item is available, its value will
|
S-Exp here. If a protected-at item is available, its value will
|
||||||
be stored at protocted_at unless this is NULL. */
|
be stored at protocted_at unless this is NULL. */
|
||||||
int
|
int
|
||||||
agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
||||||
gnupg_isotime_t protected_at,
|
gnupg_isotime_t protected_at,
|
||||||
unsigned char **result, size_t *resultlen)
|
unsigned char **result, size_t *resultlen)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
const unsigned char *s;
|
const unsigned char *s;
|
||||||
const unsigned char *protect_list;
|
const unsigned char *protect_list;
|
||||||
size_t n;
|
size_t n;
|
||||||
int infidx, i;
|
int infidx, i;
|
||||||
unsigned char sha1hash[20], sha1hash2[20];
|
unsigned char sha1hash[20], sha1hash2[20];
|
||||||
@ -792,21 +795,21 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "protected-private-key"))
|
if (!smatch (&s, n, "protected-private-key"))
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
if (*s != '(')
|
if (*s != '(')
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
|
|
||||||
for (infidx=0; protect_info[infidx].algo
|
for (infidx=0; protect_info[infidx].algo
|
||||||
&& !smatch (&s, n, protect_info[infidx].algo); infidx++)
|
&& !smatch (&s, n, protect_info[infidx].algo); infidx++)
|
||||||
;
|
;
|
||||||
if (!protect_info[infidx].algo)
|
if (!protect_info[infidx].algo)
|
||||||
return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
|
return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
|
||||||
|
|
||||||
|
|
||||||
/* See wether we have a protected-at timestamp. */
|
/* See wether we have a protected-at timestamp. */
|
||||||
@ -841,7 +844,7 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
|
|
||||||
/* Now find the list with the protected information. Here is an
|
/* Now find the list with the protected information. Here is an
|
||||||
example for such a list:
|
example for such a list:
|
||||||
(protected openpgp-s2k3-sha1-aes-cbc
|
(protected openpgp-s2k3-sha1-aes-cbc
|
||||||
((sha1 <salt> <count>) <Initialization_Vector>)
|
((sha1 <salt> <count>) <Initialization_Vector>)
|
||||||
<encrypted_data>)
|
<encrypted_data>)
|
||||||
*/
|
*/
|
||||||
@ -854,7 +857,7 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (smatch (&s, n, "protected"))
|
if (smatch (&s, n, "protected"))
|
||||||
break;
|
break;
|
||||||
s += n;
|
s += n;
|
||||||
@ -866,7 +869,7 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
/* found */
|
/* found */
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "openpgp-s2k3-sha1-" PROT_CIPHER_STRING "-cbc"))
|
if (!smatch (&s, n, "openpgp-s2k3-sha1-" PROT_CIPHER_STRING "-cbc"))
|
||||||
return gpg_error (GPG_ERR_UNSUPPORTED_PROTECTION);
|
return gpg_error (GPG_ERR_UNSUPPORTED_PROTECTION);
|
||||||
if (*s != '(' || s[1] != '(')
|
if (*s != '(' || s[1] != '(')
|
||||||
@ -874,7 +877,7 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
s += 2;
|
s += 2;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "sha1"))
|
if (!smatch (&s, n, "sha1"))
|
||||||
return gpg_error (GPG_ERR_UNSUPPORTED_PROTECTION);
|
return gpg_error (GPG_ERR_UNSUPPORTED_PROTECTION);
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
@ -890,7 +893,7 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
is nothing we should worry about */
|
is nothing we should worry about */
|
||||||
if (s[n] != ')' )
|
if (s[n] != ')' )
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
|
|
||||||
/* Old versions of gpg-agent used the funny floating point number in
|
/* Old versions of gpg-agent used the funny floating point number in
|
||||||
a byte encoding as specified by OpenPGP. However this is not
|
a byte encoding as specified by OpenPGP. However this is not
|
||||||
needed and thus we now store it as a plain unsigned integer. We
|
needed and thus we now store it as a plain unsigned integer. We
|
||||||
@ -920,8 +923,8 @@ agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
|
|
||||||
rc = do_decryption (s, n,
|
rc = do_decryption (s, n,
|
||||||
passphrase, s2ksalt, s2kcount,
|
passphrase, s2ksalt, s2kcount,
|
||||||
iv, 16,
|
iv, 16,
|
||||||
@ -995,7 +998,7 @@ agent_private_key_type (const unsigned char *privatekey)
|
|||||||
store this key in the caller provided buffer KEY. The caller must
|
store this key in the caller provided buffer KEY. The caller must
|
||||||
provide an HASHALGO, a valid S2KMODE (see rfc-2440) and depending on
|
provide an HASHALGO, a valid S2KMODE (see rfc-2440) and depending on
|
||||||
that mode an S2KSALT of 8 random bytes and an S2KCOUNT.
|
that mode an S2KSALT of 8 random bytes and an S2KCOUNT.
|
||||||
|
|
||||||
Returns an error code on failure. */
|
Returns an error code on failure. */
|
||||||
static int
|
static int
|
||||||
hash_passphrase (const char *passphrase, int hashalgo,
|
hash_passphrase (const char *passphrase, int hashalgo,
|
||||||
@ -1015,7 +1018,7 @@ hash_passphrase (const char *passphrase, int hashalgo,
|
|||||||
return gpg_error (GPG_ERR_INV_VALUE);
|
return gpg_error (GPG_ERR_INV_VALUE);
|
||||||
if ((s2kmode == 1 ||s2kmode == 3) && !s2ksalt)
|
if ((s2kmode == 1 ||s2kmode == 3) && !s2ksalt)
|
||||||
return gpg_error (GPG_ERR_INV_VALUE);
|
return gpg_error (GPG_ERR_INV_VALUE);
|
||||||
|
|
||||||
rc = gcry_md_open (&md, hashalgo, GCRY_MD_FLAG_SECURE);
|
rc = gcry_md_open (&md, hashalgo, GCRY_MD_FLAG_SECURE);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@ -1049,7 +1052,7 @@ hash_passphrase (const char *passphrase, int hashalgo,
|
|||||||
}
|
}
|
||||||
if (count < 8)
|
if (count < 8)
|
||||||
gcry_md_write (md, s2ksalt, count);
|
gcry_md_write (md, s2ksalt, count);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gcry_md_write (md, s2ksalt, 8);
|
gcry_md_write (md, s2ksalt, 8);
|
||||||
count -= 8;
|
count -= 8;
|
||||||
@ -1058,7 +1061,7 @@ hash_passphrase (const char *passphrase, int hashalgo,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
gcry_md_write (md, passphrase, pwlen);
|
gcry_md_write (md, passphrase, pwlen);
|
||||||
|
|
||||||
gcry_md_final (md);
|
gcry_md_final (md);
|
||||||
i = gcry_md_get_algo_dlen (hashalgo);
|
i = gcry_md_get_algo_dlen (hashalgo);
|
||||||
if (i > keylen - used)
|
if (i > keylen - used)
|
||||||
@ -1108,7 +1111,7 @@ make_shadow_info (const char *serialno, const char *idstring)
|
|||||||
S-expression is returned in an allocated buffer RESULT will point
|
S-expression is returned in an allocated buffer RESULT will point
|
||||||
to. The input parameters are expected to be valid canonicalized
|
to. The input parameters are expected to be valid canonicalized
|
||||||
S-expressions */
|
S-expressions */
|
||||||
int
|
int
|
||||||
agent_shadow_key (const unsigned char *pubkey,
|
agent_shadow_key (const unsigned char *pubkey,
|
||||||
const unsigned char *shadow_info,
|
const unsigned char *shadow_info,
|
||||||
unsigned char **result)
|
unsigned char **result)
|
||||||
@ -1130,16 +1133,16 @@ agent_shadow_key (const unsigned char *pubkey,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "public-key"))
|
if (!smatch (&s, n, "public-key"))
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
if (*s != '(')
|
if (*s != '(')
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
depth++;
|
depth++;
|
||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n; /* skip over the algorithm name */
|
s += n; /* skip over the algorithm name */
|
||||||
|
|
||||||
while (*s != ')')
|
while (*s != ')')
|
||||||
@ -1149,15 +1152,15 @@ agent_shadow_key (const unsigned char *pubkey,
|
|||||||
depth++;
|
depth++;
|
||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n;
|
s += n;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s +=n; /* skip value */
|
s +=n; /* skip value */
|
||||||
if (*s != ')')
|
if (*s != ')')
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
depth--;
|
depth--;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
@ -1189,7 +1192,7 @@ agent_shadow_key (const unsigned char *pubkey,
|
|||||||
|
|
||||||
/* Parse a canonical encoded shadowed key and return a pointer to the
|
/* Parse a canonical encoded shadowed key and return a pointer to the
|
||||||
inner list with the shadow_info */
|
inner list with the shadow_info */
|
||||||
int
|
int
|
||||||
agent_get_shadow_info (const unsigned char *shadowkey,
|
agent_get_shadow_info (const unsigned char *shadowkey,
|
||||||
unsigned char const **shadow_info)
|
unsigned char const **shadow_info)
|
||||||
{
|
{
|
||||||
@ -1204,16 +1207,16 @@ agent_get_shadow_info (const unsigned char *shadowkey,
|
|||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (!smatch (&s, n, "shadowed-private-key"))
|
if (!smatch (&s, n, "shadowed-private-key"))
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
if (*s != '(')
|
if (*s != '(')
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
|
||||||
depth++;
|
depth++;
|
||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s += n; /* skip over the algorithm name */
|
s += n; /* skip over the algorithm name */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@ -1225,24 +1228,24 @@ agent_get_shadow_info (const unsigned char *shadowkey,
|
|||||||
depth++;
|
depth++;
|
||||||
s++;
|
s++;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (smatch (&s, n, "shadowed"))
|
if (smatch (&s, n, "shadowed"))
|
||||||
break;
|
break;
|
||||||
s += n;
|
s += n;
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
s +=n; /* skip value */
|
s +=n; /* skip value */
|
||||||
if (*s != ')')
|
if (*s != ')')
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
depth--;
|
depth--;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
/* Found the shadowed list, S points to the protocol */
|
/* Found the shadowed list, S points to the protocol */
|
||||||
n = snext (&s);
|
n = snext (&s);
|
||||||
if (!n)
|
if (!n)
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
if (smatch (&s, n, "t1-v1"))
|
if (smatch (&s, n, "t1-v1"))
|
||||||
{
|
{
|
||||||
if (*s != '(')
|
if (*s != '(')
|
||||||
@ -1262,7 +1265,7 @@ agent_get_shadow_info (const unsigned char *shadowkey,
|
|||||||
parameters addresses. If the serial number or the ID string is not
|
parameters addresses. If the serial number or the ID string is not
|
||||||
required, NULL may be passed for them. */
|
required, NULL may be passed for them. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
parse_shadow_info (const unsigned char *shadow_info,
|
parse_shadow_info (const unsigned char *shadow_info,
|
||||||
char **r_hexsn, char **r_idstr)
|
char **r_hexsn, char **r_idstr)
|
||||||
{
|
{
|
||||||
const unsigned char *s;
|
const unsigned char *s;
|
||||||
@ -1299,7 +1302,7 @@ parse_shadow_info (const unsigned char *shadow_info,
|
|||||||
}
|
}
|
||||||
return gpg_error (GPG_ERR_INV_SEXP);
|
return gpg_error (GPG_ERR_INV_SEXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_idstr)
|
if (r_idstr)
|
||||||
{
|
{
|
||||||
*r_idstr = xtrymalloc (n+1);
|
*r_idstr = xtrymalloc (n+1);
|
||||||
|
@ -84,7 +84,7 @@ if test "$1" = "--build-w32"; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./configure --enable-maintainer-mode --prefix=${w32root} \
|
$tsdir/configure --enable-maintainer-mode --prefix=${w32root} \
|
||||||
--host=${host} --build=${build} \
|
--host=${host} --build=${build} \
|
||||||
--enable-gpgtar \
|
--enable-gpgtar \
|
||||||
--with-gpg-error-prefix=${w32root} \
|
--with-gpg-error-prefix=${w32root} \
|
||||||
|
@ -79,6 +79,9 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#ifndef CSIDL_APPDATA
|
#ifndef CSIDL_APPDATA
|
||||||
#define CSIDL_APPDATA 0x001a
|
#define CSIDL_APPDATA 0x001a
|
||||||
@ -97,7 +100,7 @@ standard_homedir (void)
|
|||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
/* It might be better to use LOCAL_APPDATA because this is
|
/* It might be better to use LOCAL_APPDATA because this is
|
||||||
defined as "non roaming" and thus more likely to be kept
|
defined as "non roaming" and thus more likely to be kept
|
||||||
locally. For private keys this is desired. However, given
|
locally. For private keys this is desired. However, given
|
||||||
@ -105,13 +108,13 @@ standard_homedir (void)
|
|||||||
using a system roaming services might be better than to let
|
using a system roaming services might be better than to let
|
||||||
them do it manually. A security conscious user will anyway
|
them do it manually. A security conscious user will anyway
|
||||||
use the registry entry to have better control. */
|
use the registry entry to have better control. */
|
||||||
if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
|
if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
|
||||||
NULL, 0, path) >= 0)
|
NULL, 0, path) >= 0)
|
||||||
{
|
{
|
||||||
char *tmp = xmalloc (strlen (path) + 6 +1);
|
char *tmp = xmalloc (strlen (path) + 6 +1);
|
||||||
strcpy (stpcpy (tmp, path), "\\gnupg");
|
strcpy (stpcpy (tmp, path), "\\gnupg");
|
||||||
dir = tmp;
|
dir = tmp;
|
||||||
|
|
||||||
/* Try to create the directory if it does not yet exists. */
|
/* Try to create the directory if it does not yet exists. */
|
||||||
if (access (dir, F_OK))
|
if (access (dir, F_OK))
|
||||||
CreateDirectory (dir, NULL);
|
CreateDirectory (dir, NULL);
|
||||||
@ -137,7 +140,7 @@ default_homedir (void)
|
|||||||
if (!dir || !*dir)
|
if (!dir || !*dir)
|
||||||
{
|
{
|
||||||
static const char *saved_dir;
|
static const char *saved_dir;
|
||||||
|
|
||||||
if (!saved_dir)
|
if (!saved_dir)
|
||||||
{
|
{
|
||||||
if (!dir || !*dir)
|
if (!dir || !*dir)
|
||||||
@ -154,7 +157,7 @@ default_homedir (void)
|
|||||||
if (tmp)
|
if (tmp)
|
||||||
saved_dir = tmp;
|
saved_dir = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saved_dir)
|
if (!saved_dir)
|
||||||
saved_dir = standard_homedir ();
|
saved_dir = standard_homedir ();
|
||||||
}
|
}
|
||||||
@ -191,7 +194,7 @@ w32_rootdir (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_debug ("bad filename `%s' returned for this process\n", dir);
|
log_debug ("bad filename `%s' returned for this process\n", dir);
|
||||||
*dir = 0;
|
*dir = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,8 +213,8 @@ w32_commondir (void)
|
|||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
|
if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
|
||||||
NULL, 0, path) >= 0)
|
NULL, 0, path) >= 0)
|
||||||
{
|
{
|
||||||
char *tmp = xmalloc (strlen (path) + 4 +1);
|
char *tmp = xmalloc (strlen (path) + 4 +1);
|
||||||
strcpy (stpcpy (tmp, path), "\\GNU");
|
strcpy (stpcpy (tmp, path), "\\GNU");
|
||||||
@ -226,7 +229,7 @@ w32_commondir (void)
|
|||||||
dir = xstrdup (w32_rootdir ());
|
dir = xstrdup (w32_rootdir ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_W32_SYSTEM*/
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
@ -388,42 +391,42 @@ gnupg_module_name (int which)
|
|||||||
strcpy (stpcpy (name, s), s2); \
|
strcpy (stpcpy (name, s), s2); \
|
||||||
} \
|
} \
|
||||||
return name; \
|
return name; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
case GNUPG_MODULE_NAME_AGENT:
|
case GNUPG_MODULE_NAME_AGENT:
|
||||||
#ifdef GNUPG_DEFAULT_AGENT
|
#ifdef GNUPG_DEFAULT_AGENT
|
||||||
return GNUPG_DEFAULT_AGENT;
|
return GNUPG_DEFAULT_AGENT;
|
||||||
#else
|
#else
|
||||||
X(bindir, "gpg-agent");
|
X(bindir, "gpg-agent");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case GNUPG_MODULE_NAME_PINENTRY:
|
case GNUPG_MODULE_NAME_PINENTRY:
|
||||||
#ifdef GNUPG_DEFAULT_PINENTRY
|
#ifdef GNUPG_DEFAULT_PINENTRY
|
||||||
return GNUPG_DEFAULT_PINENTRY;
|
return GNUPG_DEFAULT_PINENTRY;
|
||||||
#else
|
#else
|
||||||
X(bindir, "pinentry");
|
X(bindir, "pinentry");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case GNUPG_MODULE_NAME_SCDAEMON:
|
case GNUPG_MODULE_NAME_SCDAEMON:
|
||||||
#ifdef GNUPG_DEFAULT_SCDAEMON
|
#ifdef GNUPG_DEFAULT_SCDAEMON
|
||||||
return GNUPG_DEFAULT_SCDAEMON;
|
return GNUPG_DEFAULT_SCDAEMON;
|
||||||
#else
|
#else
|
||||||
X(libexecdir, "scdaemon");
|
X(libexecdir, "scdaemon");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case GNUPG_MODULE_NAME_DIRMNGR:
|
case GNUPG_MODULE_NAME_DIRMNGR:
|
||||||
#ifdef GNUPG_DEFAULT_DIRMNGR
|
#ifdef GNUPG_DEFAULT_DIRMNGR
|
||||||
return GNUPG_DEFAULT_DIRMNGR;
|
return GNUPG_DEFAULT_DIRMNGR;
|
||||||
#else
|
#else
|
||||||
X(bindir, "dirmngr");
|
X(bindir, "dirmngr");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case GNUPG_MODULE_NAME_PROTECT_TOOL:
|
case GNUPG_MODULE_NAME_PROTECT_TOOL:
|
||||||
#ifdef GNUPG_DEFAULT_PROTECT_TOOL
|
#ifdef GNUPG_DEFAULT_PROTECT_TOOL
|
||||||
return GNUPG_DEFAULT_PROTECT_TOOL;
|
return GNUPG_DEFAULT_PROTECT_TOOL;
|
||||||
#else
|
#else
|
||||||
X(libexecdir, "gpg-protect-tool");
|
X(libexecdir, "gpg-protect-tool");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -442,7 +445,7 @@ gnupg_module_name (int which)
|
|||||||
case GNUPG_MODULE_NAME_GPGCONF:
|
case GNUPG_MODULE_NAME_GPGCONF:
|
||||||
X(bindir, "gpgconf");
|
X(bindir, "gpgconf");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BUG ();
|
BUG ();
|
||||||
}
|
}
|
||||||
#undef X
|
#undef X
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
|
@ -25,9 +25,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_PTH
|
#ifdef HAVE_PTH
|
||||||
#include <pth.h>
|
#include <pth.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -46,7 +49,7 @@ void
|
|||||||
init_common_subsystems (void)
|
init_common_subsystems (void)
|
||||||
{
|
{
|
||||||
/* Try to auto set the character set. */
|
/* Try to auto set the character set. */
|
||||||
set_native_charset (NULL);
|
set_native_charset (NULL);
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
/* For W32 we need to initialize the socket layer. This is because
|
/* For W32 we need to initialize the socket layer. This is because
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __riscos__
|
#ifdef __riscos__
|
||||||
@ -43,7 +46,7 @@
|
|||||||
|
|
||||||
/*-- Begin configurable part. --*/
|
/*-- Begin configurable part. --*/
|
||||||
|
|
||||||
/* The size of the internal buffers.
|
/* The size of the internal buffers.
|
||||||
NOTE: If you change this value you MUST also adjust the regression
|
NOTE: If you change this value you MUST also adjust the regression
|
||||||
test "armored_key_8192" in armor.test! */
|
test "armored_key_8192" in armor.test! */
|
||||||
#define IOBUF_BUFFER_SIZE 8192
|
#define IOBUF_BUFFER_SIZE 8192
|
||||||
@ -66,15 +69,15 @@
|
|||||||
implementation. What we define here are 3 macros to make the
|
implementation. What we define here are 3 macros to make the
|
||||||
appropriate calls:
|
appropriate calls:
|
||||||
|
|
||||||
my_fileno
|
my_fileno
|
||||||
Is expanded to fileno(a) if using a stdion backend and to a if we
|
Is expanded to fileno(a) if using a stdion backend and to a if we
|
||||||
are using the low-level backend.
|
are using the low-level backend.
|
||||||
|
|
||||||
my_fopen
|
my_fopen
|
||||||
Is defined to fopen for the stdio backend and to direct_open if
|
Is defined to fopen for the stdio backend and to direct_open if
|
||||||
we are using the low-evel backend.
|
we are using the low-evel backend.
|
||||||
|
|
||||||
my_fopen_ro
|
my_fopen_ro
|
||||||
Is defined to fopen for the stdio backend and to fd_cache_open if
|
Is defined to fopen for the stdio backend and to fd_cache_open if
|
||||||
we are using the low-evel backend.
|
we are using the low-evel backend.
|
||||||
|
|
||||||
@ -117,7 +120,7 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fp_or_fd_t fp; /* Open file pointer or handle. */
|
fp_or_fd_t fp; /* Open file pointer or handle. */
|
||||||
int keep_open;
|
int keep_open;
|
||||||
int no_cache;
|
int no_cache;
|
||||||
int eof_seen;
|
int eof_seen;
|
||||||
int print_only_name; /* Flags indicating that fname is not a real file. */
|
int print_only_name; /* Flags indicating that fname is not a real file. */
|
||||||
@ -196,7 +199,7 @@ fd_cache_strcmp (const char *a, const char *b)
|
|||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
for (; *a && *b; a++, b++)
|
for (; *a && *b; a++, b++)
|
||||||
{
|
{
|
||||||
if (*a != *b && !((*a == '/' && *b == '\\')
|
if (*a != *b && !((*a == '/' && *b == '\\')
|
||||||
|| (*a == '\\' && *b == '/')) )
|
|| (*a == '\\' && *b == '/')) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -353,7 +356,7 @@ direct_open (const char *fname, const char *mode)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Instead of closing an FD we keep it open and cache it for later reuse
|
* Instead of closing an FD we keep it open and cache it for later reuse
|
||||||
* Note that this caching strategy only works if the process does not chdir.
|
* Note that this caching strategy only works if the process does not chdir.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -477,13 +480,13 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf,
|
|||||||
{
|
{
|
||||||
assert (size); /* We need a buffer. */
|
assert (size); /* We need a buffer. */
|
||||||
if (feof (f))
|
if (feof (f))
|
||||||
{
|
{
|
||||||
/* On terminals you could easily read as many EOFs as you
|
/* On terminals you could easily read as many EOFs as you
|
||||||
call fread() or fgetc() repeatly. Every call will block
|
call fread() or fgetc() repeatly. Every call will block
|
||||||
until you press CTRL-D. So we catch this case before we
|
until you press CTRL-D. So we catch this case before we
|
||||||
call fread() again. */
|
call fread() again. */
|
||||||
rc = -1;
|
rc = -1;
|
||||||
*ret_len = 0;
|
*ret_len = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -891,7 +894,7 @@ block_filter (void *opaque, int control, iobuf_t chain, byte * buffer,
|
|||||||
/* log_debug("partial: ctx=%p c=%02x size=%u\n", a, c, a->size); */
|
/* log_debug("partial: ctx=%p c=%02x size=%u\n", a, c, a->size); */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
BUG ();
|
BUG ();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!rc && size && a->size)
|
while (!rc && size && a->size)
|
||||||
@ -1506,7 +1509,7 @@ iobuf_ioctl (iobuf_t a, int cmd, int intval, void *ptrval)
|
|||||||
{ /* keep system filepointer/descriptor open */
|
{ /* keep system filepointer/descriptor open */
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
log_debug ("iobuf-%d.%d: ioctl `%s' keep=%d\n",
|
log_debug ("iobuf-%d.%d: ioctl `%s' keep=%d\n",
|
||||||
a ? a->no : -1, a ? a->subno : -1,
|
a ? a->no : -1, a ? a->subno : -1,
|
||||||
a && a->desc ? a->desc : "?",
|
a && a->desc ? a->desc : "?",
|
||||||
intval);
|
intval);
|
||||||
for (; a; a = a->chain)
|
for (; a; a = a->chain)
|
||||||
@ -1543,7 +1546,7 @@ iobuf_ioctl (iobuf_t a, int cmd, int intval, void *ptrval)
|
|||||||
{ /* disallow/allow caching */
|
{ /* disallow/allow caching */
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
log_debug ("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
|
log_debug ("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
|
||||||
a ? a->no : -1, a ? a->subno : -1,
|
a ? a->no : -1, a ? a->subno : -1,
|
||||||
a && a->desc? a->desc : "?",
|
a && a->desc? a->desc : "?",
|
||||||
intval);
|
intval);
|
||||||
for (; a; a = a->chain)
|
for (; a; a = a->chain)
|
||||||
@ -1663,7 +1666,7 @@ iobuf_push_filter2 (iobuf_t a,
|
|||||||
|
|
||||||
if (DBG_IOBUF)
|
if (DBG_IOBUF)
|
||||||
{
|
{
|
||||||
log_debug ("iobuf-%d.%d: push `%s'\n", a->no, a->subno,
|
log_debug ("iobuf-%d.%d: push `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?");
|
a->desc?a->desc:"?");
|
||||||
print_chain (a);
|
print_chain (a);
|
||||||
}
|
}
|
||||||
@ -2170,24 +2173,24 @@ iobuf_get_filelength (iobuf_t a, int *overflow)
|
|||||||
|
|
||||||
if (overflow)
|
if (overflow)
|
||||||
*overflow = 0;
|
*overflow = 0;
|
||||||
|
|
||||||
if ( a->directfp )
|
if ( a->directfp )
|
||||||
{
|
{
|
||||||
FILE *fp = a->directfp;
|
FILE *fp = a->directfp;
|
||||||
|
|
||||||
if ( !fstat(fileno(fp), &st) )
|
if ( !fstat(fileno(fp), &st) )
|
||||||
return st.st_size;
|
return st.st_size;
|
||||||
log_error("fstat() failed: %s\n", strerror(errno) );
|
log_error("fstat() failed: %s\n", strerror(errno) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hmmm: file_filter may have already been removed */
|
/* Hmmm: file_filter may have already been removed */
|
||||||
for ( ; a; a = a->chain )
|
for ( ; a; a = a->chain )
|
||||||
if ( !a->chain && a->filter == file_filter )
|
if ( !a->chain && a->filter == file_filter )
|
||||||
{
|
{
|
||||||
file_filter_ctx_t *b = a->filter_ov;
|
file_filter_ctx_t *b = a->filter_ov;
|
||||||
fp_or_fd_t fp = b->fp;
|
fp_or_fd_t fp = b->fp;
|
||||||
|
|
||||||
#if defined(HAVE_W32_SYSTEM) && !defined(FILE_FILTER_USES_STDIO)
|
#if defined(HAVE_W32_SYSTEM) && !defined(FILE_FILTER_USES_STDIO)
|
||||||
ulong size;
|
ulong size;
|
||||||
static int (* __stdcall get_file_size_ex) (void *handle,
|
static int (* __stdcall get_file_size_ex) (void *handle,
|
||||||
@ -2197,7 +2200,7 @@ iobuf_get_filelength (iobuf_t a, int *overflow)
|
|||||||
if (!get_file_size_ex_initialized)
|
if (!get_file_size_ex_initialized)
|
||||||
{
|
{
|
||||||
void *handle;
|
void *handle;
|
||||||
|
|
||||||
handle = dlopen ("kernel32.dll", RTLD_LAZY);
|
handle = dlopen ("kernel32.dll", RTLD_LAZY);
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
@ -2207,21 +2210,21 @@ iobuf_get_filelength (iobuf_t a, int *overflow)
|
|||||||
}
|
}
|
||||||
get_file_size_ex_initialized = 1;
|
get_file_size_ex_initialized = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_file_size_ex)
|
if (get_file_size_ex)
|
||||||
{
|
{
|
||||||
/* This is a newer system with GetFileSizeEx; we use this
|
/* This is a newer system with GetFileSizeEx; we use this
|
||||||
then because it seem that GetFileSize won't return a
|
then because it seem that GetFileSize won't return a
|
||||||
proper error in case a file is larger than 4GB. */
|
proper error in case a file is larger than 4GB. */
|
||||||
LARGE_INTEGER exsize;
|
LARGE_INTEGER exsize;
|
||||||
|
|
||||||
if (get_file_size_ex (fp, &exsize))
|
if (get_file_size_ex (fp, &exsize))
|
||||||
{
|
{
|
||||||
if (!exsize.u.HighPart)
|
if (!exsize.u.HighPart)
|
||||||
return exsize.u.LowPart;
|
return exsize.u.LowPart;
|
||||||
if (overflow)
|
if (overflow)
|
||||||
*overflow = 1;
|
*overflow = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2238,14 +2241,14 @@ iobuf_get_filelength (iobuf_t a, int *overflow)
|
|||||||
#endif
|
#endif
|
||||||
break/*the for loop*/;
|
break/*the for loop*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return the file descriptor of the underlying file or -1 if it is
|
/* Return the file descriptor of the underlying file or -1 if it is
|
||||||
not available. */
|
not available. */
|
||||||
int
|
int
|
||||||
iobuf_get_fd (iobuf_t a)
|
iobuf_get_fd (iobuf_t a)
|
||||||
{
|
{
|
||||||
if (a->directfp)
|
if (a->directfp)
|
||||||
@ -2518,7 +2521,7 @@ translate_file_handle (int fd, int for_write)
|
|||||||
# else
|
# else
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
(void)for_write;
|
(void)for_write;
|
||||||
|
|
||||||
if (fd == 0)
|
if (fd == 0)
|
||||||
@ -2551,13 +2554,13 @@ iobuf_skip_rest (iobuf_t a, unsigned long n, int partial)
|
|||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (a->nofast || a->d.start >= a->d.len)
|
if (a->nofast || a->d.start >= a->d.len)
|
||||||
{
|
{
|
||||||
if (iobuf_readbyte (a) == -1)
|
if (iobuf_readbyte (a) == -1)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned long count = a->d.len - a->d.start;
|
unsigned long count = a->d.len - a->d.start;
|
||||||
@ -2565,11 +2568,11 @@ iobuf_skip_rest (iobuf_t a, unsigned long n, int partial)
|
|||||||
a->d.start = a->d.len;
|
a->d.start = a->d.len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned long remaining = n;
|
unsigned long remaining = n;
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
if (a->nofast || a->d.start >= a->d.len)
|
if (a->nofast || a->d.start >= a->d.len)
|
||||||
{
|
{
|
||||||
@ -2578,11 +2581,11 @@ iobuf_skip_rest (iobuf_t a, unsigned long n, int partial)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
--remaining;
|
--remaining;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned long count = a->d.len - a->d.start;
|
unsigned long count = a->d.len - a->d.start;
|
||||||
if (count > remaining)
|
if (count > remaining)
|
||||||
{
|
{
|
||||||
count = remaining;
|
count = remaining;
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,15 @@
|
|||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
# define WINVER 0x0500 /* Required for AllowSetForegroundWindow. */
|
# ifndef WINVER
|
||||||
|
# define WINVER 0x0500 /* Required for AllowSetForegroundWindow. */
|
||||||
|
# endif
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_PTH
|
#ifdef HAVE_PTH
|
||||||
# include <pth.h>
|
# include <pth.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -144,8 +149,8 @@ get_session_marker( size_t *rlen )
|
|||||||
initialized = 1;
|
initialized = 1;
|
||||||
/* Although this marker is guessable it is not easy to use
|
/* Although this marker is guessable it is not easy to use
|
||||||
* for a faked control packet because an attacker does not
|
* for a faked control packet because an attacker does not
|
||||||
* have enough control about the time the verification does
|
* have enough control about the time the verification does
|
||||||
* take place. Of course, we can add just more random but
|
* take place. Of course, we can add just more random but
|
||||||
* than we need the random generator even for verification
|
* than we need the random generator even for verification
|
||||||
* tasks - which does not make sense. */
|
* tasks - which does not make sense. */
|
||||||
a = aa ^ (ulong)getpid();
|
a = aa ^ (ulong)getpid();
|
||||||
@ -260,7 +265,7 @@ gnupg_sleep (unsigned int seconds)
|
|||||||
the process will give up its timeslot. */
|
the process will give up its timeslot. */
|
||||||
if (!seconds)
|
if (!seconds)
|
||||||
{
|
{
|
||||||
# ifdef HAVE_W32_SYSTEM
|
# ifdef HAVE_W32_SYSTEM
|
||||||
Sleep (0);
|
Sleep (0);
|
||||||
# else
|
# else
|
||||||
sleep (0);
|
sleep (0);
|
||||||
@ -269,7 +274,7 @@ gnupg_sleep (unsigned int seconds)
|
|||||||
pth_sleep (seconds);
|
pth_sleep (seconds);
|
||||||
#else
|
#else
|
||||||
/* Fixme: make sure that a sleep won't wake up to early. */
|
/* Fixme: make sure that a sleep won't wake up to early. */
|
||||||
# ifdef HAVE_W32_SYSTEM
|
# ifdef HAVE_W32_SYSTEM
|
||||||
Sleep (seconds*1000);
|
Sleep (seconds*1000);
|
||||||
# else
|
# else
|
||||||
sleep (seconds);
|
sleep (seconds);
|
||||||
@ -291,7 +296,7 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
|
|||||||
|
|
||||||
if (fd == GNUPG_INVALID_FD)
|
if (fd == GNUPG_INVALID_FD)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Note that _open_osfhandle is currently defined to take and return
|
/* Note that _open_osfhandle is currently defined to take and return
|
||||||
a long. */
|
a long. */
|
||||||
x = _open_osfhandle ((long)fd, for_write ? 1 : 0);
|
x = _open_osfhandle ((long)fd, for_write ? 1 : 0);
|
||||||
@ -414,7 +419,7 @@ gnupg_tmpfile (void)
|
|||||||
Must be called before we open any files! */
|
Must be called before we open any files! */
|
||||||
void
|
void
|
||||||
gnupg_reopen_std (const char *pgmname)
|
gnupg_reopen_std (const char *pgmname)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_STAT) && !defined(HAVE_W32_SYSTEM)
|
#if defined(HAVE_STAT) && !defined(HAVE_W32_SYSTEM)
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int did_stdin = 0;
|
int did_stdin = 0;
|
||||||
@ -429,7 +434,7 @@ gnupg_reopen_std (const char *pgmname)
|
|||||||
else
|
else
|
||||||
did_stdin = 2;
|
did_stdin = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat (STDOUT_FILENO, &statbuf) == -1 && errno == EBADF)
|
if (fstat (STDOUT_FILENO, &statbuf) == -1 && errno == EBADF)
|
||||||
{
|
{
|
||||||
if (open ("/dev/null",O_WRONLY) == STDOUT_FILENO)
|
if (open ("/dev/null",O_WRONLY) == STDOUT_FILENO)
|
||||||
@ -478,13 +483,13 @@ gnupg_reopen_std (const char *pgmname)
|
|||||||
|
|
||||||
|
|
||||||
/* Hack required for Windows. */
|
/* Hack required for Windows. */
|
||||||
void
|
void
|
||||||
gnupg_allow_set_foregound_window (pid_t pid)
|
gnupg_allow_set_foregound_window (pid_t pid)
|
||||||
{
|
{
|
||||||
if (!pid)
|
if (!pid)
|
||||||
log_info ("%s called with invalid pid %lu\n",
|
log_info ("%s called with invalid pid %lu\n",
|
||||||
"gnupg_allow_set_foregound_window", (unsigned long)pid);
|
"gnupg_allow_set_foregound_window", (unsigned long)pid);
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
else if (!AllowSetForegroundWindow ((pid_t)pid == (pid_t)(-1)?ASFW_ANY:pid))
|
else if (!AllowSetForegroundWindow ((pid_t)pid == (pid_t)(-1)?ASFW_ANY:pid))
|
||||||
log_info ("AllowSetForegroundWindow(%lu) failed: %s\n",
|
log_info ("AllowSetForegroundWindow(%lu) failed: %s\n",
|
||||||
(unsigned long)pid, w32_strerror (-1));
|
(unsigned long)pid, w32_strerror (-1));
|
||||||
|
@ -25,23 +25,26 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef HAVE_TCGETATTR
|
#ifdef HAVE_TCGETATTR
|
||||||
#include <termios.h>
|
# include <termios.h>
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_TERMIO_H
|
# ifdef HAVE_TERMIO_H
|
||||||
/* simulate termios with termio */
|
/* Simulate termios with termio. */
|
||||||
#include <termio.h>
|
# include <termio.h>
|
||||||
#define termios termio
|
# define termios termio
|
||||||
#define tcsetattr ioctl
|
# define tcsetattr ioctl
|
||||||
#define TCSAFLUSH TCSETAF
|
# define TCSAFLUSH TCSETAF
|
||||||
#define tcgetattr(A,B) ioctl(A,TCGETA,B)
|
# define tcgetattr(A,B) ioctl(A,TCGETA,B)
|
||||||
#define HAVE_TCGETATTR
|
# define HAVE_TCGETATTR
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32 /* use the odd Win32 functions */
|
#ifdef _WIN32 /* use the odd Win32 functions */
|
||||||
#include <windows.h>
|
# ifdef HAVE_WINSOCK2_H
|
||||||
#ifdef HAVE_TCGETATTR
|
# include <winsock2.h>
|
||||||
#error mingw32 and termios
|
# endif
|
||||||
#endif
|
# include <windows.h>
|
||||||
|
# ifdef HAVE_TCGETATTR
|
||||||
|
# error mingw32 and termios
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -179,7 +182,7 @@ init_ttyfp(void)
|
|||||||
if (my_rl_init_stream)
|
if (my_rl_init_stream)
|
||||||
my_rl_init_stream (ttyfp);
|
my_rl_init_stream (ttyfp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_TCGETATTR
|
#ifdef HAVE_TCGETATTR
|
||||||
atexit( cleanup );
|
atexit( cleanup );
|
||||||
@ -218,7 +221,7 @@ tty_printf( const char *fmt, ... )
|
|||||||
|
|
||||||
va_start( arg_ptr, fmt ) ;
|
va_start( arg_ptr, fmt ) ;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
{
|
{
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
int n;
|
int n;
|
||||||
DWORD nwritten;
|
DWORD nwritten;
|
||||||
@ -226,7 +229,7 @@ tty_printf( const char *fmt, ... )
|
|||||||
n = vasprintf(&buf, fmt, arg_ptr);
|
n = vasprintf(&buf, fmt, arg_ptr);
|
||||||
if( !buf )
|
if( !buf )
|
||||||
log_bug("vasprintf() failed\n");
|
log_bug("vasprintf() failed\n");
|
||||||
|
|
||||||
if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
|
if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
|
||||||
log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
|
log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
|
||||||
if( n != nwritten )
|
if( n != nwritten )
|
||||||
@ -265,7 +268,7 @@ tty_fprintf (FILE *fp, const char *fmt, ... )
|
|||||||
|
|
||||||
va_start( arg_ptr, fmt ) ;
|
va_start( arg_ptr, fmt ) ;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
{
|
{
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
int n;
|
int n;
|
||||||
DWORD nwritten;
|
DWORD nwritten;
|
||||||
@ -273,7 +276,7 @@ tty_fprintf (FILE *fp, const char *fmt, ... )
|
|||||||
n = vasprintf(&buf, fmt, arg_ptr);
|
n = vasprintf(&buf, fmt, arg_ptr);
|
||||||
if( !buf )
|
if( !buf )
|
||||||
log_bug("vasprintf() failed\n");
|
log_bug("vasprintf() failed\n");
|
||||||
|
|
||||||
if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
|
if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
|
||||||
log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
|
log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
|
||||||
if( n != nwritten )
|
if( n != nwritten )
|
||||||
@ -531,7 +534,7 @@ tty_get( const char *prompt )
|
|||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
init_ttyfp();
|
init_ttyfp();
|
||||||
|
|
||||||
|
21
g10/exec.c
21
g10/exec.c
@ -17,7 +17,7 @@
|
|||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FIXME: We should replace most code in this module by our
|
FIXME: We should replace most code in this module by our
|
||||||
spawn implementation from common/exechelp.c.
|
spawn implementation from common/exechelp.c.
|
||||||
*/
|
*/
|
||||||
@ -33,7 +33,10 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#include <windows.h>
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -50,7 +53,7 @@
|
|||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
|
|
||||||
#ifdef NO_EXEC
|
#ifdef NO_EXEC
|
||||||
int
|
int
|
||||||
exec_write(struct exec_info **info,const char *program,
|
exec_write(struct exec_info **info,const char *program,
|
||||||
const char *args_in,const char *name,int writeonly,int binary)
|
const char *args_in,const char *name,int writeonly,int binary)
|
||||||
{
|
{
|
||||||
@ -71,7 +74,7 @@ set_exec_path(const char *path) { return G10ERR_GENERAL; }
|
|||||||
/* This is a nicer system() for windows that waits for programs to
|
/* This is a nicer system() for windows that waits for programs to
|
||||||
return before returning control to the caller. I hate helpful
|
return before returning control to the caller. I hate helpful
|
||||||
computers. */
|
computers. */
|
||||||
static int
|
static int
|
||||||
w32_system(const char *command)
|
w32_system(const char *command)
|
||||||
{
|
{
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
@ -103,7 +106,7 @@ w32_system(const char *command)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Replaces current $PATH */
|
/* Replaces current $PATH */
|
||||||
int
|
int
|
||||||
set_exec_path(const char *path)
|
set_exec_path(const char *path)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -126,7 +129,7 @@ set_exec_path(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Makes a temp directory and filenames */
|
/* Makes a temp directory and filenames */
|
||||||
static int
|
static int
|
||||||
make_tempdir(struct exec_info *info)
|
make_tempdir(struct exec_info *info)
|
||||||
{
|
{
|
||||||
char *tmp=opt.temp_dir,*namein=info->name,*nameout;
|
char *tmp=opt.temp_dir,*namein=info->name,*nameout;
|
||||||
@ -208,7 +211,7 @@ make_tempdir(struct exec_info *info)
|
|||||||
|
|
||||||
/* Expands %i and %o in the args to the full temp files within the
|
/* Expands %i and %o in the args to the full temp files within the
|
||||||
temp directory. */
|
temp directory. */
|
||||||
static int
|
static int
|
||||||
expand_args(struct exec_info *info,const char *args_in)
|
expand_args(struct exec_info *info,const char *args_in)
|
||||||
{
|
{
|
||||||
const char *ch = args_in;
|
const char *ch = args_in;
|
||||||
@ -297,7 +300,7 @@ expand_args(struct exec_info *info,const char *args_in)
|
|||||||
If there are args, but no tempfiles, then it's a fork/exec/pipe via
|
If there are args, but no tempfiles, then it's a fork/exec/pipe via
|
||||||
shell -c. If there are tempfiles, then it's a system. */
|
shell -c. If there are tempfiles, then it's a system. */
|
||||||
|
|
||||||
int
|
int
|
||||||
exec_write(struct exec_info **info,const char *program,
|
exec_write(struct exec_info **info,const char *program,
|
||||||
const char *args_in,const char *name,int writeonly,int binary)
|
const char *args_in,const char *name,int writeonly,int binary)
|
||||||
{
|
{
|
||||||
@ -599,7 +602,7 @@ exec_finish(struct exec_info *info)
|
|||||||
log_info(_("WARNING: unable to remove tempfile (%s) `%s': %s\n"),
|
log_info(_("WARNING: unable to remove tempfile (%s) `%s': %s\n"),
|
||||||
"in",info->tempfile_in,strerror(errno));
|
"in",info->tempfile_in,strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(info->tempfile_out)
|
if(info->tempfile_out)
|
||||||
{
|
{
|
||||||
if(unlink(info->tempfile_out)==-1)
|
if(unlink(info->tempfile_out)==-1)
|
||||||
|
193
g10/gpg.c
193
g10/gpg.c
@ -31,7 +31,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
#include <windows.h>
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INCLUDED_BY_MAIN_MODULE 1
|
#define INCLUDED_BY_MAIN_MODULE 1
|
||||||
@ -273,7 +276,7 @@ enum cmd_and_opt_values
|
|||||||
oS2KDigest,
|
oS2KDigest,
|
||||||
oS2KCipher,
|
oS2KCipher,
|
||||||
oS2KCount,
|
oS2KCount,
|
||||||
oSimpleSKChecksum,
|
oSimpleSKChecksum,
|
||||||
oDisplayCharset,
|
oDisplayCharset,
|
||||||
oNotDashEscaped,
|
oNotDashEscaped,
|
||||||
oEscapeFrom,
|
oEscapeFrom,
|
||||||
@ -302,7 +305,7 @@ enum cmd_and_opt_values
|
|||||||
oNoAllowNonSelfsignedUID,
|
oNoAllowNonSelfsignedUID,
|
||||||
oAllowFreeformUID,
|
oAllowFreeformUID,
|
||||||
oNoAllowFreeformUID,
|
oNoAllowFreeformUID,
|
||||||
oAllowSecretKeyImport,
|
oAllowSecretKeyImport,
|
||||||
oEnableSpecialFilenames,
|
oEnableSpecialFilenames,
|
||||||
oNoLiteral,
|
oNoLiteral,
|
||||||
oSetFilesize,
|
oSetFilesize,
|
||||||
@ -392,7 +395,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_c (aListSecretKeys, "list-secret-keys", N_("list secret keys")),
|
ARGPARSE_c (aListSecretKeys, "list-secret-keys", N_("list secret keys")),
|
||||||
ARGPARSE_c (aKeygen, "gen-key", N_("generate a new key pair")),
|
ARGPARSE_c (aKeygen, "gen-key", N_("generate a new key pair")),
|
||||||
ARGPARSE_c (aGenRevoke, "gen-revoke",N_("generate a revocation certificate")),
|
ARGPARSE_c (aGenRevoke, "gen-revoke",N_("generate a revocation certificate")),
|
||||||
ARGPARSE_c (aDeleteKeys,"delete-keys",
|
ARGPARSE_c (aDeleteKeys,"delete-keys",
|
||||||
N_("remove keys from the public keyring")),
|
N_("remove keys from the public keyring")),
|
||||||
ARGPARSE_c (aDeleteSecretKeys, "delete-secret-keys",
|
ARGPARSE_c (aDeleteSecretKeys, "delete-secret-keys",
|
||||||
N_("remove keys from the secret keyring")),
|
N_("remove keys from the secret keyring")),
|
||||||
@ -405,9 +408,9 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_c (aExport, "export" , N_("export keys") ),
|
ARGPARSE_c (aExport, "export" , N_("export keys") ),
|
||||||
ARGPARSE_c (aSendKeys, "send-keys" , N_("export keys to a key server") ),
|
ARGPARSE_c (aSendKeys, "send-keys" , N_("export keys to a key server") ),
|
||||||
ARGPARSE_c (aRecvKeys, "recv-keys" , N_("import keys from a key server") ),
|
ARGPARSE_c (aRecvKeys, "recv-keys" , N_("import keys from a key server") ),
|
||||||
ARGPARSE_c (aSearchKeys, "search-keys" ,
|
ARGPARSE_c (aSearchKeys, "search-keys" ,
|
||||||
N_("search for keys on a key server") ),
|
N_("search for keys on a key server") ),
|
||||||
ARGPARSE_c (aRefreshKeys, "refresh-keys",
|
ARGPARSE_c (aRefreshKeys, "refresh-keys",
|
||||||
N_("update all keys from a keyserver")),
|
N_("update all keys from a keyserver")),
|
||||||
ARGPARSE_c (aLocateKeys, "locate-keys", "@"),
|
ARGPARSE_c (aLocateKeys, "locate-keys", "@"),
|
||||||
ARGPARSE_c (aFetchKeys, "fetch-keys" , "@" ),
|
ARGPARSE_c (aFetchKeys, "fetch-keys" , "@" ),
|
||||||
@ -596,7 +599,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
/* More hidden commands and options. */
|
/* More hidden commands and options. */
|
||||||
ARGPARSE_c (aPrintMDs, "print-mds", "@"), /* old */
|
ARGPARSE_c (aPrintMDs, "print-mds", "@"), /* old */
|
||||||
ARGPARSE_c (aListTrustDB, "list-trustdb", "@"),
|
ARGPARSE_c (aListTrustDB, "list-trustdb", "@"),
|
||||||
/* Not yet used:
|
/* Not yet used:
|
||||||
ARGPARSE_c (aListTrustPath, "list-trust-path", "@"), */
|
ARGPARSE_c (aListTrustPath, "list-trust-path", "@"), */
|
||||||
ARGPARSE_c (aDeleteSecretAndPublicKeys,
|
ARGPARSE_c (aDeleteSecretAndPublicKeys,
|
||||||
"delete-secret-and-public-keys", "@"),
|
"delete-secret-and-public-keys", "@"),
|
||||||
@ -620,8 +623,8 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_s_n (oNoArmor, "no-armour", "@"),
|
ARGPARSE_s_n (oNoArmor, "no-armour", "@"),
|
||||||
ARGPARSE_s_n (oNoDefKeyring, "no-default-keyring", "@"),
|
ARGPARSE_s_n (oNoDefKeyring, "no-default-keyring", "@"),
|
||||||
ARGPARSE_s_n (oNoGreeting, "no-greeting", "@"),
|
ARGPARSE_s_n (oNoGreeting, "no-greeting", "@"),
|
||||||
ARGPARSE_s_n (oNoOptions, "no-options", "@"),
|
ARGPARSE_s_n (oNoOptions, "no-options", "@"),
|
||||||
ARGPARSE_s_s (oHomedir, "homedir", "@"),
|
ARGPARSE_s_s (oHomedir, "homedir", "@"),
|
||||||
ARGPARSE_s_n (oNoBatch, "no-batch", "@"),
|
ARGPARSE_s_n (oNoBatch, "no-batch", "@"),
|
||||||
ARGPARSE_s_n (oWithColons, "with-colons", "@"),
|
ARGPARSE_s_n (oWithColons, "with-colons", "@"),
|
||||||
ARGPARSE_s_n (oWithKeyData,"with-key-data", "@"),
|
ARGPARSE_s_n (oWithKeyData,"with-key-data", "@"),
|
||||||
@ -732,8 +735,8 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_s_s (oKeyidFormat, "keyid-format", "@"),
|
ARGPARSE_s_s (oKeyidFormat, "keyid-format", "@"),
|
||||||
ARGPARSE_s_n (oExitOnStatusWriteError, "exit-on-status-write-error", "@"),
|
ARGPARSE_s_n (oExitOnStatusWriteError, "exit-on-status-write-error", "@"),
|
||||||
ARGPARSE_s_i (oLimitCardInsertTries, "limit-card-insert-tries", "@"),
|
ARGPARSE_s_i (oLimitCardInsertTries, "limit-card-insert-tries", "@"),
|
||||||
|
|
||||||
ARGPARSE_s_n (oAllowMultisigVerification,
|
ARGPARSE_s_n (oAllowMultisigVerification,
|
||||||
"allow-multisig-verification", "@"),
|
"allow-multisig-verification", "@"),
|
||||||
ARGPARSE_s_n (oEnableDSA2, "enable-dsa2", "@"),
|
ARGPARSE_s_n (oEnableDSA2, "enable-dsa2", "@"),
|
||||||
ARGPARSE_s_n (oDisableDSA2, "disable-dsa2", "@"),
|
ARGPARSE_s_n (oDisableDSA2, "disable-dsa2", "@"),
|
||||||
@ -788,7 +791,7 @@ make_libversion (const char *libname, const char *(*getfnc)(const char*))
|
|||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
if (maybe_setuid)
|
if (maybe_setuid)
|
||||||
{
|
{
|
||||||
gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
|
gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
|
||||||
@ -858,14 +861,14 @@ my_strusage( int level )
|
|||||||
break;
|
break;
|
||||||
case 35:
|
case 35:
|
||||||
if( !ciphers )
|
if( !ciphers )
|
||||||
ciphers = build_list(_("Cipher: "), 'S',
|
ciphers = build_list(_("Cipher: "), 'S',
|
||||||
openpgp_cipher_algo_name,
|
openpgp_cipher_algo_name,
|
||||||
openpgp_cipher_test_algo );
|
openpgp_cipher_test_algo );
|
||||||
p = ciphers;
|
p = ciphers;
|
||||||
break;
|
break;
|
||||||
case 36:
|
case 36:
|
||||||
if( !digests )
|
if( !digests )
|
||||||
digests = build_list(_("Hash: "), 'H',
|
digests = build_list(_("Hash: "), 'H',
|
||||||
gcry_md_algo_name,
|
gcry_md_algo_name,
|
||||||
openpgp_md_test_algo );
|
openpgp_md_test_algo );
|
||||||
p = digests;
|
p = digests;
|
||||||
@ -961,7 +964,7 @@ static void
|
|||||||
set_opt_session_env (const char *name, const char *value)
|
set_opt_session_env (const char *name, const char *value)
|
||||||
{
|
{
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
|
|
||||||
err = session_env_setenv (opt.session_env, name, value);
|
err = session_env_setenv (opt.session_env, name, value);
|
||||||
if (err)
|
if (err)
|
||||||
log_fatal ("error setting session environment: %s\n",
|
log_fatal ("error setting session environment: %s\n",
|
||||||
@ -995,7 +998,7 @@ set_debug (const char *level)
|
|||||||
/* Unless the "guru" string has been used we don't want to allow
|
/* Unless the "guru" string has been used we don't want to allow
|
||||||
hashing debugging. The rationale is that people tend to
|
hashing debugging. The rationale is that people tend to
|
||||||
select the highest debug value and would then clutter their
|
select the highest debug value and would then clutter their
|
||||||
disk with debug files which may reveal confidential data. */
|
disk with debug files which may reveal confidential data. */
|
||||||
if (numok)
|
if (numok)
|
||||||
opt.debug &= ~(DBG_HASHING_VALUE);
|
opt.debug &= ~(DBG_HASHING_VALUE);
|
||||||
}
|
}
|
||||||
@ -1019,17 +1022,17 @@ set_debug (const char *level)
|
|||||||
|
|
||||||
if (opt.debug)
|
if (opt.debug)
|
||||||
log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||||
(opt.debug & DBG_PACKET_VALUE )? " packet":"",
|
(opt.debug & DBG_PACKET_VALUE )? " packet":"",
|
||||||
(opt.debug & DBG_MPI_VALUE )? " mpi":"",
|
(opt.debug & DBG_MPI_VALUE )? " mpi":"",
|
||||||
(opt.debug & DBG_CIPHER_VALUE )? " cipher":"",
|
(opt.debug & DBG_CIPHER_VALUE )? " cipher":"",
|
||||||
(opt.debug & DBG_FILTER_VALUE )? " filter":"",
|
(opt.debug & DBG_FILTER_VALUE )? " filter":"",
|
||||||
(opt.debug & DBG_IOBUF_VALUE )? " iobuf":"",
|
(opt.debug & DBG_IOBUF_VALUE )? " iobuf":"",
|
||||||
(opt.debug & DBG_MEMORY_VALUE )? " memory":"",
|
(opt.debug & DBG_MEMORY_VALUE )? " memory":"",
|
||||||
(opt.debug & DBG_CACHE_VALUE )? " cache":"",
|
(opt.debug & DBG_CACHE_VALUE )? " cache":"",
|
||||||
(opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
|
(opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
|
||||||
(opt.debug & DBG_TRUST_VALUE )? " trust":"",
|
(opt.debug & DBG_TRUST_VALUE )? " trust":"",
|
||||||
(opt.debug & DBG_HASHING_VALUE)? " hashing":"",
|
(opt.debug & DBG_HASHING_VALUE)? " hashing":"",
|
||||||
(opt.debug & DBG_EXTPROG_VALUE)? " extprog":"",
|
(opt.debug & DBG_EXTPROG_VALUE)? " extprog":"",
|
||||||
(opt.debug & DBG_CARD_IO_VALUE)? " cardio":"",
|
(opt.debug & DBG_CARD_IO_VALUE)? " cardio":"",
|
||||||
(opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");
|
(opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");
|
||||||
}
|
}
|
||||||
@ -1092,7 +1095,7 @@ open_info_file (const char *fname, int for_write, int binary)
|
|||||||
(void)for_write;
|
(void)for_write;
|
||||||
(void)binary;
|
(void)binary;
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (binary)
|
if (binary)
|
||||||
@ -1118,7 +1121,7 @@ open_info_file (const char *fname, int for_write, int binary)
|
|||||||
if ( fd == -1)
|
if ( fd == -1)
|
||||||
log_error ( for_write? _("can't create `%s': %s\n")
|
log_error ( for_write? _("can't create `%s': %s\n")
|
||||||
: _("can't open `%s': %s\n"), fname, strerror(errno));
|
: _("can't open `%s': %s\n"), fname, strerror(errno));
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1559,7 +1562,7 @@ list_config(char *items)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
any=1;
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all || ascii_strcasecmp(name,"compress")==0)
|
if(show_all || ascii_strcasecmp(name,"compress")==0)
|
||||||
{
|
{
|
||||||
printf("cfg:compress:");
|
printf("cfg:compress:");
|
||||||
@ -1824,7 +1827,7 @@ get_default_configname (void)
|
|||||||
if (configname)
|
if (configname)
|
||||||
{
|
{
|
||||||
char *tok;
|
char *tok;
|
||||||
|
|
||||||
xfree (configname);
|
xfree (configname);
|
||||||
configname = NULL;
|
configname = NULL;
|
||||||
|
|
||||||
@ -1835,13 +1838,13 @@ get_default_configname (void)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
configname = make_filename (opt.homedir, name, NULL);
|
configname = make_filename (opt.homedir, name, NULL);
|
||||||
}
|
}
|
||||||
while (access (configname, R_OK));
|
while (access (configname, R_OK));
|
||||||
|
|
||||||
xfree(name);
|
xfree(name);
|
||||||
|
|
||||||
if (! configname)
|
if (! configname)
|
||||||
configname = make_filename (opt.homedir, "gpg" EXTSEP_S "conf", NULL);
|
configname = make_filename (opt.homedir, "gpg" EXTSEP_S "conf", NULL);
|
||||||
if (! access (configname, R_OK))
|
if (! access (configname, R_OK))
|
||||||
@ -2048,7 +2051,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
/* Initialize the secure memory. */
|
/* Initialize the secure memory. */
|
||||||
if (!gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0))
|
if (!gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0))
|
||||||
got_secmem = 1;
|
got_secmem = 1;
|
||||||
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
|
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
|
||||||
/* There should be no way to get to this spot while still carrying
|
/* There should be no way to get to this spot while still carrying
|
||||||
setuid privs. Just in case, bomb out if we are. */
|
setuid privs. Just in case, bomb out if we are. */
|
||||||
@ -2065,7 +2068,7 @@ main (int argc, char **argv)
|
|||||||
malloc_hooks.free = gcry_free;
|
malloc_hooks.free = gcry_free;
|
||||||
assuan_set_malloc_hooks (&malloc_hooks);
|
assuan_set_malloc_hooks (&malloc_hooks);
|
||||||
assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
|
assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
|
||||||
|
|
||||||
|
|
||||||
/* Try for a version specific config file first */
|
/* Try for a version specific config file first */
|
||||||
default_configname = get_default_configname ();
|
default_configname = get_default_configname ();
|
||||||
@ -2125,55 +2128,55 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
switch( pargs.r_opt )
|
switch( pargs.r_opt )
|
||||||
{
|
{
|
||||||
case aCheckKeys:
|
case aCheckKeys:
|
||||||
case aListConfig:
|
case aListConfig:
|
||||||
case aGPGConfList:
|
case aGPGConfList:
|
||||||
case aGPGConfTest:
|
case aGPGConfTest:
|
||||||
case aListPackets:
|
case aListPackets:
|
||||||
case aImport:
|
case aImport:
|
||||||
case aFastImport:
|
case aFastImport:
|
||||||
case aSendKeys:
|
case aSendKeys:
|
||||||
case aRecvKeys:
|
case aRecvKeys:
|
||||||
case aSearchKeys:
|
case aSearchKeys:
|
||||||
case aRefreshKeys:
|
case aRefreshKeys:
|
||||||
case aFetchKeys:
|
case aFetchKeys:
|
||||||
case aExport:
|
case aExport:
|
||||||
#ifdef ENABLE_CARD_SUPPORT
|
#ifdef ENABLE_CARD_SUPPORT
|
||||||
case aCardStatus:
|
case aCardStatus:
|
||||||
case aCardEdit:
|
case aCardEdit:
|
||||||
case aChangePIN:
|
case aChangePIN:
|
||||||
#endif /* ENABLE_CARD_SUPPORT*/
|
#endif /* ENABLE_CARD_SUPPORT*/
|
||||||
case aListKeys:
|
case aListKeys:
|
||||||
case aLocateKeys:
|
case aLocateKeys:
|
||||||
case aListSigs:
|
case aListSigs:
|
||||||
case aExportSecret:
|
case aExportSecret:
|
||||||
case aExportSecretSub:
|
case aExportSecretSub:
|
||||||
case aSym:
|
case aSym:
|
||||||
case aClearsign:
|
case aClearsign:
|
||||||
case aGenRevoke:
|
case aGenRevoke:
|
||||||
case aDesigRevoke:
|
case aDesigRevoke:
|
||||||
case aPrimegen:
|
case aPrimegen:
|
||||||
case aGenRandom:
|
case aGenRandom:
|
||||||
case aPrintMD:
|
case aPrintMD:
|
||||||
case aPrintMDs:
|
case aPrintMDs:
|
||||||
case aListTrustDB:
|
case aListTrustDB:
|
||||||
case aCheckTrustDB:
|
case aCheckTrustDB:
|
||||||
case aUpdateTrustDB:
|
case aUpdateTrustDB:
|
||||||
case aFixTrustDB:
|
case aFixTrustDB:
|
||||||
case aListTrustPath:
|
case aListTrustPath:
|
||||||
case aDeArmor:
|
case aDeArmor:
|
||||||
case aEnArmor:
|
case aEnArmor:
|
||||||
case aSign:
|
case aSign:
|
||||||
case aSignKey:
|
case aSignKey:
|
||||||
case aLSignKey:
|
case aLSignKey:
|
||||||
case aStore:
|
case aStore:
|
||||||
case aExportOwnerTrust:
|
case aExportOwnerTrust:
|
||||||
case aImportOwnerTrust:
|
case aImportOwnerTrust:
|
||||||
case aRebuildKeydbCaches:
|
case aRebuildKeydbCaches:
|
||||||
set_cmd (&cmd, pargs.r_opt);
|
set_cmd (&cmd, pargs.r_opt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aKeygen:
|
case aKeygen:
|
||||||
case aEditKey:
|
case aEditKey:
|
||||||
case aDeleteSecretKeys:
|
case aDeleteSecretKeys:
|
||||||
case aDeleteSecretAndPublicKeys:
|
case aDeleteSecretAndPublicKeys:
|
||||||
@ -2223,7 +2226,7 @@ main (int argc, char **argv)
|
|||||||
case oNoUseAgent:
|
case oNoUseAgent:
|
||||||
obsolete_option (configname, configlineno, "--no-use-agent");
|
obsolete_option (configname, configlineno, "--no-use-agent");
|
||||||
break;
|
break;
|
||||||
case oGpgAgentInfo:
|
case oGpgAgentInfo:
|
||||||
obsolete_option (configname, configlineno, "--gpg-agent-info");
|
obsolete_option (configname, configlineno, "--gpg-agent-info");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2286,12 +2289,12 @@ main (int argc, char **argv)
|
|||||||
case oNoArmor: opt.no_armor=1; opt.armor=0; break;
|
case oNoArmor: opt.no_armor=1; opt.armor=0; break;
|
||||||
case oNoDefKeyring: default_keyring = 0; break;
|
case oNoDefKeyring: default_keyring = 0; break;
|
||||||
case oNoGreeting: nogreeting = 1; break;
|
case oNoGreeting: nogreeting = 1; break;
|
||||||
case oNoVerbose:
|
case oNoVerbose:
|
||||||
opt.verbose = 0;
|
opt.verbose = 0;
|
||||||
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
|
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
|
||||||
opt.list_sigs=0;
|
opt.list_sigs=0;
|
||||||
break;
|
break;
|
||||||
case oQuickRandom:
|
case oQuickRandom:
|
||||||
gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
|
gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
|
||||||
break;
|
break;
|
||||||
case oEmitVersion: opt.no_version=0; break;
|
case oEmitVersion: opt.no_version=0; break;
|
||||||
@ -2321,12 +2324,12 @@ main (int argc, char **argv)
|
|||||||
case oWithColons: opt.with_colons=':'; break;
|
case oWithColons: opt.with_colons=':'; break;
|
||||||
|
|
||||||
case oWithSigCheck: opt.check_sigs = 1; /*FALLTHRU*/
|
case oWithSigCheck: opt.check_sigs = 1; /*FALLTHRU*/
|
||||||
case oWithSigList: opt.list_sigs = 1; break;
|
case oWithSigList: opt.list_sigs = 1; break;
|
||||||
|
|
||||||
case oSkipVerify: opt.skip_verify=1; break;
|
case oSkipVerify: opt.skip_verify=1; break;
|
||||||
|
|
||||||
case oSkipHiddenRecipients:
|
case oSkipHiddenRecipients:
|
||||||
case oNoSkipHiddenRecipients:
|
case oNoSkipHiddenRecipients:
|
||||||
/* Dummies for options to be used in 2.1. */
|
/* Dummies for options to be used in 2.1. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2574,7 +2577,7 @@ main (int argc, char **argv)
|
|||||||
case oCommandFile:
|
case oCommandFile:
|
||||||
opt.command_fd = open_info_file (pargs.r.ret_str, 0, 1);
|
opt.command_fd = open_info_file (pargs.r.ret_str, 0, 1);
|
||||||
break;
|
break;
|
||||||
case oCipherAlgo:
|
case oCipherAlgo:
|
||||||
def_cipher_string = xstrdup(pargs.r.ret_str);
|
def_cipher_string = xstrdup(pargs.r.ret_str);
|
||||||
break;
|
break;
|
||||||
case oDigestAlgo:
|
case oDigestAlgo:
|
||||||
@ -2604,12 +2607,12 @@ main (int argc, char **argv)
|
|||||||
compress_algo_string = xstrdup(pargs.r.ret_str);
|
compress_algo_string = xstrdup(pargs.r.ret_str);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case oCertDigestAlgo:
|
case oCertDigestAlgo:
|
||||||
cert_digest_string = xstrdup(pargs.r.ret_str);
|
cert_digest_string = xstrdup(pargs.r.ret_str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case oNoSecmemWarn:
|
case oNoSecmemWarn:
|
||||||
gcry_control (GCRYCTL_DISABLE_SECMEM_WARN);
|
gcry_control (GCRYCTL_DISABLE_SECMEM_WARN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case oRequireSecmem: require_secmem=1; break;
|
case oRequireSecmem: require_secmem=1; break;
|
||||||
@ -2882,8 +2885,8 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case oStrict:
|
case oStrict:
|
||||||
case oNoStrict:
|
case oNoStrict:
|
||||||
/* Not used */
|
/* Not used */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2908,8 +2911,8 @@ main (int argc, char **argv)
|
|||||||
opt.exit_on_status_write_error = 1;
|
opt.exit_on_status_write_error = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case oLimitCardInsertTries:
|
case oLimitCardInsertTries:
|
||||||
opt.limit_card_insert_tries = pargs.r.ret_int;
|
opt.limit_card_insert_tries = pargs.r.ret_int;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case oRequireCrossCert: opt.flags.require_cross_cert=1; break;
|
case oRequireCrossCert: opt.flags.require_cross_cert=1; break;
|
||||||
@ -2943,7 +2946,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
case oNoop: break;
|
case oNoop: break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
|
pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3350,12 +3353,12 @@ main (int argc, char **argv)
|
|||||||
avoid adding the secret keyring for a couple of commands to
|
avoid adding the secret keyring for a couple of commands to
|
||||||
avoid unneeded access in case the secrings are stored on a
|
avoid unneeded access in case the secrings are stored on a
|
||||||
floppy.
|
floppy.
|
||||||
|
|
||||||
We always need to add the keyrings if we are running under
|
We always need to add the keyrings if we are running under
|
||||||
SELinux, this is so that the rings are added to the list of
|
SELinux, this is so that the rings are added to the list of
|
||||||
secured files. */
|
secured files. */
|
||||||
if( ALWAYS_ADD_KEYRINGS
|
if( ALWAYS_ADD_KEYRINGS
|
||||||
|| (cmd != aDeArmor && cmd != aEnArmor && cmd != aGPGConfTest) )
|
|| (cmd != aDeArmor && cmd != aEnArmor && cmd != aGPGConfTest) )
|
||||||
{
|
{
|
||||||
if (ALWAYS_ADD_KEYRINGS
|
if (ALWAYS_ADD_KEYRINGS
|
||||||
|| (cmd != aCheckKeys && cmd != aListSigs && cmd != aListKeys
|
|| (cmd != aCheckKeys && cmd != aListSigs && cmd != aListKeys
|
||||||
@ -3405,11 +3408,11 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case aStore:
|
case aStore:
|
||||||
case aSym:
|
case aSym:
|
||||||
case aSign:
|
case aSign:
|
||||||
case aSignSym:
|
case aSignSym:
|
||||||
case aClearsign:
|
case aClearsign:
|
||||||
if (!opt.quiet && any_explicit_recipient)
|
if (!opt.quiet && any_explicit_recipient)
|
||||||
log_info (_("WARNING: recipients (-r) given "
|
log_info (_("WARNING: recipients (-r) given "
|
||||||
"without using public key encryption\n"));
|
"without using public key encryption\n"));
|
||||||
@ -3579,7 +3582,7 @@ main (int argc, char **argv)
|
|||||||
log_error("decrypt_message failed: %s\n", g10_errstr(rc) );
|
log_error("decrypt_message failed: %s\n", g10_errstr(rc) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aSignKey:
|
case aSignKey:
|
||||||
if( argc != 1 )
|
if( argc != 1 )
|
||||||
wrong_args(_("--sign-key user-id"));
|
wrong_args(_("--sign-key user-id"));
|
||||||
@ -3951,7 +3954,7 @@ main (int argc, char **argv)
|
|||||||
wrong_args("--import-ownertrust [file]");
|
wrong_args("--import-ownertrust [file]");
|
||||||
import_ownertrust( argc? *argv:NULL );
|
import_ownertrust( argc? *argv:NULL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aRebuildKeydbCaches:
|
case aRebuildKeydbCaches:
|
||||||
if (argc)
|
if (argc)
|
||||||
wrong_args ("--rebuild-keydb-caches");
|
wrong_args ("--rebuild-keydb-caches");
|
||||||
@ -4064,7 +4067,7 @@ g10_exit( int rc )
|
|||||||
gcry_control (GCRYCTL_DUMP_SECMEM_STATS );
|
gcry_control (GCRYCTL_DUMP_SECMEM_STATS );
|
||||||
|
|
||||||
emergency_cleanup ();
|
emergency_cleanup ();
|
||||||
|
|
||||||
rc = rc? rc : log_get_errorcount(0)? 2 : g10_errors_seen? 1 : 0;
|
rc = rc? rc : log_get_errorcount(0)? 2 : g10_errors_seen? 1 : 0;
|
||||||
exit (rc);
|
exit (rc);
|
||||||
}
|
}
|
||||||
@ -4158,12 +4161,12 @@ print_hashline( gcry_md_hd_t md, int algo, const char *fname )
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
const byte *p;
|
const byte *p;
|
||||||
|
|
||||||
if ( fname ) {
|
if ( fname ) {
|
||||||
for (p = fname; *p; p++ ) {
|
for (p = fname; *p; p++ ) {
|
||||||
if ( *p <= 32 || *p > 127 || *p == ':' || *p == '%' )
|
if ( *p <= 32 || *p > 127 || *p == ':' || *p == '%' )
|
||||||
printf("%%%02X", *p );
|
printf("%%%02X", *p );
|
||||||
else
|
else
|
||||||
putchar( *p );
|
putchar( *p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4171,7 +4174,7 @@ print_hashline( gcry_md_hd_t md, int algo, const char *fname )
|
|||||||
printf("%d:", algo );
|
printf("%d:", algo );
|
||||||
p = gcry_md_read (md, algo);
|
p = gcry_md_read (md, algo);
|
||||||
n = gcry_md_get_algo_dlen (algo);
|
n = gcry_md_get_algo_dlen (algo);
|
||||||
for(i=0; i < n ; i++, p++ )
|
for(i=0; i < n ; i++, p++ )
|
||||||
printf("%02X", *p );
|
printf("%02X", *p );
|
||||||
putchar(':');
|
putchar(':');
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@ -4229,7 +4232,7 @@ print_mds( const char *fname, int algo )
|
|||||||
else {
|
else {
|
||||||
gcry_md_final (md);
|
gcry_md_final (md);
|
||||||
if ( opt.with_colons ) {
|
if ( opt.with_colons ) {
|
||||||
if ( algo )
|
if ( algo )
|
||||||
print_hashline( md, algo, fname );
|
print_hashline( md, algo, fname );
|
||||||
else {
|
else {
|
||||||
print_hashline( md, GCRY_MD_MD5, fname );
|
print_hashline( md, GCRY_MD_MD5, fname );
|
||||||
@ -4328,7 +4331,7 @@ add_policy_url( const char *string, int which )
|
|||||||
sl=add_to_strlist( &opt.sig_policy_url, string );
|
sl=add_to_strlist( &opt.sig_policy_url, string );
|
||||||
|
|
||||||
if(critical)
|
if(critical)
|
||||||
sl->flags |= 1;
|
sl->flags |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4361,5 +4364,5 @@ add_keyserver_url( const char *string, int which )
|
|||||||
sl=add_to_strlist( &opt.sig_keyserver_url, string );
|
sl=add_to_strlist( &opt.sig_keyserver_url, string );
|
||||||
|
|
||||||
if(critical)
|
if(critical)
|
||||||
sl->flags |= 1;
|
sl->flags |= 1;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#ifndef CSIDL_APPDATA
|
#ifndef CSIDL_APPDATA
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# ifndef VER_PLATFORM_WIN32_WINDOWS
|
# ifndef VER_PLATFORM_WIN32_WINDOWS
|
||||||
# define VER_PLATFORM_WIN32_WINDOWS 1
|
# define VER_PLATFORM_WIN32_WINDOWS 1
|
||||||
@ -121,7 +124,7 @@ generate_photo_id(PKT_public_key *pk,const char *photo_name)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
len=iobuf_get_filelength(file, &overflow);
|
len=iobuf_get_filelength(file, &overflow);
|
||||||
if(len>6144 || overflow)
|
if(len>6144 || overflow)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -230,7 +233,7 @@ length_sans_trailing_chars (const unsigned char *line, size_t len,
|
|||||||
{
|
{
|
||||||
const unsigned char *p, *mark;
|
const unsigned char *p, *mark;
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
for( mark=NULL, p=line, n=0; n < len; n++, p++ )
|
for( mark=NULL, p=line, n=0; n < len; n++, p++ )
|
||||||
{
|
{
|
||||||
if (strchr (trimchars, *p ))
|
if (strchr (trimchars, *p ))
|
||||||
@ -241,8 +244,8 @@ length_sans_trailing_chars (const unsigned char *line, size_t len,
|
|||||||
else
|
else
|
||||||
mark = NULL;
|
mark = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mark)
|
if (mark)
|
||||||
return mark - line;
|
return mark - line;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@ -355,16 +358,16 @@ do_make_filename (int xmode, const char *first_part, va_list arg_ptr)
|
|||||||
{
|
{
|
||||||
const char *argv[32];
|
const char *argv[32];
|
||||||
int argc;
|
int argc;
|
||||||
size_t n;
|
size_t n;
|
||||||
int skip = 1;
|
int skip = 1;
|
||||||
char *home_buffer = NULL;
|
char *home_buffer = NULL;
|
||||||
char *name, *home, *p;
|
char *name, *home, *p;
|
||||||
|
|
||||||
n = strlen (first_part) + 1;
|
n = strlen (first_part) + 1;
|
||||||
argc = 0;
|
argc = 0;
|
||||||
while ( (argv[argc] = va_arg (arg_ptr, const char *)) )
|
while ( (argv[argc] = va_arg (arg_ptr, const char *)) )
|
||||||
{
|
{
|
||||||
n += strlen (argv[argc]) + 1;
|
n += strlen (argv[argc]) + 1;
|
||||||
if (argc >= DIM (argv)-1)
|
if (argc >= DIM (argv)-1)
|
||||||
{
|
{
|
||||||
if (xmode)
|
if (xmode)
|
||||||
@ -372,11 +375,11 @@ do_make_filename (int xmode, const char *first_part, va_list arg_ptr)
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
argc++;
|
argc++;
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
home = NULL;
|
home = NULL;
|
||||||
if (*first_part == '~')
|
if (*first_part == '~')
|
||||||
{
|
{
|
||||||
if (first_part[1] == '/' || !first_part[1])
|
if (first_part[1] == '/' || !first_part[1])
|
||||||
@ -386,13 +389,13 @@ do_make_filename (int xmode, const char *first_part, va_list arg_ptr)
|
|||||||
if (!home)
|
if (!home)
|
||||||
home = home_buffer = get_pwdir (xmode, NULL);
|
home = home_buffer = get_pwdir (xmode, NULL);
|
||||||
if (home && *home)
|
if (home && *home)
|
||||||
n += strlen (home);
|
n += strlen (home);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This is the "~username/" or "~username" case. */
|
/* This is the "~username/" or "~username" case. */
|
||||||
char *user;
|
char *user;
|
||||||
|
|
||||||
if (xmode)
|
if (xmode)
|
||||||
user = jnlib_xstrdup (first_part+1);
|
user = jnlib_xstrdup (first_part+1);
|
||||||
else
|
else
|
||||||
@ -405,7 +408,7 @@ do_make_filename (int xmode, const char *first_part, va_list arg_ptr)
|
|||||||
if (p)
|
if (p)
|
||||||
*p = 0;
|
*p = 0;
|
||||||
skip = 1 + strlen (user);
|
skip = 1 + strlen (user);
|
||||||
|
|
||||||
home = home_buffer = get_pwdir (xmode, user);
|
home = home_buffer = get_pwdir (xmode, user);
|
||||||
jnlib_free (user);
|
jnlib_free (user);
|
||||||
if (home)
|
if (home)
|
||||||
@ -426,7 +429,7 @@ do_make_filename (int xmode, const char *first_part, va_list arg_ptr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (home)
|
if (home)
|
||||||
p = stpcpy (stpcpy (name, home), first_part + skip);
|
p = stpcpy (stpcpy (name, home), first_part + skip);
|
||||||
else
|
else
|
||||||
@ -481,9 +484,9 @@ int
|
|||||||
compare_filenames (const char *a, const char *b)
|
compare_filenames (const char *a, const char *b)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DRIVE_LETTERS
|
#ifdef HAVE_DRIVE_LETTERS
|
||||||
for ( ; *a && *b; a++, b++ )
|
for ( ; *a && *b; a++, b++ )
|
||||||
{
|
{
|
||||||
if (*a != *b
|
if (*a != *b
|
||||||
&& (toupper (*(const unsigned char*)a)
|
&& (toupper (*(const unsigned char*)a)
|
||||||
!= toupper (*(const unsigned char*)b) )
|
!= toupper (*(const unsigned char*)b) )
|
||||||
&& !((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/')))
|
&& !((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/')))
|
||||||
@ -492,7 +495,7 @@ compare_filenames (const char *a, const char *b)
|
|||||||
if ((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/'))
|
if ((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/'))
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return (toupper (*(const unsigned char*)a)
|
return (toupper (*(const unsigned char*)a)
|
||||||
- toupper (*(const unsigned char*)b));
|
- toupper (*(const unsigned char*)b));
|
||||||
#else
|
#else
|
||||||
return strcmp(a,b);
|
return strcmp(a,b);
|
||||||
@ -531,7 +534,7 @@ hextobyte (const char *s)
|
|||||||
/* Print a BUFFER to stream FP while replacing all control characters
|
/* Print a BUFFER to stream FP while replacing all control characters
|
||||||
and the characters DELIM and DELIM2 with standard C escape
|
and the characters DELIM and DELIM2 with standard C escape
|
||||||
sequences. Returns the number of characters printed. */
|
sequences. Returns the number of characters printed. */
|
||||||
size_t
|
size_t
|
||||||
print_sanitized_buffer2 (FILE *fp, const void *buffer, size_t length,
|
print_sanitized_buffer2 (FILE *fp, const void *buffer, size_t length,
|
||||||
int delim, int delim2)
|
int delim, int delim2)
|
||||||
{
|
{
|
||||||
@ -540,9 +543,9 @@ print_sanitized_buffer2 (FILE *fp, const void *buffer, size_t length,
|
|||||||
|
|
||||||
for (; length; length--, p++, count++)
|
for (; length; length--, p++, count++)
|
||||||
{
|
{
|
||||||
if (*p < 0x20
|
if (*p < 0x20
|
||||||
|| *p == 0x7f
|
|| *p == 0x7f
|
||||||
|| *p == delim
|
|| *p == delim
|
||||||
|| *p == delim2
|
|| *p == delim2
|
||||||
|| ((delim || delim2) && *p=='\\'))
|
|| ((delim || delim2) && *p=='\\'))
|
||||||
{
|
{
|
||||||
@ -595,7 +598,7 @@ print_sanitized_buffer2 (FILE *fp, const void *buffer, size_t length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Same as print_sanitized_buffer2 but with just one delimiter. */
|
/* Same as print_sanitized_buffer2 but with just one delimiter. */
|
||||||
size_t
|
size_t
|
||||||
print_sanitized_buffer (FILE *fp, const void *buffer, size_t length,
|
print_sanitized_buffer (FILE *fp, const void *buffer, size_t length,
|
||||||
int delim)
|
int delim)
|
||||||
{
|
{
|
||||||
@ -603,7 +606,7 @@ print_sanitized_buffer (FILE *fp, const void *buffer, size_t length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
print_sanitized_utf8_buffer (FILE *fp, const void *buffer,
|
print_sanitized_utf8_buffer (FILE *fp, const void *buffer,
|
||||||
size_t length, int delim)
|
size_t length, int delim)
|
||||||
{
|
{
|
||||||
@ -611,7 +614,7 @@ print_sanitized_utf8_buffer (FILE *fp, const void *buffer,
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/* We can handle plain ascii simpler, so check for it first. */
|
/* We can handle plain ascii simpler, so check for it first. */
|
||||||
for (i=0; i < length; i++ )
|
for (i=0; i < length; i++ )
|
||||||
{
|
{
|
||||||
if ( (p[i] & 0x80) )
|
if ( (p[i] & 0x80) )
|
||||||
break;
|
break;
|
||||||
@ -630,20 +633,20 @@ print_sanitized_utf8_buffer (FILE *fp, const void *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
print_sanitized_string2 (FILE *fp, const char *string, int delim, int delim2)
|
print_sanitized_string2 (FILE *fp, const char *string, int delim, int delim2)
|
||||||
{
|
{
|
||||||
return string? print_sanitized_buffer2 (fp, string, strlen (string),
|
return string? print_sanitized_buffer2 (fp, string, strlen (string),
|
||||||
delim, delim2):0;
|
delim, delim2):0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
print_sanitized_string (FILE *fp, const char *string, int delim)
|
print_sanitized_string (FILE *fp, const char *string, int delim)
|
||||||
{
|
{
|
||||||
return string? print_sanitized_buffer (fp, string, strlen (string), delim):0;
|
return string? print_sanitized_buffer (fp, string, strlen (string), delim):0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
print_sanitized_utf8_string (FILE *fp, const char *string, int delim)
|
print_sanitized_utf8_string (FILE *fp, const char *string, int delim)
|
||||||
{
|
{
|
||||||
return string? print_sanitized_utf8_buffer (fp,
|
return string? print_sanitized_utf8_buffer (fp,
|
||||||
@ -663,7 +666,7 @@ sanitize_buffer (const void *p_arg, size_t n, int delim)
|
|||||||
char *buffer, *d;
|
char *buffer, *d;
|
||||||
|
|
||||||
/* First count length. */
|
/* First count length. */
|
||||||
for (save_n = n, save_p = p, buflen=1 ; n; n--, p++ )
|
for (save_n = n, save_p = p, buflen=1 ; n; n--, p++ )
|
||||||
{
|
{
|
||||||
if ( *p < 0x20 || *p == 0x7f || *p == delim || (delim && *p=='\\'))
|
if ( *p < 0x20 || *p == 0x7f || *p == delim || (delim && *p=='\\'))
|
||||||
{
|
{
|
||||||
@ -735,13 +738,13 @@ const char *
|
|||||||
w32_strerror (int ec)
|
w32_strerror (int ec)
|
||||||
{
|
{
|
||||||
static char strerr[256];
|
static char strerr[256];
|
||||||
|
|
||||||
if (ec == -1)
|
if (ec == -1)
|
||||||
ec = (int)GetLastError ();
|
ec = (int)GetLastError ();
|
||||||
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec,
|
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec,
|
||||||
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
|
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
strerr, DIM (strerr)-1, NULL);
|
strerr, DIM (strerr)-1, NULL);
|
||||||
return strerr;
|
return strerr;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_W32_SYSTEM*/
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
|
|
||||||
@ -762,7 +765,7 @@ ascii_islower (int c)
|
|||||||
return c >= 'a' && c <= 'z';
|
return c >= 'a' && c <= 'z';
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ascii_toupper (int c)
|
ascii_toupper (int c)
|
||||||
{
|
{
|
||||||
if (c >= 'a' && c <= 'z')
|
if (c >= 'a' && c <= 'z')
|
||||||
@ -770,7 +773,7 @@ ascii_toupper (int c)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ascii_tolower (int c)
|
ascii_tolower (int c)
|
||||||
{
|
{
|
||||||
if (c >= 'A' && c <= 'Z')
|
if (c >= 'A' && c <= 'Z')
|
||||||
@ -792,7 +795,7 @@ ascii_strcasecmp( const char *a, const char *b )
|
|||||||
return *a == *b? 0 : (ascii_toupper (*a) - ascii_toupper (*b));
|
return *a == *b? 0 : (ascii_toupper (*a) - ascii_toupper (*b));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ascii_strncasecmp (const char *a, const char *b, size_t n)
|
ascii_strncasecmp (const char *a, const char *b, size_t n)
|
||||||
{
|
{
|
||||||
const unsigned char *p1 = (const unsigned char *)a;
|
const unsigned char *p1 = (const unsigned char *)a;
|
||||||
@ -814,7 +817,7 @@ ascii_strncasecmp (const char *a, const char *b, size_t n)
|
|||||||
++p2;
|
++p2;
|
||||||
}
|
}
|
||||||
while (c1 == c2);
|
while (c1 == c2);
|
||||||
|
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -860,7 +863,7 @@ ascii_memcasemem (const void *haystack, size_t nhaystack,
|
|||||||
{
|
{
|
||||||
const char *a = haystack;
|
const char *a = haystack;
|
||||||
const char *b = a + nhaystack - nneedle;
|
const char *b = a + nhaystack - nneedle;
|
||||||
|
|
||||||
for (; a <= b; a++)
|
for (; a <= b; a++)
|
||||||
{
|
{
|
||||||
if ( !ascii_memcasecmp (a, needle, nneedle) )
|
if ( !ascii_memcasecmp (a, needle, nneedle) )
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
modify it under the terms of the GNU Lesser General Public License
|
modify it under the terms of the GNU Lesser General Public License
|
||||||
as published by the Free Software Foundation; either version 2.1 of
|
as published by the Free Software Foundation; either version 2.1 of
|
||||||
the License, or (at your option) any later version.
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but
|
This program is distributed in the hope that it will be useful, but
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -32,6 +32,9 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef JNLIB_IN_JNLIB
|
#ifdef JNLIB_IN_JNLIB
|
||||||
@ -595,8 +598,8 @@
|
|||||||
#ifndef SUBLANG_UZBEK_CYRILLIC
|
#ifndef SUBLANG_UZBEK_CYRILLIC
|
||||||
#define SUBLANG_UZBEK_CYRILLIC 0x02
|
#define SUBLANG_UZBEK_CYRILLIC 0x02
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Return an XPG style locale name
|
/* Return an XPG style locale name
|
||||||
language[_territory[.codeset]][@modifier].
|
language[_territory[.codeset]][@modifier].
|
||||||
Don't even bother determining the codeset; it's not useful in this
|
Don't even bother determining the codeset; it's not useful in this
|
||||||
context, because message catalogs are not specific to a single
|
context, because message catalogs are not specific to a single
|
||||||
@ -1034,7 +1037,7 @@ hash_string( const char *str_param )
|
|||||||
{
|
{
|
||||||
unsigned long int hval, g;
|
unsigned long int hval, g;
|
||||||
const char *str = str_param;
|
const char *str = str_param;
|
||||||
|
|
||||||
hval = 0;
|
hval = 0;
|
||||||
while (*str != '\0')
|
while (*str != '\0')
|
||||||
{
|
{
|
||||||
@ -1158,7 +1161,7 @@ free_domain (struct loaded_domain *domain)
|
|||||||
jnlib_free (domain);
|
jnlib_free (domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct loaded_domain *
|
static struct loaded_domain *
|
||||||
load_domain (const char *filename)
|
load_domain (const char *filename)
|
||||||
{
|
{
|
||||||
@ -1169,7 +1172,7 @@ load_domain (const char *filename)
|
|||||||
struct loaded_domain *domain = NULL;
|
struct loaded_domain *domain = NULL;
|
||||||
size_t to_read;
|
size_t to_read;
|
||||||
char *read_ptr;
|
char *read_ptr;
|
||||||
|
|
||||||
fp = fopen (filename, "rb");
|
fp = fopen (filename, "rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1225,7 +1228,7 @@ load_domain (const char *filename)
|
|||||||
domain->data = (char *) data;
|
domain->data = (char *) data;
|
||||||
domain->data_native = (char *) data + size;
|
domain->data_native = (char *) data + size;
|
||||||
domain->must_swap = data->magic != MAGIC;
|
domain->must_swap = data->magic != MAGIC;
|
||||||
|
|
||||||
/* Fill in the information about the available tables. */
|
/* Fill in the information about the available tables. */
|
||||||
switch (SWAPIT (domain->must_swap, data->revision))
|
switch (SWAPIT (domain->must_swap, data->revision))
|
||||||
{
|
{
|
||||||
@ -1276,7 +1279,7 @@ utf8_to_wchar (const char *string, size_t length, size_t *retlen)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
nbytes = (size_t)(n+1) * sizeof(*result);
|
nbytes = (size_t)(n+1) * sizeof(*result);
|
||||||
if (nbytes / sizeof(*result) != (n+1))
|
if (nbytes / sizeof(*result) != (n+1))
|
||||||
{
|
{
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1465,17 +1468,17 @@ get_string (struct loaded_domain *domain, uint32_t idx,
|
|||||||
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
||||||
translen = SWAPIT(domain->must_swap, domain->trans_tab[idx].length);
|
translen = SWAPIT(domain->must_swap, domain->trans_tab[idx].length);
|
||||||
}
|
}
|
||||||
else if (!domain->mapped[idx])
|
else if (!domain->mapped[idx])
|
||||||
{
|
{
|
||||||
/* Not yet mapped. Map from utf-8 to native encoding now. */
|
/* Not yet mapped. Map from utf-8 to native encoding now. */
|
||||||
const char *p_utf8;
|
const char *p_utf8;
|
||||||
size_t plen_utf8, buflen;
|
size_t plen_utf8, buflen;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
p_utf8 = (domain->data
|
p_utf8 = (domain->data
|
||||||
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
||||||
plen_utf8 = SWAPIT(domain->must_swap, domain->trans_tab[idx].length);
|
plen_utf8 = SWAPIT(domain->must_swap, domain->trans_tab[idx].length);
|
||||||
|
|
||||||
buf = utf8_to_native (p_utf8, plen_utf8, &buflen);
|
buf = utf8_to_native (p_utf8, plen_utf8, &buflen);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
@ -1487,7 +1490,7 @@ get_string (struct loaded_domain *domain, uint32_t idx,
|
|||||||
/* Copy into the DATA_NATIVE area. */
|
/* Copy into the DATA_NATIVE area. */
|
||||||
char *p_tmp;
|
char *p_tmp;
|
||||||
|
|
||||||
p_tmp = (domain->data_native
|
p_tmp = (domain->data_native
|
||||||
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
||||||
memcpy (p_tmp, buf, buflen);
|
memcpy (p_tmp, buf, buflen);
|
||||||
domain->mapped[idx] = buflen;
|
domain->mapped[idx] = buflen;
|
||||||
@ -1523,7 +1526,7 @@ get_string (struct loaded_domain *domain, uint32_t idx,
|
|||||||
}
|
}
|
||||||
jnlib_free (buf);
|
jnlib_free (buf);
|
||||||
}
|
}
|
||||||
else if (domain->mapped[idx] == 1)
|
else if (domain->mapped[idx] == 1)
|
||||||
{
|
{
|
||||||
/* The translated string is in the overflow_space. */
|
/* The translated string is in the overflow_space. */
|
||||||
for (os=domain->overflow_space; os; os = os->next)
|
for (os=domain->overflow_space; os; os = os->next)
|
||||||
@ -1540,8 +1543,8 @@ get_string (struct loaded_domain *domain, uint32_t idx,
|
|||||||
translen = 0;
|
translen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trans = (domain->data_native
|
trans = (domain->data_native
|
||||||
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
+ SWAPIT(domain->must_swap, domain->trans_tab[idx].offset));
|
||||||
translen = domain->mapped[idx];
|
translen = domain->mapped[idx];
|
||||||
@ -1559,7 +1562,7 @@ do_gettext (const char *msgid, const char *msgid2, unsigned long nplural)
|
|||||||
{
|
{
|
||||||
struct loaded_domain *domain;
|
struct loaded_domain *domain;
|
||||||
uint32_t top, bottom, nstr;
|
uint32_t top, bottom, nstr;
|
||||||
|
|
||||||
if (!(domain = the_domain))
|
if (!(domain = the_domain))
|
||||||
goto not_found;
|
goto not_found;
|
||||||
|
|
||||||
@ -1576,7 +1579,7 @@ do_gettext (const char *msgid, const char *msgid2, unsigned long nplural)
|
|||||||
{
|
{
|
||||||
nstr--;
|
nstr--;
|
||||||
if (nstr < domain->nstrings
|
if (nstr < domain->nstrings
|
||||||
&& SWAPIT(domain->must_swap,
|
&& SWAPIT(domain->must_swap,
|
||||||
domain->orig_tab[nstr].length) >= len
|
domain->orig_tab[nstr].length) >= len
|
||||||
&& !strcmp (msgid, (domain->data
|
&& !strcmp (msgid, (domain->data
|
||||||
+ SWAPIT(domain->must_swap,
|
+ SWAPIT(domain->must_swap,
|
||||||
@ -1599,7 +1602,7 @@ do_gettext (const char *msgid, const char *msgid2, unsigned long nplural)
|
|||||||
while (bottom < top)
|
while (bottom < top)
|
||||||
{
|
{
|
||||||
int cmp_val;
|
int cmp_val;
|
||||||
|
|
||||||
nstr = (bottom + top) / 2;
|
nstr = (bottom + top) / 2;
|
||||||
cmp_val = strcmp (msgid, (domain->data
|
cmp_val = strcmp (msgid, (domain->data
|
||||||
+ SWAPIT(domain->must_swap,
|
+ SWAPIT(domain->must_swap,
|
||||||
@ -1671,10 +1674,10 @@ gettext_select_utf8 (int value)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char atext1[] =
|
const char atext1[] =
|
||||||
"Warning: You have entered an insecure passphrase.%%0A"
|
"Warning: You have entered an insecure passphrase.%%0A"
|
||||||
"A passphrase should be at least %u character long.";
|
"A passphrase should be at least %u character long.";
|
||||||
const char atext2[] =
|
const char atext2[] =
|
||||||
"Warning: You have entered an insecure passphrase.%%0A"
|
"Warning: You have entered an insecure passphrase.%%0A"
|
||||||
"A passphrase should be at least %u characters long.";
|
"A passphrase should be at least %u characters long.";
|
||||||
|
|
||||||
@ -1683,7 +1686,7 @@ main (int argc, char **argv)
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bindtextdomain ("gnupg2", "c:/programme/gnu/gnupg/share/locale");
|
bindtextdomain ("gnupg2", "c:/programme/gnu/gnupg/share/locale");
|
||||||
|
|
||||||
printf ("locale is `%s'\n", gettext_localename ());
|
printf ("locale is `%s'\n", gettext_localename ());
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "libjnlib-config.h"
|
#include "libjnlib-config.h"
|
||||||
@ -34,7 +37,7 @@ static HKEY
|
|||||||
get_root_key(const char *root)
|
get_root_key(const char *root)
|
||||||
{
|
{
|
||||||
HKEY root_key;
|
HKEY root_key;
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
root_key = HKEY_CURRENT_USER;
|
root_key = HKEY_CURRENT_USER;
|
||||||
else if (!strcmp( root, "HKEY_CLASSES_ROOT" ) )
|
else if (!strcmp( root, "HKEY_CLASSES_ROOT" ) )
|
||||||
@ -51,7 +54,7 @@ get_root_key(const char *root)
|
|||||||
root_key = HKEY_CURRENT_CONFIG;
|
root_key = HKEY_CURRENT_CONFIG;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return root_key;
|
return root_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,10 +68,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
|
|||||||
HKEY root_key, key_handle;
|
HKEY root_key, key_handle;
|
||||||
DWORD n1, nbytes, type;
|
DWORD n1, nbytes, type;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
if ( !(root_key = get_root_key(root) ) )
|
if ( !(root_key = get_root_key(root) ) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ( RegOpenKeyEx( root_key, dir, 0, KEY_READ, &key_handle ) )
|
if ( RegOpenKeyEx( root_key, dir, 0, KEY_READ, &key_handle ) )
|
||||||
{
|
{
|
||||||
if (root)
|
if (root)
|
||||||
@ -94,7 +97,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
|
|||||||
if (type == REG_EXPAND_SZ && strchr (result, '%'))
|
if (type == REG_EXPAND_SZ && strchr (result, '%'))
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
n1 += 1000;
|
n1 += 1000;
|
||||||
tmp = jnlib_malloc (n1+1);
|
tmp = jnlib_malloc (n1+1);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
@ -111,7 +114,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
|
|||||||
if (nbytes && nbytes > n1)
|
if (nbytes && nbytes > n1)
|
||||||
{
|
{
|
||||||
/* Oops - truncated, better don't expand at all. */
|
/* Oops - truncated, better don't expand at all. */
|
||||||
jnlib_free (tmp);
|
jnlib_free (tmp);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
tmp[nbytes] = 0;
|
tmp[nbytes] = 0;
|
||||||
@ -126,14 +129,14 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
|
|||||||
result = jnlib_malloc (strlen (tmp)+1);
|
result = jnlib_malloc (strlen (tmp)+1);
|
||||||
if (!result)
|
if (!result)
|
||||||
result = tmp;
|
result = tmp;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy (result, tmp);
|
strcpy (result, tmp);
|
||||||
jnlib_free (tmp);
|
jnlib_free (tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Error - don't expand. */
|
/* Error - don't expand. */
|
||||||
jnlib_free (tmp);
|
jnlib_free (tmp);
|
||||||
}
|
}
|
||||||
@ -146,22 +149,22 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
write_w32_registry_string (const char *root, const char *dir,
|
write_w32_registry_string (const char *root, const char *dir,
|
||||||
const char *name, const char *value)
|
const char *name, const char *value)
|
||||||
{
|
{
|
||||||
HKEY root_key, reg_key;
|
HKEY root_key, reg_key;
|
||||||
|
|
||||||
if ( !(root_key = get_root_key(root) ) )
|
if ( !(root_key = get_root_key(root) ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( RegOpenKeyEx( root_key, dir, 0, KEY_WRITE, ®_key )
|
if ( RegOpenKeyEx( root_key, dir, 0, KEY_WRITE, ®_key )
|
||||||
!= ERROR_SUCCESS )
|
!= ERROR_SUCCESS )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( RegSetValueEx (reg_key, name, 0, REG_SZ, (BYTE *)value,
|
if ( RegSetValueEx (reg_key, name, 0, REG_SZ, (BYTE *)value,
|
||||||
strlen( value ) ) != ERROR_SUCCESS )
|
strlen( value ) ) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
if ( RegCreateKey( root_key, name, ®_key ) != ERROR_SUCCESS )
|
if ( RegCreateKey( root_key, name, ®_key ) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
RegCloseKey(reg_key);
|
RegCloseKey(reg_key);
|
||||||
return -1;
|
return -1;
|
||||||
@ -173,9 +176,9 @@ write_w32_registry_string (const char *root, const char *dir,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey (reg_key);
|
RegCloseKey (reg_key);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
#include <windows.h>
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -79,9 +82,9 @@ connect_server (const char *server, unsigned short port)
|
|||||||
|
|
||||||
/* Win32 gethostbyname doesn't handle IP addresses internally, so we
|
/* Win32 gethostbyname doesn't handle IP addresses internally, so we
|
||||||
try inet_addr first on that platform only. */
|
try inet_addr first on that platform only. */
|
||||||
if ((l = inet_addr (server)) != INADDR_NONE)
|
if ((l = inet_addr (server)) != INADDR_NONE)
|
||||||
memcpy (&addr.sin_addr, &l, sizeof l);
|
memcpy (&addr.sin_addr, &l, sizeof l);
|
||||||
else if ((hp = gethostbyname (server)))
|
else if ((hp = gethostbyname (server)))
|
||||||
{
|
{
|
||||||
if (hp->h_addrtype != AF_INET)
|
if (hp->h_addrtype != AF_INET)
|
||||||
{
|
{
|
||||||
@ -107,14 +110,14 @@ connect_server (const char *server, unsigned short port)
|
|||||||
sock = socket (AF_INET, SOCK_STREAM, 0);
|
sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||||
if (sock == INVALID_SOCKET)
|
if (sock == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
fprintf (console, "gpgkeys: error creating socket: ec=%d\n",
|
fprintf (console, "gpgkeys: error creating socket: ec=%d\n",
|
||||||
(int)WSAGetLastError ());
|
(int)WSAGetLastError ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect (sock, (struct sockaddr *)&addr, sizeof addr))
|
if (connect (sock, (struct sockaddr *)&addr, sizeof addr))
|
||||||
{
|
{
|
||||||
fprintf (console, "gpgkeys: error connecting `%s': ec=%d\n",
|
fprintf (console, "gpgkeys: error connecting `%s': ec=%d\n",
|
||||||
server, (int)WSAGetLastError ());
|
server, (int)WSAGetLastError ());
|
||||||
sock_close (sock);
|
sock_close (sock);
|
||||||
return -1;
|
return -1;
|
||||||
@ -134,26 +137,26 @@ connect_server (const char *server, unsigned short port)
|
|||||||
server, strerror (errno));
|
server, strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr.sin_addr = *(struct in_addr*)host->h_addr;
|
addr.sin_addr = *(struct in_addr*)host->h_addr;
|
||||||
|
|
||||||
sock = socket (AF_INET, SOCK_STREAM, 0);
|
sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||||
if (sock == -1)
|
if (sock == -1)
|
||||||
{
|
{
|
||||||
fprintf (console, "gpgkeys: error creating socket: %s\n",
|
fprintf (console, "gpgkeys: error creating socket: %s\n",
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect (sock, (struct sockaddr *)&addr, sizeof addr) == -1)
|
if (connect (sock, (struct sockaddr *)&addr, sizeof addr) == -1)
|
||||||
{
|
{
|
||||||
fprintf (console, "gpgkeys: error connecting `%s': %s\n",
|
fprintf (console, "gpgkeys: error connecting `%s': %s\n",
|
||||||
server, strerror (errno));
|
server, strerror (errno));
|
||||||
close (sock);
|
close (sock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,11 +166,11 @@ write_server (int sock, const char *data, size_t length)
|
|||||||
int nleft;
|
int nleft;
|
||||||
|
|
||||||
nleft = length;
|
nleft = length;
|
||||||
while (nleft > 0)
|
while (nleft > 0)
|
||||||
{
|
{
|
||||||
int nwritten;
|
int nwritten;
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
nwritten = send (sock, data, nleft, 0);
|
nwritten = send (sock, data, nleft, 0);
|
||||||
if ( nwritten == SOCKET_ERROR )
|
if ( nwritten == SOCKET_ERROR )
|
||||||
{
|
{
|
||||||
@ -184,7 +187,7 @@ write_server (int sock, const char *data, size_t length)
|
|||||||
if (errno == EAGAIN)
|
if (errno == EAGAIN)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 50000;
|
tv.tv_usec = 50000;
|
||||||
select(0, NULL, NULL, NULL, &tv);
|
select(0, NULL, NULL, NULL, &tv);
|
||||||
@ -197,7 +200,7 @@ write_server (int sock, const char *data, size_t length)
|
|||||||
nleft -=nwritten;
|
nleft -=nwritten;
|
||||||
data += nwritten;
|
data += nwritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +230,7 @@ send_request (const char *request, int *r_sock)
|
|||||||
return KEYSERVER_GENERAL_ERROR;
|
return KEYSERVER_GENERAL_ERROR;
|
||||||
}
|
}
|
||||||
*server++ = 0;
|
*server++ = 0;
|
||||||
|
|
||||||
sock = connect_server (server, 79);
|
sock = connect_server (server, 79);
|
||||||
if (sock == -1)
|
if (sock == -1)
|
||||||
{
|
{
|
||||||
@ -272,7 +275,7 @@ get_key (char *getkey)
|
|||||||
sock_close (sock);
|
sock_close (sock);
|
||||||
return KEYSERVER_OK;
|
return KEYSERVER_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hmmm, we use iobuf here only to cope with Windows socket
|
/* Hmmm, we use iobuf here only to cope with Windows socket
|
||||||
peculiarities (we can't used fdopen). */
|
peculiarities (we can't used fdopen). */
|
||||||
fp_read = iobuf_sockopen (sock , "r");
|
fp_read = iobuf_sockopen (sock , "r");
|
||||||
@ -286,7 +289,7 @@ get_key (char *getkey)
|
|||||||
while ( iobuf_read_line ( fp_read, &line, &buflen, &maxlen))
|
while ( iobuf_read_line ( fp_read, &line, &buflen, &maxlen))
|
||||||
{
|
{
|
||||||
maxlen=1024;
|
maxlen=1024;
|
||||||
|
|
||||||
if(gotit)
|
if(gotit)
|
||||||
{
|
{
|
||||||
print_nocr(output, (const char*)line);
|
print_nocr(output, (const char*)line);
|
||||||
@ -299,7 +302,7 @@ get_key (char *getkey)
|
|||||||
gotit=1;
|
gotit=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gotit)
|
if(gotit)
|
||||||
fprintf (output,"KEY 0x%s END\n", getkey);
|
fprintf (output,"KEY 0x%s END\n", getkey);
|
||||||
else
|
else
|
||||||
@ -316,7 +319,7 @@ get_key (char *getkey)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_help (FILE *fp)
|
show_help (FILE *fp)
|
||||||
{
|
{
|
||||||
fprintf (fp,"-h, --help\thelp\n");
|
fprintf (fp,"-h, --help\thelp\n");
|
||||||
|
@ -36,7 +36,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
#include <windows.h>
|
# ifdef HAVE_WINSOCK2_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
@ -78,7 +81,7 @@ register_timeout(void)
|
|||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
act.sa_flags=0;
|
act.sa_flags=0;
|
||||||
return sigaction(SIGALRM,&act,NULL);
|
return sigaction(SIGALRM,&act,NULL);
|
||||||
#else
|
#else
|
||||||
if(signal(SIGALRM,catch_alarm)==SIG_ERR)
|
if(signal(SIGALRM,catch_alarm)==SIG_ERR)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
@ -597,7 +600,7 @@ ks_hextobyte (const char *s)
|
|||||||
|
|
||||||
|
|
||||||
/* Non localized version of toupper. */
|
/* Non localized version of toupper. */
|
||||||
int
|
int
|
||||||
ks_toupper (int c)
|
ks_toupper (int c)
|
||||||
{
|
{
|
||||||
if (c >= 'a' && c <= 'z')
|
if (c >= 'a' && c <= 'z')
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(__APPLE__) || defined(_WIN32) || defined(__CYGWIN__)
|
||||||
typedef unsinged int pcsc_dword_t;
|
typedef unsigned int pcsc_dword_t;
|
||||||
#else
|
#else
|
||||||
typedef unsigned long pcsc_dword_t;
|
typedef unsigned long pcsc_dword_t;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user