*/
uint32 nt_error; /* NT RPC error code. */
- uint16 nt_pipe_fnum; /* Pipe handle. */
unsigned char sess_key[16]; /* Current session key. */
unsigned char ntlmssp_hash[258]; /* ntlmssp data. */
uint32 ntlmssp_cli_flgs; /* ntlmssp client flags */
/*The following definitions come from rpc_client/cli_login.c */
-BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16]);
-BOOL cli_nt_srv_pwset(struct cli_state *cli, unsigned char *new_hashof_mach_pwd);
-BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *username,
+BOOL cli_nt_setup_creds(struct cli_state *cli, uint16 fnum, unsigned char mach_pwd[16]);
+BOOL cli_nt_srv_pwset(struct cli_state *cli, uint16 fnum, unsigned char *new_hashof_mach_pwd);
+BOOL cli_nt_login_interactive(struct cli_state *cli, uint16 fnum, char *domain, char *username,
uint32 luid_low, char *password,
NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3);
-BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username,
+BOOL cli_nt_login_network(struct cli_state *cli, uint16 fnum, char *domain, char *username,
uint32 luid_low, char lm_chal[8], char lm_chal_resp[24],
char nt_chal_resp[24],
NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3);
-BOOL cli_nt_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr);
+BOOL cli_nt_logoff(struct cli_state *cli, uint16 fnum, NET_ID_INFO_CTR *ctr);
/*The following definitions come from rpc_client/cli_lsarpc.c */
-BOOL lsa_open_policy(struct cli_state *cli,
+BOOL lsa_open_policy(struct cli_state *cli, uint16 fnum,
char *server_name, POLICY_HND *hnd,
BOOL sec_qos);
-BOOL lsa_lookup_names(struct cli_state *cli,
+BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd,
int num_names,
const char **names,
DOM_SID **sids,
int *num_sids);
-BOOL lsa_lookup_sids(struct cli_state *cli,
+BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd,
int num_sids,
DOM_SID **sids,
char ***names,
int *num_names);
-BOOL lsa_query_info_pol(struct cli_state *cli,
+BOOL lsa_query_info_pol(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd, uint16 info_class,
fstring domain_name, DOM_SID *domain_sid);
-BOOL lsa_close(struct cli_state *cli, POLICY_HND *hnd);
+BOOL lsa_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
/*The following definitions come from rpc_client/cli_netlogon.c */
-BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level);
-BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan,
+BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint16 nt_pipe_fnum, uint32 status_level);
+BOOL cli_net_auth2(struct cli_state *cli, uint16 nt_pipe_fnum, uint16 sec_chan,
uint32 neg_flags, DOM_CHAL *srv_chal);
-BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal);
-BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16]);
-BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
+BOOL cli_net_req_chal(struct cli_state *cli, uint16 nt_pipe_fnum, DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal);
+BOOL cli_net_srv_pwset(struct cli_state *cli, uint16 nt_pipe_fnum, uint8 hashed_mach_pwd[16]);
+BOOL cli_net_sam_logon(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr,
NET_USER_INFO_3 *user_info3);
-BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr);
+BOOL cli_net_sam_logoff(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr);
BOOL change_trust_account_password( char *domain, char *remote_machine_list);
/*The following definitions come from rpc_client/cli_pipe.c */
-BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num,
+BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 nt_pipe_fnum, uint8 op_num,
prs_struct *data, prs_struct *rdata);
void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs);
-BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name);
-void cli_nt_session_close(struct cli_state *cli);
+BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name, uint16* nt_pipe_fnum);
+void cli_nt_session_close(struct cli_state *cli, uint16 nt_pipe_fnum);
/*The following definitions come from rpc_client/cli_reg.c */
-BOOL do_reg_connect(struct cli_state *cli, char *full_keyname, char *key_name,
+BOOL do_reg_connect(struct cli_state *cli, uint16 fnum, char *full_keyname, char *key_name,
POLICY_HND *reg_hnd);
-BOOL do_reg_open_hklm(struct cli_state *cli, uint16 unknown_0, uint32 level,
+BOOL do_reg_open_hklm(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
POLICY_HND *hnd);
-BOOL do_reg_open_hku(struct cli_state *cli, uint16 unknown_0, uint32 level,
+BOOL do_reg_open_hku(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
POLICY_HND *hnd);
-BOOL do_reg_flush_key(struct cli_state *cli, POLICY_HND *hnd);
-BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_flush_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
+BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *class, uint32 *class_len,
uint32 *num_subkeys, uint32 *max_subkeylen,
uint32 *max_subkeysize, uint32 *num_values,
uint32 *max_valnamelen, uint32 *max_valbufsize,
uint32 *sec_desc, NTTIME *mod_time);
-BOOL do_reg_unknown_1a(struct cli_state *cli, POLICY_HND *hnd, uint32 *unk);
-BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_unknown_1a(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint32 *unk);
+BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *type, uint32 *unk_0, uint32 *unk_1);
-BOOL do_reg_set_key_sec(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
uint32 sec_buf_size, SEC_DESC *sec_buf);
-BOOL do_reg_get_key_sec(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf);
-BOOL do_reg_delete_val(struct cli_state *cli, POLICY_HND *hnd, char *val_name);
-BOOL do_reg_delete_key(struct cli_state *cli, POLICY_HND *hnd, char *key_name);
-BOOL do_reg_create_key(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_delete_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *val_name);
+BOOL do_reg_delete_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *key_name);
+BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *key_name, char *key_class,
SEC_ACCESS *sam_access,
POLICY_HND *key);
-BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_enum_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
int key_index, char *key_name,
uint32 *unk_1, uint32 *unk_2,
time_t *mod_time);
-BOOL do_reg_create_val(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_create_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *val_name, uint32 type, BUFFER3 *data);
-BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_enum_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
int val_index, int max_valnamelen, int max_valbufsize,
fstring val_name,
uint32 *val_type, BUFFER2 *value);
-BOOL do_reg_open_entry(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *key_name, uint32 unk_0,
POLICY_HND *key_hnd);
-BOOL do_reg_close(struct cli_state *cli, POLICY_HND *hnd);
+BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
/*The following definitions come from rpc_client/cli_samr.c */
-BOOL create_samr_domain_alias(struct cli_state *cli,
+BOOL create_samr_domain_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
const char *acct_name, const char *acct_desc,
uint32 *rid);
-BOOL create_samr_domain_group(struct cli_state *cli,
+BOOL create_samr_domain_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
const char *acct_name, const char *acct_desc,
uint32 *rid);
-BOOL get_samr_query_usergroups(struct cli_state *cli,
+BOOL get_samr_query_usergroups(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain, uint32 user_rid,
uint32 *num_groups, DOM_GID *gid);
-BOOL delete_samr_dom_group(struct cli_state *cli,
+BOOL delete_samr_dom_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 group_rid);
-BOOL get_samr_query_groupmem(struct cli_state *cli,
+BOOL get_samr_query_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 group_rid, uint32 *num_mem,
uint32 *rid, uint32 *attr);
-BOOL delete_samr_dom_alias(struct cli_state *cli,
+BOOL delete_samr_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 alias_rid);
-BOOL get_samr_query_aliasmem(struct cli_state *cli,
+BOOL get_samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 alias_rid, uint32 *num_mem, DOM_SID2 *sid);
-BOOL get_samr_query_userinfo(struct cli_state *cli,
+BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
uint32 user_rid, SAM_USER_INFO_21 *usr);
-BOOL get_samr_query_groupinfo(struct cli_state *cli,
+BOOL get_samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
uint32 group_rid, GROUP_INFO_CTR *ctr);
-BOOL samr_chgpasswd_user(struct cli_state *cli,
+BOOL samr_chgpasswd_user(struct cli_state *cli, uint16 fnum,
char *srv_name, char *user_name,
char nt_newpass[516], uchar nt_oldhash[16],
char lm_newpass[516], uchar lm_oldhash[16]);
-BOOL samr_unknown_38(struct cli_state *cli, char *srv_name);
-BOOL samr_query_dom_info(struct cli_state *cli,
+BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name);
+BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, uint16 switch_value);
-BOOL samr_enum_dom_groups(struct cli_state *cli,
+BOOL samr_enum_dom_groups(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 size,
struct acct_info **sam,
int *num_sam_groups);
-BOOL samr_enum_dom_aliases(struct cli_state *cli,
+BOOL samr_enum_dom_aliases(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 size,
struct acct_info **sam,
int *num_sam_aliases);
-BOOL samr_enum_dom_users(struct cli_state *cli,
+BOOL samr_enum_dom_users(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint16 num_entries, uint16 unk_0,
uint16 acb_mask, uint16 unk_1, uint32 size,
struct acct_info **sam,
int *num_sam_users);
-BOOL samr_connect(struct cli_state *cli,
+BOOL samr_connect(struct cli_state *cli, uint16 fnum,
char *srv_name, uint32 unknown_0,
POLICY_HND *connect_pol);
-BOOL samr_open_user(struct cli_state *cli,
+BOOL samr_open_user(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 unk_0, uint32 rid,
POLICY_HND *user_pol);
-BOOL samr_open_alias(struct cli_state *cli,
+BOOL samr_open_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol,
uint32 flags, uint32 rid,
POLICY_HND *alias_pol);
-BOOL samr_del_aliasmem(struct cli_state *cli,
+BOOL samr_del_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, DOM_SID *sid);
-BOOL samr_add_aliasmem(struct cli_state *cli,
+BOOL samr_add_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, DOM_SID *sid);
-BOOL samr_delete_dom_alias(struct cli_state *cli,
+BOOL samr_delete_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol);
-BOOL samr_create_dom_alias(struct cli_state *cli,
+BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *alias_pol, uint32 *rid);
-BOOL samr_set_aliasinfo(struct cli_state *cli,
+BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr);
-BOOL samr_open_group(struct cli_state *cli,
+BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol,
uint32 flags, uint32 rid,
POLICY_HND *group_pol);
-BOOL samr_del_groupmem(struct cli_state *cli,
+BOOL samr_del_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol, uint32 rid);
-BOOL samr_add_groupmem(struct cli_state *cli,
+BOOL samr_add_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol, uint32 rid);
-BOOL samr_delete_dom_group(struct cli_state *cli, POLICY_HND *group_pol);
-BOOL samr_create_dom_group(struct cli_state *cli,
+BOOL samr_delete_dom_group(struct cli_state *cli, uint16 fnum, POLICY_HND *group_pol);
+BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *group_pol, uint32 *rid);
-BOOL samr_set_groupinfo(struct cli_state *cli,
+BOOL samr_set_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol, GROUP_INFO_CTR *ctr);
-BOOL samr_open_domain(struct cli_state *cli,
+BOOL samr_open_domain(struct cli_state *cli, uint16 fnum,
POLICY_HND *connect_pol, uint32 flags, DOM_SID *sid,
POLICY_HND *domain_pol);
-BOOL samr_query_lookup_names(struct cli_state *cli,
+BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 flags,
uint32 num_names, const char **names,
uint32 *num_rids,
uint32 rid[MAX_LOOKUP_SIDS],
uint32 type[MAX_LOOKUP_SIDS]);
-BOOL samr_query_lookup_rids(struct cli_state *cli,
+BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 flags,
uint32 num_rids, uint32 *rids,
uint32 *num_names,
fstring names[MAX_LOOKUP_SIDS],
uint32 type [MAX_LOOKUP_SIDS]);
-BOOL samr_query_aliasmem(struct cli_state *cli,
+BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol,
uint32 *num_mem, DOM_SID2 *sid);
-BOOL samr_query_useraliases(struct cli_state *cli,
+BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, DOM_SID *sid,
uint32 *num_aliases, uint32 *rid);
-BOOL samr_query_groupmem(struct cli_state *cli,
+BOOL samr_query_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol,
uint32 *num_mem, uint32 *rid, uint32 *attr);
-BOOL samr_query_usergroups(struct cli_state *cli,
+BOOL samr_query_usergroups(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 *num_groups, DOM_GID *gid);
-BOOL samr_query_groupinfo(struct cli_state *cli,
+BOOL samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol,
uint16 switch_value, GROUP_INFO_CTR* ctr);
-BOOL samr_query_userinfo(struct cli_state *cli,
+BOOL samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint16 switch_value, void* usr);
-BOOL samr_close(struct cli_state *cli, POLICY_HND *hnd);
+BOOL samr_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
/*The following definitions come from rpc_client/cli_srvsvc.c */
-BOOL do_srv_net_srv_conn_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum,
char *server_name, char *qual_name,
uint32 switch_value, SRV_CONN_INFO_CTR *ctr,
uint32 preferred_len,
ENUM_HND *hnd);
-BOOL do_srv_net_srv_sess_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum,
char *server_name, char *qual_name,
uint32 switch_value, SRV_SESS_INFO_CTR *ctr,
uint32 preferred_len,
ENUM_HND *hnd);
-BOOL do_srv_net_srv_share_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum,
char *server_name,
uint32 switch_value, SRV_SHARE_INFO_CTR *ctr,
uint32 preferred_len,
ENUM_HND *hnd);
-BOOL do_srv_net_srv_file_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum,
char *server_name, char *qual_name,
uint32 switch_value, SRV_FILE_INFO_CTR *ctr,
uint32 preferred_len,
ENUM_HND *hnd);
-BOOL do_srv_net_srv_get_info(struct cli_state *cli,
+BOOL do_srv_net_srv_get_info(struct cli_state *cli, uint16 fnum,
char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr);
/*The following definitions come from rpc_client/cli_wkssvc.c */
-BOOL do_wks_query_info(struct cli_state *cli,
+BOOL do_wks_query_info(struct cli_state *cli, uint16 fnum,
char *server_name, uint32 switch_value,
WKS_INFO_100 *wks100);
uint32 rid_user,
uint32 rid_group,
uint16 acct_ctrl);
+void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth);
void make_sam_user_info21(SAM_USER_INFO_21 *usr,
NTTIME *logon_time,
/*The following definitions come from smbd/oplock.c */
+BOOL setup_kernel_oplock_pipe(void);
BOOL open_oplock_ipc(void);
BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeout);
BOOL set_file_oplock(files_struct *fsp);
****************************************************************************/
BOOL get_domain_sids(DOM_SID *sid3, DOM_SID *sid5, char *servers)
{
+ uint16 nt_pipe_fnum;
POLICY_HND pol;
fstring srv_name;
struct cli_state cli;
strupper(srv_name);
/* open LSARPC session. */
- res = res ? cli_nt_session_open(&cli, PIPE_LSARPC) : False;
+ res = res ? cli_nt_session_open(&cli, PIPE_LSARPC, &nt_pipe_fnum) : False;
/* lookup domain controller; receive a policy handle */
- res = res ? lsa_open_policy(&cli, srv_name, &pol, False) : False;
+ res = res ? lsa_open_policy(&cli, nt_pipe_fnum, srv_name, &pol, False) : False;
if (sid3 != NULL)
{
/* send client info query, level 3. receive domain name and sid */
- res = res ? lsa_query_info_pol(&cli, &pol, 3, dom3, sid3) : False;
+ res = res ? lsa_query_info_pol(&cli, nt_pipe_fnum, &pol, 3, dom3, sid3) : False;
}
if (sid5 != NULL)
{
/* send client info query, level 5. receive domain name and sid */
- res = res ? lsa_query_info_pol(&cli, &pol, 5, dom5, sid5) : False;
+ res = res ? lsa_query_info_pol(&cli, nt_pipe_fnum, &pol, 5, dom5, sid5) : False;
}
/* close policy handle */
- res = res ? lsa_close(&cli, &pol) : False;
+ res = res ? lsa_close(&cli, nt_pipe_fnum, &pol) : False;
/* close the session */
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
Initialize domain session credentials.
****************************************************************************/
-BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16])
+BOOL cli_nt_setup_creds(struct cli_state *cli, uint16 fnum, unsigned char mach_pwd[16])
{
DOM_CHAL clnt_chal;
DOM_CHAL srv_chal;
generate_random_buffer( clnt_chal.data, 8, False);
/* send a client challenge; receive a server challenge */
- if (!cli_net_req_chal(cli, &clnt_chal, &srv_chal))
+ if (!cli_net_req_chal(cli, fnum, &clnt_chal, &srv_chal))
{
DEBUG(0,("cli_nt_setup_creds: request challenge failed\n"));
return False;
* Receive an auth-2 challenge response and check it.
*/
- if (!cli_net_auth2(cli, SEC_CHAN_WKSTA, 0x000001ff, &srv_chal))
+ if (!cli_net_auth2(cli, fnum, SEC_CHAN_WKSTA, 0x000001ff, &srv_chal))
{
DEBUG(0,("cli_nt_setup_creds: auth2 challenge failed\n"));
return False;
Set machine password.
****************************************************************************/
-BOOL cli_nt_srv_pwset(struct cli_state *cli, unsigned char *new_hashof_mach_pwd)
+BOOL cli_nt_srv_pwset(struct cli_state *cli, uint16 fnum, unsigned char *new_hashof_mach_pwd)
{
unsigned char processed_new_pwd[16];
cred_hash3( processed_new_pwd, new_hashof_mach_pwd, cli->sess_key, 1);
/* send client srv_pwset challenge */
- return cli_net_srv_pwset(cli, processed_new_pwd);
+ return cli_net_srv_pwset(cli, fnum, processed_new_pwd);
}
/****************************************************************************
password equivalents, protected by the session key) is inherently insecure
given the current design of the NT Domain system. JRA.
****************************************************************************/
-BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *username,
+BOOL cli_nt_login_interactive(struct cli_state *cli, uint16 fnum, char *domain, char *username,
uint32 luid_low, char *password,
NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3)
{
memset(nt_owf_user_pwd, '\0', sizeof(nt_owf_user_pwd));
/* Send client sam-logon request - update credentials on success. */
- ret = cli_net_sam_logon(cli, ctr, user_info3);
+ ret = cli_net_sam_logon(cli, fnum, ctr, user_info3);
memset(ctr->auth.id1.lm_owf.data, '\0', sizeof(lm_owf_user_pwd));
memset(ctr->auth.id1.nt_owf.data, '\0', sizeof(nt_owf_user_pwd));
password equivalents over the network. JRA.
****************************************************************************/
-BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username,
+BOOL cli_nt_login_network(struct cli_state *cli, uint16 fnum, char *domain, char *username,
uint32 luid_low, char lm_chal[8], char lm_chal_resp[24],
char nt_chal_resp[24],
NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3)
(uchar *)lm_chal, (uchar *)lm_chal_resp, (uchar *)nt_chal_resp);
/* Send client sam-logon request - update credentials on success. */
- return cli_net_sam_logon(cli, ctr, user_info3);
+ return cli_net_sam_logon(cli, fnum, ctr, user_info3);
}
/****************************************************************************
NT Logoff.
****************************************************************************/
-BOOL cli_nt_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr)
+BOOL cli_nt_logoff(struct cli_state *cli, uint16 fnum, NET_ID_INFO_CTR *ctr)
{
DEBUG(5,("cli_nt_logoff: %d\n", __LINE__));
/* Send client sam-logoff request - update credentials on success. */
- return cli_net_sam_logoff(cli, ctr);
+ return cli_net_sam_logoff(cli, fnum, ctr);
}
/****************************************************************************
do a LSA Open Policy
****************************************************************************/
-BOOL lsa_open_policy(struct cli_state *cli,
+BOOL lsa_open_policy(struct cli_state *cli, uint16 fnum,
char *server_name, POLICY_HND *hnd,
BOOL sec_qos)
{
lsa_io_q_open_pol("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, LSA_OPENPOLICY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, LSA_OPENPOLICY, &buf, &rbuf))
{
LSA_R_OPEN_POL r_o;
BOOL p;
/****************************************************************************
do a LSA Lookup Names
****************************************************************************/
-BOOL lsa_lookup_names(struct cli_state *cli,
+BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd,
int num_names,
const char **names,
lsa_io_q_lookup_names("", &q_l, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, LSA_LOOKUPNAMES, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, LSA_LOOKUPNAMES, &buf, &rbuf))
{
LSA_R_LOOKUP_NAMES r_l;
DOM_R_REF ref;
/****************************************************************************
do a LSA Lookup SIDs
****************************************************************************/
-BOOL lsa_lookup_sids(struct cli_state *cli,
+BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd,
int num_sids,
DOM_SID **sids,
lsa_io_q_lookup_sids("", &q_l, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, LSA_LOOKUPSIDS, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, LSA_LOOKUPSIDS, &buf, &rbuf))
{
LSA_R_LOOKUP_SIDS r_l;
DOM_R_REF ref;
/****************************************************************************
do a LSA Query Info Policy
****************************************************************************/
-BOOL lsa_query_info_pol(struct cli_state *cli,
+BOOL lsa_query_info_pol(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd, uint16 info_class,
fstring domain_name, DOM_SID *domain_sid)
{
lsa_io_q_query("", &q_q, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, LSA_QUERYINFOPOLICY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, LSA_QUERYINFOPOLICY, &buf, &rbuf))
{
LSA_R_QUERY_INFO r_q;
BOOL p;
/****************************************************************************
do a LSA Close
****************************************************************************/
-BOOL lsa_close(struct cli_state *cli, POLICY_HND *hnd)
+BOOL lsa_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
{
prs_struct rbuf;
prs_struct buf;
lsa_io_q_close("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, LSA_CLOSE, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, LSA_CLOSE, &buf, &rbuf))
{
LSA_R_CLOSE r_c;
BOOL p;
/****************************************************************************
do a LSA Logon Control2
****************************************************************************/
-BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level)
+BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint16 nt_pipe_fnum, uint32 status_level)
{
prs_struct rbuf;
prs_struct buf;
net_io_q_logon_ctrl2("", &q_l, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, NET_LOGON_CTRL2, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, nt_pipe_fnum, NET_LOGON_CTRL2, &buf, &rbuf))
{
NET_R_LOGON_CTRL2 r_l;
encrypt of the server challenge originally received. JRA.
****************************************************************************/
-BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan,
+BOOL cli_net_auth2(struct cli_state *cli, uint16 nt_pipe_fnum, uint16 sec_chan,
uint32 neg_flags, DOM_CHAL *srv_chal)
{
prs_struct rbuf;
net_io_q_auth_2("", &q_a, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, NET_AUTH2, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, nt_pipe_fnum, NET_AUTH2, &buf, &rbuf))
{
NET_R_AUTH_2 r_a;
server response. These are used to generate the credentials.
****************************************************************************/
-BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal)
+BOOL cli_net_req_chal(struct cli_state *cli, uint16 nt_pipe_fnum, DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal)
{
prs_struct rbuf;
prs_struct buf;
net_io_q_req_chal("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, NET_REQCHAL, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, nt_pipe_fnum, NET_REQCHAL, &buf, &rbuf))
{
NET_R_REQ_CHAL r_c;
BOOL ok;
LSA Server Password Set.
****************************************************************************/
-BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16])
+BOOL cli_net_srv_pwset(struct cli_state *cli, uint16 nt_pipe_fnum, uint8 hashed_mach_pwd[16])
{
prs_struct rbuf;
prs_struct buf;
net_io_q_srv_pwset("", &q_s, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, NET_SRVPWSET, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, nt_pipe_fnum, NET_SRVPWSET, &buf, &rbuf))
{
NET_R_SRV_PWSET r_s;
LSA SAM Logon - interactive or network.
****************************************************************************/
-BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
+BOOL cli_net_sam_logon(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr,
NET_USER_INFO_3 *user_info3)
{
DOM_CRED new_clnt_cred;
net_io_q_sam_logon("", &q_s, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, NET_SAMLOGON, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, nt_pipe_fnum, NET_SAMLOGON, &buf, &rbuf))
{
NET_R_SAM_LOGON r_s;
what that needs to be (I need to see one on the wire before
I can be sure). JRA.
****************************************************************************/
-BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr)
+BOOL cli_net_sam_logoff(struct cli_state *cli, uint16 nt_pipe_fnum, NET_ID_INFO_CTR *ctr)
{
DOM_CRED new_clnt_cred;
DOM_CRED dummy_rtn_creds;
net_io_q_sam_logoff("", &q_s, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, NET_SAMLOGOFF, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, nt_pipe_fnum, NET_SAMLOGOFF, &buf, &rbuf))
{
NET_R_SAM_LOGOFF r_s;
unsigned char orig_trust_passwd_hash[16],
unsigned char new_trust_passwd_hash[16])
{
+ uint16 nt_pipe_fnum;
struct cli_state cli;
struct nmb_name calling, called;
* Now start the NT Domain stuff :-).
*/
- if(cli_nt_session_open(&cli, PIPE_NETLOGON) == False) {
+ if(cli_nt_session_open(&cli, PIPE_NETLOGON, &nt_pipe_fnum) == False) {
DEBUG(0,("modify_trust_password: unable to open the domain client session to \
machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli)));
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
}
- if(cli_nt_setup_creds(&cli, orig_trust_passwd_hash) == False) {
+ if(cli_nt_setup_creds(&cli, nt_pipe_fnum, orig_trust_passwd_hash) == False) {
DEBUG(0,("modify_trust_password: unable to setup the PDC credentials to machine \
%s. Error was : %s.\n", remote_machine, cli_errstr(&cli)));
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
}
- if( cli_nt_srv_pwset( &cli,new_trust_passwd_hash ) == False) {
+ if( cli_nt_srv_pwset( &cli, nt_pipe_fnum, new_trust_passwd_hash ) == False) {
DEBUG(0,("modify_trust_password: unable to change password for machine %s in domain \
%s to Domain controller %s. Error was %s.\n", global_myname, domain, remote_machine,
cli_errstr(&cli)));
- cli_close(&cli, cli.nt_pipe_fnum);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
}
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
uses SMBreadX to get rest of rpc data
********************************************************************/
-static BOOL rpc_read(struct cli_state *cli,
+static BOOL rpc_read(struct cli_state *cli, uint16 nt_pipe_fnum,
prs_struct *rdata, uint32 data_to_read,
uint32 rdata_offset)
{
DEBUG(5,("rpc_read: grow buffer to %d\n", rdata->data->data_used));
}
- num_read = cli_read(cli, cli->nt_pipe_fnum, data, file_offset, size);
+ num_read = cli_read(cli, nt_pipe_fnum, data, file_offset, size);
DEBUG(5,("rpc_read: read offset: %d read: %d to read: %d\n",
file_offset, num_read, data_to_read));
****************************************************************************/
-static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd,
+static BOOL rpc_api_pipe(struct cli_state *cli, uint16 nt_pipe_fnum, uint16 cmd,
prs_struct *param , prs_struct *data,
prs_struct *rparam, prs_struct *rdata)
{
/* create setup parameters. */
setup[0] = cmd;
- setup[1] = cli->nt_pipe_fnum; /* pipe file handle. got this from an SMBOpenX. */
+ setup[1] = nt_pipe_fnum; /* pipe file handle. got this from an SMBOpenX. */
- DEBUG(5,("rpc_api_pipe: cmd:%x fnum:%x\n", cmd, cli->nt_pipe_fnum));
+ DEBUG(5,("rpc_api_pipe: cmd:%x fnum:%x\n", cmd, nt_pipe_fnum));
/* send the data: receive a response. */
if (!cli_api_pipe(cli, "\\PIPE\\\0\0\0", 8,
/* err status is only informational: the _real_ check is on the length */
if (len > 0) /* || err == (0x80000000 | STATUS_BUFFER_OVERFLOW)) */
{
- if (!rpc_read(cli, rdata, len, rdata->data->data_used))
+ if (!rpc_read(cli, nt_pipe_fnum, rdata, len, rdata->data->data_used))
{
return False;
}
prs_init(&hps, 0x8, 4, 0, True);
- num_read = cli_read(cli, cli->nt_pipe_fnum, hps.data->data, 0, 0x18);
+ num_read = cli_read(cli, nt_pipe_fnum, hps.data->data, 0, 0x18);
DEBUG(5,("rpc_api_pipe: read header (size:%d)\n", num_read));
if (num_read != 0x18) return False;
return False;
}
- if (!rpc_read(cli, rdata, len, rdata->data->data_used))
+ if (!rpc_read(cli, nt_pipe_fnum, rdata, len, rdata->data->data_used))
{
return False;
}
/****************************************************************************
send a request on an rpc pipe.
****************************************************************************/
-BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num,
+BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 nt_pipe_fnum, uint8 op_num,
prs_struct *data, prs_struct *rdata)
{
/* fudge this, at the moment: create the header; memcpy the data. oops. */
prs_init(&dataa, mem_buf_len(hdr.data), 4, 0x0, False);
mem_buf_copy(dataa.data->data, hdr.data, 0, mem_buf_len(hdr.data));
- ret = rpc_api_pipe(cli, 0x0026, NULL, &dataa, &rparam, rdata);
+ ret = rpc_api_pipe(cli, nt_pipe_fnum, 0x0026, NULL, &dataa, &rparam, rdata);
prs_mem_free(&hdr_auth );
prs_mem_free(&auth_verf);
do an rpc bind
****************************************************************************/
-static BOOL rpc_pipe_set_hnd_state(struct cli_state *cli, char *pipe_name, uint16 device_state)
+static BOOL rpc_pipe_set_hnd_state(struct cli_state *cli, uint16 nt_pipe_fnum,
+ char *pipe_name, uint16 device_state)
{
BOOL state_set = False;
char param[2];
if (pipe_name == NULL) return False;
DEBUG(5,("Set Handle state Pipe[%x]: %s - device state:%x\n",
- cli->nt_pipe_fnum, pipe_name, device_state));
+ nt_pipe_fnum, pipe_name, device_state));
/* create parameters: device state */
SSVAL(param, 0, device_state);
/* create setup parameters. */
setup[0] = 0x0001;
- setup[1] = cli->nt_pipe_fnum; /* pipe file handle. got this from an SMBOpenX. */
+ setup[1] = nt_pipe_fnum; /* pipe file handle. got this from an SMBOpenX. */
/* send the data on \PIPE\ */
if (cli_api_pipe(cli, "\\PIPE\\\0\0\0", 8,
do an rpc bind
****************************************************************************/
-static BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name,
+static BOOL rpc_pipe_bind(struct cli_state *cli, uint16 nt_pipe_fnum,
+ char *pipe_name,
RPC_IFACE *abstract, RPC_IFACE *transfer,
char *my_name)
{
return False;
}
- DEBUG(5,("Bind RPC Pipe[%x]: %s\n", cli->nt_pipe_fnum, pipe_name));
+ DEBUG(5,("Bind RPC Pipe[%x]: %s\n", nt_pipe_fnum, pipe_name));
if (!valid_pipe_name(pipe_name, abstract, transfer)) return False;
mem_buf_copy(data.data->data, hdr.data, 0, mem_buf_len(hdr.data));
/* send data on \PIPE\. receive a response */
- if (rpc_api_pipe(cli, 0x0026, NULL, &data, &rparam, &rdata))
+ if (rpc_api_pipe(cli, nt_pipe_fnum, 0x0026, NULL, &data, &rparam, &rdata))
{
RPC_HDR_BA hdr_ba;
RPC_HDR_AUTH rhdr_auth;
prs_init(&dataa, mem_buf_len(hdra.data), 4, 0x0, False);
mem_buf_copy(dataa.data->data, hdra.data, 0, mem_buf_len(hdra.data));
- if (cli_write(cli, cli->nt_pipe_fnum, 0x0008,
+ if (cli_write(cli, nt_pipe_fnum, 0x0008,
dataa.data->data, 0,
dataa.data->data_used) < 0)
{
open a session
****************************************************************************/
-BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name)
+BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name, uint16* nt_pipe_fnum)
{
RPC_IFACE abstract;
RPC_IFACE transfer;
return False;
}
- cli->nt_pipe_fnum = (uint16)fnum;
+ *nt_pipe_fnum = (uint16)fnum;
}
else
{
return False;
}
- cli->nt_pipe_fnum = (uint16)fnum;
+ *nt_pipe_fnum = (uint16)fnum;
/**************** Set Named Pipe State ***************/
- if (!rpc_pipe_set_hnd_state(cli, pipe_name, 0x4300))
+ if (!rpc_pipe_set_hnd_state(cli, *nt_pipe_fnum, pipe_name, 0x4300))
{
DEBUG(0,("cli_nt_session_open: pipe hnd state failed. Error was %s\n",
cli_errstr(cli)));
- cli_close(cli, cli->nt_pipe_fnum);
+ cli_close(cli, *nt_pipe_fnum);
return False;
}
/******************* bind request on pipe *****************/
- if (!rpc_pipe_bind(cli, pipe_name,
+ if (!rpc_pipe_bind(cli, *nt_pipe_fnum, pipe_name,
&abstract, &transfer,
global_myname))
{
DEBUG(0,("cli_nt_session_open: rpc bind failed. Error was %s\n",
cli_errstr(cli)));
- cli_close(cli, cli->nt_pipe_fnum);
+ cli_close(cli, *nt_pipe_fnum);
return False;
}
close the session
****************************************************************************/
-void cli_nt_session_close(struct cli_state *cli)
+void cli_nt_session_close(struct cli_state *cli, uint16 nt_pipe_fnum)
{
- cli_close(cli, cli->nt_pipe_fnum);
+ cli_close(cli, nt_pipe_fnum);
}
/****************************************************************************
do a REG Open Policy
****************************************************************************/
-BOOL do_reg_connect(struct cli_state *cli, char *full_keyname, char *key_name,
+BOOL do_reg_connect(struct cli_state *cli, uint16 fnum, char *full_keyname, char *key_name,
POLICY_HND *reg_hnd)
{
BOOL res = True;
{
case HKEY_LOCAL_MACHINE:
{
- res = res ? do_reg_open_hklm(cli,
+ res = res ? do_reg_open_hklm(cli, fnum,
0x84E0, 0x02000000,
reg_hnd) : False;
break;
case HKEY_USERS:
{
- res = res ? do_reg_open_hku(cli,
+ res = res ? do_reg_open_hku(cli, fnum,
0x84E0, 0x02000000,
reg_hnd) : False;
break;
/****************************************************************************
do a REG Open Policy
****************************************************************************/
-BOOL do_reg_open_hklm(struct cli_state *cli, uint16 unknown_0, uint32 level,
+BOOL do_reg_open_hklm(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
POLICY_HND *hnd)
{
prs_struct rbuf;
reg_io_q_open_hklm("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_OPEN_HKLM, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_OPEN_HKLM, &buf, &rbuf))
{
REG_R_OPEN_HKLM r_o;
BOOL p;
/****************************************************************************
do a REG Open HKU
****************************************************************************/
-BOOL do_reg_open_hku(struct cli_state *cli, uint16 unknown_0, uint32 level,
+BOOL do_reg_open_hku(struct cli_state *cli, uint16 fnum, uint16 unknown_0, uint32 level,
POLICY_HND *hnd)
{
prs_struct rbuf;
reg_io_q_open_hku("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_OPEN_HKU, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_OPEN_HKU, &buf, &rbuf))
{
REG_R_OPEN_HKU r_o;
BOOL p;
this might be some sort of "sync" or "refresh" command, sent after
modification of the registry...
****************************************************************************/
-BOOL do_reg_flush_key(struct cli_state *cli, POLICY_HND *hnd)
+BOOL do_reg_flush_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
{
prs_struct rbuf;
prs_struct buf;
reg_io_q_flush_key("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_FLUSH_KEY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_FLUSH_KEY, &buf, &rbuf))
{
REG_R_FLUSH_KEY r_o;
BOOL p;
/****************************************************************************
do a REG Query Key
****************************************************************************/
-BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *class, uint32 *class_len,
uint32 *num_subkeys, uint32 *max_subkeylen,
uint32 *max_subkeysize, uint32 *num_values,
reg_io_q_query_key("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_QUERY_KEY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_QUERY_KEY, &buf, &rbuf))
{
REG_R_QUERY_KEY r_o;
BOOL p;
/****************************************************************************
do a REG Unknown 1A
****************************************************************************/
-BOOL do_reg_unknown_1a(struct cli_state *cli, POLICY_HND *hnd, uint32 *unk)
+BOOL do_reg_unknown_1a(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint32 *unk)
{
prs_struct rbuf;
prs_struct buf;
reg_io_q_unk_1a("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_UNK_1A, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_UNK_1A, &buf, &rbuf))
{
REG_R_UNK_1A r_o;
BOOL p;
/****************************************************************************
do a REG Query Info
****************************************************************************/
-BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *type, uint32 *unk_0, uint32 *unk_1)
{
prs_struct rbuf;
reg_io_q_info("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_INFO, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_INFO, &buf, &rbuf))
{
REG_R_INFO r_o;
BOOL p;
/****************************************************************************
do a REG Set Key Security
****************************************************************************/
-BOOL do_reg_set_key_sec(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
uint32 sec_buf_size, SEC_DESC *sec_buf)
{
prs_struct rbuf;
reg_io_q_set_key_sec("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_SET_KEY_SEC, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_SET_KEY_SEC, &buf, &rbuf))
{
REG_R_SET_KEY_SEC r_o;
BOOL p;
/****************************************************************************
do a REG Query Key Security
****************************************************************************/
-BOOL do_reg_get_key_sec(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
uint32 *sec_buf_size, SEC_DESC_BUF *sec_buf)
{
prs_struct rbuf;
reg_io_q_get_key_sec("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_GET_KEY_SEC, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_GET_KEY_SEC, &buf, &rbuf))
{
REG_R_GET_KEY_SEC r_o;
BOOL p;
/****************************************************************************
do a REG Delete Value
****************************************************************************/
-BOOL do_reg_delete_val(struct cli_state *cli, POLICY_HND *hnd, char *val_name)
+BOOL do_reg_delete_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *val_name)
{
prs_struct rbuf;
prs_struct buf;
reg_io_q_delete_val("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_DELETE_VALUE, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_DELETE_VALUE, &buf, &rbuf))
{
REG_R_DELETE_VALUE r_o;
BOOL p;
/****************************************************************************
do a REG Delete Key
****************************************************************************/
-BOOL do_reg_delete_key(struct cli_state *cli, POLICY_HND *hnd, char *key_name)
+BOOL do_reg_delete_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, char *key_name)
{
prs_struct rbuf;
prs_struct buf;
reg_io_q_delete_key("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_DELETE_KEY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_DELETE_KEY, &buf, &rbuf))
{
REG_R_DELETE_KEY r_o;
BOOL p;
/****************************************************************************
do a REG Create Key
****************************************************************************/
-BOOL do_reg_create_key(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_create_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *key_name, char *key_class,
SEC_ACCESS *sam_access,
POLICY_HND *key)
reg_io_q_create_key("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_CREATE_KEY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_CREATE_KEY, &buf, &rbuf))
{
REG_R_CREATE_KEY r_o;
BOOL p;
/****************************************************************************
do a REG Enum Key
****************************************************************************/
-BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_enum_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
int key_index, char *key_name,
uint32 *unk_1, uint32 *unk_2,
time_t *mod_time)
reg_io_q_enum_key("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_ENUM_KEY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_ENUM_KEY, &buf, &rbuf))
{
REG_R_ENUM_KEY r_o;
BOOL p;
/****************************************************************************
do a REG Create Value
****************************************************************************/
-BOOL do_reg_create_val(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_create_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *val_name, uint32 type, BUFFER3 *data)
{
prs_struct rbuf;
reg_io_q_create_val("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_CREATE_VALUE, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_CREATE_VALUE, &buf, &rbuf))
{
REG_R_CREATE_VALUE r_o;
BOOL p;
/****************************************************************************
do a REG Enum Value
****************************************************************************/
-BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_enum_val(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
int val_index, int max_valnamelen, int max_valbufsize,
fstring val_name,
uint32 *val_type, BUFFER2 *value)
reg_io_q_enum_val("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_ENUM_VALUE, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_ENUM_VALUE, &buf, &rbuf))
{
REG_R_ENUM_VALUE r_o;
BOOL p;
/****************************************************************************
do a REG Open Key
****************************************************************************/
-BOOL do_reg_open_entry(struct cli_state *cli, POLICY_HND *hnd,
+BOOL do_reg_open_entry(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd,
char *key_name, uint32 unk_0,
POLICY_HND *key_hnd)
{
reg_io_q_open_entry("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_OPEN_ENTRY, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_OPEN_ENTRY, &buf, &rbuf))
{
REG_R_OPEN_ENTRY r_o;
BOOL p;
/****************************************************************************
do a REG Close
****************************************************************************/
-BOOL do_reg_close(struct cli_state *cli, POLICY_HND *hnd)
+BOOL do_reg_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
{
prs_struct rbuf;
prs_struct buf;
reg_io_q_close("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, REG_CLOSE, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, REG_CLOSE, &buf, &rbuf))
{
REG_R_CLOSE r_c;
BOOL p;
/****************************************************************************
do a SAMR create domain alias
****************************************************************************/
-BOOL create_samr_domain_alias(struct cli_state *cli,
+BOOL create_samr_domain_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
const char *acct_name, const char *acct_desc,
uint32 *rid)
if (pol_open_domain == NULL || acct_name == NULL || acct_desc == NULL) return False;
/* send create alias */
- if (!samr_create_dom_alias(cli,
+ if (!samr_create_dom_alias(cli, fnum,
pol_open_domain,
acct_name,
&pol_open_alias, rid))
make_samr_alias_info3(&ctr.alias.info3, acct_desc);
/* send set alias info */
- if (!samr_set_aliasinfo(cli,
+ if (!samr_set_aliasinfo(cli, fnum,
&pol_open_alias,
&ctr))
{
ret = False;
}
- return samr_close(cli, &pol_open_alias) && ret;
+ return samr_close(cli, fnum,&pol_open_alias) && ret;
}
/****************************************************************************
do a SAMR create domain group
****************************************************************************/
-BOOL create_samr_domain_group(struct cli_state *cli,
+BOOL create_samr_domain_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
const char *acct_name, const char *acct_desc,
uint32 *rid)
if (pol_open_domain == NULL || acct_name == NULL || acct_desc == NULL) return False;
/* send create group*/
- if (!samr_create_dom_group(cli,
+ if (!samr_create_dom_group(cli, fnum,
pol_open_domain,
acct_name,
&pol_open_group, rid))
make_samr_group_info4(&ctr.group.info4, acct_desc);
/* send user groups query */
- if (!samr_set_groupinfo(cli,
+ if (!samr_set_groupinfo(cli, fnum,
&pol_open_group,
&ctr))
{
ret = False;
}
- return samr_close(cli, &pol_open_group) && ret;
+ return samr_close(cli, fnum,&pol_open_group) && ret;
}
/****************************************************************************
do a SAMR query user groups
****************************************************************************/
-BOOL get_samr_query_usergroups(struct cli_state *cli,
+BOOL get_samr_query_usergroups(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain, uint32 user_rid,
uint32 *num_groups, DOM_GID *gid)
{
if (pol_open_domain == NULL || num_groups == NULL || gid == NULL) return False;
/* send open domain (on user sid) */
- if (!samr_open_user(cli,
+ if (!samr_open_user(cli, fnum,
pol_open_domain,
0x02011b, user_rid,
&pol_open_user))
}
/* send user groups query */
- if (!samr_query_usergroups(cli,
+ if (!samr_query_usergroups(cli, fnum,
&pol_open_user,
num_groups, gid))
{
ret = False;
}
- return samr_close(cli, &pol_open_user) && ret;
+ return samr_close(cli, fnum,&pol_open_user) && ret;
}
/****************************************************************************
do a SAMR delete group
****************************************************************************/
-BOOL delete_samr_dom_group(struct cli_state *cli,
+BOOL delete_samr_dom_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 group_rid)
{
if (pol_open_domain == NULL) return False;
/* send open domain (on group rid) */
- if (!samr_open_group(cli, pol_open_domain,
+ if (!samr_open_group(cli, fnum,pol_open_domain,
0x00000010, group_rid,
&pol_open_group))
{
}
/* send group delete */
- if (!samr_delete_dom_group(cli, &pol_open_group))
+ if (!samr_delete_dom_group(cli, fnum,&pol_open_group))
{
DEBUG(5,("delete_samr_dom_group: error in delete domain group\n"));
- samr_close(cli, &pol_open_group);
+ samr_close(cli, fnum,&pol_open_group);
return False;
}
/****************************************************************************
do a SAMR query group members
****************************************************************************/
-BOOL get_samr_query_groupmem(struct cli_state *cli,
+BOOL get_samr_query_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 group_rid, uint32 *num_mem,
uint32 *rid, uint32 *attr)
if (pol_open_domain == NULL || num_mem == NULL || rid == NULL || attr == NULL) return False;
/* send open domain (on group sid) */
- if (!samr_open_group(cli, pol_open_domain,
+ if (!samr_open_group(cli, fnum,pol_open_domain,
0x00000010, group_rid,
&pol_open_group))
{
}
/* send group info query */
- if (!samr_query_groupmem(cli, &pol_open_group, num_mem, rid, attr))
+ if (!samr_query_groupmem(cli, fnum,&pol_open_group, num_mem, rid, attr))
{
DEBUG(5,("samr_query_group: error in query group members\n"));
ret = False;
}
- return samr_close(cli, &pol_open_group) && ret;
+ return samr_close(cli, fnum,&pol_open_group) && ret;
}
/****************************************************************************
do a SAMR delete alias
****************************************************************************/
-BOOL delete_samr_dom_alias(struct cli_state *cli,
+BOOL delete_samr_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 alias_rid)
{
if (pol_open_domain == NULL) return False;
/* send open domain (on alias rid) */
- if (!samr_open_alias(cli, pol_open_domain,
+ if (!samr_open_alias(cli, fnum,pol_open_domain,
0x000f001f, alias_rid, &pol_open_alias))
{
return False;
}
/* send alias delete */
- if (!samr_delete_dom_alias(cli, &pol_open_alias))
+ if (!samr_delete_dom_alias(cli, fnum,&pol_open_alias))
{
DEBUG(5,("delete_samr_dom_alias: error in delete domain alias\n"));
- samr_close(cli, &pol_open_alias);
+ samr_close(cli, fnum,&pol_open_alias);
return False;
}
/****************************************************************************
do a SAMR query alias members
****************************************************************************/
-BOOL get_samr_query_aliasmem(struct cli_state *cli,
+BOOL get_samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 alias_rid, uint32 *num_mem, DOM_SID2 *sid)
{
if (pol_open_domain == NULL || num_mem == NULL || sid == NULL) return False;
/* send open domain (on alias sid) */
- if (!samr_open_alias(cli, pol_open_domain,
+ if (!samr_open_alias(cli, fnum, pol_open_domain,
0x000f001f, alias_rid,
&pol_open_alias))
{
}
/* send alias info query */
- if (!samr_query_aliasmem(cli, &pol_open_alias, num_mem, sid))
+ if (!samr_query_aliasmem(cli, fnum, &pol_open_alias, num_mem, sid))
{
DEBUG(5,("samr_query_alias: error in query alias members\n"));
ret = False;
}
- return samr_close(cli, &pol_open_alias) && ret;
+ return samr_close(cli, fnum,&pol_open_alias) && ret;
}
/****************************************************************************
do a SAMR query user info
****************************************************************************/
-BOOL get_samr_query_userinfo(struct cli_state *cli,
+BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
uint32 user_rid, SAM_USER_INFO_21 *usr)
bzero(usr, sizeof(*usr));
/* send open domain (on user sid) */
- if (!samr_open_user(cli,
+ if (!samr_open_user(cli, fnum,
pol_open_domain,
0x02011b, user_rid,
&pol_open_user))
}
/* send user info query */
- if (!samr_query_userinfo(cli,
+ if (!samr_query_userinfo(cli, fnum,
&pol_open_user,
info_level, (void*)usr))
{
ret = False;
}
- return samr_close(cli, &pol_open_user) && ret;
+ return samr_close(cli, fnum,&pol_open_user) && ret;
}
/****************************************************************************
do a SAMR query group info
****************************************************************************/
-BOOL get_samr_query_groupinfo(struct cli_state *cli,
+BOOL get_samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
uint32 group_rid, GROUP_INFO_CTR *ctr)
bzero(ctr, sizeof(*ctr));
/* send open domain (on group sid) */
- if (!samr_open_group(cli,
+ if (!samr_open_group(cli, fnum,
pol_open_domain,
0x00000010, group_rid, &pol_open_group))
{
}
/* send group info query */
- if (!samr_query_groupinfo(cli,
+ if (!samr_query_groupinfo(cli, fnum,
&pol_open_group,
info_level, ctr))
{
ret = False;
}
- return samr_close(cli, &pol_open_group) && ret;
+ return samr_close(cli, fnum,&pol_open_group) && ret;
}
/****************************************************************************
do a SAMR change user password command
****************************************************************************/
-BOOL samr_chgpasswd_user(struct cli_state *cli,
+BOOL samr_chgpasswd_user(struct cli_state *cli, uint16 fnum,
char *srv_name, char *user_name,
char nt_newpass[516], uchar nt_oldhash[16],
char lm_newpass[516], uchar lm_oldhash[16])
samr_io_q_chgpasswd_user("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_CHGPASSWD_USER, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_CHGPASSWD_USER, &data, &rdata))
{
SAMR_R_CHGPASSWD_USER r_e;
BOOL p;
/****************************************************************************
do a SAMR unknown 0x38 command
****************************************************************************/
-BOOL samr_unknown_38(struct cli_state *cli, char *srv_name)
+BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name)
{
prs_struct data;
prs_struct rdata;
samr_io_q_unknown_38("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_UNKNOWN_38, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_UNKNOWN_38, &data, &rdata))
{
SAMR_R_UNKNOWN_38 r_e;
BOOL p;
/****************************************************************************
do a SAMR unknown 0x8 command
****************************************************************************/
-BOOL samr_query_dom_info(struct cli_state *cli,
+BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, uint16 switch_value)
{
prs_struct data;
samr_io_q_query_dom_info("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_DOMAIN_INFO, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_DOMAIN_INFO, &data, &rdata))
{
SAMR_R_QUERY_DOMAIN_INFO r_e;
BOOL p;
/****************************************************************************
do a SAMR enumerate groups
****************************************************************************/
-BOOL samr_enum_dom_groups(struct cli_state *cli,
+BOOL samr_enum_dom_groups(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 size,
struct acct_info **sam,
int *num_sam_groups)
samr_io_q_enum_dom_groups("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_ENUM_DOM_GROUPS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOM_GROUPS, &data, &rdata))
{
SAMR_R_ENUM_DOM_GROUPS r_e;
BOOL p;
/****************************************************************************
do a SAMR enumerate aliases
****************************************************************************/
-BOOL samr_enum_dom_aliases(struct cli_state *cli,
+BOOL samr_enum_dom_aliases(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 size,
struct acct_info **sam,
int *num_sam_aliases)
samr_io_q_enum_dom_aliases("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_ENUM_DOM_ALIASES, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOM_ALIASES, &data, &rdata))
{
SAMR_R_ENUM_DOM_ALIASES r_e;
BOOL p;
/****************************************************************************
do a SAMR enumerate users
****************************************************************************/
-BOOL samr_enum_dom_users(struct cli_state *cli,
+BOOL samr_enum_dom_users(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint16 num_entries, uint16 unk_0,
uint16 acb_mask, uint16 unk_1, uint32 size,
struct acct_info **sam,
samr_io_q_enum_dom_users("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_ENUM_DOM_USERS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOM_USERS, &data, &rdata))
{
SAMR_R_ENUM_DOM_USERS r_e;
BOOL p;
/****************************************************************************
do a SAMR Connect
****************************************************************************/
-BOOL samr_connect(struct cli_state *cli,
+BOOL samr_connect(struct cli_state *cli, uint16 fnum,
char *srv_name, uint32 unknown_0,
POLICY_HND *connect_pol)
{
samr_io_q_connect("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_CONNECT, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_CONNECT, &data, &rdata))
{
SAMR_R_CONNECT r_o;
BOOL p;
/****************************************************************************
do a SAMR Open User
****************************************************************************/
-BOOL samr_open_user(struct cli_state *cli,
+BOOL samr_open_user(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 unk_0, uint32 rid,
POLICY_HND *user_pol)
{
samr_io_q_open_user("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_OPEN_USER, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_USER, &data, &rdata))
{
SAMR_R_OPEN_USER r_o;
BOOL p;
/****************************************************************************
do a SAMR Open Alias
****************************************************************************/
-BOOL samr_open_alias(struct cli_state *cli,
+BOOL samr_open_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol,
uint32 flags, uint32 rid,
POLICY_HND *alias_pol)
samr_io_q_open_alias("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_OPEN_ALIAS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_ALIAS, &data, &rdata))
{
SAMR_R_OPEN_ALIAS r_o;
BOOL p;
/****************************************************************************
do a SAMR Delete Alias Member
****************************************************************************/
-BOOL samr_del_aliasmem(struct cli_state *cli,
+BOOL samr_del_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, DOM_SID *sid)
{
prs_struct data;
samr_io_q_del_aliasmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_DEL_ALIASMEM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_DEL_ALIASMEM, &data, &rdata))
{
SAMR_R_DEL_ALIASMEM r_o;
BOOL p;
/****************************************************************************
do a SAMR Add Alias Member
****************************************************************************/
-BOOL samr_add_aliasmem(struct cli_state *cli,
+BOOL samr_add_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, DOM_SID *sid)
{
prs_struct data;
samr_io_q_add_aliasmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_ADD_ALIASMEM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_ADD_ALIASMEM, &data, &rdata))
{
SAMR_R_ADD_ALIASMEM r_o;
BOOL p;
/****************************************************************************
do a SAMR Delete Domain Alias
****************************************************************************/
-BOOL samr_delete_dom_alias(struct cli_state *cli,
+BOOL samr_delete_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol)
{
prs_struct data;
samr_io_q_delete_dom_alias("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_DELETE_DOM_ALIAS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_DELETE_DOM_ALIAS, &data, &rdata))
{
SAMR_R_DELETE_DOM_ALIAS r_o;
BOOL p;
/****************************************************************************
do a SAMR Create Domain Alias
****************************************************************************/
-BOOL samr_create_dom_alias(struct cli_state *cli,
+BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *alias_pol, uint32 *rid)
{
samr_io_q_create_dom_alias("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_CREATE_DOM_ALIAS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_CREATE_DOM_ALIAS, &data, &rdata))
{
SAMR_R_CREATE_DOM_ALIAS r_o;
BOOL p;
/****************************************************************************
do a SAMR Set Alias Info
****************************************************************************/
-BOOL samr_set_aliasinfo(struct cli_state *cli,
+BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr)
{
prs_struct data;
samr_io_q_set_aliasinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_SET_ALIASINFO, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_SET_ALIASINFO, &data, &rdata))
{
SAMR_R_SET_ALIASINFO r_o;
BOOL p;
/****************************************************************************
do a SAMR Open Group
****************************************************************************/
-BOOL samr_open_group(struct cli_state *cli,
+BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol,
uint32 flags, uint32 rid,
POLICY_HND *group_pol)
samr_io_q_open_group("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_OPEN_GROUP, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_GROUP, &data, &rdata))
{
SAMR_R_OPEN_GROUP r_o;
BOOL p;
/****************************************************************************
do a SAMR Delete Group Member
****************************************************************************/
-BOOL samr_del_groupmem(struct cli_state *cli,
+BOOL samr_del_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol, uint32 rid)
{
prs_struct data;
samr_io_q_del_groupmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_DEL_GROUPMEM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_DEL_GROUPMEM, &data, &rdata))
{
SAMR_R_DEL_GROUPMEM r_o;
BOOL p;
/****************************************************************************
do a SAMR Add Group Member
****************************************************************************/
-BOOL samr_add_groupmem(struct cli_state *cli,
+BOOL samr_add_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol, uint32 rid)
{
prs_struct data;
samr_io_q_add_groupmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_ADD_GROUPMEM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_ADD_GROUPMEM, &data, &rdata))
{
SAMR_R_ADD_GROUPMEM r_o;
BOOL p;
/****************************************************************************
do a SAMR Delete Domain Group
****************************************************************************/
-BOOL samr_delete_dom_group(struct cli_state *cli, POLICY_HND *group_pol)
+BOOL samr_delete_dom_group(struct cli_state *cli, uint16 fnum, POLICY_HND *group_pol)
{
prs_struct data;
prs_struct rdata;
samr_io_q_delete_dom_group("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_DELETE_DOM_GROUP, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_DELETE_DOM_GROUP, &data, &rdata))
{
SAMR_R_DELETE_DOM_GROUP r_o;
BOOL p;
/****************************************************************************
do a SAMR Create Domain Group
****************************************************************************/
-BOOL samr_create_dom_group(struct cli_state *cli,
+BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *group_pol, uint32 *rid)
{
samr_io_q_create_dom_group("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_CREATE_DOM_GROUP, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_CREATE_DOM_GROUP, &data, &rdata))
{
SAMR_R_CREATE_DOM_GROUP r_o;
BOOL p;
/****************************************************************************
do a SAMR Set Group Info
****************************************************************************/
-BOOL samr_set_groupinfo(struct cli_state *cli,
+BOOL samr_set_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol, GROUP_INFO_CTR *ctr)
{
prs_struct data;
samr_io_q_set_groupinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_SET_GROUPINFO, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_SET_GROUPINFO, &data, &rdata))
{
SAMR_R_SET_GROUPINFO r_o;
BOOL p;
/****************************************************************************
do a SAMR Open Domain
****************************************************************************/
-BOOL samr_open_domain(struct cli_state *cli,
+BOOL samr_open_domain(struct cli_state *cli, uint16 fnum,
POLICY_HND *connect_pol, uint32 flags, DOM_SID *sid,
POLICY_HND *domain_pol)
{
samr_io_q_open_domain("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_OPEN_DOMAIN, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_DOMAIN, &data, &rdata))
{
SAMR_R_OPEN_DOMAIN r_o;
BOOL p;
/****************************************************************************
do a SAMR Query Lookup Names
****************************************************************************/
-BOOL samr_query_lookup_names(struct cli_state *cli,
+BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 flags,
uint32 num_names, const char **names,
uint32 *num_rids,
samr_io_q_lookup_names("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_LOOKUP_NAMES, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_LOOKUP_NAMES, &data, &rdata))
{
SAMR_R_LOOKUP_NAMES r_o;
BOOL p;
/****************************************************************************
do a SAMR Query Lookup RIDS
****************************************************************************/
-BOOL samr_query_lookup_rids(struct cli_state *cli,
+BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 flags,
uint32 num_rids, uint32 *rids,
uint32 *num_names,
samr_io_q_lookup_rids("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_LOOKUP_RIDS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_LOOKUP_RIDS, &data, &rdata))
{
SAMR_R_LOOKUP_RIDS r_o;
BOOL p;
/****************************************************************************
do a SAMR Query Alias Members
****************************************************************************/
-BOOL samr_query_aliasmem(struct cli_state *cli,
+BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol,
uint32 *num_mem, DOM_SID2 *sid)
{
samr_io_q_query_aliasmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_ALIASMEM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_ALIASMEM, &data, &rdata))
{
SAMR_R_QUERY_ALIASMEM r_o;
BOOL p;
/****************************************************************************
do a SAMR Query User Aliases
****************************************************************************/
-BOOL samr_query_useraliases(struct cli_state *cli,
+BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, DOM_SID *sid,
uint32 *num_aliases, uint32 *rid)
{
samr_io_q_query_useraliases("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_USERALIASES, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_USERALIASES, &data, &rdata))
{
SAMR_R_QUERY_USERALIASES r_o;
BOOL p;
/****************************************************************************
do a SAMR Query Group Members
****************************************************************************/
-BOOL samr_query_groupmem(struct cli_state *cli,
+BOOL samr_query_groupmem(struct cli_state *cli, uint16 fnum,
POLICY_HND *group_pol,
uint32 *num_mem, uint32 *rid, uint32 *attr)
{
samr_io_q_query_groupmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_GROUPMEM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_GROUPMEM, &data, &rdata))
{
SAMR_R_QUERY_GROUPMEM r_o;
BOOL p;
/****************************************************************************
do a SAMR Query User Groups
****************************************************************************/
-BOOL samr_query_usergroups(struct cli_state *cli,
+BOOL samr_query_usergroups(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint32 *num_groups, DOM_GID *gid)
{
prs_struct data;
samr_io_q_query_usergroups("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_USERGROUPS, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_USERGROUPS, &data, &rdata))
{
SAMR_R_QUERY_USERGROUPS r_o;
BOOL p;
/****************************************************************************
do a SAMR Query Group Info
****************************************************************************/
-BOOL samr_query_groupinfo(struct cli_state *cli,
+BOOL samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol,
uint16 switch_value, GROUP_INFO_CTR* ctr)
{
samr_io_q_query_groupinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_GROUPINFO, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_GROUPINFO, &data, &rdata))
{
SAMR_R_QUERY_GROUPINFO r_o;
BOOL p;
/****************************************************************************
do a SAMR Query User Info
****************************************************************************/
-BOOL samr_query_userinfo(struct cli_state *cli,
+BOOL samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint16 switch_value, void* usr)
{
prs_struct data;
samr_io_q_query_userinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_QUERY_USERINFO, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_USERINFO, &data, &rdata))
{
SAMR_R_QUERY_USERINFO r_o;
BOOL p;
/****************************************************************************
do a SAMR Close
****************************************************************************/
-BOOL samr_close(struct cli_state *cli, POLICY_HND *hnd)
+BOOL samr_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
{
prs_struct data;
prs_struct rdata;
samr_io_q_close_hnd("", &q_c, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SAMR_CLOSE_HND, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SAMR_CLOSE_HND, &data, &rdata))
{
SAMR_R_CLOSE_HND r_c;
BOOL p;
/****************************************************************************
do a server net conn enum
****************************************************************************/
-BOOL do_srv_net_srv_conn_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, uint16 fnum,
char *server_name, char *qual_name,
uint32 switch_value, SRV_CONN_INFO_CTR *ctr,
uint32 preferred_len,
srv_io_q_net_conn_enum("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SRV_NETCONNENUM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SRV_NETCONNENUM, &data, &rdata))
{
SRV_R_NET_CONN_ENUM r_o;
BOOL p;
/****************************************************************************
do a server net sess enum
****************************************************************************/
-BOOL do_srv_net_srv_sess_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, uint16 fnum,
char *server_name, char *qual_name,
uint32 switch_value, SRV_SESS_INFO_CTR *ctr,
uint32 preferred_len,
srv_io_q_net_sess_enum("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SRV_NETSESSENUM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SRV_NETSESSENUM, &data, &rdata))
{
SRV_R_NET_SESS_ENUM r_o;
BOOL p;
/****************************************************************************
do a server net share enum
****************************************************************************/
-BOOL do_srv_net_srv_share_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_share_enum(struct cli_state *cli, uint16 fnum,
char *server_name,
uint32 switch_value, SRV_SHARE_INFO_CTR *ctr,
uint32 preferred_len,
srv_io_q_net_share_enum("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SRV_NETSHAREENUM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SRV_NETSHAREENUM, &data, &rdata))
{
SRV_R_NET_SHARE_ENUM r_o;
BOOL p;
/****************************************************************************
do a server net file enum
****************************************************************************/
-BOOL do_srv_net_srv_file_enum(struct cli_state *cli,
+BOOL do_srv_net_srv_file_enum(struct cli_state *cli, uint16 fnum,
char *server_name, char *qual_name,
uint32 switch_value, SRV_FILE_INFO_CTR *ctr,
uint32 preferred_len,
srv_io_q_net_file_enum("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SRV_NETFILEENUM, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SRV_NETFILEENUM, &data, &rdata))
{
SRV_R_NET_FILE_ENUM r_o;
BOOL p;
/****************************************************************************
do a server get info
****************************************************************************/
-BOOL do_srv_net_srv_get_info(struct cli_state *cli,
+BOOL do_srv_net_srv_get_info(struct cli_state *cli, uint16 fnum,
char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr)
{
prs_struct data;
srv_io_q_net_srv_get_info("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, SRV_NET_SRV_GET_INFO, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SRV_NET_SRV_GET_INFO, &data, &rdata))
{
SRV_R_NET_SRV_GET_INFO r_o;
BOOL p;
/****************************************************************************
do a WKS Open Policy
****************************************************************************/
-BOOL do_wks_query_info(struct cli_state *cli,
+BOOL do_wks_query_info(struct cli_state *cli, uint16 fnum,
char *server_name, uint32 switch_value,
WKS_INFO_100 *wks100)
{
wks_io_q_query_info("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, WKS_QUERY_INFO, &buf, &rbuf))
+ if (rpc_api_pipe_req(cli, fnum, WKS_QUERY_INFO, &buf, &rbuf))
{
WKS_R_QUERY_INFO r_o;
BOOL p;
****************************************************************************/
void cmd_lsa_query_info(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring srv_name;
BOOL res = True;
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)
{
****************************************************************************/
void cmd_lsa_lookup_names(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring temp;
int i;
fstring srv_name;
}
/* 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)
{
****************************************************************************/
void cmd_lsa_lookup_sids(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring temp;
int i;
pstring sid_name;
}
/* 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)
{
****************************************************************************/
void cmd_netlogon_login_test(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
extern BOOL global_machine_password_needs_changing;
fstring nt_user_name;
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)
{
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;
/* 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));
****************************************************************************/
void cmd_reg_enum(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res1 = True;
BOOL res2 = True;
}
/* 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
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,
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)
}
/* 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;
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)
}
/* 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;
/* 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)
{
****************************************************************************/
void cmd_reg_query_key(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res1 = True;
}
/* 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
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,
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,
/* 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)
{
****************************************************************************/
void cmd_reg_create_val(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
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
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
}
/* 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)
{
****************************************************************************/
void cmd_reg_delete_val(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
}
/* 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
}
/* 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)
{
****************************************************************************/
void cmd_reg_delete_key(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
}
/* 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
}
/* 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)
{
****************************************************************************/
void cmd_reg_create_key(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
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
}
/* 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)
{
****************************************************************************/
void cmd_reg_test_key_sec(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
}
/* 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
}
/* 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)
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)
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);
/* 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)
{
****************************************************************************/
void cmd_reg_get_key_sec(struct client_info *info)
{
+ uint16 fnum;
BOOL res = True;
BOOL res3 = True;
BOOL res4 = True;
}
/* 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
}
/* 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)
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)
/* 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)
{
****************************************************************************/
void cmd_sam_ntchange_pwd(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
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)
{
****************************************************************************/
void cmd_sam_test(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
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)
{
****************************************************************************/
void cmd_sam_del_aliasmem(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring tmp;
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;
{
/* 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)
{
}
}
- 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)
{
****************************************************************************/
void cmd_sam_delete_dom_alias(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring name;
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;
}
/* 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)
{
****************************************************************************/
void cmd_sam_add_aliasmem(struct client_info *info)
{
+ uint16 fnum;
+ uint16 fnum_lsa;
fstring srv_name;
fstring domain;
fstring tmp;
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;
}
/* 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)
{
}
}
- 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)
{
****************************************************************************/
void cmd_sam_create_dom_alias(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring acct_name;
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)
{
****************************************************************************/
void cmd_sam_del_groupmem(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring tmp;
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;
{
/* 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)
{
}
}
- 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)
{
****************************************************************************/
void cmd_sam_delete_dom_group(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring name;
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;
}
/* 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)
{
****************************************************************************/
void cmd_sam_add_groupmem(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring tmp;
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;
}
/* 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)
{
}
}
- 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)
{
****************************************************************************/
void cmd_sam_create_dom_group(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring acct_name;
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)
{
****************************************************************************/
void cmd_sam_enum_users(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
#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;
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))
{
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))
{
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))
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))
{
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))
}
/* 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))
{
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))
}
}
- 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)
{
****************************************************************************/
void cmd_sam_query_user(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
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[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))
{
}
}
- 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)
{
****************************************************************************/
void cmd_sam_query_dominfo(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
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)
{
****************************************************************************/
void cmd_sam_enum_aliases(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
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;
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;
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*));
}
/* 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)
{
}
}
- 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)
{
****************************************************************************/
void cmd_sam_enum_groups(struct client_info *info)
{
+ uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
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;
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))
}
}
- 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)
{
****************************************************************************/
void cmd_srv_query_info(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_INFO_CTR ctr;
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)
{
****************************************************************************/
void cmd_srv_enum_conn(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring qual_srv;
fstring tmp;
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;
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
****************************************************************************/
void cmd_srv_enum_shares(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_SHARE_INFO_CTR ctr;
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;
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
****************************************************************************/
void cmd_srv_enum_sess(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_SESS_INFO_CTR ctr;
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)
{
****************************************************************************/
void cmd_srv_enum_files(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_srv;
fstring tmp;
SRV_FILE_INFO_CTR ctr;
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)
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
if (res)
{
****************************************************************************/
void cmd_wks_query_info(struct client_info *info)
{
+ uint16 nt_pipe_fnum;
fstring dest_wks;
fstring tmp;
WKS_INFO_100 ctr;
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)
{
fstrcpy(cli_info.dom.level3_dom, "");
fstrcpy(cli_info.dom.level5_dom, "");
- smb_cli->nt_pipe_fnum = 0xffff;
-
TimeInit();
charset_initialise();
char *smb_apasswd, int smb_apasslen,
char *smb_ntpasswd, int smb_ntpasslen)
{
+ uint16 nt_pipe_fnum;
unsigned char local_challenge[8];
unsigned char local_lm_response[24];
unsigned char local_nt_reponse[24];
* Now start the NT Domain stuff :-).
*/
- if(cli_nt_session_open(&cli, PIPE_NETLOGON) == False) {
+ if(cli_nt_session_open(&cli, PIPE_NETLOGON, &nt_pipe_fnum) == False) {
DEBUG(0,("domain_client_validate: unable to open the domain client session to \
machine %s. Error was : %s.\n", cli.desthost, cli_errstr(&cli)));
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
}
- if(cli_nt_setup_creds(&cli, trust_passwd) == False) {
+ if(cli_nt_setup_creds(&cli, nt_pipe_fnum, trust_passwd) == False) {
DEBUG(0,("domain_client_validate: unable to setup the PDC credentials to machine \
%s. Error was : %s.\n", cli.desthost, cli_errstr(&cli)));
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
/* We really don't care what LUID we give the user. */
generate_random_buffer( (unsigned char *)&smb_uid_low, 4, False);
- if(cli_nt_login_network(&cli, domain, user, smb_uid_low, (char *)local_challenge,
+ if(cli_nt_login_network(&cli, nt_pipe_fnum, domain, user, smb_uid_low, (char *)local_challenge,
((smb_apasslen != 0) ? smb_apasswd : NULL),
((smb_ntpasslen != 0) ? smb_ntpasswd : NULL),
&ctr, &info3) == False) {
DEBUG(0,("domain_client_validate: unable to validate password for user %s in domain \
%s to Domain controller %s. Error was %s.\n", user, domain, cli.desthost, cli_errstr(&cli)));
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
* send here. JRA.
*/
- if(cli_nt_logoff(&cli, &ctr) == False) {
+ if(cli_nt_logoff(&cli, nt_pipe_fnum, &ctr) == False) {
DEBUG(0,("domain_client_validate: unable to log off user %s in domain \
%s to Domain controller %s. Error was %s.\n", user, domain, cli.desthost, cli_errstr(&cli)));
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return False;
}
#endif /* 0 */
- cli_nt_session_close(&cli);
+ cli_nt_session_close(&cli, nt_pipe_fnum);
cli_ulogoff(&cli);
cli_shutdown(&cli);
return True;
static void random_rpc_pipe_enc(char *pipe_name, struct client_info *cli_info,
int numops)
{
+ uint16 nt_pipe_fnum;
int i;
DEBUG(0,("starting random rpc test on %s (encryped)\n", pipe_name));
for (i = 1; i <= numops * 100; i++)
{
/* open session. */
- cli_nt_session_open(smb_cli, pipe_name);
+ cli_nt_session_open(smb_cli, pipe_name, &nt_pipe_fnum);
do_random_rpc(smb_cli, 1024);
if (i % 500 == 0)
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
}
/* close the rpc pipe */
static void random_rpc_pipe(char *pipe_name, struct client_info *cli_info,
int numops)
{
+ uint16 nt_pipe_fnum;
int i;
DEBUG(0,("starting random rpc test on %s\n", pipe_name));
}
/* open session. */
- if (!cli_nt_session_open(smb_cli, pipe_name))
+ if (!cli_nt_session_open(smb_cli, pipe_name, &nt_pipe_fnum))
{
DEBUG(0,("random rpc test: session open failed\n"));
return;
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
/* close the rpc pipe */
rpcclient_stop();
static void run_samhandles(int numops, struct client_info *cli_info)
{
+ uint16 nt_pipe_fnum;
int i;
int count = 0;
int failed = 0;
}
/* open session. */
- if (!cli_nt_session_open(smb_cli, PIPE_SAMR))
+ if (!cli_nt_session_open(smb_cli, PIPE_SAMR, &nt_pipe_fnum))
{
DEBUG(0,("samhandle test: session open failed\n"));
return;
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
/* close the rpc pipe */
rpcclient_stop();
static void run_lsahandles(int numops, struct client_info *cli_info)
{
+ uint16 nt_pipe_fnum;
int i;
int count = 0;
int failed = 0;
return;
}
/* open session. */
- if (!cli_nt_session_open(smb_cli, PIPE_LSARPC))
+ if (!cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum))
{
DEBUG(0,("lsahandle test: session open failed\n"));
return;
}
/* close the session */
- cli_nt_session_close(smb_cli);
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
/* close the rpc pipe */
rpcclient_stop();
static void run_pipegobble(int numops, struct client_info *cli_info, char *pipe_name)
{
+ uint16 nt_pipe_fnum;
int i;
int count = 0;
int failed = 0;
for (i = 1; i <= numops * 100; i++)
{
/* open session. */
- if (!cli_nt_session_open(smb_cli, pipe_name))
+ if (!cli_nt_session_open(smb_cli, pipe_name, &nt_pipe_fnum))
{
DEBUG(0,("pipe gobble test: session open failed\n"));
}