]> granicus.if.org Git - linux-pam/commit
pam_mkhomedir: check and create home directory for the same user (ticket #22)
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 20 Jan 2014 02:29:41 +0000 (02:29 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 20 Jan 2014 18:33:55 +0000 (18:33 +0000)
commitf9db4aae8b0292d1273c7acda1cc20ff87fabd5c
treed0861df2e539c5ddc4fc554680c46110e408149a
parent4eb04f3974b9245e31a59b0910c7b81ac5bc0496
pam_mkhomedir: check and create home directory for the same user (ticket #22)

Before pam_mkhomedir helper was introduced in commit
7b14630ef39e71f603aeca0c47edf2f384717176, pam_mkhomedir was checking for
existance and creating the same directory - the home directory of the
user NAME returned by pam_get_item(PAM_USER).

The change in behaviour accidentally introduced along with
mkhomedir_helper is not consistent: while the module still checks for
getpwnam(NAME)->pw_dir, the directory created by mkhomedir_helper is
getpwnam(getpwnam(NAME)->pw_name)->pw_dir, which is not necessarily
the same as the directory being checked.

This change brings check and creation back in sync, both handling
getpwnam(NAME)->pw_dir.

* modules/pam_mkhomedir/pam_mkhomedir.c (create_homedir): Replace
"struct passwd *" argument with user's name and home directory.
Pass user's name to MKHOMEDIR_HELPER.
(pam_sm_open_session): Update create_homedir call.
modules/pam_mkhomedir/pam_mkhomedir.c