s3:smbd: add connections_snum_used()
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 11:18:01 +0000 (12:18 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 14:45:36 +0000 (15:45 +0100)
This works similar to conn_snum_used(), but instead of
looking at the current connection only, it looks at
all active connections in "connections.tdb".

metze

source3/smbd/connection.c
source3/smbd/proto.h

index 5da2b08faab2a1f507217c8f40c725a43484cfce..5a9f4071b4f700fc5b9c80c8fcb2ea25beebbbe1 100644 (file)
@@ -130,6 +130,18 @@ int count_current_connections( const char *sharename, bool clear  )
        return cs.curr_connections;
 }
 
+bool connections_snum_used(struct smbd_server_connection *unused, int snum)
+{
+       int active;
+
+       active = count_current_connections(lp_servicename(snum), true);
+       if (active > 0) {
+               return true;
+       }
+
+       return false;
+}
+
 /****************************************************************************
  Claim an entry in the connections database.
 ****************************************************************************/
index 151ae78ec39b31d79c0fcab5af81251764bc12c1..6d833d7b2d533bf3a6e05729499abe9634f10573 100644 (file)
@@ -164,6 +164,7 @@ void msg_force_tdis(struct messaging_context *msg,
 
 bool yield_connection(connection_struct *conn, const char *name);
 int count_current_connections( const char *sharename, bool clear  );
+bool connections_snum_used(struct smbd_server_connection *unused, int snum);
 bool claim_connection(connection_struct *conn, const char *name);
 
 /* The following definitions come from smbd/dfree.c  */