summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c35
-rw-r--r--source3/rpcclient/cmd_netlogon.c13
-rw-r--r--source3/rpcclient/cmd_reg.c152
-rw-r--r--source3/rpcclient/cmd_samr.c291
-rw-r--r--source3/rpcclient/cmd_srvsvc.c35
-rw-r--r--source3/rpcclient/cmd_wkssvc.c7
-rw-r--r--source3/rpcclient/rpcclient.c2
7 files changed, 282 insertions, 253 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index c222d0a0e0..cfde752901 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -44,6 +44,7 @@ nt lsa query
****************************************************************************/
void cmd_lsa_query_info(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring srv_name;
BOOL res = True;
@@ -62,29 +63,29 @@ void cmd_lsa_query_info(struct client_info *info)
DEBUG(5, ("cmd_lsa_query_info: smb_cli->fd:%d\n", smb_cli->fd));
/* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False;
/* lookup domain controller; receive a policy handle */
- res = res ? lsa_open_policy(smb_cli,
+ res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum,
srv_name,
&info->dom.lsa_info_pol, False) : False;
/* send client info query, level 3. receive domain name and sid */
- res = res ? lsa_query_info_pol(smb_cli,
+ res = res ? lsa_query_info_pol(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol, 0x03,
info->dom.level3_dom,
&info->dom.level3_sid) : False;
/* send client info query, level 5. receive domain name and sid */
- res = res ? lsa_query_info_pol(smb_cli,
+ res = res ? lsa_query_info_pol(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol, 0x05,
info->dom.level5_dom,
&info->dom.level5_sid) : False;
- res = res ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False;
+ res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
@@ -125,6 +126,7 @@ lookup names
****************************************************************************/
void cmd_lsa_lookup_names(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring temp;
int i;
fstring srv_name;
@@ -157,23 +159,23 @@ void cmd_lsa_lookup_names(struct client_info *info)
}
/* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False;
/* lookup domain controller; receive a policy handle */
- res = res ? lsa_open_policy(smb_cli,
+ res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum,
srv_name,
&info->dom.lsa_info_pol, True) : False;
/* send lsa lookup sids call */
- res = res ? lsa_lookup_names(smb_cli,
+ res = res ? lsa_lookup_names(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol,
num_names, names,
&sids, &num_sids) : False;
- res = res ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False;
+ res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
@@ -215,6 +217,7 @@ lookup sids
****************************************************************************/
void cmd_lsa_lookup_sids(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring temp;
int i;
pstring sid_name;
@@ -264,23 +267,23 @@ void cmd_lsa_lookup_sids(struct client_info *info)
}
/* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False;
/* lookup domain controller; receive a policy handle */
- res = res ? lsa_open_policy(smb_cli,
+ res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum,
srv_name,
&info->dom.lsa_info_pol, True) : False;
/* send lsa lookup sids call */
- res = res ? lsa_lookup_sids(smb_cli,
+ res = res ? lsa_lookup_sids(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol,
num_sids, sids,
&names, &num_names) : False;
- res = res ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False;
+ res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 2c8514b43e..6001327862 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -43,6 +43,7 @@ experimental nt login.
****************************************************************************/
void cmd_netlogon_login_test(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
extern BOOL global_machine_password_needs_changing;
fstring nt_user_name;
@@ -89,16 +90,16 @@ void cmd_netlogon_login_test(struct client_info *info)
info->mach_acct, new_mach_pwd) : False;
#endif
/* open NETLOGON session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_NETLOGON) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_NETLOGON, &nt_pipe_fnum) : False;
- res = res ? cli_nt_setup_creds(smb_cli, trust_passwd) : False;
+ res = res ? cli_nt_setup_creds(smb_cli, nt_pipe_fnum, trust_passwd) : False;
/* change the machine password? */
if (global_machine_password_needs_changing)
{
unsigned char new_trust_passwd[16];
generate_random_buffer(new_trust_passwd, 16, True);
- res = res ? cli_nt_srv_pwset(smb_cli, new_trust_passwd) : False;
+ res = res ? cli_nt_srv_pwset(smb_cli, nt_pipe_fnum, new_trust_passwd) : False;
if (res)
{
@@ -111,7 +112,7 @@ void cmd_netlogon_login_test(struct client_info *info)
memset(trust_passwd, 0, 16);
/* do an NT login */
- res = res ? cli_nt_login_interactive(smb_cli,
+ res = res ? cli_nt_login_interactive(smb_cli, nt_pipe_fnum,
smb_cli->domain, nt_user_name,
getuid(), nt_password,
&info->dom.ctr, &info->dom.user_info3) : False;
@@ -122,10 +123,10 @@ void cmd_netlogon_login_test(struct client_info *info)
/* ok! you're logged in! do anything you like, then... */
/* do an NT logout */
- res = res ? cli_nt_logoff(smb_cli, &info->dom.ctr) : False;
+ res = res ? cli_nt_logoff(smb_cli, nt_pipe_fnum, &info->dom.ctr) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
fprintf(out_hnd,"cmd_nt_login: login (%s) test succeeded: %s\n",
nt_user_name, BOOLSTR(res));
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c
index 53936a3cf3..f6a8a0a898 100644
--- a/source3/rpcclient/cmd_reg.c
+++ b/source3/rpcclient/cmd_reg.c
@@ -60,6 +60,7 @@ nt registry enum
****************************************************************************/
void cmd_reg_enum(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res1 = True;
BOOL res2 = True;
@@ -99,16 +100,16 @@ void cmd_reg_enum(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
+ res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
&info->dom.reg_pol_connect) : False;
if ((*key_name) != 0)
{
/* open an entry */
- res1 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res1 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &key_pol) : False;
}
else
@@ -116,7 +117,7 @@ void cmd_reg_enum(struct client_info *info)
memcpy(&key_pol, &info->dom.reg_pol_connect, sizeof(key_pol));
}
- res1 = res1 ? do_reg_query_key(smb_cli,
+ res1 = res1 ? do_reg_query_key(smb_cli, fnum,
&key_pol,
key_class, &max_class_len,
&num_subkeys, &max_subkeylen, &max_subkeysize,
@@ -141,7 +142,7 @@ void cmd_reg_enum(struct client_info *info)
time_t key_mod_time;
/* unknown 1a it */
- res2 = res1 ? do_reg_unknown_1a(smb_cli, &key_pol,
+ res2 = res1 ? do_reg_unknown_1a(smb_cli, fnum, &key_pol,
&unk_1a_response) : False;
if (res2 && unk_1a_response != 5)
@@ -150,7 +151,7 @@ void cmd_reg_enum(struct client_info *info)
}
/* enum key */
- res2 = res2 ? do_reg_enum_key(smb_cli, &key_pol,
+ res2 = res2 ? do_reg_enum_key(smb_cli, fnum, &key_pol,
i, enum_name,
&enum_unk1, &enum_unk2,
&key_mod_time) : False;
@@ -181,7 +182,7 @@ void cmd_reg_enum(struct client_info *info)
fstring val_name;
/* unknown 1a it */
- res2 = res1 ? do_reg_unknown_1a(smb_cli, &key_pol,
+ res2 = res1 ? do_reg_unknown_1a(smb_cli, fnum, &key_pol,
&unk_1a_response) : False;
if (res2 && unk_1a_response != 5)
@@ -190,7 +191,7 @@ void cmd_reg_enum(struct client_info *info)
}
/* enum key */
- res2 = res2 ? do_reg_enum_val(smb_cli, &key_pol,
+ res2 = res2 ? do_reg_enum_val(smb_cli, fnum, &key_pol,
i, max_valnamelen, max_valbufsize,
val_name, &val_type, &value) : False;
@@ -205,12 +206,12 @@ void cmd_reg_enum(struct client_info *info)
/* close the handles */
if ((*key_name) != 0)
{
- res1 = res1 ? do_reg_close(smb_cli, &key_pol) : False;
+ res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
}
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1 && res2)
{
@@ -227,6 +228,7 @@ nt registry query key
****************************************************************************/
void cmd_reg_query_key(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res1 = True;
@@ -258,16 +260,16 @@ void cmd_reg_query_key(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
+ res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
&info->dom.reg_pol_connect) : False;
if ((*key_name) != 0)
{
/* open an entry */
- res1 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res1 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &key_pol) : False;
}
else
@@ -275,7 +277,7 @@ void cmd_reg_query_key(struct client_info *info)
memcpy(&key_pol, &info->dom.reg_pol_connect, sizeof(key_pol));
}
- res1 = res1 ? do_reg_query_key(smb_cli,
+ res1 = res1 ? do_reg_query_key(smb_cli, fnum,
&key_pol,
key_class, &key_class_len,
&num_subkeys, &max_subkeylen, &max_subkeysize,
@@ -284,7 +286,7 @@ void cmd_reg_query_key(struct client_info *info)
if (res1 && key_class_len != 0)
{
- res1 = res1 ? do_reg_query_key(smb_cli,
+ res1 = res1 ? do_reg_query_key(smb_cli, fnum,
&key_pol,
key_class, &key_class_len,
&num_subkeys, &max_subkeylen, &max_subkeysize,
@@ -305,12 +307,12 @@ void cmd_reg_query_key(struct client_info *info)
/* close the handles */
if ((*key_name) != 0)
{
- res1 = res1 ? do_reg_close(smb_cli, &key_pol) : False;
+ res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
}
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1)
{
@@ -327,6 +329,7 @@ nt registry create value
****************************************************************************/
void cmd_reg_create_val(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
@@ -344,7 +347,7 @@ void cmd_reg_create_val(struct client_info *info)
uint32 unk_0;
uint32 unk_1;
/* query it */
- res1 = res1 ? do_reg_query_info(smb_cli, &val_pol,
+ res1 = res1 ? do_reg_query_info(smb_cli, fnum, &val_pol,
type, &unk_0, &unk_1) : False;
#endif
@@ -421,16 +424,16 @@ void cmd_reg_create_val(struct client_info *info)
dump_data(10, (char *)value.buffer, value.buf_len);
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, keyname, parent_name,
+ res = res ? do_reg_connect(smb_cli, fnum, keyname, parent_name,
&info->dom.reg_pol_connect) : False;
if ((*val_name) != 0)
{
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
parent_name, 0x02000000, &parent_pol) : False;
}
else
@@ -439,23 +442,23 @@ void cmd_reg_create_val(struct client_info *info)
}
/* create an entry */
- res4 = res3 ? do_reg_create_val(smb_cli, &parent_pol,
+ res4 = res3 ? do_reg_create_val(smb_cli, fnum, &parent_pol,
val_name, val_type, &value) : False;
/* flush the modified key */
- res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False;
+ res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
/* close the val handle */
if ((*val_name) != 0)
{
- res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False;
+ res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
}
/* close the registry handles */
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res3 && res4)
{
@@ -473,6 +476,7 @@ nt registry delete value
****************************************************************************/
void cmd_reg_delete_val(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
@@ -500,16 +504,16 @@ void cmd_reg_delete_val(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, keyname, parent_name,
+ res = res ? do_reg_connect(smb_cli, fnum, keyname, parent_name,
&info->dom.reg_pol_connect) : False;
if ((*val_name) != 0)
{
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
parent_name, 0x02000000, &parent_pol) : False;
}
else
@@ -518,19 +522,19 @@ void cmd_reg_delete_val(struct client_info *info)
}
/* delete an entry */
- res4 = res3 ? do_reg_delete_val(smb_cli, &parent_pol, val_name) : False;
+ res4 = res3 ? do_reg_delete_val(smb_cli, fnum, &parent_pol, val_name) : False;
/* flush the modified key */
- res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False;
+ res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
/* close the key handle */
- res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False;
+ res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
/* close the registry handles */
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res3 && res4)
{
@@ -548,6 +552,7 @@ nt registry delete key
****************************************************************************/
void cmd_reg_delete_key(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
@@ -575,16 +580,16 @@ void cmd_reg_delete_key(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, parent_name, key_name,
+ res = res ? do_reg_connect(smb_cli, fnum, parent_name, key_name,
&info->dom.reg_pol_connect) : False;
if ((*key_name) != 0)
{
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &parent_pol) : False;
}
else
@@ -593,22 +598,22 @@ void cmd_reg_delete_key(struct client_info *info)
}
/* create an entry */
- res4 = res3 ? do_reg_delete_key(smb_cli, &parent_pol, subkey_name) : False;
+ res4 = res3 ? do_reg_delete_key(smb_cli, fnum, &parent_pol, subkey_name) : False;
/* flush the modified key */
- res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False;
+ res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
/* close the key handle */
if ((*key_name) != 0)
{
- res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False;
+ res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
}
/* close the registry handles */
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res3 && res4)
{
@@ -626,6 +631,7 @@ nt registry create key
****************************************************************************/
void cmd_reg_create_key(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
@@ -664,16 +670,16 @@ void cmd_reg_create_key(struct client_info *info)
sam_access.mask = SEC_RIGHTS_READ;
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, parent_key, parent_name,
+ res = res ? do_reg_connect(smb_cli, fnum, parent_key, parent_name,
&info->dom.reg_pol_connect) : False;
if ((*parent_name) != 0)
{
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
parent_name, 0x02000000, &parent_pol) : False;
}
else
@@ -682,26 +688,26 @@ void cmd_reg_create_key(struct client_info *info)
}
/* create an entry */
- res4 = res3 ? do_reg_create_key(smb_cli, &parent_pol,
+ res4 = res3 ? do_reg_create_key(smb_cli, fnum, &parent_pol,
key_name, key_class, &sam_access, &key_pol) : False;
/* flush the modified key */
- res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False;
+ res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False;
/* close the key handle */
- res4 = res4 ? do_reg_close(smb_cli, &key_pol) : False;
+ res4 = res4 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
/* close the key handle */
if ((*parent_name) != 0)
{
- res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False;
+ res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False;
}
/* close the registry handles */
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res3 && res4)
{
@@ -719,6 +725,7 @@ nt registry security info
****************************************************************************/
void cmd_reg_test_key_sec(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
@@ -743,16 +750,16 @@ void cmd_reg_test_key_sec(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
+ res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
&info->dom.reg_pol_connect) : False;
if ((*key_name) != 0)
{
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &key_pol) : False;
}
else
@@ -761,14 +768,14 @@ void cmd_reg_test_key_sec(struct client_info *info)
}
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &key_pol) : False;
/* query key sec info. first call sets sec_buf_size. */
sec_buf_size = 0;
ZERO_STRUCT(sec_buf);
- res4 = res3 ? do_reg_get_key_sec(smb_cli, &key_pol,
+ res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
&sec_buf_size, &sec_buf) : False;
if (res4)
@@ -776,7 +783,7 @@ void cmd_reg_test_key_sec(struct client_info *info)
free_sec_desc_buf(&sec_buf);
}
- res4 = res4 ? do_reg_get_key_sec(smb_cli, &key_pol,
+ res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
&sec_buf_size, &sec_buf) : False;
if (res4 && sec_buf.len > 0 && sec_buf.sec != NULL)
@@ -785,7 +792,7 @@ void cmd_reg_test_key_sec(struct client_info *info)
display_sec_desc(out_hnd, ACTION_ENUMERATE, sec_buf.sec);
display_sec_desc(out_hnd, ACTION_FOOTER , sec_buf.sec);
- res4 = res4 ? do_reg_set_key_sec(smb_cli, &key_pol,
+ res4 = res4 ? do_reg_set_key_sec(smb_cli, fnum, &key_pol,
sec_buf_size, sec_buf.sec) : False;
free_sec_desc_buf(&sec_buf);
@@ -794,14 +801,14 @@ void cmd_reg_test_key_sec(struct client_info *info)
/* close the key handle */
if ((*key_name) != 0)
{
- res3 = res3 ? do_reg_close(smb_cli, &key_pol) : False;
+ res3 = res3 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
}
/* close the registry handles */
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res3 && res4)
{
@@ -819,6 +826,7 @@ nt registry security info
****************************************************************************/
void cmd_reg_get_key_sec(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
@@ -843,16 +851,16 @@ void cmd_reg_get_key_sec(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False;
/* open registry receive a policy handle */
- res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
+ res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name,
&info->dom.reg_pol_connect) : False;
if ((*key_name) != 0)
{
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &key_pol) : False;
}
else
@@ -861,14 +869,14 @@ void cmd_reg_get_key_sec(struct client_info *info)
}
/* open an entry */
- res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect,
+ res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect,
key_name, 0x02000000, &key_pol) : False;
/* query key sec info. first call sets sec_buf_size. */
sec_buf_size = 0;
ZERO_STRUCT(sec_buf);
- res4 = res3 ? do_reg_get_key_sec(smb_cli, &key_pol,
+ res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
&sec_buf_size, &sec_buf) : False;
if (res4)
@@ -876,7 +884,7 @@ void cmd_reg_get_key_sec(struct client_info *info)
free_sec_desc_buf(&sec_buf);
}
- res4 = res4 ? do_reg_get_key_sec(smb_cli, &key_pol,
+ res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol,
&sec_buf_size, &sec_buf) : False;
if (res4 && sec_buf.len > 0 && sec_buf.sec != NULL)
@@ -891,14 +899,14 @@ void cmd_reg_get_key_sec(struct client_info *info)
/* close the key handle */
if ((*key_name) != 0)
{
- res3 = res3 ? do_reg_close(smb_cli, &key_pol) : False;
+ res3 = res3 ? do_reg_close(smb_cli, fnum, &key_pol) : False;
}
/* close the registry handles */
- res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False;
+ res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res3 && res4)
{
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index fb2accfc4d..31f74906db 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -43,6 +43,7 @@ SAM password change
****************************************************************************/
void cmd_sam_ntchange_pwd(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -91,18 +92,18 @@ void cmd_sam_ntchange_pwd(struct client_info *info)
NTLMSSP_NEGOTIATE_00002000);
/* open SAMR session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_unknown_38(smb_cli, srv_name) : False;
+ res = res ? samr_unknown_38(smb_cli, fnum, srv_name) : False;
/* establish a connection. */
- res = res ? samr_chgpasswd_user(smb_cli,
+ res = res ? samr_chgpasswd_user(smb_cli, fnum,
srv_name, smb_cli->user_name,
nt_newpass, nt_hshhash,
lm_newpass, lm_hshhash) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res)
{
@@ -120,6 +121,7 @@ experimental SAM encryted rpc test connection
****************************************************************************/
void cmd_sam_test(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -153,13 +155,13 @@ void cmd_sam_test(struct client_info *info)
NTLMSSP_NEGOTIATE_00002000);
/* open SAMR session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_unknown_38(smb_cli, srv_name) : False;
+ res = res ? samr_unknown_38(smb_cli, fnum, srv_name) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res)
{
@@ -176,6 +178,7 @@ SAM delete alias member.
****************************************************************************/
void cmd_sam_del_aliasmem(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring tmp;
@@ -213,20 +216,20 @@ void cmd_sam_del_aliasmem(struct client_info *info)
fprintf(out_hnd, "SAM Domain Alias Member\n");
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* connect to the domain */
- res1 = res ? samr_open_alias(smb_cli,
+ res1 = res ? samr_open_alias(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x000f001f, alias_rid, &alias_pol) : False;
@@ -234,7 +237,7 @@ void cmd_sam_del_aliasmem(struct client_info *info)
{
/* get a sid, delete a member from the alias */
res2 = res2 ? string_to_sid(&member_sid, tmp) : False;
- res2 = res2 ? samr_del_aliasmem(smb_cli, &alias_pol, &member_sid) : False;
+ res2 = res2 ? samr_del_aliasmem(smb_cli, fnum, &alias_pol, &member_sid) : False;
if (res2)
{
@@ -242,12 +245,12 @@ void cmd_sam_del_aliasmem(struct client_info *info)
}
}
- res1 = res1 ? samr_close(smb_cli, &alias_pol) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
+ res1 = res1 ? samr_close(smb_cli, fnum, &alias_pol) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1 && res2)
{
@@ -266,6 +269,7 @@ SAM delete alias.
****************************************************************************/
void cmd_sam_delete_dom_alias(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring name;
@@ -305,21 +309,21 @@ void cmd_sam_delete_dom_alias(struct client_info *info)
fprintf(out_hnd, "SAM Delete Domain Alias\n");
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
names[0] = name;
- res1 = res ? samr_query_lookup_names(smb_cli,
+ res1 = res ? samr_query_lookup_names(smb_cli, fnum,
&info->dom.samr_pol_open_domain, 0x000003e8,
1, names,
&num_rids, rid, type) : False;
@@ -330,18 +334,18 @@ void cmd_sam_delete_dom_alias(struct client_info *info)
}
/* connect to the domain */
- res1 = res1 ? samr_open_alias(smb_cli,
+ res1 = res1 ? samr_open_alias(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x000f001f, alias_rid, &alias_pol) : False;
- res2 = res1 ? samr_delete_dom_alias(smb_cli, &alias_pol) : False;
+ res2 = res1 ? samr_delete_dom_alias(smb_cli, fnum, &alias_pol) : False;
- res1 = res1 ? samr_close(smb_cli, &alias_pol) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
+ res1 = res1 ? samr_close(smb_cli, fnum, &alias_pol) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1 && res2)
{
@@ -361,6 +365,8 @@ SAM add alias member.
****************************************************************************/
void cmd_sam_add_aliasmem(struct client_info *info)
{
+ uint16 fnum;
+ uint16 fnum_lsa;
fstring srv_name;
fstring domain;
fstring tmp;
@@ -415,22 +421,22 @@ void cmd_sam_add_aliasmem(struct client_info *info)
fprintf(out_hnd, "SAM Domain Alias Member\n");
/* open LSARPC session. */
- res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False;
+ res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &fnum_lsa) : False;
/* lookup domain controller; receive a policy handle */
- res3 = res3 ? lsa_open_policy(smb_cli,
+ res3 = res3 ? lsa_open_policy(smb_cli, fnum,
srv_name,
&info->dom.lsa_info_pol, True) : False;
/* send lsa lookup sids call */
- res4 = res3 ? lsa_lookup_names(smb_cli,
+ res4 = res3 ? lsa_lookup_names(smb_cli, fnum,
&info->dom.lsa_info_pol,
num_names, names,
&sids, &num_sids) : False;
- res3 = res3 ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False;
+ res3 = res3 ? lsa_close(smb_cli, fnum, &info->dom.lsa_info_pol) : False;
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum_lsa);
res4 = num_sids < 2 ? False : res4;
@@ -455,27 +461,27 @@ void cmd_sam_add_aliasmem(struct client_info *info)
}
/* open SAMR session. negotiate credentials */
- res = res4 ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res4 ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* connect to the domain */
- res1 = res ? samr_open_alias(smb_cli,
+ res1 = res ? samr_open_alias(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x000f001f, alias_rid, &alias_pol) : False;
for (i = 1; i < num_sids && res2 && res1; i++)
{
/* add a member to the alias */
- res2 = res2 ? samr_add_aliasmem(smb_cli, &alias_pol, &sids[i]) : False;
+ res2 = res2 ? samr_add_aliasmem(smb_cli, fnum, &alias_pol, &sids[i]) : False;
if (res2)
{
@@ -484,12 +490,12 @@ void cmd_sam_add_aliasmem(struct client_info *info)
}
}
- res1 = res1 ? samr_close(smb_cli, &alias_pol) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
+ res1 = res1 ? samr_close(smb_cli, fnum, &alias_pol) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (sids != NULL)
{
@@ -526,6 +532,7 @@ SAM create domain alias.
****************************************************************************/
void cmd_sam_create_dom_alias(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring acct_name;
@@ -568,31 +575,31 @@ void cmd_sam_create_dom_alias(struct client_info *info)
domain, acct_name, acct_desc);
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* create a domain alias */
- res1 = res ? create_samr_domain_alias(smb_cli,
+ res1 = res ? create_samr_domain_alias(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
acct_name, acct_desc, &alias_rid) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1)
{
@@ -612,6 +619,7 @@ SAM delete group member.
****************************************************************************/
void cmd_sam_del_groupmem(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring tmp;
@@ -649,20 +657,20 @@ void cmd_sam_del_groupmem(struct client_info *info)
fprintf(out_hnd, "SAM Add Domain Group member\n");
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* connect to the domain */
- res1 = res ? samr_open_group(smb_cli,
+ res1 = res ? samr_open_group(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x0000001f, group_rid, &group_pol) : False;
@@ -670,7 +678,7 @@ void cmd_sam_del_groupmem(struct client_info *info)
{
/* get a rid, delete a member from the group */
member_rid = get_number(tmp);
- res2 = res2 ? samr_del_groupmem(smb_cli, &group_pol, member_rid) : False;
+ res2 = res2 ? samr_del_groupmem(smb_cli, fnum, &group_pol, member_rid) : False;
if (res2)
{
@@ -678,12 +686,12 @@ void cmd_sam_del_groupmem(struct client_info *info)
}
}
- res1 = res1 ? samr_close(smb_cli, &group_pol) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
+ res1 = res1 ? samr_close(smb_cli, fnum, &group_pol) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1 && res2)
{
@@ -703,6 +711,7 @@ SAM delete group.
****************************************************************************/
void cmd_sam_delete_dom_group(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring name;
@@ -742,21 +751,21 @@ void cmd_sam_delete_dom_group(struct client_info *info)
fprintf(out_hnd, "SAM Delete Domain Group\n");
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
names[0] = name;
- res1 = res ? samr_query_lookup_names(smb_cli,
+ res1 = res ? samr_query_lookup_names(smb_cli, fnum,
&info->dom.samr_pol_open_domain, 0x000003e8,
1, names,
&num_rids, rid, type) : False;
@@ -767,18 +776,18 @@ void cmd_sam_delete_dom_group(struct client_info *info)
}
/* connect to the domain */
- res1 = res1 ? samr_open_group(smb_cli,
+ res1 = res1 ? samr_open_group(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x0000001f, group_rid, &group_pol) : False;
- res2 = res1 ? samr_delete_dom_group(smb_cli, &group_pol) : False;
+ res2 = res1 ? samr_delete_dom_group(smb_cli, fnum, &group_pol) : False;
- res1 = res1 ? samr_close(smb_cli, &group_pol) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
+ res1 = res1 ? samr_close(smb_cli, fnum, &group_pol) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1 && res2)
{
@@ -798,6 +807,7 @@ SAM add group member.
****************************************************************************/
void cmd_sam_add_groupmem(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring tmp;
@@ -851,19 +861,19 @@ void cmd_sam_add_groupmem(struct client_info *info)
fprintf(out_hnd, "SAM Add Domain Group member\n");
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
- res1 = res ? samr_query_lookup_names(smb_cli,
+ res1 = res ? samr_query_lookup_names(smb_cli, fnum,
&info->dom.samr_pol_open_domain, 0x000003e8,
num_names, names,
&num_rids, rid, type) : False;
@@ -874,13 +884,13 @@ void cmd_sam_add_groupmem(struct client_info *info)
}
/* connect to the domain */
- res1 = res1 ? samr_open_group(smb_cli,
+ res1 = res1 ? samr_open_group(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x0000001f, group_rid, &group_pol) : False;
for (i = 1; i < num_rids && res2 && res1; i++)
{
- res2 = res2 ? samr_add_groupmem(smb_cli, &group_pol, rid[i]) : False;
+ res2 = res2 ? samr_add_groupmem(smb_cli, fnum, &group_pol, rid[i]) : False;
if (res2)
{
@@ -888,12 +898,12 @@ void cmd_sam_add_groupmem(struct client_info *info)
}
}
- res1 = res1 ? samr_close(smb_cli, &group_pol) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
+ res1 = res1 ? samr_close(smb_cli, fnum, &group_pol) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (names != NULL)
{
@@ -925,6 +935,7 @@ SAM create domain group.
****************************************************************************/
void cmd_sam_create_dom_group(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring acct_name;
@@ -967,31 +978,31 @@ void cmd_sam_create_dom_group(struct client_info *info)
domain, acct_name, acct_desc);
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* read some users */
- res1 = res ? create_samr_domain_group(smb_cli,
+ res1 = res ? create_samr_domain_group(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
acct_name, acct_desc, &group_rid) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res && res1)
{
@@ -1011,6 +1022,7 @@ experimental SAM users enum.
****************************************************************************/
void cmd_sam_enum_users(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -1094,27 +1106,27 @@ void cmd_sam_enum_users(struct client_info *info)
#endif
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* connect to the S-1-5-20 domain */
- res1 = res ? samr_open_domain(smb_cli,
+ res1 = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid_1_5_20,
&info->dom.samr_pol_open_builtindom) : False;
info->dom.sam = NULL;
/* read some users */
- res = res ? samr_enum_dom_users(smb_cli,
+ res = res ? samr_enum_dom_users(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
num_entries, unk_0, acb_mask, unk_1, 0xffff,
&info->dom.sam, &info->dom.num_sam_entries) : False;
@@ -1137,7 +1149,7 @@ void cmd_sam_enum_users(struct client_info *info)
if (request_user_info)
{
/* send user info query, level 0x15 */
- if (get_samr_query_userinfo(smb_cli,
+ if (get_samr_query_userinfo(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0x15, user_rid, &usr))
{
@@ -1153,7 +1165,7 @@ void cmd_sam_enum_users(struct client_info *info)
DOM_GID gid[LSA_MAX_GROUPS];
/* send user group query */
- if (get_samr_query_usergroups(smb_cli,
+ if (get_samr_query_usergroups(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
user_rid, &num_groups, gid))
{
@@ -1167,7 +1179,7 @@ void cmd_sam_enum_users(struct client_info *info)
rid_mem[i] = gid[i].g_rid;
}
- if (samr_query_lookup_rids(smb_cli,
+ if (samr_query_lookup_rids(smb_cli, fnum,
&info->dom.samr_pol_open_domain, 0x3e8,
num_groups, rid_mem,
&num_names, name, type))
@@ -1189,7 +1201,7 @@ void cmd_sam_enum_users(struct client_info *info)
sid_append_rid(&als_sid, user_rid);
/* send user alias query */
- if (samr_query_useraliases(smb_cli,
+ if (samr_query_useraliases(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
&als_sid, &num_aliases, rid))
{
@@ -1197,7 +1209,7 @@ void cmd_sam_enum_users(struct client_info *info)
fstring name [MAX_LOOKUP_SIDS];
uint32 type [MAX_LOOKUP_SIDS];
- if (samr_query_lookup_rids(smb_cli,
+ if (samr_query_lookup_rids(smb_cli, fnum,
&info->dom.samr_pol_open_domain, 0x3e8,
num_aliases, rid,
&num_names, name, type))
@@ -1209,7 +1221,7 @@ void cmd_sam_enum_users(struct client_info *info)
}
/* send user alias query */
- if (res1 && samr_query_useraliases(smb_cli,
+ if (res1 && samr_query_useraliases(smb_cli, fnum,
&info->dom.samr_pol_open_builtindom,
&als_sid, &num_aliases, rid))
{
@@ -1217,7 +1229,7 @@ void cmd_sam_enum_users(struct client_info *info)
fstring name [MAX_LOOKUP_SIDS];
uint32 type [MAX_LOOKUP_SIDS];
- if (samr_query_lookup_rids(smb_cli,
+ if (samr_query_lookup_rids(smb_cli, fnum,
&info->dom.samr_pol_open_builtindom, 0x3e8,
num_aliases, rid,
&num_names, name, type))
@@ -1230,17 +1242,17 @@ void cmd_sam_enum_users(struct client_info *info)
}
}
- res1 = res1 ? samr_close(smb_cli,
+ res1 = res1 ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_builtindom) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_connect) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (info->dom.sam != NULL)
{
@@ -1263,6 +1275,7 @@ experimental SAM user query.
****************************************************************************/
void cmd_sam_query_user(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -1305,15 +1318,15 @@ void cmd_sam_query_user(struct client_info *info)
info->myhostname, srv_name, domain, sid);
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
@@ -1322,7 +1335,7 @@ void cmd_sam_query_user(struct client_info *info)
info->dom.sam[user_idx].acct_name);
/* send user info query, level */
- if (get_samr_query_userinfo(smb_cli,
+ if (get_samr_query_userinfo(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
info_level, user_rid, &usr))
{
@@ -1334,14 +1347,14 @@ void cmd_sam_query_user(struct client_info *info)
}
}
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_connect) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res)
{
@@ -1359,6 +1372,7 @@ experimental SAM domain info query.
****************************************************************************/
void cmd_sam_query_dominfo(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -1393,30 +1407,30 @@ void cmd_sam_query_dominfo(struct client_info *info)
info->myhostname, srv_name, domain, sid);
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
/* send a samr 0x8 command */
- res = res ? samr_query_dom_info(smb_cli,
+ res = res ? samr_query_dom_info(smb_cli, fnum,
&info->dom.samr_pol_open_domain, switch_value) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_connect) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (res)
{
@@ -1434,6 +1448,7 @@ experimental SAM aliases query.
****************************************************************************/
void cmd_sam_enum_aliases(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -1472,22 +1487,22 @@ void cmd_sam_enum_aliases(struct client_info *info)
info->myhostname, srv_name, domain, sid);
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
info->dom.sam = NULL;
/* read some aliases */
- res = res ? samr_enum_dom_aliases(smb_cli,
+ res = res ? samr_enum_dom_aliases(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0xffff,
&info->dom.sam, &info->dom.num_sam_entries) : False;
@@ -1512,10 +1527,11 @@ void cmd_sam_enum_aliases(struct client_info *info)
DOM_SID2 sid_mem[MAX_LOOKUP_SIDS];
/* send user aliases query */
- if (get_samr_query_aliasmem(smb_cli,
+ if (get_samr_query_aliasmem(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
alias_rid, &num_aliases, sid_mem))
{
+ uint16 fnum_lsa;
BOOL res3 = True;
BOOL res4 = True;
char **names = NULL;
@@ -1523,8 +1539,6 @@ void cmd_sam_enum_aliases(struct client_info *info)
DOM_SID **sids = NULL;
int i;
- uint16 old_fnum = smb_cli->nt_pipe_fnum;
-
if (num_aliases != 0)
{
sids = malloc(num_aliases * sizeof(DOM_SID*));
@@ -1540,24 +1554,22 @@ void cmd_sam_enum_aliases(struct client_info *info)
}
/* open LSARPC session. */
- res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False;
+ res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &fnum_lsa) : False;
/* lookup domain controller; receive a policy handle */
- res3 = res3 ? lsa_open_policy(smb_cli,
+ res3 = res3 ? lsa_open_policy(smb_cli, fnum,
srv_name,
&info->dom.lsa_info_pol, True) : False;
/* send lsa lookup sids call */
- res4 = res3 ? lsa_lookup_sids(smb_cli,
+ res4 = res3 ? lsa_lookup_sids(smb_cli, fnum,
&info->dom.lsa_info_pol,
num_aliases, sids,
&names, &num_names) : False;
- res3 = res3 ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False;
-
- cli_nt_session_close(smb_cli);
+ res3 = res3 ? lsa_close(smb_cli, fnum, &info->dom.lsa_info_pol) : False;
- smb_cli->nt_pipe_fnum = old_fnum;
+ cli_nt_session_close(smb_cli, fnum_lsa);
if (res4 && names != NULL)
{
@@ -1584,14 +1596,14 @@ void cmd_sam_enum_aliases(struct client_info *info)
}
}
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_connect) : False;
- res = res ? samr_close(smb_cli,
+ res = res ? samr_close(smb_cli, fnum,
&info->dom.samr_pol_open_domain) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (info->dom.sam != NULL)
{
@@ -1614,6 +1626,7 @@ experimental SAM groups query.
****************************************************************************/
void cmd_sam_enum_groups(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -1652,22 +1665,22 @@ void cmd_sam_enum_groups(struct client_info *info)
info->myhostname, srv_name, domain, sid);
/* open SAMR session. negotiate credentials */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
/* establish a connection. */
- res = res ? samr_connect(smb_cli,
+ res = res ? samr_connect(smb_cli, fnum,
srv_name, 0x00000020,
&info->dom.samr_pol_connect) : False;
/* connect to the domain */
- res = res ? samr_open_domain(smb_cli,
+ res = res ? samr_open_domain(smb_cli, fnum,
&info->dom.samr_pol_connect, flags, &sid1,
&info->dom.samr_pol_open_domain) : False;
info->dom.sam = NULL;
/* read some groups */
- res = res ? samr_enum_dom_groups(smb_cli,
+ res = res ? samr_enum_dom_groups(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
0xffff,
&info->dom.sam, &info->dom.num_sam_entries) : False;
@@ -1697,11 +1710,11 @@ void cmd_sam_enum_groups(struct client_info *info)
uint32 type[MAX_LOOKUP_SIDS];
/* send user groups query */
- if (get_samr_query_groupmem(smb_cli,
+ if (get_samr_query_groupmem(smb_cli, fnum,
&info->dom.samr_pol_open_domain,
group_rid, &num_groups,
rid_mem, attr_mem) &&
- samr_query_lookup_rids(smb_cli,
+ samr_query_lookup_rids(smb_cli, fnum,
&info->dom.samr_pol_open_domain, 0x3e8,
num_groups, rid_mem,
&num_names, name, type))
@@ -1713,11 +1726,11 @@ void cmd_sam_enum_groups(struct client_info *info)
}
}
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False;
- res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False;
+ res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, fnum);
if (info->dom.sam != NULL)
{
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index f385cecb68..1be35608ee 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -43,6 +43,7 @@ server get info query
****************************************************************************/
void cmd_srv_query_info(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_INFO_CTR ctr;
@@ -67,14 +68,14 @@ void cmd_srv_query_info(struct client_info *info)
DEBUG(5, ("cmd_srv_query_info: smb_cli->fd:%d\n", smb_cli->fd));
/* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
/* send info level: receive requested info. hopefully. */
- res = res ? do_srv_net_srv_get_info(smb_cli,
+ res = res ? do_srv_net_srv_get_info(smb_cli, nt_pipe_fnum,
dest_srv, info_level, &ctr) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
@@ -95,6 +96,7 @@ server enum connections
****************************************************************************/
void cmd_srv_enum_conn(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring qual_srv;
fstring tmp;
@@ -125,13 +127,13 @@ void cmd_srv_enum_conn(struct client_info *info)
DEBUG(5, ("cmd_srv_enum_conn: smb_cli->fd:%d\n", smb_cli->fd));
/* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
hnd.ptr_hnd = 1;
hnd.handle = 0;
/* enumerate connections on server */
- res = res ? do_srv_net_srv_conn_enum(smb_cli,
+ res = res ? do_srv_net_srv_conn_enum(smb_cli, nt_pipe_fnum,
dest_srv, qual_srv,
info_level, &ctr, 0xffffffff, &hnd) : False;
@@ -143,7 +145,7 @@ void cmd_srv_enum_conn(struct client_info *info)
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
@@ -160,6 +162,7 @@ server enum shares
****************************************************************************/
void cmd_srv_enum_shares(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_SHARE_INFO_CTR ctr;
@@ -185,13 +188,13 @@ void cmd_srv_enum_shares(struct client_info *info)
DEBUG(5, ("cmd_srv_enum_shares: smb_cli->fd:%d\n", smb_cli->fd));
/* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
hnd.ptr_hnd = 0;
hnd.handle = 0;
/* enumerate shares_files on server */
- res = res ? do_srv_net_srv_share_enum(smb_cli,
+ res = res ? do_srv_net_srv_share_enum(smb_cli, nt_pipe_fnum,
dest_srv,
info_level, &ctr, 0xffffffff, &hnd) : False;
@@ -203,7 +206,7 @@ void cmd_srv_enum_shares(struct client_info *info)
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
@@ -220,6 +223,7 @@ server enum sessions
****************************************************************************/
void cmd_srv_enum_sess(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_SESS_INFO_CTR ctr;
@@ -245,17 +249,17 @@ void cmd_srv_enum_sess(struct client_info *info)
DEBUG(5, ("cmd_srv_enum_sess: smb_cli->fd:%d\n", smb_cli->fd));
/* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
hnd.ptr_hnd = 1;
hnd.handle = 0;
/* enumerate sessions on server */
- res = res ? do_srv_net_srv_sess_enum(smb_cli,
+ res = res ? do_srv_net_srv_sess_enum(smb_cli, nt_pipe_fnum,
dest_srv, NULL, info_level, &ctr, 0x1000, &hnd) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
@@ -272,6 +276,7 @@ server enum files
****************************************************************************/
void cmd_srv_enum_files(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_FILE_INFO_CTR ctr;
@@ -297,13 +302,13 @@ void cmd_srv_enum_files(struct client_info *info)
DEBUG(5, ("cmd_srv_enum_files: smb_cli->fd:%d\n", smb_cli->fd));
/* open srvsvc session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False;
hnd.ptr_hnd = 1;
hnd.handle = 0;
/* enumerate files on server */
- res = res ? do_srv_net_srv_file_enum(smb_cli,
+ res = res ? do_srv_net_srv_file_enum(smb_cli, nt_pipe_fnum,
dest_srv, NULL, info_level, &ctr, 0x1000, &hnd) : False;
if (res)
@@ -314,7 +319,7 @@ void cmd_srv_enum_files(struct client_info *info)
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c
index ee1e9748a5..7915036609 100644
--- a/source3/rpcclient/cmd_wkssvc.c
+++ b/source3/rpcclient/cmd_wkssvc.c
@@ -43,6 +43,7 @@ workstation get info query
****************************************************************************/
void cmd_wks_query_info(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_wks;
fstring tmp;
WKS_INFO_100 ctr;
@@ -67,14 +68,14 @@ void cmd_wks_query_info(struct client_info *info)
DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd));
/* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC, &nt_pipe_fnum) : False;
/* send info level: receive requested info. hopefully. */
- res = res ? do_wks_query_info(smb_cli,
+ res = res ? do_wks_query_info(smb_cli, nt_pipe_fnum,
dest_wks, info_level, &ctr) : False;
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index f207bd507c..7bd4a5aae4 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -466,8 +466,6 @@ enum client_action
fstrcpy(cli_info.dom.level3_dom, "");
fstrcpy(cli_info.dom.level5_dom, "");
- smb_cli->nt_pipe_fnum = 0xffff;
-
TimeInit();
charset_initialise();