generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsinglesecret.patch
28 lines (27 loc) · 1.12 KB
/
singlesecret.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff --git a/src/pam_google_authenticator.c b/src/pam_google_authenticator.c
index 80f3641..4348e79 100644
--- a/src/pam_google_authenticator.c
+++ b/src/pam_google_authenticator.c
@@ -1764,7 +1764,7 @@ static int parse_user(pam_handle_t *pamh, const char *name, uid_t *uid) {
static int parse_args(pam_handle_t *pamh, int argc, const char **argv,
Params *params) {
params->debug = 0;
- params->echocode = PAM_PROMPT_ECHO_OFF;
+ params->echocode = @TOTP_AUTH_ECHO@ ? PAM_PROMPT_ECHO_ON : PAM_PROMPT_ECHO_OFF;
for (int i = 0; i < argc; ++i) {
if (!strncmp(argv[i], "secret=", 7)) {
params->secret_filename_spec = argv[i] + 7;
@@ -1841,7 +1841,13 @@ static int google_authenticator(pam_handle_t *pamh,
// Handle optional arguments that configure our PAM module
Params params = { 0 };
params.allowed_perm = 0600;
- if (parse_args(pamh, argc, argv, ¶ms) < 0) {
+
+ const char *initial[] = {
+ "user=" @TOTP_AUTH_USER@,
+ "secret=" @TOTP_AUTH_SECRET@,
+ NULL
+ };
+ if (parse_args(pamh, 2, initial, ¶ms) < 0 || parse_args(pamh, argc, argv, ¶ms) < 0) {
return rc;
}