summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-04-29 13:23:47 +0200
committerVolker Lendecke <vl@samba.org>2008-05-05 18:28:58 +0200
commit2b3d03d6f16e4110d0000cbb10a087cef2ce9e44 (patch)
treeaab87dbb6367b278bf3d5aac43c14ea151f36101 /source3/smbd
parent1b2bf00fb98417434f653ce869226887d97aaeb2 (diff)
downloadsamba-2b3d03d6f16e4110d0000cbb10a087cef2ce9e44.tar.gz
samba-2b3d03d6f16e4110d0000cbb10a087cef2ce9e44.tar.bz2
samba-2b3d03d6f16e4110d0000cbb10a087cef2ce9e44.zip
Remove unix_homedir from struct user_struct
This makes pdb_get_unix_homedir unused. I wonder if that was ever really used... (This used to be commit 36bfd32f1ff878e827db91e9bf233719ecca5b01)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/password.c72
1 files changed, 35 insertions, 37 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index a7e462a0ca..74fa645c13 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -201,6 +201,37 @@ int register_initial_vuid(void)
return vuser->vuid;
}
+static int register_homes_share(const char *username)
+{
+ int result;
+ struct passwd *pwd;
+
+ result = lp_servicenumber(username);
+ if (result != -1) {
+ DEBUG(3, ("Using static (or previously created) service for "
+ "user '%s'; path = '%s'\n", username,
+ lp_pathname(result)));
+ return result;
+ }
+
+ pwd = getpwnam_alloc(talloc_tos(), username);
+
+ if ((pwd == NULL) || (pwd->pw_dir[0] == '\0')) {
+ DEBUG(3, ("No home directory defined for user '%s'\n",
+ username));
+ TALLOC_FREE(pwd);
+ return -1;
+ }
+
+ DEBUG(3, ("Adding homes service for user '%s' using home directory: "
+ "'%s'\n", username, pwd->pw_dir));
+
+ result = add_home_service(username, username, pwd->pw_dir);
+
+ TALLOC_FREE(pwd);
+ return result;
+}
+
/**
* register that a valid login has been performed, establish 'session'.
* @param server_info The token returned from the authentication process.
@@ -271,26 +302,6 @@ int register_existing_vuid(uint16 vuid,
const char *logon_script =
pdb_get_logon_script(server_info->sam_account);
- if (!IS_SAM_DEFAULT(server_info->sam_account,
- PDB_UNIXHOMEDIR)) {
- const char *unix_homedir =
- pdb_get_unix_homedir(server_info->sam_account);
- if (unix_homedir) {
- vuser->unix_homedir = unix_homedir;
- }
- } else {
- struct passwd *passwd =
- getpwnam_alloc(vuser, vuser->user.unix_name);
- if (passwd) {
- vuser->unix_homedir = passwd->pw_dir;
- /* Ensure that the unix_homedir now
- * belongs to vuser, so it goes away
- * with it, not with passwd below: */
- talloc_steal(vuser, vuser->unix_homedir);
- TALLOC_FREE(passwd);
- }
- }
-
if (logon_script) {
vuser->logon_script = logon_script;
}
@@ -336,23 +347,10 @@ int register_existing_vuid(uint16 vuid,
If a share exists by this name (autoloaded or not) reuse it . */
vuser->homes_snum = -1;
- if ( (!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir)) {
- int servicenumber = lp_servicenumber(vuser->user.unix_name);
- if ( servicenumber == -1 ) {
- DEBUG(3, ("Adding homes service for user '%s' using "
- "home directory: '%s'\n",
- vuser->user.unix_name, vuser->unix_homedir));
- vuser->homes_snum =
- add_home_service(vuser->user.unix_name,
- vuser->user.unix_name,
- vuser->unix_homedir);
- } else {
- DEBUG(3, ("Using static (or previously created) "
- "service for user '%s'; path = '%s'\n",
- vuser->user.unix_name,
- lp_pathname(servicenumber) ));
- vuser->homes_snum = servicenumber;
- }
+
+ if (!vuser->guest) {
+ vuser->homes_snum = register_homes_share(
+ vuser->user.unix_name);
}
if (srv_is_signing_negotiated() && !vuser->guest &&