Add msdfs proxy functionality to HEAD.
authorShirish Kalele <kalele@samba.org>
Sun, 29 Dec 2002 23:29:08 +0000 (23:29 +0000)
committerShirish Kalele <kalele@samba.org>
Sun, 29 Dec 2002 23:29:08 +0000 (23:29 +0000)
(This used to be commit 9df93b1ffc9ce98302540cc3d2cbd66787abc4fd)

docs/docbook/manpages/smb.conf.5.sgml
docs/htmldocs/smb.conf.5.html
docs/manpages/smb.conf.5
source3/msdfs/msdfs.c
source3/param/loadparm.c
source3/smbd/service.c

index 13fdb1c6cb6776353d2b73ab20977cb72a8c0663..17a1ddf77eefccfa371dbc6c52660d99903b09cc 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
 <refentry id="smb.conf">
-
+       
 <refmeta>
        <refentrytitle>smb.conf</refentrytitle>
        <manvolnum>5</manvolnum>
                <listitem><para><link linkend="MAXCONNECTIONS"><parameter>max connections</parameter></link></para></listitem>
                <listitem><para><link linkend="MAXPRINTJOBS"><parameter>max print jobs</parameter></link></para></listitem>
                <listitem><para><link linkend="MINPRINTSPACE"><parameter>min print space</parameter></link></para></listitem>
+               <listitem><para><link linkend="MSDFSPROXY"><parameter>msdfs proxy</parameter></link></para></listitem>
                <listitem><para><link linkend="MSDFSROOT"><parameter>msdfs root</parameter></link></para></listitem>
                <listitem><para><link linkend="NTACLSUPPORT"><parameter>nt acl support</parameter></link></para></listitem>
                <listitem><para><link linkend="ONLYGUEST"><parameter>only guest</parameter></link></para></listitem>
                </varlistentry>
 
 
-               
-               
+               <varlistentry>
+               <term><anchor id="MSDFSPROXY">msdfs proxy (S)</term>
+               <listitem><para>This parameter indicates that the share is a
+               stand-in for another CIFS share whose location is specified by
+               the value of the parameter. When clients attempt to connect to
+               this share, they are redirected to the proxied share using
+               the SMB-Dfs protocol.</para>
+               <para>Only Dfs roots can act as proxy shares. Take a look at the
+               <link linkend="MSDFSROOT"><parameter>msdfs root</parameter></link>
+               and
+               <link linkend="HOSTMSDFS"><parameter>host msdfs</parameter></link>
+               options to find out how to set up a Dfs root share.</para>
+               <para>Example: <command>msdfs proxy = \otherserver\someshare</command></para>
+               </listitem>
+               </varlistentry>
+
+
+
+
                <varlistentry>
                <term><anchor id="MSDFSROOT">msdfs root (S)</term>
                <listitem><para>This boolean parameter is only available if 
                Samba treats the share as a Dfs root and  allows clients to browse 
                the distributed file system tree rooted at the share directory. 
                Dfs links are specified  in  the share directory by symbolic 
-               links of the form <filename>msdfs:serverA\shareA,serverB\shareB
-               </filename> and so on.  For more information on setting up a Dfs tree 
+               links of the form <filename>msdfs:serverA\shareA,serverB\shareB</filename>
+               and so on.  For more information on setting up a Dfs tree 
                on Samba,  refer to <ulink url="msdfs_setup.html">msdfs_setup.html
                </ulink>.</para>
                
index 5e0e9be1e8a13a38e2d6d4cdd0c8485290df18d2..84b0920d5b90c39274f615062f9dbfbd3508c74a 100644 (file)
@@ -16,7 +16,9 @@ VLINK="#840084"
 ALINK="#0000FF"
 ><H1
 ><A
-NAME="SMB.CONF">smb.conf</H1
+NAME="SMB.CONF"
+></A
+>smb.conf</H1
 ><DIV
 CLASS="REFNAMEDIV"
 ><A
@@ -3994,6 +3996,18 @@ CLASS="PARAMETER"
 ><LI
 ><P
 ><A
+HREF="#MSDFSPROXY"
+><TT
+CLASS="PARAMETER"
+><I
+>msdfs proxy</I
+></TT
+></A
+></P
+></LI
+><LI
+><P
+><A
 HREF="#MSDFSROOT"
 ><TT
 CLASS="PARAMETER"
@@ -4656,7 +4670,7 @@ CLASS="PARAMETER"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN1513"
+NAME="AEN1517"
 ></A
 ><H2
 >EXPLANATION OF EACH PARAMETER</H2
@@ -12529,6 +12543,46 @@ CLASS="COMMAND"
 ></DD
 ><DT
 ><A
+NAME="MSDFSPROXY"
+></A
+>msdfs proxy (S)</DT
+><DD
+><P
+>This parameter indicates that the share is a
+               stand-in for another CIFS share whose location is specified by
+               the value of the parameter. When clients attempt to connect to
+               this share, they are redirected to the proxied share using
+               the SMB-Dfs protocol.</P
+><P
+>Only Dfs roots can act as proxy shares. Take a look at the
+               <A
+HREF="#MSDFSROOT"
+><TT
+CLASS="PARAMETER"
+><I
+>msdfs root</I
+></TT
+></A
+>
+               and
+               <A
+HREF="#HOSTMSDFS"
+><TT
+CLASS="PARAMETER"
+><I
+>host msdfs</I
+></TT
+></A
+>
+               options to find out how to set up a Dfs root share.</P
+><P
+>Example: <B
+CLASS="COMMAND"
+>msdfs proxy = \otherserver\someshare</B
+></P
+></DD
+><DT
+><A
 NAME="MSDFSROOT"
 ></A
 >msdfs root (S)</DT
@@ -12547,9 +12601,9 @@ CLASS="CONSTANT"
                Dfs links are specified  in  the share directory by symbolic 
                links of the form <TT
 CLASS="FILENAME"
->msdfs:serverA\shareA,serverB\shareB
-               </TT
-> and so on.  For more information on setting up a Dfs tree 
+>msdfs:serverA\shareA,serverB\shareB</TT
+>
+               and so on.  For more information on setting up a Dfs tree 
                on Samba,  refer to <A
 HREF="msdfs_setup.html"
 TARGET="_top"
@@ -19432,7 +19486,7 @@ CLASS="PARAMETER"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN6147"
+NAME="AEN6163"
 ></A
 ><H2
 >WARNINGS</H2
@@ -19462,7 +19516,7 @@ TARGET="_top"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN6153"
+NAME="AEN6169"
 ></A
 ><H2
 >VERSION</H2
@@ -19473,7 +19527,7 @@ NAME="AEN6153"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN6156"
+NAME="AEN6172"
 ></A
 ><H2
 >SEE ALSO</H2
@@ -19552,7 +19606,7 @@ CLASS="COMMAND"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN6176"
+NAME="AEN6192"
 ></A
 ><H2
 >AUTHOR</H2
index a9cf133c8d50c64feb1ae692c6a8209687e1c84e..a5330e50b60da83dcda57694c8546bfa105061f2 100644 (file)
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "SMB.CONF" "5" "26 November 2002" "" ""
+.TH "SMB.CONF" "5" "29 December 2002" "" ""
 .SH NAME
 smb.conf \- The configuration file for the Samba suite
 .SH "SYNOPSIS"
@@ -1271,6 +1271,9 @@ each parameter for details. Note that some are synonyms.
 \fImin print space\fR
 .TP 0.2i
 \(bu
+\fImsdfs proxy\fR
+.TP 0.2i
+\(bu
 \fImsdfs root\fR
 .TP 0.2i
 \(bu
@@ -4497,14 +4500,29 @@ is 6 hours (21600 seconds).
 
 Default: \fBmin wins ttl = 21600\fR
 .TP
+\fBmsdfs proxy (S)\fR
+This parameter indicates that the share is a
+stand-in for another CIFS share whose location is specified by
+the value of the parameter. When clients attempt to connect to
+this share, they are redirected to the proxied share using
+the SMB-Dfs protocol.
+
+Only Dfs roots can act as proxy shares. Take a look at the
+\fImsdfs root\fR
+and
+\fIhost msdfs\fR
+options to find out how to set up a Dfs root share.
+
+Example: \fBmsdfs proxy = \\otherserver\\someshare\fR
+.TP
 \fBmsdfs root (S)\fR
 This boolean parameter is only available if 
 Samba is configured  and  compiled with the \fB  --with-msdfs\fR option.  If set to yes, 
 Samba treats the share as a Dfs root and  allows clients to browse 
 the distributed file system tree rooted at the share directory. 
 Dfs links are specified  in  the share directory by symbolic 
-links of the form \fImsdfs:serverA\\shareA,serverB\\shareB
-\fR and so on.  For more information on setting up a Dfs tree 
+links of the form \fImsdfs:serverA\\shareA,serverB\\shareB\fR
+and so on.  For more information on setting up a Dfs tree 
 on Samba,  refer to msdfs_setup.html
 
 
index 3e66c1c10ca0eca36f3709d8e9cdf94edf6c76d7..613382961b1ebec9585390995f7278d117e12e39 100644 (file)
@@ -381,6 +381,26 @@ BOOL get_referred_path(char *pathname, struct junction_map* jn,
                return False;
        }
 
+       if (*lp_msdfs_proxy(snum) != '\0') {
+               struct referral* ref;
+               jn->referral_count = 1;
+               if ((ref = (struct referral*) malloc(sizeof(struct referral)))
+                   == NULL) {
+                       DEBUG(0, ("malloc failed for referral\n"));
+                       return False;
+               }
+
+               pstrcpy(ref->alternate_path, lp_msdfs_proxy(snum));
+               if (dp.reqpath[0] != '\0')
+                       pstrcat(ref->alternate_path, dp.reqpath);
+               ref->proximity = 0;
+               ref->ttl = REFERRAL_TTL;
+               jn->referral_list = ref;
+               if (consumedcntp)
+                       *consumedcntp = strlen(pathname);
+               return True;
+       }
+
        /* If not remote & not a self referral, return False */
        if (!resolve_dfs_path(pathname, &dp, conn, False, 
                              &jn->referral_list, &jn->referral_count,
@@ -630,7 +650,7 @@ int setup_dfs_referral(char* pathname, int max_referral_level, char** ppdata)
                        dbgtext(".\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)
@@ -798,6 +818,7 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
        char* service_name = lp_servicename(snum);
        connection_struct conns;
        connection_struct *conn = &conns;
+       struct referral *ref = NULL;
  
        pstrcpy(connect_path,lp_pathname(snum));
 
@@ -811,31 +832,34 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
        if (!create_conn_struct(conn, snum, connect_path))
                return False;
 
-       { 
-               /* form a junction for the msdfs root - convention 
-                  DO NOT REMOVE THIS: NT clients will not work with us
-                  if this is not present
-               */ 
-               struct referral *ref = NULL;
-               pstring alt_path;
-               pstrcpy(jn[cnt].service_name, service_name);
-               jn[cnt].volume_name[0] = '\0';
-               jn[cnt].referral_count = 1;
-       
-               slprintf(alt_path,sizeof(alt_path)-1,"\\\\%s\\%s", 
-                        local_machine, service_name);
-               ref = jn[cnt].referral_list = (struct referral*) malloc(sizeof(struct referral));
-               if (jn[cnt].referral_list == NULL) {
-                       DEBUG(0, ("Malloc failed!\n"));
-                       return False;
-               }
-
-               safe_strcpy(ref->alternate_path, alt_path, sizeof(pstring));
-               ref->proximity = 0;
-               ref->ttl = REFERRAL_TTL;
-               cnt++;
+       /* form a junction for the msdfs root - convention 
+          DO NOT REMOVE THIS: NT clients will not work with us
+          if this is not present
+       */ 
+       pstrcpy(jn[cnt].service_name, service_name);
+       jn[cnt].volume_name[0] = '\0';
+       jn[cnt].referral_count = 1;
+
+       ref = jn[cnt].referral_list
+               = (struct referral*) malloc(sizeof(struct referral));
+       if (jn[cnt].referral_list == NULL) {
+               DEBUG(0, ("Malloc failed!\n"));
+               return False;
        }
 
+       ref->proximity = 0;
+       ref->ttl = REFERRAL_TTL;
+       if (*lp_msdfs_proxy(snum) != '\0') {
+               pstrcpy(ref->alternate_path, lp_msdfs_proxy(snum));
+               *jn_count = 1;
+               return True;
+       }
+               
+       slprintf(ref->alternate_path, sizeof(pstring)-1,
+                "\\\\%s\\%s", local_machine, service_name);
+       cnt++;
+       
+       /* Now enumerate all dfs links */
        dirp = conn->vfs_ops.opendir(conn, connect_path);
        if(!dirp)
                return False;
index 02f120b5343716881b871d232f1913d0f00abec9..621aa67e6ac8a80fc04712849ad1d1f84d8bfcd2 100644 (file)
@@ -328,6 +328,7 @@ typedef struct
        char *szVfsObjectFile;
        char *szVfsOptions;
        char *szVfsPath;
+       char *szMSDfsProxy;
        int iMinPrintSpace;
        int iMaxPrintJobs;
        int iWriteCacheSize;
@@ -447,6 +448,7 @@ static service sDefault = {
        NULL,                   /* vfs object */
        NULL,                   /* vfs options */
        NULL,                   /* vfs path */
+       NULL,                   /* szMSDfsProxy */
        0,                      /* iMinPrintSpace */
        1000,                   /* iMaxPrintJobs */
        0,                      /* iWriteCacheSize */
@@ -1091,6 +1093,7 @@ static struct parm_struct parm_table[] = {
 
        
        {"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_SHARE},
+       {"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_SHARE},
        {"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
 
        {"Winbind options", P_SEP, P_SEPARATOR},
@@ -1739,6 +1742,7 @@ FN_LOCAL_STRING(lp_fstype, fstype)
 FN_LOCAL_STRING(lp_vfsobj, szVfsObjectFile)
 FN_LOCAL_STRING(lp_vfs_options, szVfsOptions)
 FN_LOCAL_STRING(lp_vfs_path, szVfsPath)
+FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
 static FN_LOCAL_STRING(lp_volume, volume)
 FN_LOCAL_STRING(lp_mangled_map, szMangledMap)
 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
index 1f168dd3ffff5b62c677be2d1bab9785c904992a..d00c908a1a9396f2b56d05d3091e5f9b267d9cea 100644 (file)
@@ -833,6 +833,13 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
                return NULL;
        }
 
+       /* Handle non-Dfs clients attempting connections to msdfs proxy */
+       if (lp_host_msdfs() && (*lp_msdfs_proxy(snum) != '\0'))  {
+               DEBUG(3, ("refusing connection to dfs proxy '%s'\n", service));
+               *status = NT_STATUS_BAD_NETWORK_NAME;
+               return NULL;
+       }
+
        DEBUG(5, ("making a connection to 'normal' service %s\n", service));
 
        return make_connection_snum(snum, vuser,