msdfs referrals at share-level

Guenther Deschner gd at suse.de
Mon Oct 14 13:41:16 GMT 2002


ops. patch is against 2_2 - cvs.

On Mon, Oct 14, 2002 at 03:36:04PM +0200, Guenther Deschner wrote:
> hello shirish,
> 
> we made some more experiments with the dfs-code and now have a running
> solution for our smb-proxy, without breaking msdfs (well, i didn't had a
> look on the dfs_rpc-pipe for now...)
> 
> you can now have a samba-share behave like an mdfs-symlink.
> if you set a share to "msdfs proxy = yes" and declare the link in its
> path to "msdfs link name = linkname" the clients will reveive correct 
> referrals already when they access the share :) 
> 
> since we are planning to use this patch in production, it would be very
> nice if you could comment on this.
> 
> -----8<------------------snip--------------8<--------------
> add to smb.conf:
>         [global]
>                 host msdfs = yes
> 
>         [dfs-fake]
>                 path = /export/dfs-fake
>                 msdfs root      = yes
>                 msdfs proxy     = yes
>                 msdfs link name = "linkname"
> 
> create a link:
> 
>         ln -s msdfs:unimak\\storage /export/dfs-fake/linkname
> ----->8------------------snap-------------->8--------------
> 
> thanks a lot,
> guenther
> 
> 
> On Thu, Sep 05, 2002 at 09:50:51AM -0700, Shirish Kalele wrote:
> > Hi,
> > 
> > Clients do request dfs referrals for every share they connect to. In a dfs
> > reply for a share, you could try and send a different sharename and see what
> > happens. I don't know if clients will be able to handle this. Look for
> > self_referral in the setup_dfs_referral() code to find out where to start
> > making changes.
> > 
> > Let me know how the clients take it..
> > 
> > Thanks,
> > Shirish
> > 
> > ----- Original Message -----
> > From: "Guenther Deschner" <guenther.deschner at suse.de>
> > To: <samba-technical at lists.samba.org>
> > Sent: Wednesday, September 04, 2002 2:48 PM
> > Subject: msdfs referrals at share-level
> > 
> > hello everybody,
> > 
> > as far as i have looked into msdfs.c it seems to be impossible to send
> > a client a dfs-referral at the share level (\\fileserver\msdfs-link).
> > 
> > maybe there is another way to "proxy" a request to \\samba\thisshare to
> > \\anothersamba\thatshare ?
> > 
> > i currently want to migrate a couple of nt-servers transparently for
> > clients. the basic idea is to setup one samba-server that offers faked
> > file-service via netbios-aliases and dfs-redirects to the real
> > samba-fileserver. unfortunatly touching the clients is a no-go.
> > 
> > old setup with *nt*:
> > 
> >  client -> //fileserver/share1
> > 
> > planned setup with *samba*:
> > 
> >  client -> //fileserver/share1  where share1 -> msdfs:samba-file\whatever
> > 
> > any help is much appreciated.
> > 
> > bye,
> > guenther
> > --
> > Guenther Deschner                          guenther.deschner at suse.de
> > SuSE Linux AG                                        GnuPG: 8EE11688
> > Berliner Str. 27                      phone:  +49 (0) 30 / 430944778
> > D-13507 Berlin                           fax:  +49 (0) 30 / 43732804
> > 
> > 
> 
> -- 
> Guenther Deschner                          guenther.deschner at suse.de
> SuSE Linux AG                                        GnuPG: 8EE11688
> Berliner Str. 27                      phone:  +49 (0) 30 / 430944778
> D-13507 Berlin                           fax:  +49 (0) 30 / 43732804

> --- source/param/loadparm.c	Thu Oct 10 00:26:52 2002
> +++ source/param/loadparm.c	Mon Oct 14 14:21:08 2002
> @@ -408,6 +408,8 @@
>  	BOOL bInheritPerms;
>  	BOOL bInheritACLS;
>  	BOOL bMSDfsRoot;
> +	BOOL bMSDfsProxy;
> +	char *bMSDfsLinkName;
>  	BOOL bUseClientDriver;
>  	BOOL bDefaultDevmode;
>  	BOOL bNTAclSupport;
> @@ -533,6 +535,8 @@
>  	False,			/* bInheritPerms */
>  	False,			/* bInheritACLS */
>  	False,			/* bMSDfsRoot */
> +	False,                  /* bMSDfsProxy */
> +	NULL,                   /* bMSDfsLinkName */
>  	False,			/* bUseClientDriver */
>  	False,			/* bDefaultDevmode */
>  	True,			/* bNTAclSupport */
> @@ -1107,6 +1111,8 @@
>  	{"MSDfs options", P_SEP, P_SEPARATOR},
>  
>  	{"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_SHARE},
> +	{"msdfs proxy", P_BOOL, P_LOCAL, &sDefault.bMSDfsProxy, NULL, NULL, FLAG_SHARE},
> +	{"msdfs link name", P_STRING, P_LOCAL, &sDefault.bMSDfsLinkName, NULL, NULL, FLAG_SHARE},
>  	{"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, 0},
>  #endif
>  
> @@ -1754,6 +1760,8 @@
>  FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
>  FN_LOCAL_STRING(lp_driverlocation, szPrinterDriverLocation)
>  FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
> +FN_LOCAL_BOOL(lp_msdfs_proxy, bMSDfsProxy)
> +FN_LOCAL_STRING(lp_msdfs_link_name, bMSDfsLinkName)
>  FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
>  FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
>  FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
> --- source/msdfs/msdfs.c	Fri Sep  6 22:47:07 2002
> +++ source/msdfs/msdfs.c	Mon Oct 14 14:18:46 2002
> @@ -597,12 +609,37 @@
>  	int reply_size = 0;
>  	char *pathnamep = pathname;
>  
> +	struct connection_struct conns;
> +	struct connection_struct* conn = &conns;
> +	int snum;
> +	struct dfs_path dpi;
> +
> +	struct junction_map junction2;
> +	parse_dfs_path(pathname, &dpi);
> +	pstrcpy(junction2.service_name, dpi.servicename);
> +	snum = lp_servicenumber(junction2.service_name);
> +	create_conn_struct(conn, snum);
> +	
> +
>  	ZERO_STRUCT(junction);
>  
>  	/* get the junction entry */
>  	if (!pathnamep)
>  		return -1;
>  
> +        if (lp_msdfs_proxy(SNUM(conn))) {
> +		DEBUG(10,("running in proxy mode\n"));
> +		pstrcpy(pathnamep, "\\");
> +		pstrcat(pathnamep, dpi.hostname);
> +		pstrcat(pathnamep, "\\");
> +		pstrcat(pathnamep, dpi.servicename);
> +		pstrcat(pathnamep, "\\");
> +		pstrcat(pathnamep, (char *) lp_msdfs_link_name(SNUM(conn)));
> +	 } else {
> +	        DEBUG(10,("running in normal mode\n"));
> +	}
> +	
> +	
>  	/* Trim pathname sent by client so it begins with only one backslash.
>  	   Two backslashes confuse some dfs clients
>  	 */
> @@ -628,6 +665,17 @@
>  		}
>  	}
>  	
> +        if ( lp_msdfs_proxy(SNUM(conn)) ) {
> +		DEBUG(10,("running in proxy mode\n"));
> +		pstrcpy ( pathnamep, "\\" );
> +		pstrcat ( pathnamep, dpi.hostname);
> +		pstrcat ( pathnamep, "\\" );
> +		pstrcat ( pathnamep, dpi.servicename);
> +        } else {
> +	   	DEBUG(10,("running in normal mode\n"));
> +	}
> +		
> +	
>  	/* create the referral depeding on version */
>  	DEBUG(10,("max_referral_level :%d\n",max_referral_level));
>  	if(max_referral_level<2 || max_referral_level>3)




-- 
Guenther Deschner                                         gd at suse.de
SuSE Linux AG                                        GnuPG: 8EE11688
Berliner Str. 27                      phone:  +49 (0) 30 / 430944778
D-13507 Berlin                           fax:  +49 (0) 30 / 43732804
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20021014/76444251/attachment.bin


More information about the samba-technical mailing list