summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-10-19 13:25:51 -0700
committerJeremy Allison <jra@samba.org>2010-10-19 15:13:17 -0700
commitedefaf5bed75fd315b1ca9a3da096419a7a6cec3 (patch)
treeea95458d906c3a1653e876d411b113d9efb287e8
parent492ab4d60fac5551b8c9b40d18871e677cd4187c (diff)
downloadsamba-edefaf5bed75fd315b1ca9a3da096419a7a6cec3.tar.gz
samba-edefaf5bed75fd315b1ca9a3da096419a7a6cec3.tar.bz2
samba-edefaf5bed75fd315b1ca9a3da096419a7a6cec3.zip
Move tcons.num_open from smb1 to sconn->num_tcons_open as this is needed for SMB2 also.
-rw-r--r--source3/smbd/conn.c9
-rw-r--r--source3/smbd/globals.h4
-rw-r--r--source3/smbd/msdfs.c2
-rw-r--r--source3/smbd/smb2_tcon.c3
4 files changed, 11 insertions, 7 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index d12495bf78..b18231f44c 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -33,7 +33,6 @@ init the conn structures
void conn_init(struct smbd_server_connection *sconn)
{
sconn->smb1.tcons.Connections = NULL;
- sconn->smb1.tcons.num_open = 0;
sconn->smb1.tcons.bmap = bitmap_talloc(sconn, BITMAP_BLOCK_SZ);
}
@@ -42,7 +41,7 @@ return the number of open connections
****************************************************************************/
int conn_num_open(struct smbd_server_connection *sconn)
{
- return sconn->smb1.tcons.num_open;
+ return sconn->num_tcons_open;
}
@@ -161,7 +160,7 @@ find_again:
bitmap_set(sconn->smb1.tcons.bmap, i);
- sconn->smb1.tcons.num_open++;
+ sconn->num_tcons_open++;
string_set(&conn->connectpath,"");
string_set(&conn->origpath,"");
@@ -329,8 +328,8 @@ void conn_free(connection_struct *conn)
bitmap_clear(conn->sconn->smb1.tcons.bmap, conn->cnum);
}
- SMB_ASSERT(conn->sconn->smb1.tcons.num_open > 0);
- conn->sconn->smb1.tcons.num_open--;
+ SMB_ASSERT(conn->sconn->num_tcons_open > 0);
+ conn->sconn->num_tcons_open--;
conn_free_internal(conn);
}
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index cbbb583ae9..5037b6d6b5 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -465,6 +465,9 @@ struct smbd_server_connection {
unsigned long file_gen_counter;
int first_file;
+ /* number of open connections (tcons) */
+ int num_tcons_open;
+
struct {
struct fd_event *fde;
@@ -531,7 +534,6 @@ struct smbd_server_connection {
connection_struct *Connections;
/* number of open connections */
struct bitmap *bmap;
- int num_open;
} tcons;
struct smb_signing_state *signing_state;
/* List to store partial SPNEGO auth fragments. */
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 481958c8ae..c005a2f3ab 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -256,7 +256,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
conn->params->service = snum;
conn->sconn = smbd_server_conn;
- conn->sconn->smb1.tcons.num_open += 1;
+ conn->sconn->num_tcons_open++;
if (server_info != NULL) {
conn->server_info = copy_serverinfo(conn, server_info);
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c
index 1cfb4ceaa6..203325e71a 100644
--- a/source3/smbd/smb2_tcon.c
+++ b/source3/smbd/smb2_tcon.c
@@ -127,6 +127,8 @@ static int smbd_smb2_tcon_destructor(struct smbd_smb2_tcon *tcon)
idr_remove(tcon->session->tcons.idtree, tcon->tid);
DLIST_REMOVE(tcon->session->tcons.list, tcon);
+ SMB_ASSERT(tcon->session->sconn->num_tcons_open > 0);
+ tcon->session->sconn->num_tcons_open--;
if (tcon->compat_conn) {
set_current_service(tcon->compat_conn, 0, true);
@@ -214,6 +216,7 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
DLIST_ADD_END(req->session->tcons.list, tcon,
struct smbd_smb2_tcon *);
tcon->session = req->session;
+ tcon->session->sconn->num_tcons_open++;
talloc_set_destructor(tcon, smbd_smb2_tcon_destructor);
compat_conn = make_connection_snum(req->sconn,