From ca09263d00c7c5493f4ab7214c7cfb2cf8a28eea Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 Apr 2006 09:23:34 +0000 Subject: r14940: Remove pam_winbind's ability to create home directories on it's own. Guenther (This used to be commit 87293802f3e0666c9a50eb3ca63bb1a7dccc50dc) --- source3/nsswitch/pam_winbind.c | 58 ------------------------------------------ source3/nsswitch/pam_winbind.h | 1 - 2 files changed, 59 deletions(-) (limited to 'source3') diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c index fb4cc187e1..d78d65287e 100644 --- a/source3/nsswitch/pam_winbind.c +++ b/source3/nsswitch/pam_winbind.c @@ -67,9 +67,6 @@ static int _pam_parse(int argc, const char **argv) (lp_parm_const_string(-1, "pam_winbind", "require_membership_of", NULL) != NULL)) { ctrl |= WINBIND_REQUIRED_MEMBERSHIP; } - if (lp_parm_bool(-1, "pam_winbind", "create_homedir", False)) { - ctrl |= WINBIND_CREATE_HOMEDIR; - } /* step through arguments */ for (; argc-- > 0; ++argv) { @@ -96,8 +93,6 @@ static int _pam_parse(int argc, const char **argv) ctrl |= WINBIND_KRB5_CCACHE_TYPE; else if (strequal(*argv, "cached_login")) ctrl |= WINBIND_CACHED_LOGIN; - else if (strequal(*argv, "create_homedir")) - ctrl |= WINBIND_CREATE_HOMEDIR; else { _pam_log(LOG_ERR, "pam_parse: unknown option; %s", *argv); } @@ -983,59 +978,6 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags, _pam_log_debug(ctrl, LOG_DEBUG,"pam_winbind: pam_sm_open_session handler"); - - if (ctrl & WINBIND_CREATE_HOMEDIR) { - - struct passwd *pwd = NULL; - const char *username; - int ret; - fstring tok; - fstring create_dir; - SMB_STRUCT_STAT sbuf; - - /* Get the username */ - ret = pam_get_user(pamh, &username, NULL); - if ((ret != PAM_SUCCESS) || (!username)) { - _pam_log_debug(ctrl, LOG_DEBUG, "can not get the username"); - return PAM_SERVICE_ERR; - } - - pwd = getpwnam(username); - if (pwd == NULL) { - _pam_log_debug(ctrl, LOG_DEBUG, "can not get the username"); - return PAM_SERVICE_ERR; - } - - _pam_log_debug(ctrl, LOG_DEBUG, "homedir is: %s", pwd->pw_dir); - - if (directory_exist(pwd->pw_dir, &sbuf)) { - return PAM_SUCCESS; - } - - fstrcpy(create_dir, "/"); - while (next_token((const char **)&pwd->pw_dir, tok, "/", sizeof(tok))) { - - mode_t mode = 0755; - - fstrcat(create_dir, tok); - fstrcat(create_dir, "/"); - - if (!directory_exist(create_dir, &sbuf)) { - if (mkdir(create_dir, mode) != 0) { - _pam_log(LOG_ERR, "could not create dir: %s (%s)", - create_dir, strerror(errno)); - return PAM_SERVICE_ERR; - } - } - } - - if (sys_chown(create_dir, pwd->pw_uid, pwd->pw_gid) != 0) { - _pam_log(LOG_ERR, "failed to chown user homedir: %s (%s)", - create_dir, strerror(errno)); - return PAM_SERVICE_ERR; - } - } - return PAM_SUCCESS; } diff --git a/source3/nsswitch/pam_winbind.h b/source3/nsswitch/pam_winbind.h index d998cc0486..54150be8b3 100644 --- a/source3/nsswitch/pam_winbind.h +++ b/source3/nsswitch/pam_winbind.h @@ -87,7 +87,6 @@ do { \ #define WINBIND_KRB5_AUTH (1<<7) #define WINBIND_KRB5_CCACHE_TYPE (1<<8) #define WINBIND_CACHED_LOGIN (1<<9) -#define WINBIND_CREATE_HOMEDIR (1<<10) /* * here is the string to inform the user that the new passwords they -- cgit