summaryrefslogtreecommitdiff
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
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)
-rw-r--r--source3/include/passdb.h1
-rw-r--r--source3/include/smb.h1
-rw-r--r--source3/passdb/pdb_get_set.c8
-rw-r--r--source3/smbd/password.c72
4 files changed, 35 insertions, 47 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 8d5934df52..360a0d0444 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -59,7 +59,6 @@ enum pdb_elements {
PDB_GROUPSID,
PDB_ACCTCTRL,
PDB_PASSLASTSET,
- PDB_UNIXHOMEDIR,
PDB_ACCTDESC,
PDB_WORKSTATIONS,
PDB_COMMENT,
diff --git a/source3/include/smb.h b/source3/include/smb.h
index cb36b9bebb..2ec432929d 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1781,7 +1781,6 @@ typedef struct user_struct {
gid_t gid; /* gid of a validated user */
userdom_struct user;
- const char *unix_homedir;
const char *logon_script;
bool guest;
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index c427d41e23..7a8086c63e 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -301,14 +301,6 @@ const char *pdb_get_homedir(const struct samu *sampass)
return sampass->home_dir;
}
-const char *pdb_get_unix_homedir(const struct samu *sampass)
-{
- if (sampass->unix_pw ) {
- return sampass->unix_pw->pw_dir;
- }
- return NULL;
-}
-
const char *pdb_get_dir_drive(const struct samu *sampass)
{
return sampass->dir_drive;
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 &&