summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek2019-05-31 13:13:10 +0200
committerJakub Hrozek2019-05-31 13:23:57 +0200
commit9a1a98220697f922a4c0d8460b899987ad0e1c61 (patch)
tree43abda003525768fd86b2ea8b0376c26d0cbd88d
parenthardlink: fix bad formatting in hardlink.1 (diff)
downloadkernel-qcow2-util-linux-9a1a98220697f922a4c0d8460b899987ad0e1c61.tar.gz
kernel-qcow2-util-linux-9a1a98220697f922a4c0d8460b899987ad0e1c61.tar.xz
kernel-qcow2-util-linux-9a1a98220697f922a4c0d8460b899987ad0e1c61.zip
su: More descriptive error message on malformed user entry
With users coming from LDAP, it is often the case that the entry in LDAP does not contain one or more attributes required by su or, because of misconfigured access control rights, the attribute might not be readable by the LDAP client. In that case, su just tells the user that the user does not exist. It might be more user-friendly to tell the user to check the user entry for all required fields.
-rw-r--r--login-utils/su-common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index caabe23a6..4d91b22e4 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -1446,7 +1446,9 @@ int su_main(int argc, char **argv, int mode)
|| !su->pwd->pw_passwd
|| !su->pwd->pw_name || !*su->pwd->pw_name
|| !su->pwd->pw_dir || !*su->pwd->pw_dir)
- errx(EXIT_FAILURE, _("user %s does not exist"), su->new_user);
+ errx(EXIT_FAILURE,
+ _("user %s does not exist or the user entry does not "
+ "contain all the required fields"), su->new_user);
su->new_user = su->pwd->pw_name;
su->old_user = xgetlogin();