From 2d386261acb7a3325c289da104c3b118cd621aee Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Tue, 19 May 2015 18:28:01 +0200 Subject: [PATCH] don't use default messages for first prompt - allow worker to set it --- src/auth/common.c | 1 - src/auth/common.h | 1 - src/auth/plain.c | 5 +++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/auth/common.c b/src/auth/common.c index d55242df..20457e65 100644 --- a/src/auth/common.c +++ b/src/auth/common.c @@ -20,7 +20,6 @@ #include #include -const char* pass_msg_first = "Please enter your password."; const char* pass_msg_second = "Please enter your challenge password."; const char* pass_msg_failed = "Login failed.\nPlease enter your password."; diff --git a/src/auth/common.h b/src/auth/common.h index 54c96ac2..90851c7d 100644 --- a/src/auth/common.h +++ b/src/auth/common.h @@ -3,7 +3,6 @@ #define MAX_PASSWORD_TRIES 3 -extern const char* pass_msg_first; extern const char* pass_msg_second; extern const char* pass_msg_failed; diff --git a/src/auth/plain.c b/src/auth/plain.c index 74d5f192..ba9d80a7 100644 --- a/src/auth/plain.c +++ b/src/auth/plain.c @@ -197,7 +197,7 @@ static int plain_auth_init(void **ctx, void *pool, const char *username, const c return ERR_AUTH_FAIL; strlcpy(pctx->username, username, sizeof(pctx->username)); - pctx->pass_msg = pass_msg_first; + pctx->pass_msg = NULL; /* use default */ ret = read_auth_pass(pctx); if (ret < 0) { @@ -272,7 +272,8 @@ static int plain_auth_msg(void *ctx, void *pool, passwd_msg_st *pst) { struct plain_ctx_st *pctx = ctx; - pst->msg_str = talloc_strdup(pool, pctx->pass_msg); + if (pctx->pass_msg) + pst->msg_str = talloc_strdup(pool, pctx->pass_msg); pst->counter = 0; /* we support a single password */ /* use the default prompt */