mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
* armor.c, g10.c, kbnode.c, misc.c, pkclist.c, sign.c, build-packet.c,
getkey.c, keydb.c, openfile.c, plaintext.c, status.c, gpgv.c, keygen.c, options.h, sig-check.c, tdbio.h, encode.c, hkp.c, mainproc.c, parse-packet.c, signal.c, textfilter.c: Edit all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it.
This commit is contained in:
parent
b357540659
commit
898aa0ed02
@ -1,3 +1,13 @@
|
|||||||
|
2003-05-21 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* armor.c, g10.c, kbnode.c, misc.c, pkclist.c, sign.c,
|
||||||
|
build-packet.c, getkey.c, keydb.c, openfile.c, plaintext.c,
|
||||||
|
status.c, gpgv.c, keygen.c, options.h, sig-check.c, tdbio.h,
|
||||||
|
encode.c, hkp.c, mainproc.c, parse-packet.c, signal.c,
|
||||||
|
textfilter.c: Edit all preprocessor instructions to remove
|
||||||
|
whitespace before the '#'. This is not required by C89, but there
|
||||||
|
are some compilers out there that don't like it.
|
||||||
|
|
||||||
2003-05-21 Werner Koch <wk@gnupg.org>
|
2003-05-21 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* sign.c (write_plaintext_packet)
|
* sign.c (write_plaintext_packet)
|
||||||
|
20
g10/armor.c
20
g10/armor.c
@ -39,9 +39,9 @@
|
|||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#define LF "\r\n"
|
#define LF "\r\n"
|
||||||
#else
|
#else
|
||||||
#define LF "\n"
|
#define LF "\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_LINELEN 20000
|
#define MAX_LINELEN 20000
|
||||||
@ -773,7 +773,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||||||
/* FIXME: Here we should emit another control packet,
|
/* FIXME: Here we should emit another control packet,
|
||||||
* so that we know in mainproc that we are processing
|
* so that we know in mainproc that we are processing
|
||||||
* a clearsign message */
|
* a clearsign message */
|
||||||
#if 0
|
#if 0
|
||||||
for(rc=0;!rc;) {
|
for(rc=0;!rc;) {
|
||||||
rc = 0 /*check_trailer( &fhdr, c )*/;
|
rc = 0 /*check_trailer( &fhdr, c )*/;
|
||||||
if( !rc ) {
|
if( !rc ) {
|
||||||
@ -791,7 +791,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||||||
log_error(_("error in trailer line\n"));
|
log_error(_("error in trailer line\n"));
|
||||||
rc = G10ERR_INVALID_ARMOR;
|
rc = G10ERR_INVALID_ARMOR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -817,14 +817,14 @@ armor_filter( void *opaque, int control,
|
|||||||
int idx, idx2;
|
int idx, idx2;
|
||||||
size_t n=0;
|
size_t n=0;
|
||||||
u32 crc;
|
u32 crc;
|
||||||
#if 0
|
#if 0
|
||||||
static FILE *fp ;
|
static FILE *fp ;
|
||||||
|
|
||||||
if( !fp ) {
|
if( !fp ) {
|
||||||
fp = fopen("armor.out", "w");
|
fp = fopen("armor.out", "w");
|
||||||
assert(fp);
|
assert(fp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( DBG_FILTER )
|
if( DBG_FILTER )
|
||||||
log_debug("armor-filter: control: %d\n", control );
|
log_debug("armor-filter: control: %d\n", control );
|
||||||
@ -921,11 +921,11 @@ armor_filter( void *opaque, int control,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = radix64_read( afx, a, &n, buf, size );
|
rc = radix64_read( afx, a, &n, buf, size );
|
||||||
#if 0
|
#if 0
|
||||||
if( n )
|
if( n )
|
||||||
if( fwrite(buf, n, 1, fp ) != 1 )
|
if( fwrite(buf, n, 1, fp ) != 1 )
|
||||||
BUG();
|
BUG();
|
||||||
#endif
|
#endif
|
||||||
*ret_len = n;
|
*ret_len = n;
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) {
|
else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) {
|
||||||
@ -960,10 +960,10 @@ armor_filter( void *opaque, int control,
|
|||||||
|
|
||||||
if ( afx->hdrlines ) {
|
if ( afx->hdrlines ) {
|
||||||
for ( s = afx->hdrlines; *s; s++ ) {
|
for ( s = afx->hdrlines; *s; s++ ) {
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
if ( *s == '\n' )
|
if ( *s == '\n' )
|
||||||
iobuf_put( a, '\r');
|
iobuf_put( a, '\r');
|
||||||
#endif
|
#endif
|
||||||
iobuf_put(a, *s );
|
iobuf_put(a, *s );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,12 +266,12 @@ hash_public_key( MD_HANDLE md, PKT_public_key *pk )
|
|||||||
ulong pktlen;
|
ulong pktlen;
|
||||||
int c;
|
int c;
|
||||||
IOBUF a = iobuf_temp();
|
IOBUF a = iobuf_temp();
|
||||||
#if 0
|
#if 0
|
||||||
FILE *fp = fopen("dump.pk", "a");
|
FILE *fp = fopen("dump.pk", "a");
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
fprintf(fp, "\nHashing PK (v%d):\n", pk->version);
|
fprintf(fp, "\nHashing PK (v%d):\n", pk->version);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* build the packet */
|
/* build the packet */
|
||||||
init_packet(&pkt);
|
init_packet(&pkt);
|
||||||
@ -316,19 +316,19 @@ hash_public_key( MD_HANDLE md, PKT_public_key *pk )
|
|||||||
}
|
}
|
||||||
/* hash the packet body */
|
/* hash the packet body */
|
||||||
while( (c=iobuf_get(a)) != -1 ) {
|
while( (c=iobuf_get(a)) != -1 ) {
|
||||||
#if 0
|
#if 0
|
||||||
fprintf( fp," %02x", c );
|
fprintf( fp," %02x", c );
|
||||||
if( (++i == 24) ) {
|
if( (++i == 24) ) {
|
||||||
putc('\n', fp);
|
putc('\n', fp);
|
||||||
i=0;
|
i=0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
md_putc( md, c );
|
md_putc( md, c );
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
putc('\n', fp);
|
putc('\n', fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
iobuf_cancel(a);
|
iobuf_cancel(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,14 +243,14 @@ encode_simple( const char *filename, int mode, int compat )
|
|||||||
|
|
||||||
if( opt.armor )
|
if( opt.armor )
|
||||||
iobuf_push_filter( out, armor_filter, &afx );
|
iobuf_push_filter( out, armor_filter, &afx );
|
||||||
#ifdef ENABLE_COMMENT_PACKETS
|
#ifdef ENABLE_COMMENT_PACKETS
|
||||||
else {
|
else {
|
||||||
write_comment( out, "#created by GNUPG v" VERSION " ("
|
write_comment( out, "#created by GNUPG v" VERSION " ("
|
||||||
PRINTABLE_OS_NAME ")");
|
PRINTABLE_OS_NAME ")");
|
||||||
if( opt.comment_string )
|
if( opt.comment_string )
|
||||||
write_comment( out, opt.comment_string );
|
write_comment( out, opt.comment_string );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if( s2k && !RFC1991 ) {
|
if( s2k && !RFC1991 ) {
|
||||||
PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc + seskeylen + 1 );
|
PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc + seskeylen + 1 );
|
||||||
enc->version = 4;
|
enc->version = 4;
|
||||||
@ -442,14 +442,14 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||||||
|
|
||||||
if( opt.armor )
|
if( opt.armor )
|
||||||
iobuf_push_filter( out, armor_filter, &afx );
|
iobuf_push_filter( out, armor_filter, &afx );
|
||||||
#ifdef ENABLE_COMMENT_PACKETS
|
#ifdef ENABLE_COMMENT_PACKETS
|
||||||
else {
|
else {
|
||||||
write_comment( out, "#created by GNUPG v" VERSION " ("
|
write_comment( out, "#created by GNUPG v" VERSION " ("
|
||||||
PRINTABLE_OS_NAME ")");
|
PRINTABLE_OS_NAME ")");
|
||||||
if( opt.comment_string )
|
if( opt.comment_string )
|
||||||
write_comment( out, opt.comment_string );
|
write_comment( out, opt.comment_string );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* create a session key */
|
/* create a session key */
|
||||||
cfx.dek = m_alloc_secure_clear (sizeof *cfx.dek);
|
cfx.dek = m_alloc_secure_clear (sizeof *cfx.dek);
|
||||||
if( !opt.def_cipher_algo ) { /* try to get it from the prefs */
|
if( !opt.def_cipher_algo ) { /* try to get it from the prefs */
|
||||||
|
36
g10/g10.c
36
g10/g10.c
@ -26,7 +26,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#include <fcntl.h> /* for setmode() */
|
#include <fcntl.h> /* for setmode() */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STAT
|
#ifdef HAVE_STAT
|
||||||
#include <sys/stat.h> /* for stat() */
|
#include <sys/stat.h> /* for stat() */
|
||||||
@ -737,15 +737,15 @@ build_list( const char *text, char letter,
|
|||||||
static void
|
static void
|
||||||
i18n_init(void)
|
i18n_init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SIMPLE_GETTEXT
|
#ifdef USE_SIMPLE_GETTEXT
|
||||||
set_gettext_file( PACKAGE );
|
set_gettext_file( PACKAGE );
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
setlocale( LC_ALL, "" );
|
setlocale( LC_ALL, "" );
|
||||||
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
||||||
textdomain( PACKAGE );
|
textdomain( PACKAGE );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1071,14 +1071,14 @@ main( int argc, char **argv )
|
|||||||
int pwfd = -1;
|
int pwfd = -1;
|
||||||
int with_fpr = 0; /* make an option out of --fingerprint */
|
int with_fpr = 0; /* make an option out of --fingerprint */
|
||||||
int any_explicit_recipient = 0;
|
int any_explicit_recipient = 0;
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
ulong requested_shm_size=0;
|
ulong requested_shm_size=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __riscos__
|
#ifdef __riscos__
|
||||||
riscos_global_defaults();
|
riscos_global_defaults();
|
||||||
opt.lock_once = 1;
|
opt.lock_once = 1;
|
||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
|
|
||||||
trap_unaligned();
|
trap_unaligned();
|
||||||
secmem_set_flags( secmem_get_flags() | 2 ); /* suspend warnings */
|
secmem_set_flags( secmem_get_flags() | 2 ); /* suspend warnings */
|
||||||
@ -1147,7 +1147,7 @@ main( int argc, char **argv )
|
|||||||
set_homedir ( pargs.r.ret_str );
|
set_homedir ( pargs.r.ret_str );
|
||||||
else if( pargs.r_opt == oNoPermissionWarn )
|
else if( pargs.r_opt == oNoPermissionWarn )
|
||||||
opt.no_perm_warn=1;
|
opt.no_perm_warn=1;
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
else if( pargs.r_opt == oRunAsShmCP ) {
|
else if( pargs.r_opt == oRunAsShmCP ) {
|
||||||
/* does not make sense in a options file, we do it here,
|
/* does not make sense in a options file, we do it here,
|
||||||
* so that we are the able to drop setuid as soon as possible */
|
* so that we are the able to drop setuid as soon as possible */
|
||||||
@ -1159,7 +1159,7 @@ main( int argc, char **argv )
|
|||||||
* initialized when init_shm_coprocessing() is called */
|
* initialized when init_shm_coprocessing() is called */
|
||||||
set_status_fd( iobuf_translate_file_handle (pargs.r.ret_int, 1) );
|
set_status_fd( iobuf_translate_file_handle (pargs.r.ret_int, 1) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
@ -1716,13 +1716,13 @@ main( int argc, char **argv )
|
|||||||
strusage(11), strusage(13), strusage(14) );
|
strusage(11), strusage(13), strusage(14) );
|
||||||
fprintf(stderr, "%s\n", strusage(15) );
|
fprintf(stderr, "%s\n", strusage(15) );
|
||||||
}
|
}
|
||||||
#ifdef IS_DEVELOPMENT_VERSION
|
#ifdef IS_DEVELOPMENT_VERSION
|
||||||
if( !opt.batch ) {
|
if( !opt.batch ) {
|
||||||
log_info("NOTE: THIS IS A DEVELOPMENT VERSION!\n");
|
log_info("NOTE: THIS IS A DEVELOPMENT VERSION!\n");
|
||||||
log_info("It is only intended for test purposes and should NOT be\n");
|
log_info("It is only intended for test purposes and should NOT be\n");
|
||||||
log_info("used in a production environment or with production keys!\n");
|
log_info("used in a production environment or with production keys!\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (opt.verbose > 2)
|
if (opt.verbose > 2)
|
||||||
log_info ("using character set `%s'\n", get_native_charset ());
|
log_info ("using character set `%s'\n", get_native_charset ());
|
||||||
@ -2462,9 +2462,9 @@ main( int argc, char **argv )
|
|||||||
size_t n = !endless && count < 99? count : 99;
|
size_t n = !endless && count < 99? count : 99;
|
||||||
|
|
||||||
p = get_random_bits( n*8, level, 0);
|
p = get_random_bits( n*8, level, 0);
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
setmode ( fileno(stdout), O_BINARY );
|
setmode ( fileno(stdout), O_BINARY );
|
||||||
#endif
|
#endif
|
||||||
if (opt.armor) {
|
if (opt.armor) {
|
||||||
char *tmp = make_radix64_string (p, n);
|
char *tmp = make_radix64_string (p, n);
|
||||||
fputs (tmp, stdout);
|
fputs (tmp, stdout);
|
||||||
@ -2751,9 +2751,9 @@ print_mds( const char *fname, int algo )
|
|||||||
|
|
||||||
if( !fname ) {
|
if( !fname ) {
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
setmode ( fileno(fp) , O_BINARY );
|
setmode ( fileno(fp) , O_BINARY );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fp = fopen( fname, "rb" );
|
fp = fopen( fname, "rb" );
|
||||||
|
18
g10/getkey.c
18
g10/getkey.c
@ -39,7 +39,7 @@
|
|||||||
#define MAX_UID_CACHE_ENTRIES 200
|
#define MAX_UID_CACHE_ENTRIES 200
|
||||||
|
|
||||||
#if MAX_PK_CACHE_ENTRIES < 2
|
#if MAX_PK_CACHE_ENTRIES < 2
|
||||||
#error We need the cache for key creation
|
#error We need the cache for key creation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ typedef struct keyid_list {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MAX_UID_CACHE_ENTRIES < 5
|
#if MAX_UID_CACHE_ENTRIES < 5
|
||||||
#error we really need the userid cache
|
#error we really need the userid cache
|
||||||
#endif
|
#endif
|
||||||
typedef struct user_id_db {
|
typedef struct user_id_db {
|
||||||
struct user_id_db *next;
|
struct user_id_db *next;
|
||||||
@ -119,7 +119,7 @@ print_stats()
|
|||||||
void
|
void
|
||||||
cache_public_key( PKT_public_key *pk )
|
cache_public_key( PKT_public_key *pk )
|
||||||
{
|
{
|
||||||
#if MAX_PK_CACHE_ENTRIES
|
#if MAX_PK_CACHE_ENTRIES
|
||||||
pk_cache_entry_t ce;
|
pk_cache_entry_t ce;
|
||||||
u32 keyid[2];
|
u32 keyid[2];
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ cache_public_key( PKT_public_key *pk )
|
|||||||
ce->pk = copy_public_key( NULL, pk );
|
ce->pk = copy_public_key( NULL, pk );
|
||||||
ce->keyid[0] = keyid[0];
|
ce->keyid[0] = keyid[0];
|
||||||
ce->keyid[1] = keyid[1];
|
ce->keyid[1] = keyid[1];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ cache_user_id( KBNODE keyblock )
|
|||||||
void
|
void
|
||||||
getkey_disable_caches()
|
getkey_disable_caches()
|
||||||
{
|
{
|
||||||
#if MAX_PK_CACHE_ENTRIES
|
#if MAX_PK_CACHE_ENTRIES
|
||||||
{
|
{
|
||||||
pk_cache_entry_t ce, ce2;
|
pk_cache_entry_t ce, ce2;
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ getkey_disable_caches()
|
|||||||
pk_cache_entries = 0;
|
pk_cache_entries = 0;
|
||||||
pk_cache = NULL;
|
pk_cache = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* fixme: disable user id cache ? */
|
/* fixme: disable user id cache ? */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ get_pubkey( PKT_public_key *pk, u32 *keyid )
|
|||||||
int internal = 0;
|
int internal = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
#if MAX_PK_CACHE_ENTRIES
|
#if MAX_PK_CACHE_ENTRIES
|
||||||
{ /* Try to get it from the cache */
|
{ /* Try to get it from the cache */
|
||||||
pk_cache_entry_t ce;
|
pk_cache_entry_t ce;
|
||||||
for( ce = pk_cache; ce; ce = ce->next ) {
|
for( ce = pk_cache; ce; ce = ce->next ) {
|
||||||
@ -330,7 +330,7 @@ get_pubkey( PKT_public_key *pk, u32 *keyid )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* more init stuff */
|
/* more init stuff */
|
||||||
if( !pk ) {
|
if( !pk ) {
|
||||||
pk = m_alloc_clear( sizeof *pk );
|
pk = m_alloc_clear( sizeof *pk );
|
||||||
@ -2136,7 +2136,7 @@ finish_lookup (GETKEY_CTX ctx)
|
|||||||
KBNODE k;
|
KBNODE k;
|
||||||
KBNODE foundk = NULL;
|
KBNODE foundk = NULL;
|
||||||
PKT_user_id *foundu = NULL;
|
PKT_user_id *foundu = NULL;
|
||||||
#define USAGE_MASK (PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC)
|
#define USAGE_MASK (PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC)
|
||||||
unsigned int req_usage = ( ctx->req_usage & USAGE_MASK );
|
unsigned int req_usage = ( ctx->req_usage & USAGE_MASK );
|
||||||
/* Request the primary if we're certifying another key, and also
|
/* Request the primary if we're certifying another key, and also
|
||||||
if signing data while --pgp6 or --pgp7 is on since pgp 6 and 7
|
if signing data while --pgp6 or --pgp7 is on since pgp 6 and 7
|
||||||
|
22
g10/gpgv.c
22
g10/gpgv.c
@ -26,7 +26,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#include <fcntl.h> /* for setmode() */
|
#include <fcntl.h> /* for setmode() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INCLUDED_BY_MAIN_MODULE 1
|
#define INCLUDED_BY_MAIN_MODULE 1
|
||||||
@ -125,20 +125,20 @@ set_homedir (char *dir)
|
|||||||
static void
|
static void
|
||||||
i18n_init(void)
|
i18n_init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SIMPLE_GETTEXT
|
#ifdef USE_SIMPLE_GETTEXT
|
||||||
set_gettext_file( PACKAGE );
|
set_gettext_file( PACKAGE );
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#ifdef HAVE_LC_MESSAGES
|
#ifdef HAVE_LC_MESSAGES
|
||||||
setlocale( LC_TIME, "" );
|
setlocale( LC_TIME, "" );
|
||||||
setlocale( LC_MESSAGES, "" );
|
setlocale( LC_MESSAGES, "" );
|
||||||
#else
|
#else
|
||||||
setlocale( LC_ALL, "" );
|
setlocale( LC_ALL, "" );
|
||||||
#endif
|
#endif
|
||||||
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
||||||
textdomain( PACKAGE );
|
textdomain( PACKAGE );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,9 +151,9 @@ main( int argc, char **argv )
|
|||||||
STRLIST nrings=NULL;
|
STRLIST nrings=NULL;
|
||||||
unsigned configlineno;
|
unsigned configlineno;
|
||||||
|
|
||||||
#ifdef __riscos__
|
#ifdef __riscos__
|
||||||
riscos_global_defaults();
|
riscos_global_defaults();
|
||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
|
|
||||||
log_set_name("gpgv");
|
log_set_name("gpgv");
|
||||||
init_signals();
|
init_signals();
|
||||||
|
@ -180,7 +180,7 @@ hkp_export( STRLIST users )
|
|||||||
opt.keyserver_host, g10_errstr(rc) );
|
opt.keyserver_host, g10_errstr(rc) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if 1
|
#if 1
|
||||||
if( opt.verbose ) {
|
if( opt.verbose ) {
|
||||||
int c;
|
int c;
|
||||||
while( (c=iobuf_get(hd.fp_read)) != EOF )
|
while( (c=iobuf_get(hd.fp_read)) != EOF )
|
||||||
@ -189,7 +189,7 @@ hkp_export( STRLIST users )
|
|||||||
else
|
else
|
||||||
putchar ( '?' );
|
putchar ( '?' );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if( (status/100) == 2 )
|
if( (status/100) == 2 )
|
||||||
log_info(_("success sending to `%s' (status=%u)\n"),
|
log_info(_("success sending to `%s' (status=%u)\n"),
|
||||||
opt.keyserver_host, status );
|
opt.keyserver_host, status );
|
||||||
|
@ -54,12 +54,12 @@ static void
|
|||||||
free_node( KBNODE n )
|
free_node( KBNODE n )
|
||||||
{
|
{
|
||||||
if( n ) {
|
if( n ) {
|
||||||
#if USE_UNUSED_NODES
|
#if USE_UNUSED_NODES
|
||||||
n->next = unused_nodes;
|
n->next = unused_nodes;
|
||||||
unused_nodes = n;
|
unused_nodes = n;
|
||||||
#else
|
#else
|
||||||
m_free( n );
|
m_free( n );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,13 +96,13 @@ keydb_add_resource (const char *url, int force, int secret)
|
|||||||
rt = KEYDB_RESOURCE_TYPE_KEYRING;
|
rt = KEYDB_RESOURCE_TYPE_KEYRING;
|
||||||
resname += 11;
|
resname += 11;
|
||||||
}
|
}
|
||||||
#if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__)
|
#if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__)
|
||||||
else if (strchr (resname, ':')) {
|
else if (strchr (resname, ':')) {
|
||||||
log_error ("invalid key resource URL `%s'\n", url );
|
log_error ("invalid key resource URL `%s'\n", url );
|
||||||
rc = G10ERR_GENERAL;
|
rc = G10ERR_GENERAL;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
#endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */
|
#endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*resname != DIRSEP_C ) { /* do tilde expansion etc */
|
if (*resname != DIRSEP_C ) { /* do tilde expansion etc */
|
||||||
@ -688,6 +688,3 @@ keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr)
|
|||||||
memcpy (desc.u.fpr, fpr, MAX_FINGERPRINT_LEN);
|
memcpy (desc.u.fpr, fpr, MAX_FINGERPRINT_LEN);
|
||||||
return keydb_search (hd, &desc, 1);
|
return keydb_search (hd, &desc, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1446,7 +1446,7 @@ do_create( int algo, unsigned int nbits, KBNODE pub_root, KBNODE sec_root,
|
|||||||
else
|
else
|
||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
#ifdef ENABLE_COMMENT_PACKETS
|
#ifdef ENABLE_COMMENT_PACKETS
|
||||||
if( !rc ) {
|
if( !rc ) {
|
||||||
add_kbnode( pub_root,
|
add_kbnode( pub_root,
|
||||||
make_comment_node("#created by GNUPG v" VERSION " ("
|
make_comment_node("#created by GNUPG v" VERSION " ("
|
||||||
@ -1455,7 +1455,7 @@ do_create( int algo, unsigned int nbits, KBNODE pub_root, KBNODE sec_root,
|
|||||||
make_comment_node("#created by GNUPG v" VERSION " ("
|
make_comment_node("#created by GNUPG v" VERSION " ("
|
||||||
PRINTABLE_OS_NAME ")"));
|
PRINTABLE_OS_NAME ")"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1641,7 +1641,7 @@ proc_tree( CTX c, KBNODE node )
|
|||||||
* signature has been created in textmode */
|
* signature has been created in textmode */
|
||||||
c->mfx.md2 = md_open( sig->digest_algo, 0 );
|
c->mfx.md2 = md_open( sig->digest_algo, 0 );
|
||||||
}
|
}
|
||||||
#if 0 /* workaround disabled */
|
#if 0 /* workaround disabled */
|
||||||
/* Here we have another hack to work around a pgp 2 bug
|
/* Here we have another hack to work around a pgp 2 bug
|
||||||
* It works by not using the textmode for detached signatures;
|
* It works by not using the textmode for detached signatures;
|
||||||
* this will let the first signature check (on md) fail
|
* this will let the first signature check (on md) fail
|
||||||
@ -1650,7 +1650,7 @@ proc_tree( CTX c, KBNODE node )
|
|||||||
* hack but it may help in some cases (and break others)
|
* hack but it may help in some cases (and break others)
|
||||||
*/
|
*/
|
||||||
/* c->mfx.md2? 0 :(sig->sig_class == 0x01) */
|
/* c->mfx.md2? 0 :(sig->sig_class == 0x01) */
|
||||||
#endif
|
#endif
|
||||||
if ( DBG_HASHING ) {
|
if ( DBG_HASHING ) {
|
||||||
md_start_debug( c->mfx.md, "verify" );
|
md_start_debug( c->mfx.md, "verify" );
|
||||||
if ( c->mfx.md2 )
|
if ( c->mfx.md2 )
|
||||||
|
20
g10/misc.c
20
g10/misc.c
@ -25,13 +25,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#if defined(__linux__) && defined(__alpha__) && __GLIBC__ < 2
|
#if defined(__linux__) && defined(__alpha__) && __GLIBC__ < 2
|
||||||
#include <asm/sysinfo.h>
|
#include <asm/sysinfo.h>
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SETRLIMIT
|
#ifdef HAVE_SETRLIMIT
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@ -84,10 +84,10 @@ trap_unaligned(void)
|
|||||||
int
|
int
|
||||||
disable_core_dumps()
|
disable_core_dumps()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_SETRLIMIT
|
#ifdef HAVE_SETRLIMIT
|
||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
|
|
||||||
limit.rlim_cur = 0;
|
limit.rlim_cur = 0;
|
||||||
@ -96,9 +96,9 @@ disable_core_dumps()
|
|||||||
return 0;
|
return 0;
|
||||||
if( errno != EINVAL && errno != ENOSYS )
|
if( errno != EINVAL && errno != ENOSYS )
|
||||||
log_fatal(_("can't disable core dumps: %s\n"), strerror(errno) );
|
log_fatal(_("can't disable core dumps: %s\n"), strerror(errno) );
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,20 +37,20 @@
|
|||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
#ifdef USE_ONLY_8DOT3
|
#ifdef USE_ONLY_8DOT3
|
||||||
#define SKELEXT ".skl"
|
#define SKELEXT ".skl"
|
||||||
#else
|
#else
|
||||||
#define SKELEXT EXTSEP_S "skel"
|
#define SKELEXT EXTSEP_S "skel"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_DRIVE_LETTERS) || defined (__riscos__)
|
#if defined (HAVE_DRIVE_LETTERS) || defined (__riscos__)
|
||||||
#define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) )
|
#define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) )
|
||||||
#else
|
#else
|
||||||
#define CMP_FILENAME(a,b) strcmp( (a), (b) )
|
#define CMP_FILENAME(a,b) strcmp( (a), (b) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MKDIR_TAKES_ONE_ARG
|
#ifdef MKDIR_TAKES_ONE_ARG
|
||||||
# undef mkdir
|
#undef mkdir
|
||||||
# define mkdir(a,b) mkdir(a)
|
#define mkdir(a,b) mkdir(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FIXME: Implement opt.interactive. */
|
/* FIXME: Implement opt.interactive. */
|
||||||
@ -390,5 +390,3 @@ try_make_homedir( const char *fname )
|
|||||||
/* g10_exit(1); */
|
/* g10_exit(1); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@
|
|||||||
|
|
||||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||||
/* Norcraft can't cope with common symbols */
|
/* Norcraft can't cope with common symbols */
|
||||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||||
#else
|
#else
|
||||||
#define EXTERN_UNLESS_MAIN_MODULE
|
#define EXTERN_UNLESS_MAIN_MODULE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN_UNLESS_MAIN_MODULE
|
EXTERN_UNLESS_MAIN_MODULE
|
||||||
|
@ -42,9 +42,9 @@ static int list_mode = 0;
|
|||||||
|
|
||||||
static int parse( IOBUF inp, PACKET *pkt, int onlykeypkts,
|
static int parse( IOBUF inp, PACKET *pkt, int onlykeypkts,
|
||||||
off_t *retpos, int *skip, IOBUF out, int do_skip
|
off_t *retpos, int *skip, IOBUF out, int do_skip
|
||||||
#ifdef DEBUG_PARSE_PACKET
|
#ifdef DEBUG_PARSE_PACKET
|
||||||
,const char *dbg_w, const char *dbg_f, int dbg_l
|
,const char *dbg_w, const char *dbg_f, int dbg_l
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
static int copy_packet( IOBUF inp, IOBUF out, int pkttype,
|
static int copy_packet( IOBUF inp, IOBUF out, int pkttype,
|
||||||
unsigned long pktlen );
|
unsigned long pktlen );
|
||||||
|
@ -1217,18 +1217,18 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype, int request, void *hint)
|
|||||||
compr_hack = 1;
|
compr_hack = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
log_debug("pref mask=%08lX%08lX%08lX%08lX%08lX%08lX%08lX%08lX\n",
|
log_debug("pref mask=%08lX%08lX%08lX%08lX%08lX%08lX%08lX%08lX\n",
|
||||||
(ulong)mask[7], (ulong)mask[6], (ulong)mask[5], (ulong)mask[4],
|
(ulong)mask[7], (ulong)mask[6], (ulong)mask[5], (ulong)mask[4],
|
||||||
(ulong)mask[3], (ulong)mask[2], (ulong)mask[1], (ulong)mask[0]);
|
(ulong)mask[3], (ulong)mask[2], (ulong)mask[1], (ulong)mask[0]);
|
||||||
#endif
|
#endif
|
||||||
for(i=0; i < 8; i++ )
|
for(i=0; i < 8; i++ )
|
||||||
bits[i] &= mask[i];
|
bits[i] &= mask[i];
|
||||||
#if 0
|
#if 0
|
||||||
log_debug("pref bits=%08lX%08lX%08lX%08lX%08lX%08lX%08lX%08lX\n",
|
log_debug("pref bits=%08lX%08lX%08lX%08lX%08lX%08lX%08lX%08lX\n",
|
||||||
(ulong)bits[7], (ulong)bits[6], (ulong)bits[5], (ulong)bits[4],
|
(ulong)bits[7], (ulong)bits[6], (ulong)bits[5], (ulong)bits[4],
|
||||||
(ulong)bits[3], (ulong)bits[2], (ulong)bits[1], (ulong)bits[0]);
|
(ulong)bits[3], (ulong)bits[2], (ulong)bits[1], (ulong)bits[0]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* usable algorithms are now in bits
|
/* usable algorithms are now in bits
|
||||||
* We now use the last key from pk_list to select
|
* We now use the last key from pk_list to select
|
||||||
@ -1275,9 +1275,9 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype, int request, void *hint)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
log_debug("prefs of type %d: selected %d\n", preftype, i );
|
log_debug("prefs of type %d: selected %d\n", preftype, i );
|
||||||
#endif
|
#endif
|
||||||
if( compr_hack && !i ) {
|
if( compr_hack && !i ) {
|
||||||
/* selected no compression, but we should check whether
|
/* selected no compression, but we should check whether
|
||||||
* algorithm 1 is also available (the ordering is not relevant
|
* algorithm 1 is also available (the ordering is not relevant
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#include <fcntl.h> /* for setmode() */
|
#include <fcntl.h> /* for setmode() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -85,9 +85,9 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
|||||||
else if( !*fname || (*fname=='-' && !fname[1])) {
|
else if( !*fname || (*fname=='-' && !fname[1])) {
|
||||||
/* no filename or "-" given; write to stdout */
|
/* no filename or "-" given; write to stdout */
|
||||||
fp = stdout;
|
fp = stdout;
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
setmode ( fileno(fp) , O_BINARY );
|
setmode ( fileno(fp) , O_BINARY );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while( !overwrite_filep (fname) ) {
|
while( !overwrite_filep (fname) ) {
|
||||||
@ -127,10 +127,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
|||||||
}
|
}
|
||||||
if( mfx->md )
|
if( mfx->md )
|
||||||
md_putc(mfx->md, c );
|
md_putc(mfx->md, c );
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
if( c == '\r' ) /* convert to native line ending */
|
if( c == '\r' ) /* convert to native line ending */
|
||||||
continue; /* fixme: this hack might be too simple */
|
continue; /* fixme: this hack might be too simple */
|
||||||
#endif
|
#endif
|
||||||
if( fp ) {
|
if( fp ) {
|
||||||
if( putc( c, fp ) == EOF ) {
|
if( putc( c, fp ) == EOF ) {
|
||||||
log_error("Error writing to `%s': %s\n",
|
log_error("Error writing to `%s': %s\n",
|
||||||
@ -174,10 +174,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
|||||||
while( (c = iobuf_get(pt->buf)) != -1 ) {
|
while( (c = iobuf_get(pt->buf)) != -1 ) {
|
||||||
if( mfx->md )
|
if( mfx->md )
|
||||||
md_putc(mfx->md, c );
|
md_putc(mfx->md, c );
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
if( convert && c == '\r' )
|
if( convert && c == '\r' )
|
||||||
continue; /* fixme: this hack might be too simple */
|
continue; /* fixme: this hack might be too simple */
|
||||||
#endif
|
#endif
|
||||||
if( fp ) {
|
if( fp ) {
|
||||||
if( putc( c, fp ) == EOF ) {
|
if( putc( c, fp ) == EOF ) {
|
||||||
log_error("Error writing to `%s': %s\n",
|
log_error("Error writing to `%s': %s\n",
|
||||||
@ -414,8 +414,3 @@ hash_datafiles( MD_HANDLE md, MD_HANDLE md2, STRLIST files,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ signature_check2( PKT_signature *sig, MD_HANDLE digest,
|
|||||||
static int
|
static int
|
||||||
cmp_help( void *opaque, MPI result )
|
cmp_help( void *opaque, MPI result )
|
||||||
{
|
{
|
||||||
#if 0 /* we do not use this anymore */
|
#if 0 /* we do not use this anymore */
|
||||||
int rc=0, i, j, c, old_enc;
|
int rc=0, i, j, c, old_enc;
|
||||||
byte *dp;
|
byte *dp;
|
||||||
const byte *asn;
|
const byte *asn;
|
||||||
@ -198,9 +198,9 @@ cmp_help( void *opaque, MPI result )
|
|||||||
return G10ERR_BAD_SIGN;
|
return G10ERR_BAD_SIGN;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -43,11 +43,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#define LF "\r\n"
|
#define LF "\r\n"
|
||||||
void __stdcall Sleep(ulong);
|
void __stdcall Sleep(ulong);
|
||||||
#define sleep(a) Sleep((a)*1000)
|
#define sleep(a) Sleep((a)*1000)
|
||||||
#else
|
#else
|
||||||
#define LF "\n"
|
#define LF "\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int recipient_digest_algo=0;
|
static int recipient_digest_algo=0;
|
||||||
|
40
g10/signal.c
40
g10/signal.c
@ -41,8 +41,8 @@ static volatile int caught_sigusr1 = 0;
|
|||||||
static void
|
static void
|
||||||
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
#ifdef HAVE_SIGACTION
|
#ifdef HAVE_SIGACTION
|
||||||
struct sigaction oact, nact;
|
struct sigaction oact, nact;
|
||||||
|
|
||||||
if (check_ign) {
|
if (check_ign) {
|
||||||
@ -56,7 +56,7 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
|||||||
sigemptyset (&nact.sa_mask);
|
sigemptyset (&nact.sa_mask);
|
||||||
nact.sa_flags = 0;
|
nact.sa_flags = 0;
|
||||||
sigaction ( sig, &nact, NULL);
|
sigaction ( sig, &nact, NULL);
|
||||||
#else
|
#else
|
||||||
RETSIGTYPE (*ohandler)(int);
|
RETSIGTYPE (*ohandler)(int);
|
||||||
|
|
||||||
ohandler = signal (sig, handler);
|
ohandler = signal (sig, handler);
|
||||||
@ -64,18 +64,18 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
|||||||
/* Change it back if it was already set to IGN */
|
/* Change it back if it was already set to IGN */
|
||||||
signal (sig, SIG_IGN);
|
signal (sig, SIG_IGN);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_signal_name( int signum )
|
get_signal_name( int signum )
|
||||||
{
|
{
|
||||||
#if defined(SYS_SIGLIST_DECLARED) && defined(NSIG)
|
#if defined(SYS_SIGLIST_DECLARED) && defined(NSIG)
|
||||||
return (signum >= 0 && signum < NSIG) ? sys_siglist[signum] : "?";
|
return (signum >= 0 && signum < NSIG) ? sys_siglist[signum] : "?";
|
||||||
#else
|
#else
|
||||||
return "some signal";
|
return "some signal";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ got_usr_signal( int sig )
|
|||||||
void
|
void
|
||||||
init_signals()
|
init_signals()
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
init_one_signal (SIGINT, got_fatal_signal, 1 );
|
init_one_signal (SIGINT, got_fatal_signal, 1 );
|
||||||
init_one_signal (SIGHUP, got_fatal_signal, 1 );
|
init_one_signal (SIGHUP, got_fatal_signal, 1 );
|
||||||
init_one_signal (SIGTERM, got_fatal_signal, 1 );
|
init_one_signal (SIGTERM, got_fatal_signal, 1 );
|
||||||
@ -124,15 +124,15 @@ init_signals()
|
|||||||
init_one_signal (SIGSEGV, got_fatal_signal, 1 );
|
init_one_signal (SIGSEGV, got_fatal_signal, 1 );
|
||||||
init_one_signal (SIGUSR1, got_usr_signal, 0 );
|
init_one_signal (SIGUSR1, got_usr_signal, 0 );
|
||||||
init_one_signal (SIGPIPE, SIG_IGN, 0 );
|
init_one_signal (SIGPIPE, SIG_IGN, 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pause_on_sigusr( int which )
|
pause_on_sigusr( int which )
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
#ifdef HAVE_SIGPROCMASK
|
#ifdef HAVE_SIGPROCMASK
|
||||||
sigset_t mask, oldmask;
|
sigset_t mask, oldmask;
|
||||||
|
|
||||||
assert( which == 1 );
|
assert( which == 1 );
|
||||||
@ -144,24 +144,24 @@ pause_on_sigusr( int which )
|
|||||||
sigsuspend( &oldmask );
|
sigsuspend( &oldmask );
|
||||||
caught_sigusr1 = 0;
|
caught_sigusr1 = 0;
|
||||||
sigprocmask( SIG_UNBLOCK, &mask, NULL );
|
sigprocmask( SIG_UNBLOCK, &mask, NULL );
|
||||||
#else
|
#else
|
||||||
assert (which == 1);
|
assert (which == 1);
|
||||||
sighold (SIGUSR1);
|
sighold (SIGUSR1);
|
||||||
while (!caught_sigusr1)
|
while (!caught_sigusr1)
|
||||||
sigpause(SIGUSR1);
|
sigpause(SIGUSR1);
|
||||||
caught_sigusr1 = 0;
|
caught_sigusr1 = 0;
|
||||||
sigrelse(SIGUSR1); ????
|
sigrelse(SIGUSR1); ????
|
||||||
#endif /*!HAVE_SIGPROCMASK*/
|
#endif /*!HAVE_SIGPROCMASK*/
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_block( int block )
|
do_block( int block )
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
static int is_blocked;
|
static int is_blocked;
|
||||||
#ifdef HAVE_SIGPROCMASK
|
#ifdef HAVE_SIGPROCMASK
|
||||||
static sigset_t oldmask;
|
static sigset_t oldmask;
|
||||||
|
|
||||||
if( block ) {
|
if( block ) {
|
||||||
@ -179,7 +179,7 @@ do_block( int block )
|
|||||||
sigprocmask( SIG_SETMASK, &oldmask, NULL );
|
sigprocmask( SIG_SETMASK, &oldmask, NULL );
|
||||||
is_blocked = 0;
|
is_blocked = 0;
|
||||||
}
|
}
|
||||||
#else /*!HAVE_SIGPROCMASK*/
|
#else /*!HAVE_SIGPROCMASK*/
|
||||||
static void (*disposition[MAXSIG])();
|
static void (*disposition[MAXSIG])();
|
||||||
int sig;
|
int sig;
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ do_block( int block )
|
|||||||
}
|
}
|
||||||
is_blocked = 0;
|
is_blocked = 0;
|
||||||
}
|
}
|
||||||
#endif /*!HAVE_SIGPROCMASK*/
|
#endif /*!HAVE_SIGPROCMASK*/
|
||||||
#endif /*HAVE_DOSISH_SYSTEM*/
|
#endif /*HAVE_DOSISH_SYSTEM*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
99
g10/status.c
99
g10/status.c
@ -26,19 +26,19 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
#ifdef USE_CAPABILITIES
|
#ifdef USE_CAPABILITIES
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_IPC_H
|
#ifdef HAVE_SYS_IPC_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_SHM_H
|
#ifdef HAVE_SYS_SHM_H
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MLOCK)
|
#if defined(HAVE_MLOCK)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
@ -310,9 +310,9 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem )
|
|||||||
char buf[100];
|
char buf[100];
|
||||||
struct shmid_ds shmds;
|
struct shmid_ds shmds;
|
||||||
|
|
||||||
#ifndef IPC_RMID_DEFERRED_RELEASE
|
#ifndef IPC_RMID_DEFERRED_RELEASE
|
||||||
atexit( remove_shmid );
|
atexit( remove_shmid );
|
||||||
#endif
|
#endif
|
||||||
requested_shm_size = (requested_shm_size + 4095) & ~4095;
|
requested_shm_size = (requested_shm_size + 4095) & ~4095;
|
||||||
if ( requested_shm_size > 2 * 4096 )
|
if ( requested_shm_size > 2 * 4096 )
|
||||||
log_fatal("too much shared memory requested; only 8k are allowed\n");
|
log_fatal("too much shared memory requested; only 8k are allowed\n");
|
||||||
@ -323,7 +323,7 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem )
|
|||||||
log_fatal("can't get %uk of shared memory: %s\n",
|
log_fatal("can't get %uk of shared memory: %s\n",
|
||||||
(unsigned)shm_size/1024, strerror(errno));
|
(unsigned)shm_size/1024, strerror(errno));
|
||||||
|
|
||||||
#if !defined(IPC_HAVE_SHM_LOCK) \
|
#if !defined(IPC_HAVE_SHM_LOCK) \
|
||||||
&& defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK)
|
&& defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK)
|
||||||
/* part of the old code which uses mlock */
|
/* part of the old code which uses mlock */
|
||||||
shm_area = shmat( shm_id, 0, 0 );
|
shm_area = shmat( shm_id, 0, 0 );
|
||||||
@ -333,25 +333,25 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem )
|
|||||||
log_debug("mapped %uk shared memory at %p, id=%d\n",
|
log_debug("mapped %uk shared memory at %p, id=%d\n",
|
||||||
(unsigned)shm_size/1024, shm_area, shm_id );
|
(unsigned)shm_size/1024, shm_area, shm_id );
|
||||||
if( lock_mem ) {
|
if( lock_mem ) {
|
||||||
#ifdef USE_CAPABILITIES
|
#ifdef USE_CAPABILITIES
|
||||||
cap_set_proc( cap_from_text("cap_ipc_lock+ep") );
|
cap_set_proc( cap_from_text("cap_ipc_lock+ep") );
|
||||||
#endif
|
#endif
|
||||||
/* (need the cast for Solaris with Sun's workshop compilers) */
|
/* (need the cast for Solaris with Sun's workshop compilers) */
|
||||||
if ( mlock ( (char*)shm_area, shm_size) )
|
if ( mlock ( (char*)shm_area, shm_size) )
|
||||||
log_info("locking shared memory %d failed: %s\n",
|
log_info("locking shared memory %d failed: %s\n",
|
||||||
shm_id, strerror(errno));
|
shm_id, strerror(errno));
|
||||||
else
|
else
|
||||||
shm_is_locked = 1;
|
shm_is_locked = 1;
|
||||||
#ifdef USE_CAPABILITIES
|
#ifdef USE_CAPABILITIES
|
||||||
cap_set_proc( cap_from_text("cap_ipc_lock+p") );
|
cap_set_proc( cap_from_text("cap_ipc_lock+p") );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IPC_RMID_DEFERRED_RELEASE
|
#ifdef IPC_RMID_DEFERRED_RELEASE
|
||||||
if( shmctl( shm_id, IPC_RMID, 0) )
|
if( shmctl( shm_id, IPC_RMID, 0) )
|
||||||
log_fatal("shmctl IPC_RMDID of %d failed: %s\n",
|
log_fatal("shmctl IPC_RMDID of %d failed: %s\n",
|
||||||
shm_id, strerror(errno));
|
shm_id, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( shmctl( shm_id, IPC_STAT, &shmds ) )
|
if( shmctl( shm_id, IPC_STAT, &shmds ) )
|
||||||
log_fatal("shmctl IPC_STAT of %d failed: %s\n",
|
log_fatal("shmctl IPC_STAT of %d failed: %s\n",
|
||||||
@ -363,27 +363,27 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem )
|
|||||||
shm_id, strerror(errno));
|
shm_id, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* this is the new code which handles the changes in the SHM semantics
|
#else /* this is the new code which handles the changes in the SHM
|
||||||
* introduced with Linux 2.4. The changes is that we now change the
|
* semantics introduced with Linux 2.4. The changes is that we
|
||||||
* permissions and then attach to the memory.
|
* now change the permissions and then attach to the memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( lock_mem ) {
|
if( lock_mem ) {
|
||||||
#ifdef USE_CAPABILITIES
|
#ifdef USE_CAPABILITIES
|
||||||
cap_set_proc( cap_from_text("cap_ipc_lock+ep") );
|
cap_set_proc( cap_from_text("cap_ipc_lock+ep") );
|
||||||
#endif
|
#endif
|
||||||
#ifdef IPC_HAVE_SHM_LOCK
|
#ifdef IPC_HAVE_SHM_LOCK
|
||||||
if ( shmctl (shm_id, SHM_LOCK, 0) )
|
if ( shmctl (shm_id, SHM_LOCK, 0) )
|
||||||
log_info("locking shared memory %d failed: %s\n",
|
log_info("locking shared memory %d failed: %s\n",
|
||||||
shm_id, strerror(errno));
|
shm_id, strerror(errno));
|
||||||
else
|
else
|
||||||
shm_is_locked = 1;
|
shm_is_locked = 1;
|
||||||
#else
|
#else
|
||||||
log_info("Locking shared memory %d failed: No way to do it\n", shm_id );
|
log_info("Locking shared memory %d failed: No way to do it\n", shm_id );
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_CAPABILITIES
|
#ifdef USE_CAPABILITIES
|
||||||
cap_set_proc( cap_from_text("cap_ipc_lock+p") );
|
cap_set_proc( cap_from_text("cap_ipc_lock+p") );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( shmctl( shm_id, IPC_STAT, &shmds ) )
|
if( shmctl( shm_id, IPC_STAT, &shmds ) )
|
||||||
@ -403,13 +403,13 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem )
|
|||||||
log_debug("mapped %uk shared memory at %p, id=%d\n",
|
log_debug("mapped %uk shared memory at %p, id=%d\n",
|
||||||
(unsigned)shm_size/1024, shm_area, shm_id );
|
(unsigned)shm_size/1024, shm_area, shm_id );
|
||||||
|
|
||||||
#ifdef IPC_RMID_DEFERRED_RELEASE
|
#ifdef IPC_RMID_DEFERRED_RELEASE
|
||||||
if( shmctl( shm_id, IPC_RMID, 0) )
|
if( shmctl( shm_id, IPC_RMID, 0) )
|
||||||
log_fatal("shmctl IPC_RMDID of %d failed: %s\n",
|
log_fatal("shmctl IPC_RMDID of %d failed: %s\n",
|
||||||
shm_id, strerror(errno));
|
shm_id, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* write info; Protocol version, id, size, locked size */
|
/* write info; Protocol version, id, size, locked size */
|
||||||
sprintf( buf, "pv=1 pid=%d shmid=%d sz=%u lz=%u", (int)getpid(),
|
sprintf( buf, "pv=1 pid=%d shmid=%d sz=%u lz=%u", (int)getpid(),
|
||||||
shm_id, (unsigned)shm_size, shm_is_locked? (unsigned)shm_size:0 );
|
shm_id, (unsigned)shm_size, shm_is_locked? (unsigned)shm_size:0 );
|
||||||
@ -479,11 +479,11 @@ myread(int fd, void *buf, size_t count)
|
|||||||
eof_emmited++;
|
eof_emmited++;
|
||||||
}
|
}
|
||||||
else { /* Ctrl-D not caught - do something reasonable */
|
else { /* Ctrl-D not caught - do something reasonable */
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
raise (SIGINT); /* nothing to hangup under DOS */
|
raise (SIGINT); /* nothing to hangup under DOS */
|
||||||
#else
|
#else
|
||||||
raise (SIGHUP); /* no more input data */
|
raise (SIGHUP); /* no more input data */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -541,10 +541,10 @@ cpr_enabled()
|
|||||||
{
|
{
|
||||||
if( opt.command_fd != -1 )
|
if( opt.command_fd != -1 )
|
||||||
return 1;
|
return 1;
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
if( opt.shm_coprocess )
|
if( opt.shm_coprocess )
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,10 +555,10 @@ cpr_get_no_help( const char *keyword, const char *prompt )
|
|||||||
|
|
||||||
if( opt.command_fd != -1 )
|
if( opt.command_fd != -1 )
|
||||||
return do_get_from_fd ( keyword, 0, 0 );
|
return do_get_from_fd ( keyword, 0, 0 );
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
if( opt.shm_coprocess )
|
if( opt.shm_coprocess )
|
||||||
return do_shm_get( keyword, 0, 0 );
|
return do_shm_get( keyword, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
for(;;) {
|
for(;;) {
|
||||||
p = tty_get( prompt );
|
p = tty_get( prompt );
|
||||||
return p;
|
return p;
|
||||||
@ -572,10 +572,10 @@ cpr_get( const char *keyword, const char *prompt )
|
|||||||
|
|
||||||
if( opt.command_fd != -1 )
|
if( opt.command_fd != -1 )
|
||||||
return do_get_from_fd ( keyword, 0, 0 );
|
return do_get_from_fd ( keyword, 0, 0 );
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
if( opt.shm_coprocess )
|
if( opt.shm_coprocess )
|
||||||
return do_shm_get( keyword, 0, 0 );
|
return do_shm_get( keyword, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
for(;;) {
|
for(;;) {
|
||||||
p = tty_get( prompt );
|
p = tty_get( prompt );
|
||||||
if( *p=='?' && !p[1] && !(keyword && !*keyword)) {
|
if( *p=='?' && !p[1] && !(keyword && !*keyword)) {
|
||||||
@ -608,10 +608,10 @@ cpr_get_hidden( const char *keyword, const char *prompt )
|
|||||||
|
|
||||||
if( opt.command_fd != -1 )
|
if( opt.command_fd != -1 )
|
||||||
return do_get_from_fd ( keyword, 1, 0 );
|
return do_get_from_fd ( keyword, 1, 0 );
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
if( opt.shm_coprocess )
|
if( opt.shm_coprocess )
|
||||||
return do_shm_get( keyword, 1, 0 );
|
return do_shm_get( keyword, 1, 0 );
|
||||||
#endif
|
#endif
|
||||||
for(;;) {
|
for(;;) {
|
||||||
p = tty_get_hidden( prompt );
|
p = tty_get_hidden( prompt );
|
||||||
if( *p == '?' && !p[1] ) {
|
if( *p == '?' && !p[1] ) {
|
||||||
@ -628,10 +628,10 @@ cpr_kill_prompt(void)
|
|||||||
{
|
{
|
||||||
if( opt.command_fd != -1 )
|
if( opt.command_fd != -1 )
|
||||||
return;
|
return;
|
||||||
#ifdef USE_SHM_COPROCESSING
|
#ifdef USE_SHM_COPROCESSING
|
||||||
if( opt.shm_coprocess )
|
if( opt.shm_coprocess )
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
tty_kill_prompt();
|
tty_kill_prompt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -691,4 +691,3 @@ cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define ITEMS_PER_HLST_RECORD ((TRUST_RECORD_LEN-6)/5)
|
#define ITEMS_PER_HLST_RECORD ((TRUST_RECORD_LEN-6)/5)
|
||||||
#define ITEMS_PER_PREF_RECORD (TRUST_RECORD_LEN-10)
|
#define ITEMS_PER_PREF_RECORD (TRUST_RECORD_LEN-10)
|
||||||
#if ITEMS_PER_PREF_RECORD % 2
|
#if ITEMS_PER_PREF_RECORD % 2
|
||||||
#error ITEMS_PER_PREF_RECORD must be even
|
#error ITEMS_PER_PREF_RECORD must be even
|
||||||
#endif
|
#endif
|
||||||
#define MAX_LIST_SIGS_DEPTH 20
|
#define MAX_LIST_SIGS_DEPTH 20
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#define LF "\r\n"
|
#define LF "\r\n"
|
||||||
#else
|
#else
|
||||||
#define LF "\n"
|
#define LF "\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_LINELEN 19995 /* a little bit smaller than in armor.c */
|
#define MAX_LINELEN 19995 /* a little bit smaller than in armor.c */
|
||||||
@ -193,7 +193,7 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
|
|||||||
iobuf_put( out, ' ' );
|
iobuf_put( out, ' ' );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /*defined(HAVE_DOSISH_SYSTEM)*/
|
#if 0 /*defined(HAVE_DOSISH_SYSTEM)*/
|
||||||
/* We don't use this anymore because my interpretation of rfc2440 7.1
|
/* We don't use this anymore because my interpretation of rfc2440 7.1
|
||||||
* is that there is no conversion needed. If one decides to
|
* is that there is no conversion needed. If one decides to
|
||||||
* clearsign a unix file on a DOS box he will get a mixed line endings.
|
* clearsign a unix file on a DOS box he will get a mixed line endings.
|
||||||
@ -215,9 +215,9 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
|
|||||||
else
|
else
|
||||||
iobuf_write( out, buffer, n );
|
iobuf_write( out, buffer, n );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
iobuf_write( out, buffer, n );
|
iobuf_write( out, buffer, n );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* at eof */
|
/* at eof */
|
||||||
@ -232,4 +232,3 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
|
|||||||
|
|
||||||
return 0; /* okay */
|
return 0; /* okay */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user