Ensure we don't keep searching for sharename if it's
authorJeremy Allison <jra@samba.org>
Wed, 14 May 2008 21:10:05 +0000 (14:10 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 14 May 2008 21:10:05 +0000 (14:10 -0700)
not the start of the list.
Jeremy.
(This used to be commit 15857534b76bc66ad122510100aa224f17250465)

source3/smbd/conn.c

index 125277be21128badcac0aa348b83cf357d52808a..159b232b5faf19b230fc6e55e590635f050fff6a 100644 (file)
@@ -90,12 +90,12 @@ connection_struct *conn_find(unsigned cnum)
 
 connection_struct *conn_find_byname(const char *service)
 {
-       int count=0;
        connection_struct *conn;
 
-       for (conn=Connections;conn;conn=conn->next,count++) {
+       for (conn=Connections;conn;conn=conn->next) {
                if (strequal(lp_servicename(SNUM(conn)),service)) {
-                       if (count > 10) {
+                       if (conn != Connections) {
+                               /* Promote if not first. */
                                DLIST_PROMOTE(Connections, conn);
                        }
                        return conn;