diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-05-20 14:38:37 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-05-20 14:38:37 +0300 |
commit | f664b904fde206c6c7e0dc45b690ed7d28bea571 (patch) | |
tree | 5d8ecd3ab9afed8b1a19b2b522c355aae5bdda9d | |
parent | 37e557be7bba1d0611365b40b26ad03e4b66e95b (diff) | |
download | pam-modules-f664b904fde206c6c7e0dc45b690ed7d28bea571.tar.gz pam-modules-f664b904fde206c6c7e0dc45b690ed7d28bea571.tar.bz2 |
pam_ldaphome: don't run initrc program if the home dir already exists.
* pam_ldaphome/pam_ldaphome.c (create_exists): New return code.
(create_home_dir): Return create_exists if the directory already
exists.
(ldaphome_main): Run initrc only after creating the home dir.
-rw-r--r-- | pam_ldaphome/pam_ldaphome.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pam_ldaphome/pam_ldaphome.c b/pam_ldaphome/pam_ldaphome.c index f89b151..83b9cf7 100644 --- a/pam_ldaphome/pam_ldaphome.c +++ b/pam_ldaphome/pam_ldaphome.c | |||
@@ -1387,6 +1387,7 @@ dir_in_path(const char *dir, const char *path) | |||
1387 | 1387 | ||
1388 | enum create_status { | 1388 | enum create_status { |
1389 | create_ok, | 1389 | create_ok, |
1390 | create_exists, | ||
1390 | create_failure, | 1391 | create_failure, |
1391 | create_skip | 1392 | create_skip |
1392 | }; | 1393 | }; |
@@ -1430,7 +1431,8 @@ create_home_dir(pam_handle_t *pamh, struct passwd *pw, struct gray_env *env) | |||
1430 | _pam_log(LOG_ERR, "%s exists, but is not a directory", | 1431 | _pam_log(LOG_ERR, "%s exists, but is not a directory", |
1431 | pw->pw_dir); | 1432 | pw->pw_dir); |
1432 | return create_failure; | 1433 | return create_failure; |
1433 | } | 1434 | } else |
1435 | return create_exists; | ||
1434 | 1436 | ||
1435 | return create_ok; | 1437 | return create_ok; |
1436 | } | 1438 | } |
@@ -1882,6 +1884,8 @@ ldaphome_main(pam_handle_t *pamh, int flags, int argc, const char **argv, | |||
1882 | retval = run_initrc(pamh, pw, env); | 1884 | retval = run_initrc(pamh, pw, env); |
1883 | if (retval) | 1885 | if (retval) |
1884 | break; | 1886 | break; |
1887 | /* fall through */ | ||
1888 | case create_exists: | ||
1885 | retval = import_public_key(pamh, pw, env); | 1889 | retval = import_public_key(pamh, pw, env); |
1886 | break; | 1890 | break; |
1887 | case create_failure: | 1891 | case create_failure: |