diff options
author | Eduardo Chappa <chappa@washington.edu> | 2015-09-08 19:54:58 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2015-09-08 19:54:58 -0600 |
commit | 8cc4a2fc0e42e07a61d51bffd882d9251332a5ed (patch) | |
tree | b653ba39179b7ee4b2e35eb9b11ecc7fedb0d0f6 | |
parent | 92569d7853a2ffde330ecf62f198d61891b72f83 (diff) | |
download | alpine-8cc4a2fc0e42e07a61d51bffd882d9251332a5ed.tar.xz |
* SMIME: add full year when displaying information about a certificate
in the certificate management screen. Suggested by Matthias Rieber.
* SMIME: sort certificates by some type of alphabetical order in the
displayed name.
-rw-r--r-- | alpine/smime.c | 9 | ||||
-rw-r--r-- | pith/pine.hlp | 8 | ||||
-rw-r--r-- | pith/smkeys.c | 14 |
3 files changed, 20 insertions, 11 deletions
diff --git a/alpine/smime.c b/alpine/smime.c index ca2d1f10..9a3b109d 100644 --- a/alpine/smime.c +++ b/alpine/smime.c @@ -1334,7 +1334,6 @@ smime_setup_size(char **s, size_t buflen, size_t n) snprintf(t, buflen-3, "%zu.%zu", n, n); t += strlen(t); *t++ = 's'; - *t++ = ' '; *s = t; } @@ -1387,19 +1386,21 @@ void smime_manage_certs_init(struct pine *ps, CONF_S **ctmp, CONF_S **first_line if(cl->name && strlen(cl->name) > e) e = strlen(cl->name); - if(ctype != Private) + if(ctype != Private && SMHOLDERTYPE(ctype) == Directory) e -= 4; /* remove extension length FIX FIX FIX */ nf = 5; /* there are 5 fields */ s = 3; /* status has fixed size */ - df = dt = 8; /* date from and date to have fixed size */ - md5 = ps->ttyo->screen_cols - s - df - dt - e - 2*nf; + df = dt = 10; /* date from and date to have fixed size */ + md5 = ps->ttyo->screen_cols - s - df - dt - e - (nf - 1); memset(u, '\0', sizeof(u)); t = u; smime_setup_size(&t, sizeof(u), s); smime_setup_size(&t, sizeof(u) - strlen(t), e); smime_setup_size(&t, sizeof(u) - strlen(t), df); + *t++ = ' '; /* leave an extra space between dates */ smime_setup_size(&t, sizeof(u) - strlen(t), dt); + *t++ = ' '; /* and another space between date and md5 sum */ smime_setup_size(&t, sizeof(u) - strlen(t), md5); for(cl = data, i = 0; cl; cl = cl->next) diff --git a/pith/pine.hlp b/pith/pine.hlp index c45b1e97..21a18299 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 100 2015-09-07 20:04:59 +Alpine Commit 101 2015-09-08 19:54:50 ============= h_news ================= <HTML> <HEAD> @@ -254,6 +254,12 @@ Additions include: <LI> Reimplementation of the code that allows the .pinerc file to be a symbolic link by Kyle George from tcpsoft.com to use realpath. + + <LI> SMIME: add full year when displaying information about a certificate + in the certificate management screen. Suggested by Matthias Rieber. + + <LI> SMIME: sort certificates by some type of alphabetical order in the + displayed name. </UL> diff --git a/pith/smkeys.c b/pith/smkeys.c index d84aa222..73e3cdbe 100644 --- a/pith/smkeys.c +++ b/pith/smkeys.c @@ -284,9 +284,9 @@ resort_certificates(CertList **data, WhichCerts ctype) return; for(i = 0; cl; cl = cl->next, i++) - if(ctype != Private){ /* ctype == Public or ctype == CACerts */ - for(t = s = cl->name; (t = strstr(s, ".crt")) != NULL; s = t+1); - if (s) *(s-1) = '\0'; + if(SMHOLDERTYPE(ctype) == Directory && ctype != Private){ + for(t = s = cl->name; (t = strstr(s, ".crt")) != NULL; s = t+1); + if (s) *(s-1) = '\0'; } j = i; cll = fs_get(i*sizeof(CertList *)); @@ -295,10 +295,10 @@ resort_certificates(CertList **data, WhichCerts ctype) qsort((void *)cll, j, sizeof(CertList *), compare_certs_by_name); for(i = 0; i < j - 1; i++){ cll[i]->next = cll[i+1]; - if(ctype != Private) + if(SMHOLDERTYPE(ctype) == Directory && ctype != Private) cll[i]->name[strlen(cll[i]->name)]= '.'; /* restore ".crt" part */ } - if(ctype != Private) + if(SMHOLDERTYPE(ctype) == Directory && ctype != Private) cll[j-1]->name[strlen(cll[j-1]->name)]= '.'; /* restore ".crt" part */ cll[j-1]->next = NULL; *data = cll[0]; @@ -408,7 +408,7 @@ smime_get_date(ASN1_GENERALIZEDTIME *tm) if(F_ON(F_DATES_TO_LOCAL,ps_global)){ parse_date(convert_date_to_local(date), &smd); memset(&smtm, 0, sizeof(smtm)); - smtm.tm_year = MIN(MAX(smd.year-1900, 0), 2000) % 100 - 1900; + smtm.tm_year = smd.year - 1900; smtm.tm_mon = MIN(MAX(smd.month-1, 0), 11); smtm.tm_mday = MIN(MAX(smd.day, 1), 31); our_strftime(buf, sizeof(buf), "%x", &smtm); @@ -1128,6 +1128,8 @@ mem_to_certlist(char *contents, WhichCerts ctype) *save_p = '\n'; } } + if(ret != NULL) + resort_certificates(&ret, ctype); return ret; } |