mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-19 01:51:03 +00:00
set minimum key size
This commit is contained in:
parent
6be15f9c67
commit
8c2e4d44ce
1 changed files with 7 additions and 1 deletions
|
@ -87,6 +87,8 @@ getkey(NSString **key)
|
||||||
char *one = NULL;
|
char *one = NULL;
|
||||||
char *two = NULL;
|
char *two = NULL;
|
||||||
|
|
||||||
|
#define MINKEY 16
|
||||||
|
|
||||||
/* Open the terminal
|
/* Open the terminal
|
||||||
*/
|
*/
|
||||||
if ((stream = fopen("/dev/tty", "r+")) == NULL)
|
if ((stream = fopen("/dev/tty", "r+")) == NULL)
|
||||||
|
@ -113,7 +115,7 @@ getkey(NSString **key)
|
||||||
int olen = 0;
|
int olen = 0;
|
||||||
int tlen = 0;
|
int tlen = 0;
|
||||||
|
|
||||||
while (0 == olen)
|
while (olen < MINKEY)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
|
@ -127,6 +129,10 @@ getkey(NSString **key)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
olen = trim(one);
|
olen = trim(one);
|
||||||
|
if (olen < MINKEY)
|
||||||
|
{
|
||||||
|
fprintf(stream, "\nKey must be at least %u characters\n", MINKEY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (0 == tlen)
|
while (0 == tlen)
|
||||||
|
|
Loading…
Reference in a new issue