svn commit: samba r14940 - branches/SAMBA_3_0/source/nsswitch trunk/source/nsswitch

gd at samba.org gd at samba.org
Thu Apr 6 09:23:35 GMT 2006


Author: gd
Date: 2006-04-06 09:23:34 +0000 (Thu, 06 Apr 2006)
New Revision: 14940

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14940

Log:
Remove pam_winbind's ability to create home directories on it's own.

Guenther

Modified:
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.h
   trunk/source/nsswitch/pam_winbind.c
   trunk/source/nsswitch/pam_winbind.h


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.c	2006-04-06 09:15:17 UTC (rev 14939)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.c	2006-04-06 09:23:34 UTC (rev 14940)
@@ -67,9 +67,6 @@
 	    (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 @@
 			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 @@
 
 	_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;
 }
 

Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.h
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.h	2006-04-06 09:15:17 UTC (rev 14939)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.h	2006-04-06 09:23:34 UTC (rev 14940)
@@ -87,7 +87,6 @@
 #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

Modified: trunk/source/nsswitch/pam_winbind.c
===================================================================
--- trunk/source/nsswitch/pam_winbind.c	2006-04-06 09:15:17 UTC (rev 14939)
+++ trunk/source/nsswitch/pam_winbind.c	2006-04-06 09:23:34 UTC (rev 14940)
@@ -67,9 +67,6 @@
 	    (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 @@
 			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 @@
 
 	_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;
 }
 

Modified: trunk/source/nsswitch/pam_winbind.h
===================================================================
--- trunk/source/nsswitch/pam_winbind.h	2006-04-06 09:15:17 UTC (rev 14939)
+++ trunk/source/nsswitch/pam_winbind.h	2006-04-06 09:23:34 UTC (rev 14940)
@@ -87,7 +87,6 @@
 #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



More information about the samba-cvs mailing list