diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-10-05 19:24:35 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-10-05 19:24:35 -0500 |
commit | 3ab7801c9e6cddc381992f604d57a89f594feeaa (patch) | |
tree | e5c22f16ec89d12973d5b7e7cea292faa0e7d736 /user/kscreenlocker/kscreenlocker-5.8.5-stop-using-getpass.patch | |
parent | 5c6964cb8fbabe2e2d61eb95bcbec1f82e7f6084 (diff) | |
download | packages-3ab7801c9e6cddc381992f604d57a89f594feeaa.tar.gz packages-3ab7801c9e6cddc381992f604d57a89f594feeaa.tar.bz2 packages-3ab7801c9e6cddc381992f604d57a89f594feeaa.tar.xz packages-3ab7801c9e6cddc381992f604d57a89f594feeaa.zip |
user/kscreenlocker: new package
Diffstat (limited to 'user/kscreenlocker/kscreenlocker-5.8.5-stop-using-getpass.patch')
-rw-r--r-- | user/kscreenlocker/kscreenlocker-5.8.5-stop-using-getpass.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/user/kscreenlocker/kscreenlocker-5.8.5-stop-using-getpass.patch b/user/kscreenlocker/kscreenlocker-5.8.5-stop-using-getpass.patch new file mode 100644 index 000000000..f10789f88 --- /dev/null +++ b/user/kscreenlocker/kscreenlocker-5.8.5-stop-using-getpass.patch @@ -0,0 +1,71 @@ +--- kscreenlocker-5.8.5/kcheckpass/kcheckpass.c.old 2016-12-27 11:25:36.000000000 +0000 ++++ kscreenlocker-5.8.5/kcheckpass/kcheckpass.c 2017-01-31 04:32:44.858227055 +0000 +@@ -56,6 +56,7 @@ + #include <stdlib.h> + #include <errno.h> + #include <time.h> ++#include <termios.h> + + #include <config-kscreenlocker.h> + #if HAVE_SYS_PRCTL_H +@@ -75,9 +76,41 @@ + static int havetty, sfd = -1, nullpass; + + static char * ++better_getpass (void) ++{ ++ char *password = NULL, *nl; ++ size_t buf_len = 0; ++ ssize_t pass_len; ++ struct termios ti; ++ ++ tcgetattr(STDIN_FILENO, &ti); ++ ti.c_lflag &= ~ECHO; ++ tcsetattr(STDIN_FILENO, TCSANOW, &ti); ++ ++ pass_len = getdelim(&password, &buf_len, '\n', stdin); ++ ++ if (pass_len < 0) { ++ free(password); ++ return NULL; ++ } ++ ++ ti.c_lflag |= ECHO; ++ tcsetattr(STDIN_FILENO, TCSANOW, &ti); ++ ++ /* Do not include the \n at the end */ ++ nl = strchr(password, '\n'); ++ if (nl) { ++ *nl = '\0'; ++ } ++ ++ return password; ++} ++ ++ ++static char * + conv_legacy (ConvRequest what, const char *prompt) + { +- char *p, *p2; ++ char *p2; + int len; + char buf[1024]; + +@@ -99,13 +132,10 @@ + return strdup(buf); + case ConvGetHidden: + if (havetty) { +-#ifdef HAVE_GETPASSPHRASE +- p = getpassphrase(prompt ? prompt : "Password: "); +-#else +- p = getpass(prompt ? prompt : "Password: "); +-#endif +- p2 = strdup(p); +- memset(p, 0, strlen(p)); ++ fputs(prompt ? prompt : "Password: ", stdout); ++ fflush(stdout); ++ p2 = better_getpass(); ++ printf("\n"); + return p2; + } else { + if (prompt) |