MSDfs and substitutions/default service..

Shirish Kalele kalele at veritas.com
Thu May 9 11:23:04 GMT 2002


Yes, the reason the substitutions don't work is that dfs referrals are done
over IPC$ where %S doesn't resolve to the service name you want.
This is also the reason why any default services won't be found when a dfs
referral is done unless we specifically add the service.

Try out this patch and let me know. It'll also go into the next release..

Thanks,
Shirish

--- msdfs.c.orig Thu May  9 11:08:38 2002
+++ msdfs.c Thu May  9 11:12:02 2002
@@ -87,6 +87,8 @@
  ZERO_STRUCTP(conn);
  conn->service = snum;
  conn->connectpath = lp_pathname(snum);
+ string_sub(conn->connectpath, "%S", lp_servicename(snum),
+     strlen(conn->connectpath));

  if (!smbd_vfs_init(conn)) {
   DEBUG(0,("create_conn_struct: smbd_vfs_init failed.\n"));
@@ -366,12 +368,16 @@

  /* Verify the share is a dfs root */
  snum = lp_servicenumber(jn->service_name);
- if(snum < 0)
-  return False;
+ if(snum < 0) {
+  if ((snum = find_service(jn->service_name)) < 0)
+   return False;
+ }

  if (!create_conn_struct(conn, snum))
   return False;
-
+
+ pstring_sub(conn->connectpath, "%S", dp.servicename);
+
  if (!lp_msdfs_root(SNUM(conn))) {
   DEBUG(3,("get_referred_path: .%s. in dfs path %s is not a dfs root.\n",
     dp.servicename, pathname));




----- Original Message -----
From: "Kevin Wheatley" <hxpro at cinesite.co.uk>
To: "Shirish Kalele" <kalele at veritas.com>; <samba-technical at samba.org>
Sent: Thursday, May 09, 2002 11:14 AM
Subject: Re: MSDfs and substitutions/default service..


> Kevin Wheatley wrote:
> > [2002/05/09 14:25:39, 5] smbd/uid.c:(199)
> >   change_to_user uid=(0,0) gid=(0,0)
> > [2002/05/09 14:25:39, 10] smbd/nttrans.c:(398)
> >   map_create_disposition: Mapped create_disposition 0x1 to 0x1
> > [2002/05/09 14:25:39, 10] smbd/nttrans.c:(259)
> >   get_filename: data_offset = 87, data_len = 43, fname_len = 43
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(46)
> >   temp in parse_dfs_path: .vdisktest\FOO\directory\shot1. after
> > trimming \'s
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(55)
> >   hostname: vdisktest
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(67)
> >   servicename: FOO
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(77)
> >   rest of the path: directory/shot1
> > [2002/05/09 14:25:39, 10] vdisk.c:(165)
> >   vdisk_readlink: link /dfsroot/FOO/directory/shot1 path
> > /hosts/anneka/images/FOO/directory/shot1 ->
> > msdfs:machine1\images\FOO\directory\shot1
> > [2002/05/09 14:25:39, 5] msdfs/msdfs.c:(189)
> >   is_msdfs_link: /dfsroot/FOO/directory/shot1 ->
> > msdfs:machine1\images\FOO\directory\shot1
> > [2002/05/09 14:25:39, 6] msdfs/msdfs.c:(244)
> >   resolve_dfs_path: \vdisktest\FOO\directory\shot1 resolves to a valid
> > Dfs link.
> > [2002/05/09 14:25:39, 3] msdfs/msdfs.c:(313)
> >   dfs_redirect: Redirecting \vdisktest\FOO\Directory\shot1
> > [2002/05/09 14:25:39, 3] smbd/error.c:(106)
> >   error packet at msdfs/msdfs.c(662) cmd=162 (SMBntcreateX)
> > NT_STATUS_PATH_NOT_COVERED
>
>
> this also appears when the Win2K machine sends
> call_trans2qfilepathinfo: TRANSACT2_QPATHINFO, the msdfs code finds
> the correct file, and decides it is an msdfs link, then we get the
> following:
>
> [2002/05/09 18:05:55, 3] msdfs/msdfs.c:(313)
>   dfs_redirect: Redirecting \vdisktest\SWP\Output_Renders\caa_007_tk1
> [2002/05/09 18:05:55, 3] smbd/error.c:(106)
>   error packet at msdfs/msdfs.c(662) cmd=50 (SMBtrans2)
> NT_STATUS_PATH_NOT_COVERED
>
> which results from:
>
> #define RESOLVE_DFSPATH(name, conn, inbuf, outbuf)              \
> { if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) &&          \
>       lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) &&           \
>       dfs_redirect(name,conn,False))                            \
>              return(dfs_path_error(inbuf,outbuf)); }
>
> key bit being from dfs_redirect:
>
> if (resolve_dfs_path(pathname, &dp, conn, findfirst_flag,
>      NULL, NULL, NULL, NULL)) {
> DEBUG(3,("dfs_redirect: Redirecting %s\n", pathname));
> return True;
> } else {
>
> This bit returns true which causes the error, I just havn't worked
> what this has to do with the '%S' error or if this is a red herring.
>
> > else where I get the following:
> >
> > [2002/05/09 14:25:39, 10] smbd/trans2.c:(2997)
> >   call_trans2getdfsreferral
> > [2002/05/09 14:25:39, 10] smbd/trans2.c:(3011)
> >   UNICODE referral for \vdisktest\FOO\directory\shot1
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(46)
> >   temp in parse_dfs_path: .vdisktest\FOO\directory\shot1. after
> > trimming \'s
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(55)
> >   hostname: vdisktest
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(67)
> >   servicename: FOO
> > [2002/05/09 14:25:39, 10] msdfs/msdfs.c:(77)
> >   rest of the path: directory/shot1
> > [2002/05/09 14:25:39, 3] smbd/vfs.c:(137)
> >   Initialising custom vfs hooks from /usr/samba/lib/VFS/vdisk.so
> > [2002/05/09 14:25:39, 5] msdfs/msdfs.c:(175)
> >   is_msdfs_link: /images/dfsroot/%S/directory/shot1 does not exist.
> > [2002/05/09 14:25:39, 5] msdfs/msdfs.c:(175)
> >   is_msdfs_link: /images/dfsroot/%S/directory does not exist.
> > [2002/05/09 14:25:39, 3] msdfs/msdfs.c:(387)
> >   get_referred_path: No valid referrals for path
> > \vdisktest\FOO\directory\shot1
> > [2002/05/09 14:25:39, 3] smbd/error.c:(91)
> >   error string = No such file or directory
> > [2002/05/09 14:25:39, 3] smbd/error.c:(106)
> >   error packet at smbd/trans2.c(3016) cmd=50 (SMBtrans2)
> > NT_STATUS_NO_SUCH_FILE
>
> This I think needs to be fixed so that resolve_dfs_path()
>
> /* check if need to redirect */
> fstrcpy(localpath, conn->connectpath);
> fstrcat(localpath, "/");
> fstrcat(localpath, dp->reqpath);
>
> /* Need to substitute macros here ? */
>
> before the call to is_msdfs_link()
>
> Am I on the right track here ?
>
> Thanks
>
> Kevin
>
> --
> | Kevin Wheatley              | These are the opinions of nobody   |
> | Special Services (Projects) | and are not shared by my employers |
> | Cinesite Digital Studios    |                                    |
>





More information about the samba-technical mailing list