blob: 5e93936ffc5224105675d55d787089ab288a4ebc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "commonheaders.h"
// globale variablen
struct passphrase *passphrases;
int passphrasecount;
void initPassphrases(void)
{
passphrasecount=0;
passphrases=NULL;
}
void releasePassphrases(void)
{
int i;
for(i=0; i<passphrasecount; i++)
ZeroMemory(passphrases[i].passphrase, sizeof(passphrases[i].passphrase));
free(passphrases);
}
void addPassphrase(const char *akeyuserid, const char *apassphrase)
{
passphrasecount++;
passphrases=realloc(passphrases, sizeof(struct passphrase)*passphrasecount);
strcpy(passphrases[passphrasecount-1].keyuserid, akeyuserid);
strcpy(passphrases[passphrasecount-1].passphrase, apassphrase);
}
char *getPassphrase(const char *akeyuserid)
{
int i;
char *result;
result=NULL;
for(i=0; i<passphrasecount; i++)
{
if(strcmp(passphrases[i].keyuserid, akeyuserid)==0)
result=passphrases[i].passphrase;
}
return result;
}
|