comparison src/tls.c @ 5888:a85efdabe237

Call #'read-passwd when requesting a password from the user, tls.c src/ChangeLog addition: 2015-04-09 Aidan Kehoe <kehoea@parhasard.net> * tls.c (nss_pk11_password): * tls.c (gnutls_pk11_password): * tls.c (openssl_password): * tls.c (syms_of_tls): Our read-a-password function is #'read-passwd, not #'read-password, correct that in this file.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 09 Apr 2015 14:54:37 +0100
parents 6eca500211f4
children a0e751d6c3ad
comparison
equal deleted inserted replaced
5887:6eca500211f4 5888:a85efdabe237
27 #include <errno.h> 27 #include <errno.h>
28 #include <netinet/in.h> 28 #include <netinet/in.h>
29 #include <netinet/tcp.h> 29 #include <netinet/tcp.h>
30 30
31 static Lisp_Object prompt; 31 static Lisp_Object prompt;
32 static Lisp_Object Qread_password; 32 static Lisp_Object Qread_passwd;
33 Lisp_Object Qtls_error; 33 Lisp_Object Qtls_error;
34 34
35 #ifdef HAVE_NSS 35 #ifdef HAVE_NSS
36 #include <prinit.h> 36 #include <prinit.h>
37 #include <private/pprio.h> 37 #include <private/pprio.h>
311 311
312 token_name = PK11_GetTokenName (slot); 312 token_name = PK11_GetTokenName (slot);
313 if (token_name == NULL) 313 if (token_name == NULL)
314 token_name = "security token"; 314 token_name = "security token";
315 lsp_password = 315 lsp_password =
316 call1 (Qread_password, concat2 (prompt, 316 call1 (Qread_passwd, concat2 (prompt,
317 build_extstring (token_name, Qnative))); 317 build_extstring (token_name, Qnative)));
318 c_password = LISP_STRING_TO_EXTERNAL (lsp_password, Qnative); 318 c_password = LISP_STRING_TO_EXTERNAL (lsp_password, Qnative);
319 nss_password = PL_strdup (c_password); 319 nss_password = PL_strdup (c_password);
320 320
321 /* Wipe out the password on the stack and in the Lisp string */ 321 /* Wipe out the password on the stack and in the Lisp string */
716 args[0] = prompt; 716 args[0] = prompt;
717 args[1] = build_extstring (token_label, Qnative); 717 args[1] = build_extstring (token_label, Qnative);
718 args[2] = build_ascstring (" ("); 718 args[2] = build_ascstring (" (");
719 args[3] = build_extstring (token_url, Qnative); 719 args[3] = build_extstring (token_url, Qnative);
720 args[4] = build_ascstring (")"); 720 args[4] = build_ascstring (")");
721 lsp_password = call1 (Qread_password, Fconcat (5, args)); 721 lsp_password = call1 (Qread_passwd, Fconcat (5, args));
722 c_password = LISP_STRING_TO_EXTERNAL (lsp_password, Qnative); 722 c_password = LISP_STRING_TO_EXTERNAL (lsp_password, Qnative);
723 723
724 /* Insert the password */ 724 /* Insert the password */
725 len = strlen (c_password); 725 len = strlen (c_password);
726 if (len > pin_max) 726 if (len > pin_max)
1077 { 1077 {
1078 Lisp_Object lsp_password, args[2]; 1078 Lisp_Object lsp_password, args[2];
1079 Extbyte *c_password; 1079 Extbyte *c_password;
1080 1080
1081 lsp_password = 1081 lsp_password =
1082 call1 (Qread_password, concat2 (prompt, build_ascstring ("PEM"))); 1082 call1 (Qread_passwd, concat2 (prompt, build_ascstring ("PEM: ")));
1083 c_password = LISP_STRING_TO_EXTERNAL (lsp_password, Qnative); 1083 c_password = LISP_STRING_TO_EXTERNAL (lsp_password, Qnative);
1084 strncpy (buf, c_password, size); 1084 strncpy (buf, c_password, size);
1085 1085
1086 /* Wipe out the password on the stack and in the Lisp string */ 1086 /* Wipe out the password on the stack and in the Lisp string */
1087 args[0] = lsp_password; 1087 args[0] = lsp_password;
1170 1170
1171 void 1171 void
1172 syms_of_tls (void) 1172 syms_of_tls (void)
1173 { 1173 {
1174 #ifdef WITH_TLS 1174 #ifdef WITH_TLS
1175 DEFSYMBOL (Qread_password); 1175 DEFSYMBOL (Qread_passwd);
1176 #endif 1176 #endif
1177 DEFERROR (Qtls_error, "TLS error", Qerror); 1177 DEFERROR (Qtls_error, "TLS error", Qerror);
1178 } 1178 }
1179 1179
1180 void 1180 void