diff --git a/src/responder/pam/pamsrv_json.c b/src/responder/pam/pamsrv_json.c index ed04924d12c..021f56c9105 100644 --- a/src/responder/pam/pamsrv_json.c +++ b/src/responder/pam/pamsrv_json.c @@ -202,9 +202,6 @@ obtain_prompts(struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx, char *passkey_init_prompt = NULL; char *passkey_pin_prompt = NULL; char *passkey_touch_prompt = NULL; - const char *tmp = NULL; - int prompt_type; - size_t c; errno_t ret; tmp_ctx = talloc_new(NULL); @@ -212,94 +209,10 @@ obtain_prompts(struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx, return ENOMEM; } - if (pc_list != NULL) { - for (c = 0; pc_list[c] != NULL; c++) { - prompt_type = pc_get_type(pc_list[c]); - switch(prompt_type) { - case PC_TYPE_PASSWORD: - tmp = pc_get_password_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - password_prompt = talloc_strdup(tmp_ctx, tmp); - if (password_prompt == NULL) { - ret = ENOMEM; - } - break; - case PC_TYPE_EIDP: - tmp = pc_get_eidp_init_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - oauth2_init_prompt = talloc_strdup(tmp_ctx, tmp); - if (oauth2_init_prompt == NULL) { - ret = ENOMEM; - } - tmp = pc_get_eidp_link_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - oauth2_link_prompt = talloc_strdup(tmp_ctx, tmp); - if (oauth2_link_prompt == NULL) { - ret = ENOMEM; - } - break; - case PC_TYPE_SMARTCARD: - tmp = pc_get_smartcard_init_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - sc_init_prompt = talloc_strdup(tmp_ctx, tmp); - if (sc_init_prompt == NULL) { - ret = ENOMEM; - } - tmp = pc_get_smartcard_pin_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - sc_pin_prompt = talloc_strdup(tmp_ctx, tmp); - if (sc_pin_prompt == NULL) { - ret = ENOMEM; - } - break; - case PC_TYPE_PASSKEY: - tmp = pc_get_passkey_inter_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - passkey_init_prompt = talloc_strdup(tmp_ctx, tmp); - if (passkey_init_prompt == NULL) { - ret = ENOMEM; - } - tmp = pc_get_passkey_pin_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - passkey_pin_prompt = talloc_strdup(tmp_ctx, tmp); - if (passkey_pin_prompt == NULL) { - ret = ENOMEM; - } - tmp = pc_get_passkey_touch_prompt(pc_list[c]); - if (tmp == NULL) { - ret = ENOENT; - } - passkey_touch_prompt = talloc_strdup(tmp_ctx, tmp); - if (passkey_touch_prompt == NULL) { - ret = ENOMEM; - } - break; - default: - ret = EPERM; - goto done; - } - } - } - if (password_prompt == NULL) { - ret = confdb_get_string(cdb, tmp_ctx, CONFDB_PC_CONF_ENTRY, - CONFDB_PC_PASSWORD_PROMPT, "", - &password_prompt); - if (ret != EOK) { + password_prompt = talloc_strdup(tmp_ctx, "Password"); + if (password_prompt == NULL) { + ret = ENOMEM; goto done; } } @@ -330,7 +243,7 @@ obtain_prompts(struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx, } if (sc_pin_prompt == NULL) { - sc_pin_prompt = talloc_strdup(tmp_ctx, "PIN"); + sc_pin_prompt = talloc_strdup(tmp_ctx, "Smartcard PIN"); if (sc_pin_prompt == NULL) { ret = ENOMEM; goto done; diff --git a/src/tests/cmocka/test_pamsrv_json.c b/src/tests/cmocka/test_pamsrv_json.c index 0ecfe7b8963..c048af1e490 100644 --- a/src/tests/cmocka/test_pamsrv_json.c +++ b/src/tests/cmocka/test_pamsrv_json.c @@ -31,17 +31,17 @@ #include "src/responder/pam/pamsrv_json.h" #define PASSWORD_PROMPT "Password" -#define OAUTH2_INIT_PROMPT "Init" -#define OAUTH2_LINK_PROMPT "Link" +#define OAUTH2_INIT_PROMPT "Log In" +#define OAUTH2_LINK_PROMPT "Log in online with another device" #define OAUTH2_URI "short.url.com/tmp\0" #define OAUTH2_URI_COMP "\0" #define OAUTH2_CODE "1234-5678" #define OAUTH2_STR OAUTH2_URI OAUTH2_URI_COMP OAUTH2_CODE #define SC_INIT_PROMPT "Insert smartcard" -#define SC_PIN_PROMPT "PIN" -#define PASSKEY_INIT_PROMPT "Insert key" -#define PASSKEY_PIN_PROMPT "Key PIN" -#define PASSKEY_TOUCH_PROMPT "Touch key" +#define SC_PIN_PROMPT "Smartcard PIN" +#define PASSKEY_INIT_PROMPT "Insert security key" +#define PASSKEY_PIN_PROMPT "Security key PIN" +#define PASSKEY_TOUCH_PROMPT "Touch security key" #define SC1_CERT_USER "cert_user1\0" #define SC1_TOKEN_NAME "token_name1\0" @@ -75,18 +75,18 @@ #define BASIC_SC "\"smartcard:1\": {" \ "\"name\": \"prompt1\", \"role\": \"smartcard\", " \ "\"selectable\": true, " \ - "\"init_instruction\": \"Insert smartcard\", " \ - "\"pin_prompt\": \"PIN\"}" + "\"init_instruction\": \"" SC_INIT_PROMPT "\", " \ + "\"pin_prompt\": \"" SC_PIN_PROMPT "\"}" #define MULTIPLE_SC "\"smartcard:1\": {" \ "\"name\": \"prompt1\", \"role\": \"smartcard\", " \ "\"selectable\": true, " \ - "\"init_instruction\": \"Insert smartcard\", " \ - "\"pin_prompt\": \"PIN\"}, " \ + "\"init_instruction\": \"" SC_INIT_PROMPT "\", " \ + "\"pin_prompt\": \"" SC_PIN_PROMPT "\"}, " \ "\"smartcard:2\": {" \ "\"name\": \"prompt2\", \"role\": \"smartcard\", " \ "\"selectable\": true, " \ - "\"init_instruction\": \"Insert smartcard\", " \ - "\"pin_prompt\": \"PIN\"}" + "\"init_instruction\": \"" SC_INIT_PROMPT "\", " \ + "\"pin_prompt\": \"" SC_PIN_PROMPT "\"}" #define BASIC_PASSKEY "\"passkey\": {" \ "\"name\": \"passkey\", \"role\": \"passkey\", " \ "\"selectable\": true, " \