summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_srvsvc_nt.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-07-21 14:13:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:17 -0500
commite0c68d0a1d591e4285746a8af70040448752a735 (patch)
treed7edf767f718e4fe2b4362fe3f2c9c3d4758bf2f /source3/rpc_server/srv_srvsvc_nt.c
parent2cc356a52538e932e530643d493fb8caa279878f (diff)
downloadsamba-e0c68d0a1d591e4285746a8af70040448752a735.tar.gz
samba-e0c68d0a1d591e4285746a8af70040448752a735.tar.bz2
samba-e0c68d0a1d591e4285746a8af70040448752a735.zip
r17177: Get rid of a global variable by adding a private data pointer to
share_mode_forall(). Volker (This used to be commit f97f6cedffdc4d10afcac90a163b93a801acf514)
Diffstat (limited to 'source3/rpc_server/srv_srvsvc_nt.c')
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index be4c51c0d2..e4e5bde215 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -123,7 +123,8 @@ static WERROR net_enum_pipes( TALLOC_CTX *ctx, FILE_INFO_3 **info,
static struct file_enum_count f_enum_cnt;
static void enum_file_fn( const struct share_mode_entry *e,
- const char *sharepath, const char *fname )
+ const char *sharepath, const char *fname,
+ void *dummy )
{
struct file_enum_count *fenum = &f_enum_cnt;
@@ -191,7 +192,7 @@ static WERROR net_enum_files( TALLOC_CTX *ctx, FILE_INFO_3 **info,
f_enum_cnt.count = *count;
f_enum_cnt.info = *info;
- share_mode_forall( enum_file_fn );
+ share_mode_forall( enum_file_fn, NULL );
*info = f_enum_cnt.info;
*count = f_enum_cnt.count;
@@ -802,13 +803,11 @@ static void init_srv_sess_info_0(SRV_SESS_INFO_0 *ss0, uint32 *snum, uint32 *sto
/*******************************************************************
********************************************************************/
-/* global needed to make use of the share_mode_forall() callback */
-static struct sess_file_count s_file_cnt;
-
static void sess_file_fn( const struct share_mode_entry *e,
- const char *sharepath, const char *fname )
+ const char *sharepath, const char *fname,
+ void *private_data )
{
- struct sess_file_count *sess = &s_file_cnt;
+ struct sess_file_count *sess = (struct sess_file_count *)private_data;
if ( (procid_to_pid(&e->pid) == sess->pid) && (sess->uid == e->uid) ) {
sess->count++;
@@ -822,11 +821,13 @@ static void sess_file_fn( const struct share_mode_entry *e,
static int net_count_files( uid_t uid, pid_t pid )
{
+ struct sess_file_count s_file_cnt;
+
s_file_cnt.count = 0;
s_file_cnt.uid = uid;
s_file_cnt.pid = pid;
- share_mode_forall( sess_file_fn );
+ share_mode_forall( sess_file_fn, (void *)&s_file_cnt );
return s_file_cnt.count;
}