summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-06-07 03:20:09 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-06-07 03:20:09 +0000
commit1079bd40c50b75324464ea059141656b23ccf31a (patch)
treeeae2e2f370b9a3198e990d744a828c72b41406ba
parentd64341bf80a8b3f56ca0273600e71a353ea64c3c (diff)
downloadsamba-1079bd40c50b75324464ea059141656b23ccf31a.tar.gz
samba-1079bd40c50b75324464ea059141656b23ccf31a.tar.bz2
samba-1079bd40c50b75324464ea059141656b23ccf31a.zip
Don't assume that the SAM knows the unix home directory - look it up by
getpwnam() if need be. Fixes bug #130 Andrew Bartlett (This used to be commit a4bc789a3993be4b25955c729b533b86dba666f4)
-rw-r--r--source3/smbd/password.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 283eed73ef..9560449aa5 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -168,16 +168,24 @@ int register_vuid(auth_serversupplied_info *server_info, const char *smb_name)
{
/* Keep the homedir handy */
const char *homedir = pdb_get_homedir(server_info->sam_account);
- const char *unix_homedir = pdb_get_unix_homedir(server_info->sam_account);
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 = smb_xstrdup(unix_homedir);
+ }
+ } else {
+ struct passwd *passwd = getpwnam_alloc(vuser->user.unix_name);
+ if (passwd) {
+ vuser->unix_homedir = smb_xstrdup(passwd->pw_dir);
+ passwd_free(&passwd);
+ }
+ }
+
if (homedir) {
vuser->homedir = smb_xstrdup(homedir);
}
-
- if (unix_homedir) {
- vuser->unix_homedir = smb_xstrdup(unix_homedir);
- }
-
if (logon_script) {
vuser->logon_script = smb_xstrdup(logon_script);
}