****************************************************************************/
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);
- return(pass->pw_dir);
+ if (pass == NULL || pass->pw_dir == NULL) return(NULL);
+
+ pstrcpy(home_dir, pass->pw_dir);
+ DEBUG(10,("get_home_dir: returning %s for user %s\n", home_dir, user));
+ return home_dir;
}
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;
}
int homes = lp_servicenumber(HOMES_NAME);
char *home = get_home_dir(user);
if (homes >= 0 && home)
- lp_add_home(user,homes,home);
+ {
+ pstring home_dir;
+ fstrcpy(home_dir, home);
+ lp_add_home(user,homes,home_dir);
+ }
}
if (iService < 0)
{
char *phome_dir = get_home_dir(service);
+ pstring home_dir;
- if(!phome_dir)
+ if(phome_dir == NULL)
{
/*
* Try mapping the servicename, it may
if (phome_dir)
{
int iHomeService;
+ pstrcpy(home_dir, phome_dir);
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);
}
}