This patch allows accepting a backspace in pkcsconf PIN entry. It should do the expected thing, allowing you to delete any part of an entered PIN.
Tested on opensuse 11.3 only so far. Signed-off-by: Kent Yoder <[email protected]> diff --git a/usr/sbin/pkcsconf/pkcsconf.c b/usr/sbin/pkcsconf/pkcsconf.c index f94ecfa..541103b 100755 --- a/usr/sbin/pkcsconf/pkcsconf.c +++ b/usr/sbin/pkcsconf/pkcsconf.c @@ -647,20 +647,22 @@ int get_pin(CK_CHAR **pin) /* Turn off echoing to the terminal when getting the password */ echo(FALSE); /* Get each character and print out a '*' for each input */ - for (count = 0; (c != LINE_FEED) && (count < PIN_SIZE); count++) { + for (count = 0; (c != LINE_FEED) && (count < PIN_SIZE);) { buff[count] = getc(stdin); c = buff[count]; if (c == BACK_SPACE || c == DELETE) { - printf("\nBackspace and delete character not allowed. " - "Please retry entering your PIN.\n"); - rc = -EINVAL; - echo(TRUE); - fflush(stdout); - goto out; - } - if ((c != LINE_FEED)) + if (count) { + count--; + putchar(BACK_SPACE); + putchar(' '); + putchar(BACK_SPACE); + fflush(stdout); + } + continue; + } else if ((c != LINE_FEED)) printf("*"); fflush(stdout); + count++; } echo(TRUE); /* After we get the password go to the next line */ ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Opencryptoki-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech
