summaryrefslogtreecommitdiff
path: root/source3/smbd/conn.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-13 14:01:19 -0700
committerJeremy Allison <jra@samba.org>2008-05-13 14:01:19 -0700
commitbafe8d22fde97755bf35e8abf389d52b8993a551 (patch)
tree1bd38dbcfbcbcf824026b31fb93e6dceba195872 /source3/smbd/conn.c
parent34933a5c236ee489e4c11172820cdc0496b9e334 (diff)
downloadsamba-bafe8d22fde97755bf35e8abf389d52b8993a551.tar.gz
Fix bug #5460. The problem is RHEL5.0 shipped a CIFS client
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. (This used to be commit e1cda82f6f7de3306a653af920756c1640057f2d)
Diffstat (limited to 'source3/smbd/conn.c')
-rw-r--r--source3/smbd/conn.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index e899af13194..125277be211 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -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.