23 |
#endif |
#endif |
24 |
|
|
25 |
#include <windows.h> |
#include <windows.h> |
|
#include <windows.h> |
|
26 |
#include <commctrl.h> |
#include <commctrl.h> |
27 |
#include <time.h> |
#include <time.h> |
28 |
|
|
226 |
struct tm *warp; |
struct tm *warp; |
227 |
|
|
228 |
if (timestamp == 0 || timestamp == -1) |
if (timestamp == 0 || timestamp == -1) |
229 |
return "????-??-??"; |
return "????" "-??" "-??"; |
230 |
warp = localtime( ×tamp ); |
warp = localtime( ×tamp ); |
231 |
_snprintf( timebuf, sizeof timebuf - 1, "%04d-%02d-%02d", |
_snprintf( timebuf, sizeof timebuf - 1, "%04d-%02d-%02d", |
232 |
warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday ); |
warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday ); |
372 |
get_key_status (gpgme_key_t key, int uididx, int listmode) |
get_key_status (gpgme_key_t key, int uididx, int listmode) |
373 |
{ |
{ |
374 |
gpgme_user_id_t u; |
gpgme_user_id_t u; |
375 |
char fmt[64], * p; |
char * p; |
376 |
const char * attr; |
const char * attr; |
377 |
int i = 0; |
int i = 0; |
378 |
u32 key_attr =0; |
u32 key_attr =0; |
379 |
|
|
380 |
if (uididx < 0 || count_userids (key) > uididx) |
if (uididx < 0 || count_userids (key) > uididx) |
381 |
uididx = 0; |
uididx = 0; |
|
memset (fmt, 0, sizeof (fmt)); |
|
382 |
if (listmode) { |
if (listmode) { |
383 |
|
const char *s; |
384 |
|
|
385 |
if (key->revoked) |
if (key->revoked) |
386 |
sprintf (fmt, _("Revoked")); |
s = _("Revoked"); |
387 |
else if (key->expired) |
else if (key->expired) |
388 |
sprintf (fmt, _("Expired")); |
s = _("Expired"); |
389 |
else if (key->disabled) |
else if (key->disabled) |
390 |
sprintf (fmt, _("Disabled")); |
s = _("Disabled"); |
391 |
|
else |
392 |
|
s = ""; |
393 |
|
|
394 |
/* if the key has a special status, we don't continue to figure out |
/* if the key has a special status, we don't continue to figure out |
395 |
what any user-id validities. */ |
what any user-id validities. */ |
396 |
if (strlen (fmt) > 0) |
if (*s) |
397 |
return m_strdup (fmt); |
return m_strdup (s); |
398 |
} |
} |
399 |
u = get_nth_userid (key, uididx); |
u = get_nth_userid (key, uididx); |
400 |
key_attr = u->validity; |
key_attr = u->validity; |
401 |
attr = get_key_trust2 (NULL, key_attr, 0, 0); |
attr = get_key_trust2 (NULL, key_attr, 0, 0); |
402 |
|
/* FIXME: Why not just strdup and why does this function either |
403 |
|
* return a new allocated or an m_strdup allocated string? This |
404 |
|
* is very dangerous!!! */ |
405 |
p = new char[strlen( attr ) + 2]; |
p = new char[strlen( attr ) + 2]; |
406 |
if (!p) |
if (!p) |
407 |
BUG (NULL); |
BUG (NULL); |
408 |
sprintf (p, "%s", attr); |
strcpy (p, attr); |
409 |
return p; |
return p; |
410 |
} /* get_key_status */ |
} /* get_key_status */ |
411 |
|
|