[rt-commit] r197 - in /redwax-tool/trunk: ChangeLog redwax_p11kit.c

rt-commit at redwax.eu rt-commit at redwax.eu
Fri Dec 13 18:40:27 CET 2024


Author: minfrin at redwax.eu
Date: Fri Dec 13 18:40:27 2024
New Revision: 197

Log:
PKCS11 pins were rejected if a PIN was the maximum
possible pin length. If no pin is entered, we skip
the login.

Modified:
    redwax-tool/trunk/ChangeLog
    redwax-tool/trunk/redwax_p11kit.c

Modified: redwax-tool/trunk/ChangeLog
==============================================================================
--- redwax-tool/trunk/ChangeLog	(original)
+++ redwax-tool/trunk/ChangeLog	Fri Dec 13 18:40:27 2024
@@ -1,3 +1,9 @@
+
+Changes with v0.9.8
+
+ *) PKCS11 pins were rejected if a PIN was the maximum
+    possible pin length. If no pin is entered, we skip
+    the login. [Graham Leggett]
 
 Changes with v0.9.7
 

Modified: redwax-tool/trunk/redwax_p11kit.c
==============================================================================
--- redwax-tool/trunk/redwax_p11kit.c	(original)
+++ redwax-tool/trunk/redwax_p11kit.c	Fri Dec 13 18:40:27 2024
@@ -1022,12 +1022,18 @@
 
             int len;
 
+            apr_size_t maxbuf;
+
             if (max <= 0) {
                 /* maximum length says no password allowed */
                 break;
             }
-
-            status = apr_password_get(prompt, buf, &max);
+            else {
+            	/* enough space for a trailing zero */
+            	maxbuf = max + 1;
+            }
+
+            status = apr_password_get(prompt, buf, &maxbuf);
             if (APR_ENAMETOOLONG == status) {
                 redwax_print_error(r,
                         "%s: user PIN was longer than %" APR_SSIZE_T_FMT
@@ -1041,7 +1047,12 @@
             }
 
             len = strlen(buf);
-            if (len < min) {
+            if (len == 0) {
+
+            	/* if no pin is entered, give up the login */
+            	break;
+            }
+            else if (len < min) {
 
                 redwax_print_error(r,
                         "%s: user PIN was shorter than %"



More information about the rt-commit mailing list