1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-12 12:23:50 +03:00

trying to track down issues in get_home_dir().

This commit is contained in:
Luke Leighton
-
parent f4b8a28306
commit 2cce78aa00
4 changed files with 21 additions and 7 deletions

View File

@@ -31,12 +31,16 @@ get a users home directory.
****************************************************************************/ ****************************************************************************/
char *get_home_dir(char *user) char *get_home_dir(char *user)
{ {
static struct passwd *pass; struct passwd *pass;
static pstring home_dir;
pass = Get_Pwnam(user, False); pass = Get_Pwnam(user, False);
if (!pass) return(NULL); if (pass == NULL || pass->pw_dir == NULL) return(NULL);
return(pass->pw_dir);
pstrcpy(home_dir, pass->pw_dir);
DEBUG(10,("get_home_dir: returning %s for user %s\n", home_dir, user));
return home_dir;
} }

View File

@@ -511,6 +511,10 @@ you will get this warning only once (for all trust accounts)\n", unix_name));
if (!sid_front_equal(&global_sam_sid, &gmep.sid)) if (!sid_front_equal(&global_sam_sid, &gmep.sid))
{ {
fstring sid_str;
sid_to_string(sid_str, &gmep.sid);
DEBUG(0,("UNIX User %s Primary Group is in the wrong domain! %s\n",
sam->unix_name, sid_str));
return NULL; return NULL;
} }

View File

@@ -750,7 +750,11 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
int homes = lp_servicenumber(HOMES_NAME); int homes = lp_servicenumber(HOMES_NAME);
char *home = get_home_dir(user); char *home = get_home_dir(user);
if (homes >= 0 && home) if (homes >= 0 && home)
lp_add_home(user,homes,home); {
pstring home_dir;
fstrcpy(home_dir, home);
lp_add_home(user,homes,home_dir);
}
} }

View File

@@ -92,8 +92,9 @@ int find_service(char *service)
if (iService < 0) if (iService < 0)
{ {
char *phome_dir = get_home_dir(service); char *phome_dir = get_home_dir(service);
pstring home_dir;
if(!phome_dir) if(phome_dir == NULL)
{ {
/* /*
* Try mapping the servicename, it may * Try mapping the servicename, it may
@@ -109,9 +110,10 @@ int find_service(char *service)
if (phome_dir) if (phome_dir)
{ {
int iHomeService; int iHomeService;
pstrcpy(home_dir, phome_dir);
if ((iHomeService = lp_servicenumber(HOMES_NAME)) >= 0) if ((iHomeService = lp_servicenumber(HOMES_NAME)) >= 0)
{ {
lp_add_home(service,iHomeService,phome_dir); lp_add_home(service,iHomeService,home_dir);
iService = lp_servicenumber(service); iService = lp_servicenumber(service);
} }
} }