diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/client.h | 1 | ||||
-rw-r--r-- | source3/include/proto.h | 164 | ||||
-rw-r--r-- | source3/lib/sids.c | 13 | ||||
-rw-r--r-- | source3/rpc_client/cli_login.c | 22 | ||||
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 20 | ||||
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 39 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 54 | ||||
-rw-r--r-- | source3/rpc_client/cli_reg.c | 70 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.c | 192 | ||||
-rw-r--r-- | source3/rpc_client/cli_srvsvc.c | 20 | ||||
-rw-r--r-- | source3/rpc_client/cli_wkssvc.c | 4 | ||||
-rw-r--r-- | source3/rpcclient/cmd_lsarpc.c | 35 | ||||
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 13 | ||||
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 152 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 291 | ||||
-rw-r--r-- | source3/rpcclient/cmd_srvsvc.c | 35 | ||||
-rw-r--r-- | source3/rpcclient/cmd_wkssvc.c | 7 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 2 | ||||
-rw-r--r-- | source3/smbd/password.c | 19 | ||||
-rw-r--r-- | source3/utils/rpctorture.c | 23 |
20 files changed, 608 insertions, 568 deletions
diff --git a/source3/include/client.h b/source3/include/client.h index 0f28fa0d08..25f8436079 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -125,7 +125,6 @@ struct cli_state { */ 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 */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 2e0f42e575..7f170aaad5 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1498,252 +1498,252 @@ void load_printers(void); /*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); @@ -2296,6 +2296,7 @@ void make_sam_user_info11(SAM_USER_INFO_11 *usr, 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, @@ -2853,6 +2854,7 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op); /*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); diff --git a/source3/lib/sids.c b/source3/lib/sids.c index b308664bcf..07c7d0823e 100644 --- a/source3/lib/sids.c +++ b/source3/lib/sids.c @@ -180,6 +180,7 @@ BOOL get_member_domain_sid(void) ****************************************************************************/ 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; @@ -220,28 +221,28 @@ BOOL get_domain_sids(DOM_SID *sid3, DOM_SID *sid5, char *servers) 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); diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c index c7a542577f..4520607898 100644 --- a/source3/rpc_client/cli_login.c +++ b/source3/rpc_client/cli_login.c @@ -29,7 +29,7 @@ extern int DEBUGLEVEL; 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; @@ -41,7 +41,7 @@ BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16]) 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; @@ -64,7 +64,7 @@ BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16]) * 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; @@ -77,7 +77,7 @@ BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16]) 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]; @@ -91,7 +91,7 @@ BOOL cli_nt_srv_pwset(struct cli_state *cli, unsigned char *new_hashof_mach_pwd) 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); } /**************************************************************************** @@ -100,7 +100,7 @@ NT login - interactive. 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) { @@ -139,7 +139,7 @@ BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *usernam 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)); @@ -153,7 +153,7 @@ NT login - network. 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) @@ -170,16 +170,16 @@ BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, (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); } diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index f0c9bdfe16..81bff830dd 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -35,7 +35,7 @@ extern int DEBUGLEVEL; /**************************************************************************** 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) { @@ -69,7 +69,7 @@ BOOL lsa_open_policy(struct cli_state *cli, 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; @@ -101,7 +101,7 @@ BOOL lsa_open_policy(struct cli_state *cli, /**************************************************************************** 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, @@ -129,7 +129,7 @@ BOOL lsa_lookup_names(struct cli_state *cli, 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; @@ -219,7 +219,7 @@ BOOL lsa_lookup_names(struct cli_state *cli, /**************************************************************************** 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, @@ -247,7 +247,7 @@ BOOL lsa_lookup_sids(struct cli_state *cli, 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; @@ -338,7 +338,7 @@ BOOL lsa_lookup_sids(struct cli_state *cli, /**************************************************************************** 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) { @@ -366,7 +366,7 @@ BOOL lsa_query_info_pol(struct cli_state *cli, 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; @@ -451,7 +451,7 @@ BOOL lsa_query_info_pol(struct cli_state *cli, /**************************************************************************** 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; @@ -474,7 +474,7 @@ BOOL lsa_close(struct cli_state *cli, POLICY_HND *hnd) 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; diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 099c81496a..750265483c 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -57,7 +57,7 @@ static void gen_next_creds( struct cli_state *cli, DOM_CRED *new_clnt_cred) /**************************************************************************** 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; @@ -79,7 +79,7 @@ BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level) 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; @@ -110,7 +110,7 @@ Ensure that the server credential returned matches the session key 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; @@ -135,7 +135,7 @@ BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan, 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; @@ -197,7 +197,7 @@ LSA Request Challenge. Sends our challenge to server, then gets 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; @@ -222,7 +222,7 @@ BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_ 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; @@ -256,7 +256,7 @@ BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_ 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; @@ -284,7 +284,7 @@ BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16]) 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; @@ -321,7 +321,7 @@ password ?).\n", cli->desthost )); 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; @@ -355,7 +355,7 @@ BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, 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; @@ -407,7 +407,7 @@ send a different info level. Right now though, I'm not sure 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; @@ -439,7 +439,7 @@ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr) 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; @@ -480,6 +480,7 @@ static BOOL modify_trust_password( char *domain, char *remote_machine, 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; @@ -563,35 +564,35 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) )); * 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); diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 712e608847..9d2ee533d6 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -46,7 +46,7 @@ static uint32 get_rpc_call_id(void) 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) { @@ -83,7 +83,7 @@ static BOOL rpc_read(struct cli_state *cli, 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)); @@ -250,7 +250,7 @@ static BOOL rpc_auth_pipe(struct cli_state *cli, prs_struct *rdata, ****************************************************************************/ -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) { @@ -281,9 +281,9 @@ static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, /* 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, @@ -337,7 +337,7 @@ static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, /* 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; } @@ -363,7 +363,7 @@ static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, 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; @@ -385,7 +385,7 @@ static BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, 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; } @@ -604,7 +604,7 @@ static BOOL create_rpc_request(prs_struct *rhdr, uint8 op_num, int data_len, /**************************************************************************** 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. */ @@ -680,7 +680,7 @@ BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, 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); @@ -695,7 +695,8 @@ BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num, 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]; @@ -707,14 +708,14 @@ static BOOL rpc_pipe_set_hnd_state(struct cli_state *cli, char *pipe_name, uint1 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, @@ -833,7 +834,8 @@ static BOOL check_bind_response(RPC_HDR_BA *hdr_ba, char *pipe_name, RPC_IFACE * 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) { @@ -855,7 +857,7 @@ static BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_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; @@ -882,7 +884,7 @@ static BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name, 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; @@ -984,7 +986,7 @@ static BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name, 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) { @@ -1029,7 +1031,7 @@ void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs) 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; @@ -1045,7 +1047,7 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name) return False; } - cli->nt_pipe_fnum = (uint16)fnum; + *nt_pipe_fnum = (uint16)fnum; } else { @@ -1056,14 +1058,14 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name) 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; } @@ -1071,13 +1073,13 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name) /******************* 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; } @@ -1104,7 +1106,7 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name) 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); } diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index 61e38a8d96..b3d2f6e864 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -34,7 +34,7 @@ extern int DEBUGLEVEL; /**************************************************************************** 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; @@ -61,7 +61,7 @@ BOOL do_reg_connect(struct cli_state *cli, char *full_keyname, char *key_name, { 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; @@ -69,7 +69,7 @@ BOOL do_reg_connect(struct cli_state *cli, char *full_keyname, char *key_name, case HKEY_USERS: { - res = res ? do_reg_open_hku(cli, + res = res ? do_reg_open_hku(cli, fnum, 0x84E0, 0x02000000, reg_hnd) : False; break; @@ -87,7 +87,7 @@ BOOL do_reg_connect(struct cli_state *cli, char *full_keyname, char *key_name, /**************************************************************************** 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; @@ -110,7 +110,7 @@ BOOL do_reg_open_hklm(struct cli_state *cli, uint16 unknown_0, uint32 level, 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; @@ -144,7 +144,7 @@ BOOL do_reg_open_hklm(struct cli_state *cli, uint16 unknown_0, uint32 level, /**************************************************************************** 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; @@ -167,7 +167,7 @@ BOOL do_reg_open_hku(struct cli_state *cli, uint16 unknown_0, uint32 level, 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; @@ -203,7 +203,7 @@ do a REG Unknown 0xB command. sent after a create key or create value. 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; @@ -225,7 +225,7 @@ BOOL do_reg_flush_key(struct cli_state *cli, POLICY_HND *hnd) 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; @@ -257,7 +257,7 @@ BOOL do_reg_flush_key(struct cli_state *cli, POLICY_HND *hnd) /**************************************************************************** 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, @@ -284,7 +284,7 @@ BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -327,7 +327,7 @@ BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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; @@ -349,7 +349,7 @@ BOOL do_reg_unknown_1a(struct cli_state *cli, POLICY_HND *hnd, uint32 *unk) 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; @@ -382,7 +382,7 @@ BOOL do_reg_unknown_1a(struct cli_state *cli, POLICY_HND *hnd, uint32 *unk) /**************************************************************************** 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; @@ -405,7 +405,7 @@ BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -440,7 +440,7 @@ BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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; @@ -463,7 +463,7 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -488,7 +488,7 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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; @@ -511,7 +511,7 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -557,7 +557,7 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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; @@ -579,7 +579,7 @@ BOOL do_reg_delete_val(struct cli_state *cli, POLICY_HND *hnd, char *val_name) 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; @@ -611,7 +611,7 @@ BOOL do_reg_delete_val(struct cli_state *cli, POLICY_HND *hnd, char *val_name) /**************************************************************************** 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; @@ -633,7 +633,7 @@ BOOL do_reg_delete_key(struct cli_state *cli, POLICY_HND *hnd, char *key_name) 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; @@ -665,7 +665,7 @@ BOOL do_reg_delete_key(struct cli_state *cli, POLICY_HND *hnd, char *key_name) /**************************************************************************** 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) @@ -704,7 +704,7 @@ BOOL do_reg_create_key(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -739,7 +739,7 @@ BOOL do_reg_create_key(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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) @@ -764,7 +764,7 @@ BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -800,7 +800,7 @@ BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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; @@ -823,7 +823,7 @@ BOOL do_reg_create_val(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -855,7 +855,7 @@ BOOL do_reg_create_val(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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) @@ -880,7 +880,7 @@ BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd, 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; @@ -915,7 +915,7 @@ BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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) { @@ -939,7 +939,7 @@ BOOL do_reg_open_entry(struct cli_state *cli, POLICY_HND *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; @@ -972,7 +972,7 @@ BOOL do_reg_open_entry(struct cli_state *cli, POLICY_HND *hnd, /**************************************************************************** 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; @@ -995,7 +995,7 @@ BOOL do_reg_close(struct cli_state *cli, POLICY_HND *hnd) 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; diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index e950269ec3..7c89dfcc02 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -36,7 +36,7 @@ extern int DEBUGLEVEL; /**************************************************************************** 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) @@ -48,7 +48,7 @@ BOOL create_samr_domain_alias(struct cli_state *cli, 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)) @@ -63,7 +63,7 @@ BOOL create_samr_domain_alias(struct cli_state *cli, 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)) { @@ -71,13 +71,13 @@ BOOL create_samr_domain_alias(struct cli_state *cli, 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) @@ -89,7 +89,7 @@ BOOL create_samr_domain_group(struct cli_state *cli, 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)) @@ -105,7 +105,7 @@ BOOL create_samr_domain_group(struct cli_state *cli, 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)) { @@ -113,13 +113,13 @@ BOOL create_samr_domain_group(struct cli_state *cli, 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) { @@ -129,7 +129,7 @@ BOOL get_samr_query_usergroups(struct cli_state *cli, 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)) @@ -138,7 +138,7 @@ BOOL get_samr_query_usergroups(struct cli_state *cli, } /* send user groups query */ - if (!samr_query_usergroups(cli, + if (!samr_query_usergroups(cli, fnum, &pol_open_user, num_groups, gid)) { @@ -146,13 +146,13 @@ BOOL get_samr_query_usergroups(struct cli_state *cli, 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) { @@ -161,7 +161,7 @@ BOOL delete_samr_dom_group(struct cli_state *cli, 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)) { @@ -169,11 +169,11 @@ BOOL delete_samr_dom_group(struct cli_state *cli, } /* 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; } @@ -184,7 +184,7 @@ BOOL delete_samr_dom_group(struct cli_state *cli, /**************************************************************************** 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) @@ -195,7 +195,7 @@ BOOL get_samr_query_groupmem(struct cli_state *cli, 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)) { @@ -203,20 +203,20 @@ BOOL get_samr_query_groupmem(struct cli_state *cli, } /* 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) { @@ -225,18 +225,18 @@ BOOL delete_samr_dom_alias(struct cli_state *cli, 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; } @@ -247,7 +247,7 @@ BOOL delete_samr_dom_alias(struct cli_state *cli, /**************************************************************************** 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) { @@ -257,7 +257,7 @@ BOOL get_samr_query_aliasmem(struct cli_state *cli, 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)) { @@ -265,20 +265,20 @@ BOOL get_samr_query_aliasmem(struct cli_state *cli, } /* 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) @@ -291,7 +291,7 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, 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)) @@ -300,7 +300,7 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, } /* send user info query */ - if (!samr_query_userinfo(cli, + if (!samr_query_userinfo(cli, fnum, &pol_open_user, info_level, (void*)usr)) { @@ -309,13 +309,13 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, 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) @@ -328,7 +328,7 @@ BOOL get_samr_query_groupinfo(struct cli_state *cli, 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)) { @@ -336,7 +336,7 @@ BOOL get_samr_query_groupinfo(struct cli_state *cli, } /* send group info query */ - if (!samr_query_groupinfo(cli, + if (!samr_query_groupinfo(cli, fnum, &pol_open_group, info_level, ctr)) { @@ -345,13 +345,13 @@ BOOL get_samr_query_groupinfo(struct cli_state *cli, 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]) @@ -378,7 +378,7 @@ BOOL samr_chgpasswd_user(struct cli_state *cli, 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; @@ -408,7 +408,7 @@ BOOL samr_chgpasswd_user(struct cli_state *cli, /**************************************************************************** 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; @@ -429,7 +429,7 @@ BOOL samr_unknown_38(struct cli_state *cli, char *srv_name) 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; @@ -460,7 +460,7 @@ BOOL samr_unknown_38(struct cli_state *cli, char *srv_name) /**************************************************************************** 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; @@ -485,7 +485,7 @@ BOOL samr_query_dom_info(struct cli_state *cli, 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; @@ -515,7 +515,7 @@ BOOL samr_query_dom_info(struct cli_state *cli, /**************************************************************************** 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) @@ -542,7 +542,7 @@ BOOL samr_enum_dom_groups(struct cli_state *cli, 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; @@ -609,7 +609,7 @@ BOOL samr_enum_dom_groups(struct cli_state *cli, /**************************************************************************** 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) @@ -636,7 +636,7 @@ BOOL samr_enum_dom_aliases(struct cli_state *cli, 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; @@ -697,7 +697,7 @@ BOOL samr_enum_dom_aliases(struct cli_state *cli, /**************************************************************************** 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, @@ -727,7 +727,7 @@ BOOL samr_enum_dom_users(struct cli_state *cli, 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; @@ -788,7 +788,7 @@ BOOL samr_enum_dom_users(struct cli_state *cli, /**************************************************************************** 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) { @@ -815,7 +815,7 @@ BOOL samr_connect(struct cli_state *cli, 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; @@ -846,7 +846,7 @@ BOOL samr_connect(struct cli_state *cli, /**************************************************************************** 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) { @@ -873,7 +873,7 @@ BOOL samr_open_user(struct cli_state *cli, 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; @@ -904,7 +904,7 @@ BOOL samr_open_user(struct cli_state *cli, /**************************************************************************** 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) @@ -931,7 +931,7 @@ BOOL samr_open_alias(struct cli_state *cli, 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; @@ -962,7 +962,7 @@ BOOL samr_open_alias(struct cli_state *cli, /**************************************************************************** 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; @@ -987,7 +987,7 @@ BOOL samr_del_aliasmem(struct cli_state *cli, 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; @@ -1017,7 +1017,7 @@ BOOL samr_del_aliasmem(struct cli_state *cli, /**************************************************************************** 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; @@ -1042,7 +1042,7 @@ BOOL samr_add_aliasmem(struct cli_state *cli, 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; @@ -1072,7 +1072,7 @@ BOOL samr_add_aliasmem(struct cli_state *cli, /**************************************************************************** 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; @@ -1097,7 +1097,7 @@ BOOL samr_delete_dom_alias(struct cli_state *cli, 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; @@ -1127,7 +1127,7 @@ BOOL samr_delete_dom_alias(struct cli_state *cli, /**************************************************************************** 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) { @@ -1153,7 +1153,7 @@ BOOL samr_create_dom_alias(struct cli_state *cli, 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; @@ -1185,7 +1185,7 @@ BOOL samr_create_dom_alias(struct cli_state *cli, /**************************************************************************** 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; @@ -1210,7 +1210,7 @@ BOOL samr_set_aliasinfo(struct cli_state *cli, 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; @@ -1240,7 +1240,7 @@ BOOL samr_set_aliasinfo(struct cli_state *cli, /**************************************************************************** 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) @@ -1267,7 +1267,7 @@ BOOL samr_open_group(struct cli_state *cli, 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; @@ -1298,7 +1298,7 @@ BOOL samr_open_group(struct cli_state *cli, /**************************************************************************** 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; @@ -1323,7 +1323,7 @@ BOOL samr_del_groupmem(struct cli_state *cli, 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; @@ -1353,7 +1353,7 @@ BOOL samr_del_groupmem(struct cli_state *cli, /**************************************************************************** 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; @@ -1378,7 +1378,7 @@ BOOL samr_add_groupmem(struct cli_state *cli, 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; @@ -1408,7 +1408,7 @@ BOOL samr_add_groupmem(struct cli_state *cli, /**************************************************************************** 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; @@ -1432,7 +1432,7 @@ BOOL samr_delete_dom_group(struct cli_state *cli, POLICY_HND *group_pol) 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; @@ -1462,7 +1462,7 @@ BOOL samr_delete_dom_group(struct cli_state *cli, POLICY_HND *group_pol) /**************************************************************************** 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) { @@ -1488,7 +1488,7 @@ BOOL samr_create_dom_group(struct cli_state *cli, 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; @@ -1520,7 +1520,7 @@ BOOL samr_create_dom_group(struct cli_state *cli, /**************************************************************************** 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; @@ -1545,7 +1545,7 @@ BOOL samr_set_groupinfo(struct cli_state *cli, 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; @@ -1575,7 +1575,7 @@ BOOL samr_set_groupinfo(struct cli_state *cli, /**************************************************************************** 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) { @@ -1603,7 +1603,7 @@ BOOL samr_open_domain(struct cli_state *cli, 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; @@ -1634,7 +1634,7 @@ BOOL samr_open_domain(struct cli_state *cli, /**************************************************************************** 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, @@ -1664,7 +1664,7 @@ BOOL samr_query_lookup_names(struct cli_state *cli, 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; @@ -1719,7 +1719,7 @@ BOOL samr_query_lookup_names(struct cli_state *cli, /**************************************************************************** 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, @@ -1749,7 +1749,7 @@ BOOL samr_query_lookup_rids(struct cli_state *cli, 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; @@ -1804,7 +1804,7 @@ BOOL samr_query_lookup_rids(struct cli_state *cli, /**************************************************************************** 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) { @@ -1830,7 +1830,7 @@ BOOL samr_query_aliasmem(struct cli_state *cli, 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; @@ -1865,7 +1865,7 @@ BOOL samr_query_aliasmem(struct cli_state *cli, /**************************************************************************** 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) { @@ -1891,7 +1891,7 @@ BOOL samr_query_useraliases(struct cli_state *cli, 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; @@ -1926,7 +1926,7 @@ BOOL samr_query_useraliases(struct cli_state *cli, /**************************************************************************** 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) { @@ -1952,7 +1952,7 @@ BOOL samr_query_groupmem(struct cli_state *cli, 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; @@ -1990,7 +1990,7 @@ BOOL samr_query_groupmem(struct cli_state *cli, /**************************************************************************** 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; @@ -2015,7 +2015,7 @@ BOOL samr_query_usergroups(struct cli_state *cli, 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; @@ -2050,7 +2050,7 @@ BOOL samr_query_usergroups(struct cli_state *cli, /**************************************************************************** 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) { @@ -2076,7 +2076,7 @@ BOOL samr_query_groupinfo(struct cli_state *cli, 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; @@ -2115,7 +2115,7 @@ BOOL samr_query_groupinfo(struct cli_state *cli, /**************************************************************************** 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; @@ -2140,7 +2140,7 @@ BOOL samr_query_userinfo(struct cli_state *cli, 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; @@ -2179,7 +2179,7 @@ BOOL samr_query_userinfo(struct cli_state *cli, /**************************************************************************** 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; @@ -2203,7 +2203,7 @@ BOOL samr_close(struct cli_state *cli, POLICY_HND *hnd) 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; diff --git a/source3/rpc_client/cli_srvsvc.c b/source3/rpc_client/cli_srvsvc.c index d42a2985f0..86862c7a2a 100644 --- a/source3/rpc_client/cli_srvsvc.c +++ b/source3/rpc_client/cli_srvsvc.c @@ -34,7 +34,7 @@ extern int DEBUGLEVEL; /**************************************************************************** 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, @@ -70,7 +70,7 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, 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; @@ -111,7 +111,7 @@ BOOL do_srv_net_srv_conn_enum(struct cli_state *cli, /**************************************************************************** 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, @@ -147,7 +147,7 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, 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; @@ -188,7 +188,7 @@ BOOL do_srv_net_srv_sess_enum(struct cli_state *cli, /**************************************************************************** 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, @@ -226,7 +226,7 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, 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; @@ -267,7 +267,7 @@ BOOL do_srv_net_srv_share_enum(struct cli_state *cli, /**************************************************************************** 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, @@ -305,7 +305,7 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, 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; @@ -346,7 +346,7 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, /**************************************************************************** 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; @@ -370,7 +370,7 @@ BOOL do_srv_net_srv_get_info(struct cli_state *cli, 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; diff --git a/source3/rpc_client/cli_wkssvc.c b/source3/rpc_client/cli_wkssvc.c index e45016c1b8..06ba8b88c8 100644 --- a/source3/rpc_client/cli_wkssvc.c +++ b/source3/rpc_client/cli_wkssvc.c @@ -34,7 +34,7 @@ extern int DEBUGLEVEL; /**************************************************************************** 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) { @@ -59,7 +59,7 @@ BOOL do_wks_query_info(struct cli_state *cli, 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; diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index c222d0a0e0..cfde752901 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -44,6 +44,7 @@ nt lsa query ****************************************************************************/ void cmd_lsa_query_info(struct client_info *info) { + uint16 nt_pipe_fnum; fstring srv_name; BOOL res = True; @@ -62,29 +63,29 @@ void cmd_lsa_query_info(struct client_info *info) DEBUG(5, ("cmd_lsa_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False; /* lookup domain controller; receive a policy handle */ - res = res ? lsa_open_policy(smb_cli, + res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum, srv_name, &info->dom.lsa_info_pol, False) : False; /* send client info query, level 3. receive domain name and sid */ - res = res ? lsa_query_info_pol(smb_cli, + res = res ? lsa_query_info_pol(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol, 0x03, info->dom.level3_dom, &info->dom.level3_sid) : False; /* send client info query, level 5. receive domain name and sid */ - res = res ? lsa_query_info_pol(smb_cli, + res = res ? lsa_query_info_pol(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol, 0x05, info->dom.level5_dom, &info->dom.level5_sid) : False; - res = res ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False; + res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { @@ -125,6 +126,7 @@ lookup names ****************************************************************************/ void cmd_lsa_lookup_names(struct client_info *info) { + uint16 nt_pipe_fnum; fstring temp; int i; fstring srv_name; @@ -157,23 +159,23 @@ void cmd_lsa_lookup_names(struct client_info *info) } /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False; /* lookup domain controller; receive a policy handle */ - res = res ? lsa_open_policy(smb_cli, + res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum, srv_name, &info->dom.lsa_info_pol, True) : False; /* send lsa lookup sids call */ - res = res ? lsa_lookup_names(smb_cli, + res = res ? lsa_lookup_names(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol, num_names, names, &sids, &num_sids) : False; - res = res ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False; + res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { @@ -215,6 +217,7 @@ lookup sids ****************************************************************************/ void cmd_lsa_lookup_sids(struct client_info *info) { + uint16 nt_pipe_fnum; fstring temp; int i; pstring sid_name; @@ -264,23 +267,23 @@ void cmd_lsa_lookup_sids(struct client_info *info) } /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &nt_pipe_fnum) : False; /* lookup domain controller; receive a policy handle */ - res = res ? lsa_open_policy(smb_cli, + res = res ? lsa_open_policy(smb_cli, nt_pipe_fnum, srv_name, &info->dom.lsa_info_pol, True) : False; /* send lsa lookup sids call */ - res = res ? lsa_lookup_sids(smb_cli, + res = res ? lsa_lookup_sids(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol, num_sids, sids, &names, &num_names) : False; - res = res ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False; + res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 2c8514b43e..6001327862 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -43,6 +43,7 @@ experimental nt login. ****************************************************************************/ void cmd_netlogon_login_test(struct client_info *info) { + uint16 nt_pipe_fnum; extern BOOL global_machine_password_needs_changing; fstring nt_user_name; @@ -89,16 +90,16 @@ void cmd_netlogon_login_test(struct client_info *info) info->mach_acct, new_mach_pwd) : False; #endif /* open NETLOGON session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_NETLOGON) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_NETLOGON, &nt_pipe_fnum) : False; - res = res ? cli_nt_setup_creds(smb_cli, trust_passwd) : False; + res = res ? cli_nt_setup_creds(smb_cli, nt_pipe_fnum, trust_passwd) : False; /* change the machine password? */ if (global_machine_password_needs_changing) { unsigned char new_trust_passwd[16]; generate_random_buffer(new_trust_passwd, 16, True); - res = res ? cli_nt_srv_pwset(smb_cli, new_trust_passwd) : False; + res = res ? cli_nt_srv_pwset(smb_cli, nt_pipe_fnum, new_trust_passwd) : False; if (res) { @@ -111,7 +112,7 @@ void cmd_netlogon_login_test(struct client_info *info) memset(trust_passwd, 0, 16); /* do an NT login */ - res = res ? cli_nt_login_interactive(smb_cli, + res = res ? cli_nt_login_interactive(smb_cli, nt_pipe_fnum, smb_cli->domain, nt_user_name, getuid(), nt_password, &info->dom.ctr, &info->dom.user_info3) : False; @@ -122,10 +123,10 @@ void cmd_netlogon_login_test(struct client_info *info) /* ok! you're logged in! do anything you like, then... */ /* do an NT logout */ - res = res ? cli_nt_logoff(smb_cli, &info->dom.ctr) : False; + res = res ? cli_nt_logoff(smb_cli, nt_pipe_fnum, &info->dom.ctr) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); fprintf(out_hnd,"cmd_nt_login: login (%s) test succeeded: %s\n", nt_user_name, BOOLSTR(res)); diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index 53936a3cf3..f6a8a0a898 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -60,6 +60,7 @@ nt registry enum ****************************************************************************/ void cmd_reg_enum(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res1 = True; BOOL res2 = True; @@ -99,16 +100,16 @@ void cmd_reg_enum(struct client_info *info) } /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, full_keyname, key_name, + res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name, &info->dom.reg_pol_connect) : False; if ((*key_name) != 0) { /* open an entry */ - res1 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res1 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; } else @@ -116,7 +117,7 @@ void cmd_reg_enum(struct client_info *info) memcpy(&key_pol, &info->dom.reg_pol_connect, sizeof(key_pol)); } - res1 = res1 ? do_reg_query_key(smb_cli, + res1 = res1 ? do_reg_query_key(smb_cli, fnum, &key_pol, key_class, &max_class_len, &num_subkeys, &max_subkeylen, &max_subkeysize, @@ -141,7 +142,7 @@ void cmd_reg_enum(struct client_info *info) time_t key_mod_time; /* unknown 1a it */ - res2 = res1 ? do_reg_unknown_1a(smb_cli, &key_pol, + res2 = res1 ? do_reg_unknown_1a(smb_cli, fnum, &key_pol, &unk_1a_response) : False; if (res2 && unk_1a_response != 5) @@ -150,7 +151,7 @@ void cmd_reg_enum(struct client_info *info) } /* enum key */ - res2 = res2 ? do_reg_enum_key(smb_cli, &key_pol, + res2 = res2 ? do_reg_enum_key(smb_cli, fnum, &key_pol, i, enum_name, &enum_unk1, &enum_unk2, &key_mod_time) : False; @@ -181,7 +182,7 @@ void cmd_reg_enum(struct client_info *info) fstring val_name; /* unknown 1a it */ - res2 = res1 ? do_reg_unknown_1a(smb_cli, &key_pol, + res2 = res1 ? do_reg_unknown_1a(smb_cli, fnum, &key_pol, &unk_1a_response) : False; if (res2 && unk_1a_response != 5) @@ -190,7 +191,7 @@ void cmd_reg_enum(struct client_info *info) } /* enum key */ - res2 = res2 ? do_reg_enum_val(smb_cli, &key_pol, + res2 = res2 ? do_reg_enum_val(smb_cli, fnum, &key_pol, i, max_valnamelen, max_valbufsize, val_name, &val_type, &value) : False; @@ -205,12 +206,12 @@ void cmd_reg_enum(struct client_info *info) /* close the handles */ if ((*key_name) != 0) { - res1 = res1 ? do_reg_close(smb_cli, &key_pol) : False; + res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False; } - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1 && res2) { @@ -227,6 +228,7 @@ nt registry query key ****************************************************************************/ void cmd_reg_query_key(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res1 = True; @@ -258,16 +260,16 @@ void cmd_reg_query_key(struct client_info *info) } /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, full_keyname, key_name, + res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name, &info->dom.reg_pol_connect) : False; if ((*key_name) != 0) { /* open an entry */ - res1 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res1 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; } else @@ -275,7 +277,7 @@ void cmd_reg_query_key(struct client_info *info) memcpy(&key_pol, &info->dom.reg_pol_connect, sizeof(key_pol)); } - res1 = res1 ? do_reg_query_key(smb_cli, + res1 = res1 ? do_reg_query_key(smb_cli, fnum, &key_pol, key_class, &key_class_len, &num_subkeys, &max_subkeylen, &max_subkeysize, @@ -284,7 +286,7 @@ void cmd_reg_query_key(struct client_info *info) if (res1 && key_class_len != 0) { - res1 = res1 ? do_reg_query_key(smb_cli, + res1 = res1 ? do_reg_query_key(smb_cli, fnum, &key_pol, key_class, &key_class_len, &num_subkeys, &max_subkeylen, &max_subkeysize, @@ -305,12 +307,12 @@ void cmd_reg_query_key(struct client_info *info) /* close the handles */ if ((*key_name) != 0) { - res1 = res1 ? do_reg_close(smb_cli, &key_pol) : False; + res1 = res1 ? do_reg_close(smb_cli, fnum, &key_pol) : False; } - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1) { @@ -327,6 +329,7 @@ nt registry create value ****************************************************************************/ void cmd_reg_create_val(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res3 = True; BOOL res4 = True; @@ -344,7 +347,7 @@ void cmd_reg_create_val(struct client_info *info) uint32 unk_0; uint32 unk_1; /* query it */ - res1 = res1 ? do_reg_query_info(smb_cli, &val_pol, + res1 = res1 ? do_reg_query_info(smb_cli, fnum, &val_pol, type, &unk_0, &unk_1) : False; #endif @@ -421,16 +424,16 @@ void cmd_reg_create_val(struct client_info *info) dump_data(10, (char *)value.buffer, value.buf_len); /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, keyname, parent_name, + res = res ? do_reg_connect(smb_cli, fnum, keyname, parent_name, &info->dom.reg_pol_connect) : False; if ((*val_name) != 0) { /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, parent_name, 0x02000000, &parent_pol) : False; } else @@ -439,23 +442,23 @@ void cmd_reg_create_val(struct client_info *info) } /* create an entry */ - res4 = res3 ? do_reg_create_val(smb_cli, &parent_pol, + res4 = res3 ? do_reg_create_val(smb_cli, fnum, &parent_pol, val_name, val_type, &value) : False; /* flush the modified key */ - res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False; + res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False; /* close the val handle */ if ((*val_name) != 0) { - res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False; + res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False; } /* close the registry handles */ - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res3 && res4) { @@ -473,6 +476,7 @@ nt registry delete value ****************************************************************************/ void cmd_reg_delete_val(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res3 = True; BOOL res4 = True; @@ -500,16 +504,16 @@ void cmd_reg_delete_val(struct client_info *info) } /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, keyname, parent_name, + res = res ? do_reg_connect(smb_cli, fnum, keyname, parent_name, &info->dom.reg_pol_connect) : False; if ((*val_name) != 0) { /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, parent_name, 0x02000000, &parent_pol) : False; } else @@ -518,19 +522,19 @@ void cmd_reg_delete_val(struct client_info *info) } /* delete an entry */ - res4 = res3 ? do_reg_delete_val(smb_cli, &parent_pol, val_name) : False; + res4 = res3 ? do_reg_delete_val(smb_cli, fnum, &parent_pol, val_name) : False; /* flush the modified key */ - res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False; + res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False; /* close the key handle */ - res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False; + res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False; /* close the registry handles */ - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res3 && res4) { @@ -548,6 +552,7 @@ nt registry delete key ****************************************************************************/ void cmd_reg_delete_key(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res3 = True; BOOL res4 = True; @@ -575,16 +580,16 @@ void cmd_reg_delete_key(struct client_info *info) } /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, parent_name, key_name, + res = res ? do_reg_connect(smb_cli, fnum, parent_name, key_name, &info->dom.reg_pol_connect) : False; if ((*key_name) != 0) { /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &parent_pol) : False; } else @@ -593,22 +598,22 @@ void cmd_reg_delete_key(struct client_info *info) } /* create an entry */ - res4 = res3 ? do_reg_delete_key(smb_cli, &parent_pol, subkey_name) : False; + res4 = res3 ? do_reg_delete_key(smb_cli, fnum, &parent_pol, subkey_name) : False; /* flush the modified key */ - res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False; + res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False; /* close the key handle */ if ((*key_name) != 0) { - res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False; + res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False; } /* close the registry handles */ - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res3 && res4) { @@ -626,6 +631,7 @@ nt registry create key ****************************************************************************/ void cmd_reg_create_key(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res3 = True; BOOL res4 = True; @@ -664,16 +670,16 @@ void cmd_reg_create_key(struct client_info *info) sam_access.mask = SEC_RIGHTS_READ; /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, parent_key, parent_name, + res = res ? do_reg_connect(smb_cli, fnum, parent_key, parent_name, &info->dom.reg_pol_connect) : False; if ((*parent_name) != 0) { /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, parent_name, 0x02000000, &parent_pol) : False; } else @@ -682,26 +688,26 @@ void cmd_reg_create_key(struct client_info *info) } /* create an entry */ - res4 = res3 ? do_reg_create_key(smb_cli, &parent_pol, + res4 = res3 ? do_reg_create_key(smb_cli, fnum, &parent_pol, key_name, key_class, &sam_access, &key_pol) : False; /* flush the modified key */ - res4 = res4 ? do_reg_flush_key(smb_cli, &parent_pol) : False; + res4 = res4 ? do_reg_flush_key(smb_cli, fnum, &parent_pol) : False; /* close the key handle */ - res4 = res4 ? do_reg_close(smb_cli, &key_pol) : False; + res4 = res4 ? do_reg_close(smb_cli, fnum, &key_pol) : False; /* close the key handle */ if ((*parent_name) != 0) { - res3 = res3 ? do_reg_close(smb_cli, &parent_pol) : False; + res3 = res3 ? do_reg_close(smb_cli, fnum, &parent_pol) : False; } /* close the registry handles */ - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res3 && res4) { @@ -719,6 +725,7 @@ nt registry security info ****************************************************************************/ void cmd_reg_test_key_sec(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res3 = True; BOOL res4 = True; @@ -743,16 +750,16 @@ void cmd_reg_test_key_sec(struct client_info *info) } /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, full_keyname, key_name, + res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name, &info->dom.reg_pol_connect) : False; if ((*key_name) != 0) { /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; } else @@ -761,14 +768,14 @@ void cmd_reg_test_key_sec(struct client_info *info) } /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; /* query key sec info. first call sets sec_buf_size. */ sec_buf_size = 0; ZERO_STRUCT(sec_buf); - res4 = res3 ? do_reg_get_key_sec(smb_cli, &key_pol, + res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, &sec_buf_size, &sec_buf) : False; if (res4) @@ -776,7 +783,7 @@ void cmd_reg_test_key_sec(struct client_info *info) free_sec_desc_buf(&sec_buf); } - res4 = res4 ? do_reg_get_key_sec(smb_cli, &key_pol, + res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, &sec_buf_size, &sec_buf) : False; if (res4 && sec_buf.len > 0 && sec_buf.sec != NULL) @@ -785,7 +792,7 @@ void cmd_reg_test_key_sec(struct client_info *info) display_sec_desc(out_hnd, ACTION_ENUMERATE, sec_buf.sec); display_sec_desc(out_hnd, ACTION_FOOTER , sec_buf.sec); - res4 = res4 ? do_reg_set_key_sec(smb_cli, &key_pol, + res4 = res4 ? do_reg_set_key_sec(smb_cli, fnum, &key_pol, sec_buf_size, sec_buf.sec) : False; free_sec_desc_buf(&sec_buf); @@ -794,14 +801,14 @@ void cmd_reg_test_key_sec(struct client_info *info) /* close the key handle */ if ((*key_name) != 0) { - res3 = res3 ? do_reg_close(smb_cli, &key_pol) : False; + res3 = res3 ? do_reg_close(smb_cli, fnum, &key_pol) : False; } /* close the registry handles */ - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res3 && res4) { @@ -819,6 +826,7 @@ nt registry security info ****************************************************************************/ void cmd_reg_get_key_sec(struct client_info *info) { + uint16 fnum; BOOL res = True; BOOL res3 = True; BOOL res4 = True; @@ -843,16 +851,16 @@ void cmd_reg_get_key_sec(struct client_info *info) } /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG, &fnum) : False; /* open registry receive a policy handle */ - res = res ? do_reg_connect(smb_cli, full_keyname, key_name, + res = res ? do_reg_connect(smb_cli, fnum, full_keyname, key_name, &info->dom.reg_pol_connect) : False; if ((*key_name) != 0) { /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; } else @@ -861,14 +869,14 @@ void cmd_reg_get_key_sec(struct client_info *info) } /* open an entry */ - res3 = res ? do_reg_open_entry(smb_cli, &info->dom.reg_pol_connect, + res3 = res ? do_reg_open_entry(smb_cli, fnum, &info->dom.reg_pol_connect, key_name, 0x02000000, &key_pol) : False; /* query key sec info. first call sets sec_buf_size. */ sec_buf_size = 0; ZERO_STRUCT(sec_buf); - res4 = res3 ? do_reg_get_key_sec(smb_cli, &key_pol, + res4 = res3 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, &sec_buf_size, &sec_buf) : False; if (res4) @@ -876,7 +884,7 @@ void cmd_reg_get_key_sec(struct client_info *info) free_sec_desc_buf(&sec_buf); } - res4 = res4 ? do_reg_get_key_sec(smb_cli, &key_pol, + res4 = res4 ? do_reg_get_key_sec(smb_cli, fnum, &key_pol, &sec_buf_size, &sec_buf) : False; if (res4 && sec_buf.len > 0 && sec_buf.sec != NULL) @@ -891,14 +899,14 @@ void cmd_reg_get_key_sec(struct client_info *info) /* close the key handle */ if ((*key_name) != 0) { - res3 = res3 ? do_reg_close(smb_cli, &key_pol) : False; + res3 = res3 ? do_reg_close(smb_cli, fnum, &key_pol) : False; } /* close the registry handles */ - res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; + res = res ? do_reg_close(smb_cli, fnum, &info->dom.reg_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res3 && res4) { diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index fb2accfc4d..31f74906db 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -43,6 +43,7 @@ SAM password change ****************************************************************************/ void cmd_sam_ntchange_pwd(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -91,18 +92,18 @@ void cmd_sam_ntchange_pwd(struct client_info *info) NTLMSSP_NEGOTIATE_00002000); /* open SAMR session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_unknown_38(smb_cli, srv_name) : False; + res = res ? samr_unknown_38(smb_cli, fnum, srv_name) : False; /* establish a connection. */ - res = res ? samr_chgpasswd_user(smb_cli, + res = res ? samr_chgpasswd_user(smb_cli, fnum, srv_name, smb_cli->user_name, nt_newpass, nt_hshhash, lm_newpass, lm_hshhash) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -120,6 +121,7 @@ experimental SAM encryted rpc test connection ****************************************************************************/ void cmd_sam_test(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -153,13 +155,13 @@ void cmd_sam_test(struct client_info *info) NTLMSSP_NEGOTIATE_00002000); /* open SAMR session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_unknown_38(smb_cli, srv_name) : False; + res = res ? samr_unknown_38(smb_cli, fnum, srv_name) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -176,6 +178,7 @@ SAM delete alias member. ****************************************************************************/ void cmd_sam_del_aliasmem(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring tmp; @@ -213,20 +216,20 @@ void cmd_sam_del_aliasmem(struct client_info *info) fprintf(out_hnd, "SAM Domain Alias Member\n"); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* connect to the domain */ - res1 = res ? samr_open_alias(smb_cli, + res1 = res ? samr_open_alias(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x000f001f, alias_rid, &alias_pol) : False; @@ -234,7 +237,7 @@ void cmd_sam_del_aliasmem(struct client_info *info) { /* get a sid, delete a member from the alias */ res2 = res2 ? string_to_sid(&member_sid, tmp) : False; - res2 = res2 ? samr_del_aliasmem(smb_cli, &alias_pol, &member_sid) : False; + res2 = res2 ? samr_del_aliasmem(smb_cli, fnum, &alias_pol, &member_sid) : False; if (res2) { @@ -242,12 +245,12 @@ void cmd_sam_del_aliasmem(struct client_info *info) } } - res1 = res1 ? samr_close(smb_cli, &alias_pol) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; + res1 = res1 ? samr_close(smb_cli, fnum, &alias_pol) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1 && res2) { @@ -266,6 +269,7 @@ SAM delete alias. ****************************************************************************/ void cmd_sam_delete_dom_alias(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring name; @@ -305,21 +309,21 @@ void cmd_sam_delete_dom_alias(struct client_info *info) fprintf(out_hnd, "SAM Delete Domain Alias\n"); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; names[0] = name; - res1 = res ? samr_query_lookup_names(smb_cli, + res1 = res ? samr_query_lookup_names(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x000003e8, 1, names, &num_rids, rid, type) : False; @@ -330,18 +334,18 @@ void cmd_sam_delete_dom_alias(struct client_info *info) } /* connect to the domain */ - res1 = res1 ? samr_open_alias(smb_cli, + res1 = res1 ? samr_open_alias(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x000f001f, alias_rid, &alias_pol) : False; - res2 = res1 ? samr_delete_dom_alias(smb_cli, &alias_pol) : False; + res2 = res1 ? samr_delete_dom_alias(smb_cli, fnum, &alias_pol) : False; - res1 = res1 ? samr_close(smb_cli, &alias_pol) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; + res1 = res1 ? samr_close(smb_cli, fnum, &alias_pol) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1 && res2) { @@ -361,6 +365,8 @@ SAM add alias member. ****************************************************************************/ void cmd_sam_add_aliasmem(struct client_info *info) { + uint16 fnum; + uint16 fnum_lsa; fstring srv_name; fstring domain; fstring tmp; @@ -415,22 +421,22 @@ void cmd_sam_add_aliasmem(struct client_info *info) fprintf(out_hnd, "SAM Domain Alias Member\n"); /* open LSARPC session. */ - res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False; + res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &fnum_lsa) : False; /* lookup domain controller; receive a policy handle */ - res3 = res3 ? lsa_open_policy(smb_cli, + res3 = res3 ? lsa_open_policy(smb_cli, fnum, srv_name, &info->dom.lsa_info_pol, True) : False; /* send lsa lookup sids call */ - res4 = res3 ? lsa_lookup_names(smb_cli, + res4 = res3 ? lsa_lookup_names(smb_cli, fnum, &info->dom.lsa_info_pol, num_names, names, &sids, &num_sids) : False; - res3 = res3 ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False; + res3 = res3 ? lsa_close(smb_cli, fnum, &info->dom.lsa_info_pol) : False; - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum_lsa); res4 = num_sids < 2 ? False : res4; @@ -455,27 +461,27 @@ void cmd_sam_add_aliasmem(struct client_info *info) } /* open SAMR session. negotiate credentials */ - res = res4 ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res4 ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* connect to the domain */ - res1 = res ? samr_open_alias(smb_cli, + res1 = res ? samr_open_alias(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x000f001f, alias_rid, &alias_pol) : False; for (i = 1; i < num_sids && res2 && res1; i++) { /* add a member to the alias */ - res2 = res2 ? samr_add_aliasmem(smb_cli, &alias_pol, &sids[i]) : False; + res2 = res2 ? samr_add_aliasmem(smb_cli, fnum, &alias_pol, &sids[i]) : False; if (res2) { @@ -484,12 +490,12 @@ void cmd_sam_add_aliasmem(struct client_info *info) } } - res1 = res1 ? samr_close(smb_cli, &alias_pol) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; + res1 = res1 ? samr_close(smb_cli, fnum, &alias_pol) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (sids != NULL) { @@ -526,6 +532,7 @@ SAM create domain alias. ****************************************************************************/ void cmd_sam_create_dom_alias(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring acct_name; @@ -568,31 +575,31 @@ void cmd_sam_create_dom_alias(struct client_info *info) domain, acct_name, acct_desc); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* create a domain alias */ - res1 = res ? create_samr_domain_alias(smb_cli, + res1 = res ? create_samr_domain_alias(smb_cli, fnum, &info->dom.samr_pol_open_domain, acct_name, acct_desc, &alias_rid) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1) { @@ -612,6 +619,7 @@ SAM delete group member. ****************************************************************************/ void cmd_sam_del_groupmem(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring tmp; @@ -649,20 +657,20 @@ void cmd_sam_del_groupmem(struct client_info *info) fprintf(out_hnd, "SAM Add Domain Group member\n"); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* connect to the domain */ - res1 = res ? samr_open_group(smb_cli, + res1 = res ? samr_open_group(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x0000001f, group_rid, &group_pol) : False; @@ -670,7 +678,7 @@ void cmd_sam_del_groupmem(struct client_info *info) { /* get a rid, delete a member from the group */ member_rid = get_number(tmp); - res2 = res2 ? samr_del_groupmem(smb_cli, &group_pol, member_rid) : False; + res2 = res2 ? samr_del_groupmem(smb_cli, fnum, &group_pol, member_rid) : False; if (res2) { @@ -678,12 +686,12 @@ void cmd_sam_del_groupmem(struct client_info *info) } } - res1 = res1 ? samr_close(smb_cli, &group_pol) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; + res1 = res1 ? samr_close(smb_cli, fnum, &group_pol) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1 && res2) { @@ -703,6 +711,7 @@ SAM delete group. ****************************************************************************/ void cmd_sam_delete_dom_group(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring name; @@ -742,21 +751,21 @@ void cmd_sam_delete_dom_group(struct client_info *info) fprintf(out_hnd, "SAM Delete Domain Group\n"); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; names[0] = name; - res1 = res ? samr_query_lookup_names(smb_cli, + res1 = res ? samr_query_lookup_names(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x000003e8, 1, names, &num_rids, rid, type) : False; @@ -767,18 +776,18 @@ void cmd_sam_delete_dom_group(struct client_info *info) } /* connect to the domain */ - res1 = res1 ? samr_open_group(smb_cli, + res1 = res1 ? samr_open_group(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x0000001f, group_rid, &group_pol) : False; - res2 = res1 ? samr_delete_dom_group(smb_cli, &group_pol) : False; + res2 = res1 ? samr_delete_dom_group(smb_cli, fnum, &group_pol) : False; - res1 = res1 ? samr_close(smb_cli, &group_pol) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; + res1 = res1 ? samr_close(smb_cli, fnum, &group_pol) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1 && res2) { @@ -798,6 +807,7 @@ SAM add group member. ****************************************************************************/ void cmd_sam_add_groupmem(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring tmp; @@ -851,19 +861,19 @@ void cmd_sam_add_groupmem(struct client_info *info) fprintf(out_hnd, "SAM Add Domain Group member\n"); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; - res1 = res ? samr_query_lookup_names(smb_cli, + res1 = res ? samr_query_lookup_names(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x000003e8, num_names, names, &num_rids, rid, type) : False; @@ -874,13 +884,13 @@ void cmd_sam_add_groupmem(struct client_info *info) } /* connect to the domain */ - res1 = res1 ? samr_open_group(smb_cli, + res1 = res1 ? samr_open_group(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x0000001f, group_rid, &group_pol) : False; for (i = 1; i < num_rids && res2 && res1; i++) { - res2 = res2 ? samr_add_groupmem(smb_cli, &group_pol, rid[i]) : False; + res2 = res2 ? samr_add_groupmem(smb_cli, fnum, &group_pol, rid[i]) : False; if (res2) { @@ -888,12 +898,12 @@ void cmd_sam_add_groupmem(struct client_info *info) } } - res1 = res1 ? samr_close(smb_cli, &group_pol) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; + res1 = res1 ? samr_close(smb_cli, fnum, &group_pol) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (names != NULL) { @@ -925,6 +935,7 @@ SAM create domain group. ****************************************************************************/ void cmd_sam_create_dom_group(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring acct_name; @@ -967,31 +978,31 @@ void cmd_sam_create_dom_group(struct client_info *info) domain, acct_name, acct_desc); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* read some users */ - res1 = res ? create_samr_domain_group(smb_cli, + res1 = res ? create_samr_domain_group(smb_cli, fnum, &info->dom.samr_pol_open_domain, acct_name, acct_desc, &group_rid) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res && res1) { @@ -1011,6 +1022,7 @@ experimental SAM users enum. ****************************************************************************/ void cmd_sam_enum_users(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -1094,27 +1106,27 @@ void cmd_sam_enum_users(struct client_info *info) #endif /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* connect to the S-1-5-20 domain */ - res1 = res ? samr_open_domain(smb_cli, + res1 = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid_1_5_20, &info->dom.samr_pol_open_builtindom) : False; info->dom.sam = NULL; /* read some users */ - res = res ? samr_enum_dom_users(smb_cli, + res = res ? samr_enum_dom_users(smb_cli, fnum, &info->dom.samr_pol_open_domain, num_entries, unk_0, acb_mask, unk_1, 0xffff, &info->dom.sam, &info->dom.num_sam_entries) : False; @@ -1137,7 +1149,7 @@ void cmd_sam_enum_users(struct client_info *info) if (request_user_info) { /* send user info query, level 0x15 */ - if (get_samr_query_userinfo(smb_cli, + if (get_samr_query_userinfo(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x15, user_rid, &usr)) { @@ -1153,7 +1165,7 @@ void cmd_sam_enum_users(struct client_info *info) DOM_GID gid[LSA_MAX_GROUPS]; /* send user group query */ - if (get_samr_query_usergroups(smb_cli, + if (get_samr_query_usergroups(smb_cli, fnum, &info->dom.samr_pol_open_domain, user_rid, &num_groups, gid)) { @@ -1167,7 +1179,7 @@ void cmd_sam_enum_users(struct client_info *info) rid_mem[i] = gid[i].g_rid; } - if (samr_query_lookup_rids(smb_cli, + if (samr_query_lookup_rids(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x3e8, num_groups, rid_mem, &num_names, name, type)) @@ -1189,7 +1201,7 @@ void cmd_sam_enum_users(struct client_info *info) sid_append_rid(&als_sid, user_rid); /* send user alias query */ - if (samr_query_useraliases(smb_cli, + if (samr_query_useraliases(smb_cli, fnum, &info->dom.samr_pol_open_domain, &als_sid, &num_aliases, rid)) { @@ -1197,7 +1209,7 @@ void cmd_sam_enum_users(struct client_info *info) fstring name [MAX_LOOKUP_SIDS]; uint32 type [MAX_LOOKUP_SIDS]; - if (samr_query_lookup_rids(smb_cli, + if (samr_query_lookup_rids(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x3e8, num_aliases, rid, &num_names, name, type)) @@ -1209,7 +1221,7 @@ void cmd_sam_enum_users(struct client_info *info) } /* send user alias query */ - if (res1 && samr_query_useraliases(smb_cli, + if (res1 && samr_query_useraliases(smb_cli, fnum, &info->dom.samr_pol_open_builtindom, &als_sid, &num_aliases, rid)) { @@ -1217,7 +1229,7 @@ void cmd_sam_enum_users(struct client_info *info) fstring name [MAX_LOOKUP_SIDS]; uint32 type [MAX_LOOKUP_SIDS]; - if (samr_query_lookup_rids(smb_cli, + if (samr_query_lookup_rids(smb_cli, fnum, &info->dom.samr_pol_open_builtindom, 0x3e8, num_aliases, rid, &num_names, name, type)) @@ -1230,17 +1242,17 @@ void cmd_sam_enum_users(struct client_info *info) } } - res1 = res1 ? samr_close(smb_cli, + res1 = res1 ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_builtindom) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (info->dom.sam != NULL) { @@ -1263,6 +1275,7 @@ experimental SAM user query. ****************************************************************************/ void cmd_sam_query_user(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -1305,15 +1318,15 @@ void cmd_sam_query_user(struct client_info *info) info->myhostname, srv_name, domain, sid); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; @@ -1322,7 +1335,7 @@ void cmd_sam_query_user(struct client_info *info) info->dom.sam[user_idx].acct_name); /* send user info query, level */ - if (get_samr_query_userinfo(smb_cli, + if (get_samr_query_userinfo(smb_cli, fnum, &info->dom.samr_pol_open_domain, info_level, user_rid, &usr)) { @@ -1334,14 +1347,14 @@ void cmd_sam_query_user(struct client_info *info) } } - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -1359,6 +1372,7 @@ experimental SAM domain info query. ****************************************************************************/ void cmd_sam_query_dominfo(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -1393,30 +1407,30 @@ void cmd_sam_query_dominfo(struct client_info *info) info->myhostname, srv_name, domain, sid); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; /* send a samr 0x8 command */ - res = res ? samr_query_dom_info(smb_cli, + res = res ? samr_query_dom_info(smb_cli, fnum, &info->dom.samr_pol_open_domain, switch_value) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (res) { @@ -1434,6 +1448,7 @@ experimental SAM aliases query. ****************************************************************************/ void cmd_sam_enum_aliases(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -1472,22 +1487,22 @@ void cmd_sam_enum_aliases(struct client_info *info) info->myhostname, srv_name, domain, sid); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; info->dom.sam = NULL; /* read some aliases */ - res = res ? samr_enum_dom_aliases(smb_cli, + res = res ? samr_enum_dom_aliases(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0xffff, &info->dom.sam, &info->dom.num_sam_entries) : False; @@ -1512,10 +1527,11 @@ void cmd_sam_enum_aliases(struct client_info *info) DOM_SID2 sid_mem[MAX_LOOKUP_SIDS]; /* send user aliases query */ - if (get_samr_query_aliasmem(smb_cli, + if (get_samr_query_aliasmem(smb_cli, fnum, &info->dom.samr_pol_open_domain, alias_rid, &num_aliases, sid_mem)) { + uint16 fnum_lsa; BOOL res3 = True; BOOL res4 = True; char **names = NULL; @@ -1523,8 +1539,6 @@ void cmd_sam_enum_aliases(struct client_info *info) DOM_SID **sids = NULL; int i; - uint16 old_fnum = smb_cli->nt_pipe_fnum; - if (num_aliases != 0) { sids = malloc(num_aliases * sizeof(DOM_SID*)); @@ -1540,24 +1554,22 @@ void cmd_sam_enum_aliases(struct client_info *info) } /* open LSARPC session. */ - res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC) : False; + res3 = res3 ? cli_nt_session_open(smb_cli, PIPE_LSARPC, &fnum_lsa) : False; /* lookup domain controller; receive a policy handle */ - res3 = res3 ? lsa_open_policy(smb_cli, + res3 = res3 ? lsa_open_policy(smb_cli, fnum, srv_name, &info->dom.lsa_info_pol, True) : False; /* send lsa lookup sids call */ - res4 = res3 ? lsa_lookup_sids(smb_cli, + res4 = res3 ? lsa_lookup_sids(smb_cli, fnum, &info->dom.lsa_info_pol, num_aliases, sids, &names, &num_names) : False; - res3 = res3 ? lsa_close(smb_cli, &info->dom.lsa_info_pol) : False; - - cli_nt_session_close(smb_cli); + res3 = res3 ? lsa_close(smb_cli, fnum, &info->dom.lsa_info_pol) : False; - smb_cli->nt_pipe_fnum = old_fnum; + cli_nt_session_close(smb_cli, fnum_lsa); if (res4 && names != NULL) { @@ -1584,14 +1596,14 @@ void cmd_sam_enum_aliases(struct client_info *info) } } - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; - res = res ? samr_close(smb_cli, + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (info->dom.sam != NULL) { @@ -1614,6 +1626,7 @@ experimental SAM groups query. ****************************************************************************/ void cmd_sam_enum_groups(struct client_info *info) { + uint16 fnum; fstring srv_name; fstring domain; fstring sid; @@ -1652,22 +1665,22 @@ void cmd_sam_enum_groups(struct client_info *info) info->myhostname, srv_name, domain, sid); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, + res = res ? samr_connect(smb_cli, fnum, srv_name, 0x00000020, &info->dom.samr_pol_connect) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, + res = res ? samr_open_domain(smb_cli, fnum, &info->dom.samr_pol_connect, flags, &sid1, &info->dom.samr_pol_open_domain) : False; info->dom.sam = NULL; /* read some groups */ - res = res ? samr_enum_dom_groups(smb_cli, + res = res ? samr_enum_dom_groups(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0xffff, &info->dom.sam, &info->dom.num_sam_entries) : False; @@ -1697,11 +1710,11 @@ void cmd_sam_enum_groups(struct client_info *info) uint32 type[MAX_LOOKUP_SIDS]; /* send user groups query */ - if (get_samr_query_groupmem(smb_cli, + if (get_samr_query_groupmem(smb_cli, fnum, &info->dom.samr_pol_open_domain, group_rid, &num_groups, rid_mem, attr_mem) && - samr_query_lookup_rids(smb_cli, + samr_query_lookup_rids(smb_cli, fnum, &info->dom.samr_pol_open_domain, 0x3e8, num_groups, rid_mem, &num_names, name, type)) @@ -1713,11 +1726,11 @@ void cmd_sam_enum_groups(struct client_info *info) } } - res = res ? samr_close(smb_cli, &info->dom.samr_pol_connect) : False; - res = res ? samr_close(smb_cli, &info->dom.samr_pol_open_domain) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_connect) : False; + res = res ? samr_close(smb_cli, fnum, &info->dom.samr_pol_open_domain) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, fnum); if (info->dom.sam != NULL) { diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c index f385cecb68..1be35608ee 100644 --- a/source3/rpcclient/cmd_srvsvc.c +++ b/source3/rpcclient/cmd_srvsvc.c @@ -43,6 +43,7 @@ server get info query ****************************************************************************/ void cmd_srv_query_info(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_srv; fstring tmp; SRV_INFO_CTR ctr; @@ -67,14 +68,14 @@ void cmd_srv_query_info(struct client_info *info) DEBUG(5, ("cmd_srv_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; /* send info level: receive requested info. hopefully. */ - res = res ? do_srv_net_srv_get_info(smb_cli, + res = res ? do_srv_net_srv_get_info(smb_cli, nt_pipe_fnum, dest_srv, info_level, &ctr) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { @@ -95,6 +96,7 @@ server enum connections ****************************************************************************/ void cmd_srv_enum_conn(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_srv; fstring qual_srv; fstring tmp; @@ -125,13 +127,13 @@ void cmd_srv_enum_conn(struct client_info *info) DEBUG(5, ("cmd_srv_enum_conn: smb_cli->fd:%d\n", smb_cli->fd)); /* open srvsvc session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; hnd.ptr_hnd = 1; hnd.handle = 0; /* enumerate connections on server */ - res = res ? do_srv_net_srv_conn_enum(smb_cli, + res = res ? do_srv_net_srv_conn_enum(smb_cli, nt_pipe_fnum, dest_srv, qual_srv, info_level, &ctr, 0xffffffff, &hnd) : False; @@ -143,7 +145,7 @@ void cmd_srv_enum_conn(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { @@ -160,6 +162,7 @@ server enum shares ****************************************************************************/ void cmd_srv_enum_shares(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_srv; fstring tmp; SRV_SHARE_INFO_CTR ctr; @@ -185,13 +188,13 @@ void cmd_srv_enum_shares(struct client_info *info) DEBUG(5, ("cmd_srv_enum_shares: smb_cli->fd:%d\n", smb_cli->fd)); /* open srvsvc session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; hnd.ptr_hnd = 0; hnd.handle = 0; /* enumerate shares_files on server */ - res = res ? do_srv_net_srv_share_enum(smb_cli, + res = res ? do_srv_net_srv_share_enum(smb_cli, nt_pipe_fnum, dest_srv, info_level, &ctr, 0xffffffff, &hnd) : False; @@ -203,7 +206,7 @@ void cmd_srv_enum_shares(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { @@ -220,6 +223,7 @@ server enum sessions ****************************************************************************/ void cmd_srv_enum_sess(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_srv; fstring tmp; SRV_SESS_INFO_CTR ctr; @@ -245,17 +249,17 @@ void cmd_srv_enum_sess(struct client_info *info) DEBUG(5, ("cmd_srv_enum_sess: smb_cli->fd:%d\n", smb_cli->fd)); /* open srvsvc session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; hnd.ptr_hnd = 1; hnd.handle = 0; /* enumerate sessions on server */ - res = res ? do_srv_net_srv_sess_enum(smb_cli, + res = res ? do_srv_net_srv_sess_enum(smb_cli, nt_pipe_fnum, dest_srv, NULL, info_level, &ctr, 0x1000, &hnd) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { @@ -272,6 +276,7 @@ server enum files ****************************************************************************/ void cmd_srv_enum_files(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_srv; fstring tmp; SRV_FILE_INFO_CTR ctr; @@ -297,13 +302,13 @@ void cmd_srv_enum_files(struct client_info *info) DEBUG(5, ("cmd_srv_enum_files: smb_cli->fd:%d\n", smb_cli->fd)); /* open srvsvc session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_SRVSVC, &nt_pipe_fnum) : False; hnd.ptr_hnd = 1; hnd.handle = 0; /* enumerate files on server */ - res = res ? do_srv_net_srv_file_enum(smb_cli, + res = res ? do_srv_net_srv_file_enum(smb_cli, nt_pipe_fnum, dest_srv, NULL, info_level, &ctr, 0x1000, &hnd) : False; if (res) @@ -314,7 +319,7 @@ void cmd_srv_enum_files(struct client_info *info) } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index ee1e9748a5..7915036609 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -43,6 +43,7 @@ workstation get info query ****************************************************************************/ void cmd_wks_query_info(struct client_info *info) { + uint16 nt_pipe_fnum; fstring dest_wks; fstring tmp; WKS_INFO_100 ctr; @@ -67,14 +68,14 @@ void cmd_wks_query_info(struct client_info *info) DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd)); /* open LSARPC session. */ - res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False; + res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC, &nt_pipe_fnum) : False; /* send info level: receive requested info. hopefully. */ - res = res ? do_wks_query_info(smb_cli, + res = res ? do_wks_query_info(smb_cli, nt_pipe_fnum, dest_wks, info_level, &ctr) : False; /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); if (res) { diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index f207bd507c..7bd4a5aae4 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -466,8 +466,6 @@ enum client_action fstrcpy(cli_info.dom.level3_dom, ""); fstrcpy(cli_info.dom.level5_dom, ""); - smb_cli->nt_pipe_fnum = 0xffff; - TimeInit(); charset_initialise(); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 8718e75c3b..726d93e404 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -1095,6 +1095,7 @@ BOOL domain_client_validate( char *user, char *domain, 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]; @@ -1174,19 +1175,19 @@ BOOL domain_client_validate( char *user, char *domain, * 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; @@ -1195,13 +1196,13 @@ machine %s. Error was : %s.\n", cli.desthost, cli_errstr(&cli))); /* 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; @@ -1218,17 +1219,17 @@ machine %s. Error was : %s.\n", cli.desthost, cli_errstr(&cli))); * 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; diff --git a/source3/utils/rpctorture.c b/source3/utils/rpctorture.c index 3b2a497ad4..c08db239b7 100644 --- a/source3/utils/rpctorture.c +++ b/source3/utils/rpctorture.c @@ -275,6 +275,7 @@ BOOL do_random_rpc(struct cli_state *cli, int max_len) 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)); @@ -300,7 +301,7 @@ static void random_rpc_pipe_enc(char *pipe_name, struct client_info *cli_info, 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) @@ -309,7 +310,7 @@ static void random_rpc_pipe_enc(char *pipe_name, struct client_info *cli_info, } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); } /* close the rpc pipe */ @@ -322,6 +323,7 @@ static void random_rpc_pipe_enc(char *pipe_name, struct client_info *cli_info, 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)); @@ -334,7 +336,7 @@ static void random_rpc_pipe(char *pipe_name, struct client_info *cli_info, } /* 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; @@ -350,7 +352,7 @@ static void random_rpc_pipe(char *pipe_name, struct client_info *cli_info, } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); /* close the rpc pipe */ rpcclient_stop(); @@ -388,6 +390,7 @@ static void run_randomrpc(int numops, struct client_info *cli_info) static void run_samhandles(int numops, struct client_info *cli_info) { + uint16 nt_pipe_fnum; int i; int count = 0; int failed = 0; @@ -412,7 +415,7 @@ static void run_samhandles(int numops, struct client_info *cli_info) } /* 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; @@ -440,7 +443,7 @@ static void run_samhandles(int numops, struct client_info *cli_info) } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); /* close the rpc pipe */ rpcclient_stop(); @@ -451,6 +454,7 @@ static void run_samhandles(int numops, struct client_info *cli_info) static void run_lsahandles(int numops, struct client_info *cli_info) { + uint16 nt_pipe_fnum; int i; int count = 0; int failed = 0; @@ -474,7 +478,7 @@ static void run_lsahandles(int numops, struct client_info *cli_info) 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; @@ -495,7 +499,7 @@ static void run_lsahandles(int numops, struct client_info *cli_info) } /* close the session */ - cli_nt_session_close(smb_cli); + cli_nt_session_close(smb_cli, nt_pipe_fnum); /* close the rpc pipe */ rpcclient_stop(); @@ -506,6 +510,7 @@ static void run_lsahandles(int numops, struct client_info *cli_info) 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; @@ -531,7 +536,7 @@ static void run_pipegobble(int numops, struct client_info *cli_info, char *pipe_ 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")); } |