trying to track down issues in get_home_dir().
authorLuke Leighton <lkcl@samba.org>
Mon, 14 Dec 1998 20:21:39 +0000 (20:21 +0000)
committerLuke Leighton <lkcl@samba.org>
Mon, 14 Dec 1998 20:21:39 +0000 (20:21 +0000)
source/lib/username.c
source/passdb/sampassdb.c
source/smbd/reply.c
source/smbd/service.c

index f04314ab36d75b12ae8e16b476cd115b408dbae5..8ae55fcc894beb0c3f8ee2174476d8a777864dec 100644 (file)
@@ -31,12 +31,16 @@ get a users home directory.
 ****************************************************************************/
 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;
 }
 
 
index bcd2764abcf1961f7fe8a19a90656e8243a2cd91..13b1279b2b78f3d3e429c0e14a5a75d978b96c2f 100644 (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))
        {
+               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;
        }
 
index d7069767143d1ed3318d7e27be25a0221a68d31f..694cf3cdd52e5baf7c656f266e817e759fcbd69c 100644 (file)
@@ -750,7 +750,11 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
     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);
+       }
   }
 
 
index bc7fb88387eec93c9ba21f654b0d1937965ef6e5..4dd3cb4d97eef03741e4dcf434b4149420d8c5bb 100644 (file)
@@ -92,8 +92,9 @@ int find_service(char *service)
    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
@@ -109,9 +110,10 @@ int find_service(char *service)
       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);
         }
       }