summaryrefslogtreecommitdiff
path: root/pith/smkeys.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2015-09-08 19:54:58 -0600
committerEduardo Chappa <chappa@washington.edu>2015-09-08 19:54:58 -0600
commit8cc4a2fc0e42e07a61d51bffd882d9251332a5ed (patch)
treeb653ba39179b7ee4b2e35eb9b11ecc7fedb0d0f6 /pith/smkeys.c
parent92569d7853a2ffde330ecf62f198d61891b72f83 (diff)
downloadalpine-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.
Diffstat (limited to 'pith/smkeys.c')
-rw-r--r--pith/smkeys.c14
1 files changed, 8 insertions, 6 deletions
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;
}