summaryrefslogtreecommitdiff
path: root/source4/smb_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-19 04:26:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:40 -0500
commita32fe0f293fb86d69f3f7001daac2614adfb6b98 (patch)
tree5f4477d2e4a04c2855ec1d1ce38aa704dc11ffb6 /source4/smb_server
parentf3d61cc61545605cb8ea07b21b07577ccde4e1e8 (diff)
downloadsamba-a32fe0f293fb86d69f3f7001daac2614adfb6b98.tar.gz
samba-a32fe0f293fb86d69f3f7001daac2614adfb6b98.tar.bz2
samba-a32fe0f293fb86d69f3f7001daac2614adfb6b98.zip
r8577: added management calls to list current tree connects
(This used to be commit 658befc1e4df44bee1f365a730951001f0f36640)
Diffstat (limited to 'source4/smb_server')
-rw-r--r--source4/smb_server/conn.c1
-rw-r--r--source4/smb_server/management.c33
-rw-r--r--source4/smb_server/smb_server.h2
3 files changed, 36 insertions, 0 deletions
diff --git a/source4/smb_server/conn.c b/source4/smb_server/conn.c
index dfc310a161..a9cd71e801 100644
--- a/source4/smb_server/conn.c
+++ b/source4/smb_server/conn.c
@@ -81,6 +81,7 @@ struct smbsrv_tcon *smbsrv_tcon_new(struct smbsrv_connection *smb_conn)
tcon->tid = i;
tcon->smb_conn = smb_conn;
+ tcon->connect_time = timeval_current();
talloc_set_destructor(tcon, smbsrv_tcon_destructor);
diff --git a/source4/smb_server/management.c b/source4/smb_server/management.c
index 8282818360..234adac414 100644
--- a/source4/smb_server/management.c
+++ b/source4/smb_server/management.c
@@ -60,6 +60,37 @@ static NTSTATUS smbsrv_session_information(struct irpc_message *msg,
}
/*
+ return a list of tree connects
+*/
+static NTSTATUS smbsrv_tree_information(struct irpc_message *msg,
+ struct smbsrv_information *r)
+{
+ struct smbsrv_connection *smb_conn = talloc_get_type(msg->private, struct smbsrv_connection);
+ int i=0, count=0;
+ struct smbsrv_tcon *tcon;
+
+ /* count the number of tcons */
+ for (tcon=smb_conn->tree.tcons; tcon; tcon=tcon->next) {
+ count++;
+ }
+
+ r->out.info.trees.num_trees = count;
+ r->out.info.trees.trees = talloc_array(r, struct smbsrv_tree_info, count);
+ NT_STATUS_HAVE_NO_MEMORY(r->out.info.trees.trees);
+
+ for (tcon=smb_conn->tree.tcons; tcon; tcon=tcon->next) {
+ struct smbsrv_tree_info *info = &r->out.info.trees.trees[i];
+ info->tid = tcon->tid;
+ info->share_name = lp_servicename(tcon->service);
+ info->connect_time = timeval_to_nttime(&tcon->connect_time);
+ info->client_ip = socket_get_peer_addr(smb_conn->connection->socket, r);
+ i++;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/*
serve smbserver information via irpc
*/
static NTSTATUS smbsrv_information(struct irpc_message *msg,
@@ -68,6 +99,8 @@ static NTSTATUS smbsrv_information(struct irpc_message *msg,
switch (r->in.level) {
case SMBSRV_INFO_SESSIONS:
return smbsrv_session_information(msg, r);
+ case SMBSRV_INFO_TREES:
+ return smbsrv_tree_information(msg, r);
}
return NT_STATUS_OK;
diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h
index df49825e0e..819a70cbae 100644
--- a/source4/smb_server/smb_server.h
+++ b/source4/smb_server/smb_server.h
@@ -79,6 +79,8 @@ struct smbsrv_tcon {
/* the reported device type */
char *dev_type;
+
+ struct timeval connect_time;
};
/* a set of flags to control handling of request structures */