summaryrefslogtreecommitdiffstats
path: root/src/tools/sssctl
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2017-05-10 17:13:48 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2017-06-01 16:52:14 +0200
commitb130adaa3934d0531aca0f32961ab8b4cc720820 (patch)
tree03ea2b236c48494a165e77c14dd90cf9b18c1533 /src/tools/sssctl
parentee7e72a65d323636600ffda271d5b5c4ddbc78b1 (diff)
downloadsssd-b130adaa3934d0531aca0f32961ab8b4cc720820.tar.gz
sssd-b130adaa3934d0531aca0f32961ab8b4cc720820.tar.xz
sssd-b130adaa3934d0531aca0f32961ab8b4cc720820.zip
sssctl: show user name used for authentication in user-checks
Since there are cases where the user name is not entered directly but determined by other means the user-checks should show the name of the user used for authentication. Related to https://pagure.io/SSSD/sssd/issue/3395 Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Diffstat (limited to 'src/tools/sssctl')
-rw-r--r--src/tools/sssctl/sssctl_user_checks.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tools/sssctl/sssctl_user_checks.c b/src/tools/sssctl/sssctl_user_checks.c
index 7c7b564bd..d5cd8a1b4 100644
--- a/src/tools/sssctl/sssctl_user_checks.c
+++ b/src/tools/sssctl/sssctl_user_checks.c
@@ -200,6 +200,8 @@ errno_t sssctl_user_checks(struct sss_cmdline *cmdline,
const char *action = DEFAULT_ACTION;
const char *service = DEFAULT_SERVICE;
int ret;
+ int pret;
+ const char *pam_user = NULL;
size_t c;
char **pam_env;
@@ -246,7 +248,14 @@ errno_t sssctl_user_checks(struct sss_cmdline *cmdline,
if ( strncmp(action, "auth", 4)== 0 ) {
fprintf(stdout, _("testing pam_authenticate\n\n"));
ret = pam_authenticate(pamh, 0);
- fprintf(stderr, _("pam_authenticate: %s\n\n"), pam_strerror(pamh, ret));
+ pret = pam_get_item(pamh, PAM_USER, (const void **) &pam_user);
+ if (pret != PAM_SUCCESS) {
+ fprintf(stderr, _("pam_get_item failed: %s\n"), pam_strerror(pamh,
+ pret));
+ pam_user = "- not available -";
+ }
+ fprintf(stderr, _("pam_authenticate for user [%s]: %s\n\n"), pam_user,
+ pam_strerror(pamh, ret));
} else if ( strncmp(action, "chau", 4)== 0 ) {
fprintf(stdout, _("testing pam_chauthtok\n\n"));
ret = pam_chauthtok(pamh, 0);