diff options
Diffstat (limited to 'source4/smb_server')
-rw-r--r-- | source4/smb_server/conn.c | 1 | ||||
-rw-r--r-- | source4/smb_server/management.c | 33 | ||||
-rw-r--r-- | source4/smb_server/smb_server.h | 2 |
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 */ |