]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix bug #5460. The problem is RHEL5.0 shipped a CIFS client
authorJeremy Allison <jra@samba.org>
Tue, 13 May 2008 21:03:21 +0000 (14:03 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 13 May 2008 21:03:21 +0000 (14:03 -0700)
that sets the DFS bit on pathnames but doesn't
send DFS paths. This causes lookups to fail as
the smbd/msdfs.c code now just eats the first
two parts of the pathname and uses the rest as
the local path. The previous hostname check
used to protect us from that as we knew that
when the hostname was invalid it was a local
path (and a broken client).
I didn't want to put that check back in, but
came up with another idea - even though the
hostname can be a different one, the sharename
must be valid on this machine. So we can check
for a valid sharename instead.
Jeremy.

source/smbd/conn.c
source/smbd/msdfs.c

index 5aedadc56b0ddaaed9075b58224c8d1cb8ece7fb..1a5552266bede0670bce15b6c88a8901a646b61f 100644 (file)
@@ -63,10 +63,10 @@ bool conn_snum_used(int snum)
        return(False);
 }
 
-
 /****************************************************************************
-find a conn given a cnum
+ Find a conn given a cnum.
 ****************************************************************************/
+
 connection_struct *conn_find(unsigned cnum)
 {
        int count=0;
@@ -84,6 +84,27 @@ connection_struct *conn_find(unsigned cnum)
        return NULL;
 }
 
+/****************************************************************************
+ Find a conn given a service name.
+****************************************************************************/
+
+connection_struct *conn_find_byname(const char *service)
+{
+       int count=0;
+       connection_struct *conn;
+
+       for (conn=Connections;conn;conn=conn->next,count++) {
+               if (strequal(lp_servicename(SNUM(conn)),service)) {
+                       if (count > 10) {
+                               DLIST_PROMOTE(Connections, conn);
+                       }
+                       return conn;
+               }
+       }
+
+       return NULL;
+}
+
 
 /****************************************************************************
   find first available connection slot, starting from a random position.
index 4f9e73967785b8ba4326112a485e39ec34a3a220..7400f792eddcc5c524053a0d0c68a67ada3d6efb 100644 (file)
@@ -133,6 +133,16 @@ static NTSTATUS parse_dfs_path(const char *pathname,
        if(p == NULL) {
                pdp->servicename = temp;
                pdp->reqpath = eos_ptr; /* "" */
+               /* Is this really our servicename ? */
+               if (NULL == conn_find_byname(pdp->servicename)) {
+                       DEBUG(10,("parse_dfs_path: %s is not our servicename\n",
+                               pdp->servicename));
+                       p = temp;
+                       DEBUG(10,("parse_dfs_path: trying to convert %s "
+                               "to a local path\n",
+                               temp));
+                       goto local_path;
+               }
                return NT_STATUS_OK;
        }
        *p = '\0';