From e0559720098ca57ab29badca282763879cbac6e4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 17 Aug 1999 23:16:17 +0000 Subject: patch from Michael Glauche to list connections from STATUS..LCK. (This used to be commit 91a66dd5c3a551691fbf91e782cb6ff16dfea37b) --- source3/rpc_server/srv_srvsvc.c | 47 +++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'source3/rpc_server/srv_srvsvc.c') diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index 5b43ec0303..834c95615a 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -509,8 +509,18 @@ static void srv_reply_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, ********************************************************************/ static void make_srv_conn_info_0(SRV_CONN_INFO_0 *ss0, uint32 *snum, uint32 *stot) { - uint32 num_entries = 0; - (*stot) = 1; + uint32 num_entries = 0; + struct connect_record *crec; + uint32 connection_count; + + if (!get_connection_status(&crec, &connection_count)) + { + (*snum) = 0; + (*stot) = 0; + return; + } + + (*stot) = connection_count; if (ss0 == NULL) { @@ -518,13 +528,13 @@ static void make_srv_conn_info_0(SRV_CONN_INFO_0 *ss0, uint32 *snum, uint32 *sto return; } - DEBUG(5,("make_srv_conn_0_ss0\n")); + DEBUG(0,("make_srv_conn_0_ss0\n")); if (snum) { for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++) { - make_srv_conn_info0(&(ss0->info_0 [num_entries]), (*stot)); + make_srv_conn_info0(&(ss0->info_0 [num_entries]), (*snum)); /* move on to creating next connection */ /* move on to creating next conn */ @@ -550,6 +560,8 @@ static void make_srv_conn_info_0(SRV_CONN_INFO_0 *ss0, uint32 *snum, uint32 *sto (*stot) = 0; } + + free(crec); } /******************************************************************* @@ -579,8 +591,21 @@ static void make_srv_conn_1_info(CONN_INFO_1 *se1, CONN_INFO_1_STR *str1, ********************************************************************/ static void make_srv_conn_info_1(SRV_CONN_INFO_1 *ss1, uint32 *snum, uint32 *stot) { - uint32 num_entries = 0; - (*stot) = 1; + uint32 num_entries = 0; + time_t current_time; + time_t diff; + + struct connect_record *crec; + uint32 connection_count; + + if (!get_connection_status(&crec, &connection_count)) + { + (*snum) = 0; + (*stot) = 0; + return; + } + + (*stot) = connection_count; if (ss1 == NULL) { @@ -588,15 +613,21 @@ static void make_srv_conn_info_1(SRV_CONN_INFO_1 *ss1, uint32 *snum, uint32 *sto return; } + current_time=time(NULL); + DEBUG(5,("make_srv_conn_1_ss1\n")); if (snum) { for (; (*snum) < (*stot) && num_entries < MAX_CONN_ENTRIES; (*snum)++) { + diff = current_time - crec[num_entries].start; make_srv_conn_1_info(&(ss1->info_1 [num_entries]), &(ss1->info_1_str[num_entries]), - (*stot), 0x3, 1, 1, 3,"dummy_user", "IPC$"); + (*snum), 0, 0, 1, diff,uidtoname(crec[num_entries].uid), + crec[num_entries].name); + +/* FIXME : type of connection + number of locked files */ /* move on to creating next connection */ /* move on to creating next conn */ @@ -621,6 +652,8 @@ static void make_srv_conn_info_1(SRV_CONN_INFO_1 *ss1, uint32 *snum, uint32 *sto (*stot) = 0; } + + free(crec); } /******************************************************************* -- cgit