always use lowercase version of emailadresses.

This commit is contained in:
TLINDEN
2013-11-03 14:50:03 +01:00
parent 79068fce66
commit a1794a4775
9 changed files with 102 additions and 71 deletions

View File

@@ -49,7 +49,7 @@ void pcp_keygen(char *passwd) {
memcpy(k->owner, owner, strlen(owner) + 1);
char *mail = pcp_getstdin("Enter the email address of the key owner");
memcpy(k->mail, mail, strlen(mail) + 1);
memcpy(k->mail, _lc(mail), strlen(mail) + 1);
if(debug)
pcp_dumpkey(k);
@@ -550,6 +550,7 @@ void pcpedit_key(char *keyid) {
char *pcp_find_id_byrec(char *recipient) {
pcp_pubkey_t *p;
char *id = NULL;
_lc(recipient);
for(p=pcppubkey_hash; p != NULL; p=(pcp_pubkey_t*)(p->hh.next)) {
if(strncmp(p->owner, recipient, 255) == 0) {
id = ucmalloc(17);
@@ -564,3 +565,11 @@ char *pcp_find_id_byrec(char *recipient) {
}
return id;
}
char *_lc(char *in) {
size_t len = strlen(in);
int i;
for(i=0; i<len; ++i)
in[i] = towlower(in[i]);
return in;
}

View File

@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <wctype.h>
#include "randomart.h"
#include "mac.h"
@@ -32,5 +33,6 @@ int pcp_importsecret (vault_t *vault, FILE *in);
int pcp_sanitycheck_key(pcp_key_t *key);
void pcpdelete_key(char *keyid);
char *pcp_find_id_byrec(char *recipient);
char *_lc(char *in);
#endif // _HAVE_KEYMGMT_H