mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Fixes for W32
This commit is contained in:
parent
64ddc393e1
commit
397a73b685
36 changed files with 296 additions and 165 deletions
|
@ -1,3 +1,23 @@
|
|||
2001-04-19 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* keyid.c (mk_datestr): New. Handles negative times. we must do
|
||||
this because Windoze segvs on negative times passed to gmtime().
|
||||
Changed all datestr_from function to use this one.
|
||||
|
||||
* keyid.c, keyid.h (colon_strtime): New. To implement the
|
||||
fixed-list-mode.
|
||||
(colon_datestr_from_pk): New.
|
||||
(colon_datestr_from_sk): New.
|
||||
(colon_datestr_from_sig): New.
|
||||
* keylist.c (list_keyblock_colon): Use these functions here.
|
||||
* mainproc.c (list_node): Ditto.
|
||||
|
||||
2001-04-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* openfile.c (open_sigfile): Fixed the handling of ".sign".
|
||||
* mainproc.c (proc_tree): Use iobuf_get_real_fname.
|
||||
Both are by Vincent Broman.
|
||||
|
||||
2001-04-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* getkey.c (fixup_uidnode): Removed check for !sig which is
|
||||
|
|
|
@ -185,6 +185,12 @@ const char *datestr_from_sk( PKT_secret_key *sk );
|
|||
const char *datestr_from_sig( PKT_signature *sig );
|
||||
const char *expirestr_from_pk( PKT_public_key *pk );
|
||||
const char *expirestr_from_sk( PKT_secret_key *sk );
|
||||
|
||||
const char *colon_strtime (u32 t);
|
||||
const char *colon_datestr_from_pk (PKT_public_key *pk);
|
||||
const char *colon_datestr_from_sk (PKT_secret_key *sk);
|
||||
const char *colon_datestr_from_sig (PKT_signature *sig);
|
||||
|
||||
byte *fingerprint_from_sk( PKT_secret_key *sk, byte *buf, size_t *ret_len );
|
||||
byte *fingerprint_from_pk( PKT_public_key *pk, byte *buf, size_t *ret_len );
|
||||
|
||||
|
|
87
g10/keyid.c
87
g10/keyid.c
|
@ -260,6 +260,21 @@ nbits_from_sk( PKT_secret_key *sk )
|
|||
return pubkey_nbits( sk->pubkey_algo, sk->skey );
|
||||
}
|
||||
|
||||
static const char *
|
||||
mk_datestr (char *buffer, time_t atime)
|
||||
{
|
||||
struct tm *tp;
|
||||
|
||||
if ( atime < 0 ) /* 32 bit time_t and after 2038-01-19 */
|
||||
strcpy (buffer, "????-??-??"); /* mark this as invalid */
|
||||
else {
|
||||
tp = gmtime (&atime);
|
||||
sprintf (buffer,"%04d-%02d-%02d",
|
||||
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/****************
|
||||
* return a string with the creation date of the pk
|
||||
* Note: this is alloced in a static buffer.
|
||||
|
@ -269,36 +284,27 @@ const char *
|
|||
datestr_from_pk( PKT_public_key *pk )
|
||||
{
|
||||
static char buffer[11+5];
|
||||
struct tm *tp;
|
||||
time_t atime = pk->timestamp;
|
||||
|
||||
tp = gmtime( &atime );
|
||||
sprintf(buffer,"%04d-%02d-%02d", 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
|
||||
return buffer;
|
||||
return mk_datestr (buffer, atime);
|
||||
}
|
||||
|
||||
const char *
|
||||
datestr_from_sk( PKT_secret_key *sk )
|
||||
{
|
||||
static char buffer[11+5];
|
||||
struct tm *tp;
|
||||
time_t atime = sk->timestamp;
|
||||
|
||||
tp = gmtime( &atime );
|
||||
sprintf(buffer,"%04d-%02d-%02d", 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
|
||||
return buffer;
|
||||
return mk_datestr (buffer, atime);
|
||||
}
|
||||
|
||||
const char *
|
||||
datestr_from_sig( PKT_signature *sig )
|
||||
{
|
||||
static char buffer[11+5];
|
||||
struct tm *tp;
|
||||
time_t atime = sig->timestamp;
|
||||
|
||||
tp = gmtime( &atime );
|
||||
sprintf(buffer,"%04d-%02d-%02d", 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
|
||||
return buffer;
|
||||
return mk_datestr (buffer, atime);
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,32 +312,73 @@ const char *
|
|||
expirestr_from_pk( PKT_public_key *pk )
|
||||
{
|
||||
static char buffer[11+5];
|
||||
struct tm *tp;
|
||||
time_t atime;
|
||||
|
||||
if( !pk->expiredate )
|
||||
return _("never ");
|
||||
atime = pk->expiredate;
|
||||
tp = gmtime( &atime );
|
||||
sprintf(buffer,"%04d-%02d-%02d", 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
|
||||
return buffer;
|
||||
return mk_datestr (buffer, atime);
|
||||
}
|
||||
|
||||
const char *
|
||||
expirestr_from_sk( PKT_secret_key *sk )
|
||||
{
|
||||
static char buffer[11+5];
|
||||
struct tm *tp;
|
||||
time_t atime;
|
||||
|
||||
if( !sk->expiredate )
|
||||
return "never ";
|
||||
atime = sk->expiredate;
|
||||
tp = gmtime( &atime );
|
||||
sprintf(buffer,"%04d-%02d-%02d", 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
|
||||
return buffer;
|
||||
return mk_datestr (buffer, atime);
|
||||
}
|
||||
|
||||
const char *
|
||||
colon_strtime (u32 t)
|
||||
{
|
||||
if (!t)
|
||||
return "";
|
||||
if (opt.fixed_list_mode) {
|
||||
static char buf[15];
|
||||
sprintf (buf, "%lu", (ulong)t);
|
||||
return buf;
|
||||
}
|
||||
return strtimestamp(t);
|
||||
}
|
||||
|
||||
const char *
|
||||
colon_datestr_from_pk (PKT_public_key *pk)
|
||||
{
|
||||
if (opt.fixed_list_mode) {
|
||||
static char buf[15];
|
||||
sprintf (buf, "%lu", (ulong)pk->timestamp);
|
||||
return buf;
|
||||
}
|
||||
return datestr_from_pk (pk);
|
||||
}
|
||||
|
||||
const char *
|
||||
colon_datestr_from_sk (PKT_secret_key *sk)
|
||||
{
|
||||
if (opt.fixed_list_mode) {
|
||||
static char buf[15];
|
||||
sprintf (buf, "%lu", (ulong)sk->timestamp);
|
||||
return buf;
|
||||
}
|
||||
return datestr_from_sk (sk);
|
||||
}
|
||||
|
||||
const char *
|
||||
colon_datestr_from_sig (PKT_signature *sig)
|
||||
{
|
||||
if (opt.fixed_list_mode) {
|
||||
static char buf[15];
|
||||
sprintf (buf, "%lu", (ulong)sig->timestamp);
|
||||
return buf;
|
||||
}
|
||||
return datestr_from_sig (sig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************** .
|
||||
* Return a byte array with the fingerprint for the given PK/SK
|
||||
|
|
|
@ -399,8 +399,8 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||
nbits_from_sk( sk ),
|
||||
sk->pubkey_algo,
|
||||
(ulong)keyid[0],(ulong)keyid[1],
|
||||
datestr_from_sk( sk ),
|
||||
sk->expiredate? strtimestamp(sk->expiredate):""
|
||||
colon_datestr_from_sk( sk ),
|
||||
colon_strtime (sk->expiredate)
|
||||
/* fixme: add LID here */ );
|
||||
}
|
||||
else {
|
||||
|
@ -427,8 +427,8 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||
nbits_from_pk( pk ),
|
||||
pk->pubkey_algo,
|
||||
(ulong)keyid[0],(ulong)keyid[1],
|
||||
datestr_from_pk( pk ),
|
||||
pk->expiredate? strtimestamp(pk->expiredate):"" );
|
||||
colon_datestr_from_pk( pk ),
|
||||
colon_strtime (pk->expiredate) );
|
||||
if( pk->local_id )
|
||||
printf("%lu", pk->local_id );
|
||||
putchar(':');
|
||||
|
@ -529,8 +529,8 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||
nbits_from_pk( pk2 ),
|
||||
pk2->pubkey_algo,
|
||||
(ulong)keyid2[0],(ulong)keyid2[1],
|
||||
datestr_from_pk( pk2 ),
|
||||
pk2->expiredate? strtimestamp(pk2->expiredate):""
|
||||
colon_datestr_from_pk( pk2 ),
|
||||
colon_strtime (pk2->expiredate)
|
||||
/* fixme: add LID and ownertrust here */
|
||||
);
|
||||
if( pk->local_id ) /* use the local_id of the main key??? */
|
||||
|
@ -565,8 +565,8 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||
nbits_from_sk( sk2 ),
|
||||
sk2->pubkey_algo,
|
||||
(ulong)keyid2[0],(ulong)keyid2[1],
|
||||
datestr_from_sk( sk2 ),
|
||||
sk2->expiredate? strtimestamp(sk2->expiredate):""
|
||||
colon_datestr_from_sk( sk2 ),
|
||||
colon_strtime (sk2->expiredate)
|
||||
/* fixme: add LID */ );
|
||||
print_capabilities (NULL, sk2, NULL);
|
||||
putchar ('\n');
|
||||
|
@ -627,7 +627,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||
putchar(sigrc);
|
||||
printf("::%d:%08lX%08lX:%s::::", sig->pubkey_algo,
|
||||
(ulong)sig->keyid[0],
|
||||
(ulong)sig->keyid[1], datestr_from_sig(sig));
|
||||
(ulong)sig->keyid[1], colon_datestr_from_sig(sig));
|
||||
if( sigrc == '%' )
|
||||
printf("[%s] ", g10_errstr(rc) );
|
||||
else if( sigrc == '?' )
|
||||
|
|
|
@ -781,8 +781,8 @@ list_node( CTX c, KBNODE node )
|
|||
nbits_from_pk( pk ),
|
||||
pk->pubkey_algo,
|
||||
(ulong)keyid[0],(ulong)keyid[1],
|
||||
datestr_from_pk( pk ),
|
||||
pk->expiredate? strtimestamp(pk->expiredate):"" );
|
||||
colon_datestr_from_pk( pk ),
|
||||
colon_strtime (pk->expiredate) );
|
||||
if( c->local_id )
|
||||
printf("%lu", c->local_id );
|
||||
putchar(':');
|
||||
|
@ -868,8 +868,8 @@ list_node( CTX c, KBNODE node )
|
|||
nbits_from_sk( sk ),
|
||||
sk->pubkey_algo,
|
||||
(ulong)keyid[0],(ulong)keyid[1],
|
||||
datestr_from_sk( sk ),
|
||||
sk->expiredate? strtimestamp(sk->expiredate):""
|
||||
colon_datestr_from_sk( sk ),
|
||||
colon_strtime (sk->expiredate)
|
||||
/* fixme: add LID */ );
|
||||
}
|
||||
else
|
||||
|
@ -966,7 +966,7 @@ list_node( CTX c, KBNODE node )
|
|||
putchar(sigrc);
|
||||
printf("::%d:%08lX%08lX:%s::::", sig->pubkey_algo,
|
||||
(ulong)sig->keyid[0],
|
||||
(ulong)sig->keyid[1], datestr_from_sig(sig));
|
||||
(ulong)sig->keyid[1], colon_datestr_from_sig(sig));
|
||||
}
|
||||
else
|
||||
printf("%c %08lX %s ",
|
||||
|
@ -1415,7 +1415,7 @@ proc_tree( CTX c, KBNODE node )
|
|||
}
|
||||
else {
|
||||
rc = ask_for_detached_datafile( c->mfx.md, c->mfx.md2,
|
||||
iobuf_get_fname(c->iobuf),
|
||||
iobuf_get_real_fname(c->iobuf),
|
||||
n1? (n1->pkt->pkt.onepass_sig->sig_class == 0x01):0 );
|
||||
}
|
||||
if( rc ) {
|
||||
|
@ -1493,7 +1493,7 @@ proc_tree( CTX c, KBNODE node )
|
|||
}
|
||||
else {
|
||||
rc = ask_for_detached_datafile( c->mfx.md, c->mfx.md2,
|
||||
iobuf_get_fname(c->iobuf),
|
||||
iobuf_get_real_fname(c->iobuf),
|
||||
(sig->sig_class == 0x01) );
|
||||
}
|
||||
if( rc ) {
|
||||
|
|
|
@ -267,7 +267,7 @@ open_sigfile( const char *iname )
|
|||
|| !strcmp(iname + len - 4, ".asc")) ) {
|
||||
char *buf;
|
||||
buf = m_strdup(iname);
|
||||
buf[len-4] = 0 ;
|
||||
buf[len-(buf[len-1]=='n'?5:4)] = 0 ;
|
||||
a = iobuf_open( buf );
|
||||
if( a && opt.verbose )
|
||||
log_info(_("assuming signed data in `%s'\n"), buf );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue