previous logged user's home dir is seen

Andrew Bartlett abartlet at pcug.org.au
Sun Oct 21 05:54:02 GMT 2001


TAKAHASHI Motonobu wrote:
> 
> 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.

This patch breaks things badly!

Unfortunetly Win2k terminal server sends all users in over ONE TCP
connection to ONE smbd.  This patch would have all the users getting the
last users home dir, and only the last users home dir - others would
dissaper.  (This is perfectly valid use of the protocol).

The fix is twofold:  Ensure proper permissions on home dirs, and don't
use \\server\homes.

Other hacks include: 'valid users = %S'

But this patch is certainly not a fix.

Andrew Bartlett

> --- 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

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Samba Team member, Build Farm maintainer        abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net




More information about the samba-technical mailing list