Skip to content

Commit e64465f

Browse files
committed
Responder: set hardcoded strings for prompts
Due to the difficulty of having a single source for the prompts strings for both CLI and GUI, it has been decided to leave them fixed and use the strings proposed by Allan in the mockups design. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
1 parent 5adb68a commit e64465f

File tree

2 files changed

+10
-97
lines changed

2 files changed

+10
-97
lines changed

src/responder/pam/pamsrv_json.c

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -206,104 +206,17 @@ obtain_prompts(struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx,
206206
char *passkey_init_prompt = NULL;
207207
char *passkey_pin_prompt = NULL;
208208
char *passkey_touch_prompt = NULL;
209-
const char *tmp = NULL;
210-
int prompt_type;
211-
size_t c;
212209
errno_t ret;
213210

214211
tmp_ctx = talloc_new(NULL);
215212
if (tmp_ctx == NULL) {
216213
return ENOMEM;
217214
}
218215

219-
if (pc_list != NULL) {
220-
for (c = 0; pc_list[c] != NULL; c++) {
221-
prompt_type = pc_get_type(pc_list[c]);
222-
switch(prompt_type) {
223-
case PC_TYPE_PASSWORD:
224-
tmp = pc_get_password_prompt(pc_list[c]);
225-
if (tmp == NULL) {
226-
ret = ENOENT;
227-
}
228-
password_prompt = talloc_strdup(tmp_ctx, tmp);
229-
if (password_prompt == NULL) {
230-
ret = ENOMEM;
231-
}
232-
break;
233-
case PC_TYPE_EIDP:
234-
tmp = pc_get_eidp_init_prompt(pc_list[c]);
235-
if (tmp == NULL) {
236-
ret = ENOENT;
237-
}
238-
oauth2_init_prompt = talloc_strdup(tmp_ctx, tmp);
239-
if (oauth2_init_prompt == NULL) {
240-
ret = ENOMEM;
241-
}
242-
tmp = pc_get_eidp_link_prompt(pc_list[c]);
243-
if (tmp == NULL) {
244-
ret = ENOENT;
245-
}
246-
oauth2_link_prompt = talloc_strdup(tmp_ctx, tmp);
247-
if (oauth2_link_prompt == NULL) {
248-
ret = ENOMEM;
249-
}
250-
break;
251-
case PC_TYPE_SMARTCARD:
252-
tmp = pc_get_smartcard_init_prompt(pc_list[c]);
253-
if (tmp == NULL) {
254-
ret = ENOENT;
255-
}
256-
sc_init_prompt = talloc_strdup(tmp_ctx, tmp);
257-
if (sc_init_prompt == NULL) {
258-
ret = ENOMEM;
259-
}
260-
tmp = pc_get_smartcard_pin_prompt(pc_list[c]);
261-
if (tmp == NULL) {
262-
ret = ENOENT;
263-
}
264-
sc_pin_prompt = talloc_strdup(tmp_ctx, tmp);
265-
if (sc_pin_prompt == NULL) {
266-
ret = ENOMEM;
267-
}
268-
break;
269-
case PC_TYPE_PASSKEY:
270-
tmp = pc_get_passkey_inter_prompt(pc_list[c]);
271-
if (tmp == NULL) {
272-
ret = ENOENT;
273-
}
274-
passkey_init_prompt = talloc_strdup(tmp_ctx, tmp);
275-
if (passkey_init_prompt == NULL) {
276-
ret = ENOMEM;
277-
}
278-
tmp = pc_get_passkey_pin_prompt(pc_list[c]);
279-
if (tmp == NULL) {
280-
ret = ENOENT;
281-
}
282-
passkey_pin_prompt = talloc_strdup(tmp_ctx, tmp);
283-
if (passkey_pin_prompt == NULL) {
284-
ret = ENOMEM;
285-
}
286-
tmp = pc_get_passkey_touch_prompt(pc_list[c]);
287-
if (tmp == NULL) {
288-
ret = ENOENT;
289-
}
290-
passkey_touch_prompt = talloc_strdup(tmp_ctx, tmp);
291-
if (passkey_touch_prompt == NULL) {
292-
ret = ENOMEM;
293-
}
294-
break;
295-
default:
296-
ret = EPERM;
297-
goto done;
298-
}
299-
}
300-
}
301-
302216
if (password_prompt == NULL) {
303-
ret = confdb_get_string(cdb, tmp_ctx, CONFDB_PC_CONF_ENTRY,
304-
CONFDB_PC_PASSWORD_PROMPT, "",
305-
&password_prompt);
306-
if (ret != EOK) {
217+
password_prompt = talloc_strdup(tmp_ctx, "Password");
218+
if (password_prompt == NULL) {
219+
ret = ENOMEM;
307220
goto done;
308221
}
309222
}
@@ -334,7 +247,7 @@ obtain_prompts(struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx,
334247
}
335248

336249
if (sc_pin_prompt == NULL) {
337-
sc_pin_prompt = talloc_strdup(tmp_ctx, "PIN");
250+
sc_pin_prompt = talloc_strdup(tmp_ctx, "Smartcard PIN");
338251
if (sc_pin_prompt == NULL) {
339252
ret = ENOMEM;
340253
goto done;

src/tests/cmocka/test_pamsrv_json.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
#include "src/responder/pam/pamsrv_json.h"
3232

3333
#define PASSWORD_PROMPT "Password"
34-
#define OAUTH2_INIT_PROMPT "Init"
35-
#define OAUTH2_LINK_PROMPT "Link"
34+
#define OAUTH2_INIT_PROMPT "Log In"
35+
#define OAUTH2_LINK_PROMPT "Log in online with another device"
3636
#define OAUTH2_URI "short.url.com/tmp\0"
3737
#define OAUTH2_URI_COMP "\0"
3838
#define OAUTH2_CODE "1234-5678"
3939
#define OAUTH2_STR OAUTH2_URI OAUTH2_URI_COMP OAUTH2_CODE
40-
#define SC_PIN_PROMPT "PIN"
41-
#define PASSKEY_INIT_PROMPT "Insert key"
42-
#define PASSKEY_PIN_PROMPT "Key PIN"
43-
#define PASSKEY_TOUCH_PROMPT "Touch key"
40+
#define SC_PIN_PROMPT "Smartcard PIN"
41+
#define PASSKEY_INIT_PROMPT "Insert security key"
42+
#define PASSKEY_PIN_PROMPT "Security key PIN"
43+
#define PASSKEY_TOUCH_PROMPT "Touch security key"
4444
#define PASSKEY_CRYPTO_CHAL "6uDMvRKj3W5xJV3HaQjZrtXMNmUUAjRGklFG2MIhN5s="
4545

4646
#define SC1_CERT_USER "cert_user1\0"

0 commit comments

Comments
 (0)