previous logged user's home dir is seen

TAKAHASHI Motonobu monyo at samba.gr.jp
Sun Oct 21 04:59:03 GMT 2001


Hi, 

There is a probrem that:
for example, if there is a Samba PDC which also offers users's home
directories, when a certain user logged off and another user
logged on immediately to the Samba PDC, the previous user's home
directory will appear in the share list.

The patch bellow is fixed this problem for Samba 2.2.2, 
Samba 2.0.10 and Samba HEAD branch can be fixed with the same
approach.

--- loadparm.c.org	Sun Oct 14 06:09:31 2001
+++ loadparm.c	Sun Oct 21 20:11:56 2001
@@ -525,6 +525,7 @@
 static BOOL bGlobalOnly = False;
 static int server_role;
 static int default_server_announce;
+static int snum_home_service = -1;
 
 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
 
@@ -541,6 +542,7 @@
 static BOOL handle_winbind_id(char *pszParmValue, char **ptr);
 static BOOL handle_wins_server_list(char *pszParmValue, char **ptr);
 static BOOL handle_debug_list( char *pszParmValue, char **ptr );
+static BOOL snum_not_home(int);
 
 static void set_server_role(void);
 static void set_default_server_announce_type(void);
@@ -1855,6 +1857,14 @@
 	return (i);
 }
 
+/*************************************************************************** 
+check if a snum is not home service 
+***************************************************************************/ 
+static BOOL snum_not_home(int snum) 
+{ 
+  return(snum != snum_home_service); 
+} 
+
 /***************************************************************************
 add a new home service, with the specified home directory, defaults coming 
 from service ifrom. homename must be in DOS codepage.
@@ -1864,6 +1874,10 @@
 	int i;
 	SMB_STRUCT_STAT buf;
 	
+	/* remove previous logged user's home directory if it still exists */
+	lp_killunused(snum_not_home);
+	snum_home_service = -1;
+
 	/* if the user's home directory doesn't exist, then don't 
 	   add it to the list of available shares */
 	if (sys_stat(pszHomedir, &buf))
@@ -1886,6 +1900,7 @@
 	}
 	ServicePtrs[i]->bAvailable = sDefault.bAvailable;
 	ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
+	snum_home_service = i;
 
 	DEBUG(3,
 	      ("adding home directory %s at %s\n", pszHomename, pszHomedir));

-----
TAKAHASHI, Motonobu(monyo)         monyo at samba.gr.jp

Samba Team - http://samba.org/     Samba-JP - http://www.samba.gr.jp/  
JWNTUG - http://www.jwntug.or.jp/  Analog-JP - http://www.jp.analog.cx/
MCSE+I, MCSE(W2K), SCNA, CCNA, Turbo-CI




More information about the samba-technical mailing list