diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/ntdomain.h | 66 | ||||
-rw-r--r-- | source3/include/proto.h | 324 | ||||
-rw-r--r-- | source3/lib/time.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.c | 34 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 19 | ||||
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 334 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_srvsvc.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_svcctl.c | 4 | ||||
-rw-r--r-- | source3/rpcclient/display.c | 362 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 65 |
13 files changed, 662 insertions, 556 deletions
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 5bb0888151..1b7a7b55a6 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -150,28 +150,50 @@ struct acct_info * higher order functions for use with msrpc client code */ -#define ALIAS_FN(fn) void (*fn)(char*, DOM_SID*, uint32, char*) -#define ALIAS_INFO_FN(fn) void (*fn)(char*, DOM_SID*, uint32, ALIAS_INFO_CTR *) -#define ALIAS_MEM_FN(fn) void(*fn)(char*, DOM_SID*, uint32, char*, uint32, DOM_SID**, char**, uint8*) - -#define GROUP_FN(fn) void (*fn)(char*, DOM_SID*, uint32, char*) -#define GROUP_INFO_FN(fn) void (*fn)(char*, DOM_SID*, uint32, GROUP_INFO_CTR *) -#define GROUP_MEM_FN(fn) void(*fn)(char*, DOM_SID*, uint32, char*, uint32, uint32*, char**, uint32*) - -#define USER_FN(fn) void (*fn)(char*, DOM_SID*, uint32, char*) -#define USER_INFO_FN(fn) void (*fn)(char*, DOM_SID*, uint32, SAM_USER_INFO_21 *) -#define USER_MEM_FN(fn) void (*fn)(char*, DOM_SID*, uint32, char*, uint32, uint32*, char**, uint32*) - -#define REG_FN(fn) void (*fn)(int, const char *, int) -#define REG_KEY_FN(fn) void (*fn)(const char*, const char*, time_t) -#define REG_VAL_FN(fn) void (*fn)(const char *, const char*, uint32, BUFFER2 *) - -#define SVC_QUERY_FN(fn) void (*fn)(QUERY_SERVICE_CONFIG *) -#define SVC_INFO_FN(fn) void (*fn)(ENUM_SRVC_STATUS *) - -#define TPRT_INFO_FN(fn) void (*fn)(SRV_TPRT_INFO_CTR *) - -#define PRINT_INFO_FN(fn) void (*fn)(const char*, uint32, uint32, void **) +#define ALIAS_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32, const char*) +#define ALIAS_INFO_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32, ALIAS_INFO_CTR *const) +#define ALIAS_MEM_FN(fn)\ + void(*fn)(const char*, const DOM_SID*, uint32, const char*,\ + uint32, DOM_SID *const *const, char *const *const,\ + uint8*const) + +#define GROUP_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32, const char*) +#define GROUP_INFO_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32, GROUP_INFO_CTR *const) +#define GROUP_MEM_FN(fn)\ + void(*fn)(const char*, const DOM_SID*, uint32, const char*,\ + uint32, const uint32*, char *const *const,\ + uint32*const) + +#define USER_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32, const char*) +#define USER_INFO_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32,\ + SAM_USER_INFO_21 *const) +#define USER_MEM_FN(fn)\ + void (*fn)(const char*, const DOM_SID*, uint32, const char*,\ + uint32, const uint32*, char *const *const, uint32* const) + +#define REG_FN(fn)\ + void (*fn)(int, const char *, int) +#define REG_KEY_FN(fn)\ + void (*fn)(const char*, const char*, time_t) +#define REG_VAL_FN(fn)\ + void (*fn)(const char *, const char*, uint32, const BUFFER2 *) + +#define SVC_QUERY_FN(fn)\ + void (*fn)(const QUERY_SERVICE_CONFIG *) +#define SVC_INFO_FN(fn)\ + void (*fn)(const ENUM_SRVC_STATUS *) + +#define TPRT_INFO_FN(fn)\ + void (*fn)(const SRV_TPRT_INFO_CTR *) + +#define PRINT_INFO_FN(fn)\ + void (*fn)(const char*, uint32, uint32, void *const *const) #endif /* _NT_DOMAIN_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 65cb7677b2..b9e090d834 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -356,7 +356,7 @@ void GetTimeOfDay(struct timeval *tval); void TimeInit(void); int TimeDiff(time_t t); struct tm *LocalTime(time_t *t); -time_t nt_time_to_unix(NTTIME *nt); +time_t nt_time_to_unix(const NTTIME *nt); time_t interpret_long_date(char *p); void unix_to_nt_time(NTTIME *nt, time_t t); void init_nt_time(NTTIME *nt); @@ -468,9 +468,9 @@ void set_remote_arch(enum remote_arch_types type); enum remote_arch_types get_remote_arch(void); char *align4(char *q, char *base); char *align2(char *q, char *base); -void out_ascii(FILE *f, unsigned char *buf,int len); -void out_struct(FILE *f,char *buf1,int len, int per_line); -void out_data(FILE *f,char *buf1,int len, int per_line); +void out_ascii(FILE *f, const unsigned char *buf,int len); +void out_struct(FILE *f, const char *buf1,int len, int per_line); +void out_data(FILE *f, const char *buf1,int len, int per_line); void print_asc(int level, unsigned char const *buf,int len); void dump_data(int level, const char *buf1, int len); char *tab_depth(int depth); @@ -1831,11 +1831,11 @@ BOOL create_rpc_bind_resp(struct pwd_info *pwd, prs_struct *rhdr, prs_struct *rhdr_autha, prs_struct *auth_resp); -BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 nt_pipe_fnum, uint8 op_num, +BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 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, uint16* nt_pipe_fnum); -void cli_nt_session_close(struct cli_state *cli, uint16 nt_pipe_fnum); +BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name, uint16* fnum); +void cli_nt_session_close(struct cli_state *cli, uint16 fnum); /*The following definitions come from rpc_client/cli_reg.c */ @@ -1901,20 +1901,21 @@ BOOL create_samr_domain_group(struct cli_state *cli, uint16 fnum, const char *acct_name, const char *acct_desc, uint32 *rid); BOOL get_samr_query_usergroups(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, uint32 user_rid, + const POLICY_HND *pol_open_domain, + uint32 user_rid, uint32 *num_groups, DOM_GID **gid); 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, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 group_rid, uint32 *num_mem, uint32 **rid, uint32 **attr); 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, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 alias_rid, uint32 *num_mem, DOM_SID2 *sid); BOOL set_samr_set_userinfo(struct cli_state *cli, uint16 fnum, POLICY_HND *pol_open_domain, @@ -1925,11 +1926,11 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum, uint32 info_level, uint32 user_rid, SAM_USER_INFO_21 *usr); BOOL get_samr_query_groupinfo(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 info_level, uint32 group_rid, GROUP_INFO_CTR *ctr); BOOL get_samr_query_aliasinfo(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 info_level, uint32 alias_rid, ALIAS_INFO_CTR *ctr); BOOL samr_chgpasswd_user(struct cli_state *cli, uint16 fnum, @@ -1956,13 +1957,14 @@ uint32 samr_enum_dom_users(struct cli_state *cli, uint16 fnum, struct acct_info **sam, uint32 *num_sam_users); BOOL samr_connect(struct cli_state *cli, uint16 fnum, - char *srv_name, uint32 unknown_0, + const char *srv_name, uint32 unknown_0, POLICY_HND *connect_pol); BOOL samr_open_user(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol, uint32 unk_0, uint32 rid, + const POLICY_HND *pol, + uint32 unk_0, uint32 rid, POLICY_HND *user_pol); BOOL samr_open_alias(struct cli_state *cli, uint16 fnum, - POLICY_HND *domain_pol, + const POLICY_HND *domain_pol, uint32 flags, uint32 rid, POLICY_HND *alias_pol); BOOL samr_del_aliasmem(struct cli_state *cli, uint16 fnum, @@ -1984,7 +1986,7 @@ BOOL samr_query_aliasinfo(struct cli_state *cli, uint16 fnum, 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, uint16 fnum, - POLICY_HND *domain_pol, + const POLICY_HND *domain_pol, uint32 flags, uint32 rid, POLICY_HND *group_pol); BOOL samr_del_groupmem(struct cli_state *cli, uint16 fnum, @@ -1998,8 +2000,9 @@ BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum, 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, uint16 fnum, - POLICY_HND *connect_pol, uint32 ace_perms, - DOM_SID *sid, + const POLICY_HND *connect_pol, + uint32 ace_perms, + const DOM_SID *sid, POLICY_HND *domain_pol); BOOL samr_query_lookup_domain(struct cli_state *cli, uint16 fnum, POLICY_HND *pol, const char *dom_name, @@ -2011,16 +2014,17 @@ BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum, uint32 rid[MAX_LOOKUP_SIDS], uint32 type[MAX_LOOKUP_SIDS]); BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol, uint32 flags, + const POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rids, uint32 *num_names, char ***names, uint32 **type); BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *alias_pol, + const POLICY_HND *alias_pol, uint32 *num_mem, DOM_SID2 *sid); BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol, uint32 *ptr_sid, DOM_SID2 *sid, + const POLICY_HND *pol, + uint32 *ptr_sid, DOM_SID2 *sid, uint32 *num_aliases, uint32 **rid); BOOL samr_query_groupmem(struct cli_state *cli, uint16 fnum, POLICY_HND *group_pol, @@ -2221,7 +2225,7 @@ uint32 get_enum_hnd(ENUM_HND *enh); BOOL make_enum_hnd(ENUM_HND *enh, uint32 hnd); BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth); BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth); -BOOL make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid); +BOOL make_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid); BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth); BOOL make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer); BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth); @@ -2550,8 +2554,8 @@ BOOL make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct *ps, int depth); BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct *ps, int depth); BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 flags, - DOM_SID *sid); + const POLICY_HND *connect_pol, uint32 flags, + const DOM_SID *sid); BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth); BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth); BOOL make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol); @@ -2618,7 +2622,7 @@ BOOL make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, uint32 status); BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth); BOOL make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, - POLICY_HND *hnd, uint32 unk, uint32 rid); + const POLICY_HND *hnd, uint32 unk, uint32 rid); BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth); BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth); BOOL make_samr_group_info1(GROUP_INFO1 *gr1, @@ -2708,7 +2712,7 @@ BOOL make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd, BOOL samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth); BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth); BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, - POLICY_HND *hnd, + const POLICY_HND *hnd, uint32 *ptr_sid, DOM_SID2 *sid); BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth); void samr_free_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u); @@ -2716,12 +2720,12 @@ BOOL make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, uint32 num_rids, uint32 *rid, uint32 status); BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth); void samr_free_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u); -BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, +BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, const POLICY_HND *pol, uint32 unknown_0, uint32 rid); BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth); BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth); BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, - POLICY_HND *pol, uint32 flags, + const POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rid); BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth); void samr_free_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u); @@ -2752,7 +2756,8 @@ BOOL samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_s BOOL make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u, uint32 status); BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth); -BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd); +BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, + const POLICY_HND *hnd); BOOL samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth); BOOL make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, uint32 num_sids, DOM_SID2 *sid, uint32 status); @@ -2765,7 +2770,7 @@ BOOL make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, uint32 num_rids, uint32 *rid, uint8 *type, uint32 status); BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth); BOOL make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, - POLICY_HND *pol, + const POLICY_HND *pol, uint32 unk_0, uint32 rid); BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth); BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth); @@ -2894,7 +2899,7 @@ void free_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u); BOOL make_samr_r_set_userinfo(SAMR_R_SET_USERINFO *r_u, uint32 status); BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *ps, int depth); BOOL make_samr_q_connect(SAMR_Q_CONNECT *q_u, - char *srv_name, uint32 unknown_0); + const char *srv_name, uint32 unknown_0); BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth); BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth); BOOL make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u); @@ -3360,46 +3365,55 @@ void cmd_reg_shutdown(struct client_info *info); /*The following definitions come from rpcclient/cmd_samr.c */ uint32 sam_query_usergroups(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid, uint32 user_rid, - char *user_name, + const char *user_name, uint32 *num_groups, DOM_GID **gid, char ***name, uint32 **type, USER_MEM_FN(usr_mem)); -int msrpc_sam_enum_users(struct client_info *info, +int msrpc_sam_enum_users(struct cli_state *cli, + const char* domain, + const DOM_SID *sid1, + const char* srv_name, struct acct_info **sam, uint32 *num_sam_entries, USER_FN(usr_fn), USER_INFO_FN(usr_inf_fn), USER_MEM_FN(usr_grp_fn), USER_MEM_FN(usr_als_fn)); -BOOL sam_query_dominfo(struct client_info *info, DOM_SID *sid1, +BOOL sam_query_dominfo(struct client_info *info, const DOM_SID *sid1, uint32 switch_value, SAM_UNK_CTR *ctr); BOOL sam_query_aliasmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, + const POLICY_HND *pol_dom, uint32 alias_rid, uint32 *num_names, DOM_SID ***sids, char ***name, uint8 **type); BOOL sam_query_groupmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, + const POLICY_HND *pol_dom, uint32 group_rid, uint32 *num_names, uint32 **rid_mem, char ***name, uint32 **type); -uint32 msrpc_sam_enum_groups(struct client_info *info, +uint32 msrpc_sam_enum_groups(struct cli_state *cli, + const char* domain, + const DOM_SID *sid1, + const char* srv_name, struct acct_info **sam, uint32 *num_sam_entries, GROUP_FN(grp_fn), GROUP_INFO_FN(grp_inf_fn), GROUP_MEM_FN(grp_mem_fn)); -uint32 msrpc_sam_enum_aliases(struct client_info *info, +uint32 msrpc_sam_enum_aliases(struct cli_state *cli, + const char* domain, + const DOM_SID *sid1, + const char* srv_name, struct acct_info **sam, uint32 *num_sam_entries, ALIAS_FN(als_fn), @@ -3459,7 +3473,7 @@ void cmd_time(struct client_info *info); /*The following definitions come from rpcclient/cmd_svcctl.c */ -void svc_display_query_svc_cfg(QUERY_SERVICE_CONFIG *cfg); +void svc_display_query_svc_cfg(const QUERY_SERVICE_CONFIG *cfg); BOOL svc_query_service(struct cli_state *cli, uint16 fnum, POLICY_HND *pol_scm, const char *svc_name, @@ -3485,123 +3499,125 @@ char *get_file_mode_str(uint32 share_mode); char *get_file_oplock_str(uint32 op_type); char *get_share_type_str(uint32 type); char *get_server_type_str(uint32 type); -void display_srv_info_101(FILE *out_hnd, enum action_type action, - SRV_INFO_101 *sv101); -void display_srv_info_102(FILE *out_hnd, enum action_type action,SRV_INFO_102 *sv102); -void display_srv_info_ctr(FILE *out_hnd, enum action_type action,SRV_INFO_CTR *ctr); -void display_conn_info_0(FILE *out_hnd, enum action_type action, - CONN_INFO_0 *info0); -void display_conn_info_1(FILE *out_hnd, enum action_type action, - CONN_INFO_1 *info1, CONN_INFO_1_STR *str1); -void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action, - SRV_CONN_INFO_0 *ctr); -void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action, - SRV_CONN_INFO_1 *ctr); -void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, - SRV_CONN_INFO_CTR *ctr); -void display_tprt_info_0(FILE *out_hnd, enum action_type action, - TPRT_INFO_0 *info0, TPRT_INFO_0_STR *str0); -void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action, - SRV_TPRT_INFO_0 *ctr); -void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, - SRV_TPRT_INFO_CTR *ctr); -void display_share_info_1(FILE *out_hnd, enum action_type action, - SH_INFO_1 *info1, SH_INFO_1_STR *str1); -void display_share_info_2(FILE *out_hnd, enum action_type action, - SH_INFO_2 *info2, SH_INFO_2_STR *str2); -void display_srv_share_info_1_ctr(FILE *out_hnd, enum action_type action, - SRV_SHARE_INFO_1 *ctr); -void display_srv_share_info_2_ctr(FILE *out_hnd, enum action_type action, - SRV_SHARE_INFO_2 *ctr); -void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action, - SRV_SHARE_INFO_CTR *ctr); -void display_file_info_3(FILE *out_hnd, enum action_type action, - FILE_INFO_3 *info3, FILE_INFO_3_STR *str3); -void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action, - SRV_FILE_INFO_3 *ctr); -void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action, - SRV_FILE_INFO_CTR *ctr); -void display_sess_info_0(FILE *out_hnd, enum action_type action, - SESS_INFO_0 *info0, SESS_INFO_0_STR *str0); -void display_sess_info_1(FILE *out_hnd, enum action_type action, - SESS_INFO_1 *info1, SESS_INFO_1_STR *str1); -void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action, - SRV_SESS_INFO_0 *ctr); -void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action, - SRV_SESS_INFO_1 *ctr); -void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action, - SRV_SESS_INFO_CTR *ctr); -void display_server(FILE *out_hnd, enum action_type action, - char *sname, uint32 type, char *comment); -void display_share(FILE *out_hnd, enum action_type action, - char *sname, uint32 type, char *comment); -void display_share2(FILE *out_hnd, enum action_type action, - char *sname, uint32 type, char *comment, - uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd); -void display_name(FILE *out_hnd, enum action_type action, - char *sname); -void display_alias_members(FILE *out_hnd, enum action_type action, - uint32 num_mem, char **sid_mem, - uint8 *type); -void display_alias_rid_info(FILE *out_hnd, enum action_type action, - DOM_SID *sid, - uint32 num_rids, uint32 *rid); -void display_group_members(FILE *out_hnd, enum action_type action, - uint32 num_mem, char **name, uint32 *type); -void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *info1); -void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *info4); -void display_group_info_ctr(FILE *out_hnd, enum action_type action, - GROUP_INFO_CTR *ctr); -void display_group_rid_info(FILE *out_hnd, enum action_type action, - uint32 num_gids, DOM_GID *gid); -void display_alias_name_info(FILE *out_hnd, enum action_type action, - uint32 num_aliases, fstring *alias_name, uint32 *num_als_usrs); -void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *info3); -void display_alias_info_ctr(FILE *out_hnd, enum action_type action, - ALIAS_INFO_CTR *ctr); -void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *usr); +void display_srv_info_101(FILE *out_hnd, enum action_type action, + SRV_INFO_101 *const sv101); +void display_srv_info_102(FILE *out_hnd, enum action_type action, SRV_INFO_102 *const sv102); +void display_srv_info_ctr(FILE *out_hnd, enum action_type action, SRV_INFO_CTR *const ctr); +void display_conn_info_0(FILE *out_hnd, enum action_type action, + CONN_INFO_0 *const info0); +void display_conn_info_1(FILE *out_hnd, enum action_type action, + CONN_INFO_1 *const info1, CONN_INFO_1_STR *const str1); +void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action, + SRV_CONN_INFO_0 *const ctr); +void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action, + SRV_CONN_INFO_1 *const ctr); +void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, + SRV_CONN_INFO_CTR *const ctr); +void display_tprt_info_0(FILE *out_hnd, enum action_type action, + TPRT_INFO_0 *const info0, TPRT_INFO_0_STR *const str0); +void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action, + const SRV_TPRT_INFO_0 *const ctr); +void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, + const SRV_TPRT_INFO_CTR *const ctr); +void display_share_info_1(FILE *out_hnd, enum action_type action, + SH_INFO_1 *const info1, SH_INFO_1_STR *const str1); +void display_share_info_2(FILE *out_hnd, enum action_type action, + SH_INFO_2 *const info2, SH_INFO_2_STR *const str2); +void display_srv_share_info_1_ctr(FILE *out_hnd, enum action_type action, + SRV_SHARE_INFO_1 *const ctr); +void display_srv_share_info_2_ctr(FILE *out_hnd, enum action_type action, + SRV_SHARE_INFO_2 *const ctr); +void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action, + SRV_SHARE_INFO_CTR *const ctr); +void display_file_info_3(FILE *out_hnd, enum action_type action, + FILE_INFO_3 *const info3, FILE_INFO_3_STR *const str3); +void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action, + SRV_FILE_INFO_3 *const ctr); +void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action, + SRV_FILE_INFO_CTR *const ctr); +void display_sess_info_0(FILE *out_hnd, enum action_type action, + SESS_INFO_0 *const info0, SESS_INFO_0_STR *const str0); +void display_sess_info_1(FILE *out_hnd, enum action_type action, + SESS_INFO_1 *const info1, SESS_INFO_1_STR *const str1); +void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action, + SRV_SESS_INFO_0 *const ctr); +void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action, + SRV_SESS_INFO_1 *const ctr); +void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action, + SRV_SESS_INFO_CTR *const ctr); +void display_server(FILE *out_hnd, enum action_type action, + char *const sname, uint32 type, char *const comment); +void display_share(FILE *out_hnd, enum action_type action, + char *const sname, uint32 type, char *const comment); +void display_share2(FILE *out_hnd, enum action_type action, + char *const sname, uint32 type, char *const comment, + uint32 perms, uint32 max_uses, uint32 num_uses, + char *const path, char *const passwd); +void display_name(FILE *out_hnd, enum action_type action, + char *const sname); +void display_alias_members(FILE *out_hnd, enum action_type action, + uint32 num_mem, char *const *const sid_mem, + uint8 *const type); +void display_alias_rid_info(FILE *out_hnd, enum action_type action, + DOM_SID *const sid, + uint32 num_rids, uint32 *const rid); +void display_group_members(FILE *out_hnd, enum action_type action, + uint32 num_mem, char *const *const name, uint32 *const type); +void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1); +void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4); +void display_group_info_ctr(FILE *out_hnd, enum action_type action, + GROUP_INFO_CTR *const ctr); +void display_group_rid_info(FILE *out_hnd, enum action_type action, + uint32 num_gids, DOM_GID *const gid); +void display_alias_name_info(FILE *out_hnd, enum action_type action, + uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs); +void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3); +void display_alias_info_ctr(FILE *out_hnd, enum action_type action, + ALIAS_INFO_CTR *const ctr); +void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr); char *get_sec_mask_str(uint32 type); -void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *info); -void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *ace); -void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *sec_acl); -void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *sec); +void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *const info); +void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *const ace); +void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *const sec_acl); +void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec); char *get_reg_val_type_str(uint32 type); -void display_reg_value_info(FILE *out_hnd, enum action_type action, - const char *val_name, - uint32 val_type, BUFFER2 *value); -void display_reg_key_info(FILE *out_hnd, enum action_type action, +void display_reg_value_info(FILE *out_hnd, enum action_type action, + const char *val_name, + uint32 val_type, const BUFFER2 *value); +void display_reg_key_info(FILE *out_hnd, enum action_type action, const char *key_name, time_t key_mod_time); char *get_svc_start_type_str(uint32 type); -void display_query_svc_cfg(FILE *out_hnd, enum action_type action, - QUERY_SERVICE_CONFIG *cfg); -void display_svc_info(FILE *out_hnd, enum action_type action, ENUM_SRVC_STATUS *svc); -void display_at_enum_info(FILE *out_hnd, enum action_type action, - uint32 num_jobs, AT_ENUM_INFO *jobs, fstring *commands); -void display_at_job_info(FILE *out_hnd, enum action_type action, - AT_JOB_INFO *job, fstring command); -void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *ev); -void display_sam_sync_ctr(FILE *out_hnd, enum action_type action, - SAM_DELTA_HDR *delta, - SAM_DELTA_CTR *ctr); -void display_sam_sync(FILE *out_hnd, enum action_type action, - SAM_DELTA_HDR *deltas, - SAM_DELTA_CTR *ctr, +void display_query_svc_cfg(FILE *out_hnd, enum action_type action, + const QUERY_SERVICE_CONFIG *const cfg); +void display_svc_info(FILE *out_hnd, enum action_type action, + const ENUM_SRVC_STATUS *const svc); +void display_at_enum_info(FILE *out_hnd, enum action_type action, + uint32 num_jobs, const AT_ENUM_INFO *const jobs, const fstring *const commands); +void display_at_job_info(FILE *out_hnd, enum action_type action, + AT_JOB_INFO *const job, fstring command); +void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev); +void display_sam_sync_ctr(FILE *out_hnd, enum action_type action, + SAM_DELTA_HDR *const delta, + SAM_DELTA_CTR *const ctr); +void display_sam_sync(FILE *out_hnd, enum action_type action, + SAM_DELTA_HDR *const deltas, + SAM_DELTA_CTR *const ctr, uint32 num); -void display_sam_unk_info_2(FILE *out_hnd, enum action_type action, - SAM_UNK_INFO_2 *info2); -void display_sam_unk_ctr(FILE *out_hnd, enum action_type action, - uint32 switch_value, SAM_UNK_CTR *ctr); -void display_print_info_0(FILE *out_hnd, enum action_type action, - PRINTER_INFO_0 *i0); -void display_print_info_1(FILE *out_hnd, enum action_type action, - PRINTER_INFO_1 *i1); -void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, - uint32 count, PRINTER_INFO_0 **ctr); -void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, - uint32 count, PRINTER_INFO_1 **ctr); -void display_printer_info_ctr(FILE *out_hnd, enum action_type action, - uint32 level, uint32 count, void **ctr); +void display_sam_unk_info_2(FILE *out_hnd, enum action_type action, + SAM_UNK_INFO_2 *const info2); +void display_sam_unk_ctr(FILE *out_hnd, enum action_type action, + uint32 switch_value, SAM_UNK_CTR *const ctr); +void display_print_info_0(FILE *out_hnd, enum action_type action, + PRINTER_INFO_0 *const i0); +void display_print_info_1(FILE *out_hnd, enum action_type action, + PRINTER_INFO_1 *const i1); +void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, + uint32 count, PRINTER_INFO_0 *const *const ctr); +void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, + uint32 count, PRINTER_INFO_1 *const *const ctr); +void display_printer_info_ctr(FILE *out_hnd, enum action_type action, + uint32 level, uint32 count, + void *const *const ctr); /*The following definitions come from rpcclient/rpcclient.c */ diff --git a/source3/lib/time.c b/source3/lib/time.c index 85f6006389..c332b906a0 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -247,7 +247,7 @@ its the GMT you get by taking a localtime and adding the serverzone. This is NOT the same as GMT in some cases. This routine converts this to real GMT. ****************************************************************************/ -time_t nt_time_to_unix(NTTIME *nt) +time_t nt_time_to_unix(const NTTIME *nt) { double d; time_t ret; diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 0001f81dc8..94865e4d3c 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -148,7 +148,8 @@ BOOL create_samr_domain_group(struct cli_state *cli, uint16 fnum, do a SAMR query user groups ****************************************************************************/ BOOL get_samr_query_usergroups(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, uint32 user_rid, + const POLICY_HND *pol_open_domain, + uint32 user_rid, uint32 *num_groups, DOM_GID **gid) { POLICY_HND pol_open_user; @@ -213,7 +214,7 @@ BOOL delete_samr_dom_group(struct cli_state *cli, uint16 fnum, do a SAMR query group members ****************************************************************************/ BOOL get_samr_query_groupmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 group_rid, uint32 *num_mem, uint32 **rid, uint32 **attr) { @@ -223,7 +224,7 @@ BOOL get_samr_query_groupmem(struct cli_state *cli, uint16 fnum, 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, fnum,pol_open_domain, + if (!samr_open_group(cli, fnum, pol_open_domain, 0x00000010, group_rid, &pol_open_group)) { @@ -276,7 +277,7 @@ BOOL delete_samr_dom_alias(struct cli_state *cli, uint16 fnum, do a SAMR query alias members ****************************************************************************/ BOOL get_samr_query_aliasmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 alias_rid, uint32 *num_mem, DOM_SID2 *sid) { POLICY_HND pol_open_alias; @@ -379,7 +380,7 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum, do a SAMR query group info ****************************************************************************/ BOOL get_samr_query_groupinfo(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 info_level, uint32 group_rid, GROUP_INFO_CTR *ctr) { @@ -415,7 +416,7 @@ BOOL get_samr_query_groupinfo(struct cli_state *cli, uint16 fnum, do a SAMR query alias info ****************************************************************************/ BOOL get_samr_query_aliasinfo(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_open_domain, + const POLICY_HND *pol_open_domain, uint32 info_level, uint32 alias_rid, ALIAS_INFO_CTR *ctr) { @@ -929,7 +930,7 @@ uint32 samr_enum_dom_users(struct cli_state *cli, uint16 fnum, do a SAMR Connect ****************************************************************************/ BOOL samr_connect(struct cli_state *cli, uint16 fnum, - char *srv_name, uint32 unknown_0, + const char *srv_name, uint32 unknown_0, POLICY_HND *connect_pol) { prs_struct data; @@ -987,7 +988,8 @@ BOOL samr_connect(struct cli_state *cli, uint16 fnum, do a SAMR Open User ****************************************************************************/ BOOL samr_open_user(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol, uint32 unk_0, uint32 rid, + const POLICY_HND *pol, + uint32 unk_0, uint32 rid, POLICY_HND *user_pol) { prs_struct data; @@ -1045,7 +1047,7 @@ BOOL samr_open_user(struct cli_state *cli, uint16 fnum, do a SAMR Open Alias ****************************************************************************/ BOOL samr_open_alias(struct cli_state *cli, uint16 fnum, - POLICY_HND *domain_pol, + const POLICY_HND *domain_pol, uint32 flags, uint32 rid, POLICY_HND *alias_pol) { @@ -1499,7 +1501,7 @@ BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum, do a SAMR Open Group ****************************************************************************/ BOOL samr_open_group(struct cli_state *cli, uint16 fnum, - POLICY_HND *domain_pol, + const POLICY_HND *domain_pol, uint32 flags, uint32 rid, POLICY_HND *group_pol) { @@ -1834,8 +1836,9 @@ BOOL samr_set_groupinfo(struct cli_state *cli, uint16 fnum, do a SAMR Open Domain ****************************************************************************/ BOOL samr_open_domain(struct cli_state *cli, uint16 fnum, - POLICY_HND *connect_pol, uint32 ace_perms, - DOM_SID *sid, + const POLICY_HND *connect_pol, + uint32 ace_perms, + const DOM_SID *sid, POLICY_HND *domain_pol) { pstring sid_str; @@ -2040,7 +2043,7 @@ BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum, do a SAMR Query Lookup RIDS ****************************************************************************/ BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol, uint32 flags, + const POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rids, uint32 *num_names, char ***names, @@ -2139,7 +2142,7 @@ BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum, do a SAMR Query Alias Members ****************************************************************************/ BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *alias_pol, + const POLICY_HND *alias_pol, uint32 *num_mem, DOM_SID2 *sid) { prs_struct data; @@ -2200,7 +2203,8 @@ BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum, do a SAMR Query User Aliases ****************************************************************************/ BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol, uint32 *ptr_sid, DOM_SID2 *sid, + const POLICY_HND *pol, + uint32 *ptr_sid, DOM_SID2 *sid, uint32 *num_aliases, uint32 **rid) { prs_struct data; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 03cec1128c..9f224c120b 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -179,7 +179,7 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ -BOOL make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) +BOOL make_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) { sid_copy(&sid2->sid, sid); sid2->num_auths = sid2->sid.num_auths; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0059aed756..2cd796f874 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -150,8 +150,8 @@ BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct * reads or writes a structure. ********************************************************************/ BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 flags, - DOM_SID *sid) + const POLICY_HND *connect_pol, uint32 flags, + const DOM_SID *sid) { if (q_u == NULL) return False; @@ -1846,7 +1846,7 @@ BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct makes a SAMR_Q_OPEN_GROUP structure. ********************************************************************/ BOOL make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, - POLICY_HND *hnd, uint32 unk, uint32 rid) + const POLICY_HND *hnd, uint32 unk, uint32 rid) { if (q_c == NULL || hnd == NULL) return False; @@ -3290,7 +3290,7 @@ BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct makes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, - POLICY_HND *hnd, + const POLICY_HND *hnd, uint32 *ptr_sid, DOM_SID2 *sid) { if (q_u == NULL || hnd == NULL) return False; @@ -3484,7 +3484,7 @@ void samr_free_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u) /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, +BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, const POLICY_HND *pol, uint32 unknown_0, uint32 rid) { if (q_u == NULL) return False; @@ -3545,7 +3545,7 @@ BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i makes a SAMR_Q_LOOKUP_RIDS structure. ********************************************************************/ BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, - POLICY_HND *pol, uint32 flags, + const POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rid) { if (q_u == NULL) return False; @@ -4117,7 +4117,8 @@ BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_s /******************************************************************* makes a SAMR_Q_QUERY_ALIASMEM structure. ********************************************************************/ -BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd) +BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, + const POLICY_HND *hnd) { if (q_c == NULL || hnd == NULL) return False; @@ -4404,7 +4405,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p reads or writes a structure. ********************************************************************/ BOOL make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, - POLICY_HND *pol, + const POLICY_HND *pol, uint32 unk_0, uint32 rid) { if (q_u == NULL) return False; @@ -5617,7 +5618,7 @@ BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *p makes a SAMR_Q_CONNECT structure. ********************************************************************/ BOOL make_samr_q_connect(SAMR_Q_CONNECT *q_u, - char *srv_name, uint32 unknown_0) + const char *srv_name, uint32 unknown_0) { int len_srv_name = strlen(srv_name); diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index adf3c7281e..31ef8f082b 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -108,7 +108,7 @@ static void reg_display_key_info(const char *full_name, static void reg_display_val_info(const char *full_name, const char* name, uint32 type, - BUFFER2 *value) + const BUFFER2 *const value) { display_reg_value_info(out_hnd, ACTION_HEADER , name, type, value); display_reg_value_info(out_hnd, ACTION_ENUMERATE, name, type, value); diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 4d6cdf6409..7b5837acca 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -37,73 +37,73 @@ extern struct cli_state *smb_cli; extern FILE* out_hnd; -static void sam_display_alias_info(char *domain, DOM_SID *sid, +static void sam_display_alias_info(const char *domain, const DOM_SID *sid, uint32 alias_rid, - ALIAS_INFO_CTR *ctr) + ALIAS_INFO_CTR *const ctr) { display_alias_info_ctr(out_hnd, ACTION_HEADER , ctr); display_alias_info_ctr(out_hnd, ACTION_ENUMERATE, ctr); display_alias_info_ctr(out_hnd, ACTION_FOOTER , ctr); } -static void sam_display_alias(char *domain, DOM_SID *sid, - uint32 alias_rid, char *alias_name) +static void sam_display_alias(const char *domain, const DOM_SID *sid, + uint32 alias_rid, const char *alias_name) { report(out_hnd, "Alias RID: %8x Alias Name: %s\n", alias_rid, alias_name); } -static void sam_display_alias_members(char *domain, DOM_SID *sid, - uint32 alias_rid, char *alias_name, +static void sam_display_alias_members(const char *domain, const DOM_SID *sid, + uint32 alias_rid, const char *alias_name, uint32 num_names, - DOM_SID **sids, - char **name, - uint8 *type) + DOM_SID *const *const sids, + char *const *const name, + uint8 *const type) { display_alias_members(out_hnd, ACTION_HEADER , num_names, name, type); display_alias_members(out_hnd, ACTION_ENUMERATE, num_names, name, type); display_alias_members(out_hnd, ACTION_FOOTER , num_names, name, type); } -static void sam_display_group_info(char *domain, DOM_SID *sid, +static void sam_display_group_info(const char *domain, const DOM_SID *sid, uint32 group_rid, - GROUP_INFO_CTR *ctr) + GROUP_INFO_CTR *const ctr) { display_group_info_ctr(out_hnd, ACTION_HEADER , ctr); display_group_info_ctr(out_hnd, ACTION_ENUMERATE, ctr); display_group_info_ctr(out_hnd, ACTION_FOOTER , ctr); } -static void sam_display_group(char *domain, DOM_SID *sid, - uint32 group_rid, char *group_name) +static void sam_display_group(const char *domain, const DOM_SID *sid, + uint32 group_rid, const char *group_name) { report(out_hnd, "Group RID: %8x Group Name: %s\n", group_rid, group_name); } -static void sam_display_group_members(char *domain, DOM_SID *sid, - uint32 group_rid, char *group_name, +static void sam_display_group_members(const char *domain, const DOM_SID *sid, + uint32 group_rid, const char *group_name, uint32 num_names, - uint32 *rid_mem, - char **name, - uint32 *type) + const uint32 *rid_mem, + char *const *const name, + uint32 *const type) { display_group_members(out_hnd, ACTION_HEADER , num_names, name, type); display_group_members(out_hnd, ACTION_ENUMERATE, num_names, name, type); display_group_members(out_hnd, ACTION_FOOTER , num_names, name, type); } -static void sam_display_user_info(char *domain, DOM_SID *sid, +static void sam_display_user_info(const char *domain, const DOM_SID *sid, uint32 user_rid, - SAM_USER_INFO_21 *usr) + SAM_USER_INFO_21 *const usr) { display_sam_user_info_21(out_hnd, ACTION_HEADER , usr); display_sam_user_info_21(out_hnd, ACTION_ENUMERATE, usr); display_sam_user_info_21(out_hnd, ACTION_FOOTER , usr); } -static void sam_display_user(char *domain, DOM_SID *sid, - uint32 user_rid, char *user_name) +static void sam_display_user(const char *domain, const DOM_SID *sid, + uint32 user_rid, const char *user_name) { report(out_hnd, "User RID: %8x User Name: %s\n", user_rid, user_name); @@ -111,8 +111,8 @@ static void sam_display_user(char *domain, DOM_SID *sid, static BOOL req_user_info(struct cli_state *cli, uint16 fnum, POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const char *domain, + const DOM_SID *sid, uint32 user_rid, USER_INFO_FN(usr_inf)) { @@ -135,11 +135,11 @@ static BOOL req_user_info(struct cli_state *cli, uint16 fnum, SAM Query User Groups. ****************************************************************************/ uint32 sam_query_usergroups(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid, uint32 user_rid, - char *user_name, + const char *user_name, uint32 *num_groups, DOM_GID **gid, char ***name, @@ -186,9 +186,9 @@ uint32 sam_query_usergroups(struct cli_state *cli, uint16 fnum, } static uint32 req_group_info(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, DOM_SID *sid, - uint32 user_rid, char *user_name, + const POLICY_HND *pol_dom, + const char *domain, const DOM_SID *sid, + uint32 user_rid, const char *user_name, USER_MEM_FN(usr_mem)) { uint32 num_groups; @@ -218,10 +218,10 @@ static uint32 req_group_info(struct cli_state *cli, uint16 fnum, } static void req_alias_info(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid1, uint32 user_rid, - char *user_name, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid1, uint32 user_rid, + const char *user_name, USER_MEM_FN(usr_mem)) { uint32 num_aliases; @@ -295,7 +295,10 @@ static void req_alias_info(struct cli_state *cli, uint16 fnum, /**************************************************************************** experimental SAM users enum. ****************************************************************************/ -int msrpc_sam_enum_users(struct client_info *info, +int msrpc_sam_enum_users(struct cli_state *cli, + const char* domain, + const DOM_SID *sid1, + const char* srv_name, struct acct_info **sam, uint32 *num_sam_entries, USER_FN(usr_fn), @@ -304,10 +307,6 @@ int msrpc_sam_enum_users(struct client_info *info, USER_MEM_FN(usr_als_fn)) { uint16 fnum; - fstring srv_name; - fstring domain; - fstring sid; - DOM_SID sid1; DOM_SID sid_1_5_20; uint32 user_idx; BOOL res = True; @@ -323,44 +322,29 @@ int msrpc_sam_enum_users(struct client_info *info, POLICY_HND pol_dom; POLICY_HND pol_blt; - sid_copy(&sid1, &info->dom.level5_sid); - sid_to_string(sid, &sid1); - fstrcpy(domain, info->dom.level5_dom); - (*sam) = NULL; (*num_sam_entries) = 0; - if (sid1.num_auths == 0) - { - report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); - return 0; - } - - - fstrcpy(srv_name, "\\\\"); - fstrcat(srv_name, info->dest_host); - strupper(srv_name); - string_to_sid(&sid_1_5_20, "S-1-5-32"); DEBUG(5,("Number of entries:%d unk_0:%04x acb_mask:%04x unk_1:%04x\n", start_idx, unk_0, acb_mask, unk_1)); /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; + res = res ? cli_nt_session_open(cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, fnum, + res = res ? samr_connect(cli, fnum, srv_name, 0x02000000, &sam_pol) : False; /* connect to the domain */ - res1 = res ? samr_open_domain(smb_cli, fnum, - &sam_pol, ace_perms, &sid1, + res1 = res ? samr_open_domain(cli, fnum, + &sam_pol, ace_perms, sid1, &pol_dom) : False; /* connect to the S-1-5-20 domain */ - res2 = res ? samr_open_domain(smb_cli, fnum, + res2 = res ? samr_open_domain(cli, fnum, &sam_pol, ace_perms, &sid_1_5_20, &pol_blt) : False; @@ -369,7 +353,7 @@ int msrpc_sam_enum_users(struct client_info *info, /* read some users */ do { - status = samr_enum_dom_users(smb_cli, fnum, + status = samr_enum_dom_users(cli, fnum, &pol_dom, &start_idx, acb_mask, unk_1, 0x100000, sam, num_sam_entries); @@ -390,45 +374,45 @@ int msrpc_sam_enum_users(struct client_info *info, if (usr_fn != NULL) { - usr_fn(domain, &sid1, user_rid, user_name); + usr_fn(domain, sid1, user_rid, user_name); } if (usr_inf_fn != NULL) { - req_user_info(smb_cli, fnum, &pol_dom, - domain, &sid1, + req_user_info(cli, fnum, &pol_dom, + domain, sid1, user_rid, usr_inf_fn); } if (usr_grp_fn != NULL) { - req_group_info(smb_cli, fnum, &pol_dom, - domain, &sid1, + req_group_info(cli, fnum, &pol_dom, + domain, sid1, user_rid, user_name, usr_grp_fn); } if (usr_als_fn != NULL) { - req_alias_info(smb_cli, fnum, &pol_dom, - domain, &sid1, + req_alias_info(cli, fnum, &pol_dom, + domain, sid1, user_rid, user_name, usr_als_fn); - req_alias_info(smb_cli, fnum, &pol_blt, - domain, &sid1, + req_alias_info(cli, fnum, &pol_blt, + domain, sid1, user_rid, user_name, usr_als_fn); } } } - res2 = res2 ? samr_close(smb_cli, fnum, &pol_blt) : False; - res1 = res1 ? samr_close(smb_cli, fnum, &pol_dom) : False; - res = res ? samr_close(smb_cli, fnum, &sam_pol) : False; + res2 = res2 ? samr_close(cli, fnum, &pol_blt) : False; + res1 = res1 ? samr_close(cli, fnum, &pol_dom) : False; + res = res ? samr_close(cli, fnum, &sam_pol) : False; /* close the session */ - cli_nt_session_close(smb_cli, fnum); + cli_nt_session_close(cli, fnum); if (res) { @@ -446,7 +430,7 @@ int msrpc_sam_enum_users(struct client_info *info, /**************************************************************************** experimental SAM domain info query. ****************************************************************************/ -BOOL sam_query_dominfo(struct client_info *info, DOM_SID *sid1, +BOOL sam_query_dominfo(struct client_info *info, const DOM_SID *sid1, uint32 switch_value, SAM_UNK_CTR *ctr) { uint16 fnum; @@ -502,9 +486,9 @@ BOOL sam_query_dominfo(struct client_info *info, DOM_SID *sid1, static BOOL query_aliasinfo(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid, uint32 alias_rid, ALIAS_INFO_FN(grp_inf)) { @@ -526,7 +510,7 @@ static BOOL query_aliasinfo(struct cli_state *cli, uint16 fnum, } BOOL sam_query_aliasmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, + const POLICY_HND *pol_dom, uint32 alias_rid, uint32 *num_names, DOM_SID ***sids, @@ -606,11 +590,11 @@ BOOL sam_query_aliasmem(struct cli_state *cli, uint16 fnum, } static BOOL req_aliasmem_info(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid, uint32 alias_rid, - char *alias_name, + const char *alias_name, ALIAS_MEM_FN(als_mem)) { uint32 num_names = 0; @@ -641,7 +625,7 @@ static BOOL req_aliasmem_info(struct cli_state *cli, uint16 fnum, } BOOL sam_query_groupmem(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, + const POLICY_HND *pol_dom, uint32 group_rid, uint32 *num_names, uint32 **rid_mem, @@ -715,9 +699,9 @@ BOOL sam_query_groupmem(struct cli_state *cli, uint16 fnum, } static BOOL query_groupinfo(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid, uint32 group_rid, GROUP_INFO_FN(grp_inf)) { @@ -739,11 +723,11 @@ static BOOL query_groupinfo(struct cli_state *cli, uint16 fnum, } static BOOL req_groupmem_info(struct cli_state *cli, uint16 fnum, - POLICY_HND *pol_dom, - char *domain, - DOM_SID *sid, + const POLICY_HND *pol_dom, + const char *domain, + const DOM_SID *sid, uint32 group_rid, - char *group_name, + const char *group_name, GROUP_MEM_FN(grp_mem)) { uint32 num_names = 0; @@ -775,7 +759,10 @@ static BOOL req_groupmem_info(struct cli_state *cli, uint16 fnum, /**************************************************************************** SAM groups query. ****************************************************************************/ -uint32 msrpc_sam_enum_groups(struct client_info *info, +uint32 msrpc_sam_enum_groups(struct cli_state *cli, + const char* domain, + const DOM_SID *sid1, + const char* srv_name, struct acct_info **sam, uint32 *num_sam_entries, GROUP_FN(grp_fn), @@ -783,42 +770,23 @@ uint32 msrpc_sam_enum_groups(struct client_info *info, GROUP_MEM_FN(grp_mem_fn)) { uint16 fnum; - fstring srv_name; - fstring domain; - fstring sid; - DOM_SID sid1; BOOL res = True; uint32 ace_perms = 0x02000000; /* access control permissions. */ POLICY_HND sam_pol; POLICY_HND pol_dom; uint32 status; - sid_copy(&sid1, &info->dom.level5_sid); - - if (sid1.num_auths == 0) - { - report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); - return 0; - } - - sid_to_string(sid, &sid1); - fstrcpy(domain, info->dom.level3_dom); - - fstrcpy(srv_name, "\\\\"); - fstrcat(srv_name, info->dest_host); - strupper(srv_name); - /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; + res = res ? cli_nt_session_open(cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, fnum, + res = res ? samr_connect(cli, fnum, srv_name, 0x02000000, &sam_pol) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, fnum, - &sam_pol, ace_perms, &sid1, + res = res ? samr_open_domain(cli, fnum, + &sam_pol, ace_perms, sid1, &pol_dom) : False; (*sam) = NULL; @@ -831,7 +799,7 @@ uint32 msrpc_sam_enum_groups(struct client_info *info, /* read some groups */ do { - status = samr_enum_dom_groups(smb_cli, fnum, + status = samr_enum_dom_groups(cli, fnum, &pol_dom, &start_idx, 0x100000, sam, num_sam_entries); @@ -850,34 +818,31 @@ uint32 msrpc_sam_enum_groups(struct client_info *info, if (grp_fn != NULL) { - grp_fn(domain, &sid1, group_rid, group_name); + grp_fn(domain, sid1, group_rid, group_name); } if (grp_inf_fn != NULL) { - query_groupinfo(smb_cli, fnum, &pol_dom, - domain, &sid1, + query_groupinfo(cli, fnum, &pol_dom, + domain, sid1, group_rid, grp_inf_fn); } if (grp_mem_fn != NULL) { - req_groupmem_info(smb_cli, fnum, &pol_dom, - domain, &sid1, + req_groupmem_info(cli, fnum, &pol_dom, + domain, sid1, group_rid, group_name, grp_mem_fn); } } } - res = res ? samr_close(smb_cli, fnum, - &pol_dom) : False; - - res = res ? samr_close(smb_cli, fnum, - &sam_pol) : False; + res = res ? samr_close(cli, fnum, &pol_dom) : False; + res = res ? samr_close(cli, fnum, &sam_pol) : False; /* close the session */ - cli_nt_session_close(smb_cli, fnum); + cli_nt_session_close(cli, fnum); if (res) { @@ -893,7 +858,10 @@ uint32 msrpc_sam_enum_groups(struct client_info *info, /**************************************************************************** SAM aliases query. ****************************************************************************/ -uint32 msrpc_sam_enum_aliases(struct client_info *info, +uint32 msrpc_sam_enum_aliases(struct cli_state *cli, + const char* domain, + const DOM_SID *sid1, + const char* srv_name, struct acct_info **sam, uint32 *num_sam_entries, ALIAS_FN(als_fn), @@ -901,41 +869,23 @@ uint32 msrpc_sam_enum_aliases(struct client_info *info, ALIAS_MEM_FN(als_mem_fn)) { uint16 fnum; - fstring srv_name; - fstring domain; - fstring sid; - DOM_SID sid1; BOOL res = True; uint32 ace_perms = 0x02000000; /* access control permissions */ POLICY_HND sam_pol; POLICY_HND pol_dom; uint32 status = 0x0; - sid_copy(&sid1, &info->dom.level5_sid); - sid_to_string(sid, &sid1); - fstrcpy(domain, info->dom.level5_dom); - - if (sid1.num_auths == 0) - { - report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); - return 0; - } - - fstrcpy(srv_name, "\\\\"); - fstrcat(srv_name, info->dest_host); - strupper(srv_name); - /* open SAMR session. negotiate credentials */ - res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False; + res = res ? cli_nt_session_open(cli, PIPE_SAMR, &fnum) : False; /* establish a connection. */ - res = res ? samr_connect(smb_cli, fnum, + res = res ? samr_connect(cli, fnum, srv_name, 0x02000000, &sam_pol) : False; /* connect to the domain */ - res = res ? samr_open_domain(smb_cli, fnum, - &sam_pol, ace_perms, &sid1, + res = res ? samr_open_domain(cli, fnum, + &sam_pol, ace_perms, sid1, &pol_dom) : False; (*sam) = NULL; @@ -948,7 +898,7 @@ uint32 msrpc_sam_enum_aliases(struct client_info *info, /* read some groups */ do { - status = samr_enum_dom_aliases(smb_cli, fnum, + status = samr_enum_dom_aliases(cli, fnum, &pol_dom, &start_idx, 0x100000, sam, num_sam_entries); @@ -967,34 +917,31 @@ uint32 msrpc_sam_enum_aliases(struct client_info *info, if (als_fn != NULL) { - als_fn(domain, &sid1, alias_rid, alias_name); + als_fn(domain, sid1, alias_rid, alias_name); } if (als_inf_fn != NULL) { - query_aliasinfo(smb_cli, fnum, &pol_dom, - domain, &sid1, + query_aliasinfo(cli, fnum, &pol_dom, + domain, sid1, alias_rid, als_inf_fn); } if (als_mem_fn != NULL) { - req_aliasmem_info(smb_cli, fnum, &pol_dom, - domain, &sid1, + req_aliasmem_info(cli, fnum, &pol_dom, + domain, sid1, alias_rid, alias_name, als_mem_fn); } } } - res = res ? samr_close(smb_cli, fnum, - &sam_pol) : False; - - res = res ? samr_close(smb_cli, fnum, - &pol_dom) : False; + res = res ? samr_close(cli, fnum, &sam_pol) : False; + res = res ? samr_close(cli, fnum, &pol_dom) : False; /* close the session */ - cli_nt_session_close(smb_cli, fnum); + cli_nt_session_close(cli, fnum); if (res) { @@ -2191,6 +2138,24 @@ void cmd_sam_enum_users(struct client_info *info) uint32 num_sam_entries = 0; int i; + fstring srv_name; + fstring domain; + fstring sid; + DOM_SID sid1; + sid_copy(&sid1, &info->dom.level5_sid); + sid_to_string(sid, &sid1); + fstrcpy(domain, info->dom.level5_dom); + + if (sid1.num_auths == 0) + { + report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); + return; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, info->dest_host); + strupper(srv_name); + for (i = 0; i < 3; i++) { /* a bad way to do token parsing... */ @@ -2208,7 +2173,8 @@ void cmd_sam_enum_users(struct client_info *info) report(out_hnd, "SAM Enumerate Users\n"); - msrpc_sam_enum_users(info, &sam, &num_sam_entries, + msrpc_sam_enum_users(smb_cli, domain, &sid1, srv_name, + &sam, &num_sam_entries, sam_display_user, request_user_info ? sam_display_user_info : NULL, request_group_info ? sam_display_group_members : NULL, @@ -3064,6 +3030,24 @@ void cmd_sam_enum_aliases(struct client_info *info) struct acct_info *sam = NULL; uint32 num_sam_entries = 0; + fstring domain; + fstring srv_name; + fstring sid; + DOM_SID sid1; + sid_copy(&sid1, &info->dom.level5_sid); + sid_to_string(sid, &sid1); + fstrcpy(domain, info->dom.level5_dom); + + if (sid1.num_auths == 0) + { + report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); + return; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, info->dest_host); + strupper(srv_name); + for (i = 0; i < 2; i++) { /* a bad way to do token parsing... */ @@ -3080,7 +3064,8 @@ void cmd_sam_enum_aliases(struct client_info *info) report(out_hnd, "SAM Enumerate Aliases\n"); - msrpc_sam_enum_aliases(info, &sam, &num_sam_entries, + msrpc_sam_enum_aliases(smb_cli, domain, &sid1, srv_name, + &sam, &num_sam_entries, sam_display_alias, request_alias_info ? sam_display_alias_info : NULL, request_member_info ? sam_display_alias_members : NULL); @@ -3103,6 +3088,24 @@ void cmd_sam_enum_groups(struct client_info *info) struct acct_info *sam = NULL; uint32 num_sam_entries = 0; + fstring srv_name; + fstring domain; + fstring sid; + DOM_SID sid1; + sid_copy(&sid1, &info->dom.level5_sid); + sid_to_string(sid, &sid1); + fstrcpy(domain, info->dom.level5_dom); + + if (sid1.num_auths == 0) + { + report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n"); + return; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, info->dest_host); + strupper(srv_name); + for (i = 0; i < 3; i++) { /* a bad way to do token parsing... */ @@ -3119,7 +3122,8 @@ void cmd_sam_enum_groups(struct client_info *info) report(out_hnd, "SAM Enumerate Groups\n"); - msrpc_sam_enum_groups(info, &sam, &num_sam_entries, + msrpc_sam_enum_groups(smb_cli, domain, &sid1, srv_name, + &sam, &num_sam_entries, sam_display_group, request_group_info ? sam_display_group_info : NULL, request_member_info ? sam_display_group_members : NULL); diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 469b5b1a72..073ee24495 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -72,7 +72,7 @@ BOOL msrpc_spoolss_enum_printers(struct cli_state *cli, } static void spool_print_info_ctr(const char* srv_name, uint32 level, - uint32 num, void **ctr) + uint32 num, void *const *const ctr) { display_printer_info_ctr(out_hnd, ACTION_HEADER , level, num, ctr); display_printer_info_ctr(out_hnd, ACTION_ENUMERATE, level, num, ctr); diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c index 63ea653c63..c0cf56de51 100644 --- a/source3/rpcclient/cmd_srvsvc.c +++ b/source3/rpcclient/cmd_srvsvc.c @@ -139,7 +139,7 @@ BOOL msrpc_srv_enum_tprt(struct cli_state *cli, return res1; } -static void srv_display_tprt_ctr(SRV_TPRT_INFO_CTR *ctr) +static void srv_display_tprt_ctr(const SRV_TPRT_INFO_CTR *ctr) { display_srv_tprt_info_ctr(out_hnd, ACTION_HEADER , ctr); display_srv_tprt_info_ctr(out_hnd, ACTION_ENUMERATE, ctr); diff --git a/source3/rpcclient/cmd_svcctl.c b/source3/rpcclient/cmd_svcctl.c index 7e93653275..07bebe2bda 100644 --- a/source3/rpcclient/cmd_svcctl.c +++ b/source3/rpcclient/cmd_svcctl.c @@ -36,7 +36,7 @@ extern int smb_tidx; extern FILE* out_hnd; -void svc_display_query_svc_cfg(QUERY_SERVICE_CONFIG *cfg) +void svc_display_query_svc_cfg(const QUERY_SERVICE_CONFIG *cfg) { display_query_svc_cfg(out_hnd, ACTION_HEADER , cfg); display_query_svc_cfg(out_hnd, ACTION_ENUMERATE, cfg); @@ -124,7 +124,7 @@ void cmd_svc_info(struct client_info *info) } } -static void svc_display_svc_info(ENUM_SRVC_STATUS *svc) +static void svc_display_svc_info(const ENUM_SRVC_STATUS *svc) { display_svc_info(out_hnd, ACTION_HEADER , svc); display_svc_info(out_hnd, ACTION_ENUMERATE, svc); diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c index 946532a010..5bd4fb324b 100644 --- a/source3/rpcclient/display.c +++ b/source3/rpcclient/display.c @@ -10,7 +10,7 @@ the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -26,13 +26,13 @@ struct field_info sid_name_info[] = { { SID_NAME_UNKNOWN, "UNKNOWN" }, /* default */ - { SID_NAME_USER , "User" }, - { SID_NAME_DOM_GRP, "Domain Group" }, - { SID_NAME_DOMAIN , "Domain" }, - { SID_NAME_ALIAS , "Local Group" }, - { SID_NAME_WKN_GRP, "Well-known Group"}, - { SID_NAME_DELETED, "Deleted" }, - { SID_NAME_INVALID, "Invalid" }, + { SID_NAME_USER , "User" }, + { SID_NAME_DOM_GRP, "Domain Group" }, + { SID_NAME_DOMAIN , "Domain" }, + { SID_NAME_ALIAS , "Local Group" }, + { SID_NAME_WKN_GRP, "Well-known Group"}, + { SID_NAME_DELETED, "Deleted" }, + { SID_NAME_INVALID, "Invalid" }, { 0 , NULL } }; @@ -169,8 +169,8 @@ char *get_server_type_str(uint32 type) /**************************************************************************** server info level 101 display function ****************************************************************************/ -void display_srv_info_101(FILE *out_hnd, enum action_type action, - const SRV_INFO_101 *sv101) +void display_srv_info_101(FILE *out_hnd, enum action_type action, + SRV_INFO_101 *const sv101) { if (sv101 == NULL) { @@ -211,7 +211,7 @@ void display_srv_info_101(FILE *out_hnd, enum action_type action, /**************************************************************************** server info level 102 display function ****************************************************************************/ -void display_srv_info_102(FILE *out_hnd, enum action_type action,const SRV_INFO_102 *sv102) +void display_srv_info_102(FILE *out_hnd, enum action_type action, SRV_INFO_102 *const sv102) { if (sv102 == NULL) { @@ -234,7 +234,7 @@ void display_srv_info_102(FILE *out_hnd, enum action_type action,const SRV_INFO_ unistr2_to_ascii(name, &sv102->uni_name, sizeof(name)-1); unistr2_to_ascii(comment, &sv102->uni_comment, sizeof(comment)-1); - unistr2_to_ascii(usr_path, &sv102->uni_usr_path, + unistr2_to_ascii(usr_path, &sv102->uni_usr_path, sizeof(usr_path)-1); display_server(out_hnd, action, name, sv102->srv_type, comment); @@ -243,7 +243,7 @@ void display_srv_info_102(FILE *out_hnd, enum action_type action,const SRV_INFO_ fprintf(out_hnd, "\tos version :\t%d.%d\n" , sv102->ver_major, sv102->ver_minor); fprintf(out_hnd, "\tusers :\t%x\n" , sv102->users ); - fprintf(out_hnd, "\tdisc, hidden :\t%x,%x\n" , sv102->disc , sv102->hidden ); + fprintf(out_hnd, "\tdisc, hidden :\t%x, %x\n" , sv102->disc , sv102->hidden ); fprintf(out_hnd, "\tannounce, delta :\t%d, %d\n", sv102->announce , sv102->ann_delta); fprintf(out_hnd, "\tlicenses :\t%d\n" , sv102->licenses ); fprintf(out_hnd, "\tuser path :\t%s\n" , usr_path); @@ -260,7 +260,7 @@ void display_srv_info_102(FILE *out_hnd, enum action_type action,const SRV_INFO_ /**************************************************************************** server info container display function ****************************************************************************/ -void display_srv_info_ctr(FILE *out_hnd, enum action_type action,const SRV_INFO_CTR *ctr) +void display_srv_info_ctr(FILE *out_hnd, enum action_type action, SRV_INFO_CTR *const ctr) { if (ctr == NULL || ctr->ptr_srv_ctr == 0) { @@ -291,8 +291,8 @@ void display_srv_info_ctr(FILE *out_hnd, enum action_type action,const SRV_INFO_ /**************************************************************************** connection info level 0 display function ****************************************************************************/ -void display_conn_info_0(FILE *out_hnd, enum action_type action, - const CONN_INFO_0 *info0) +void display_conn_info_0(FILE *out_hnd, enum action_type action, + CONN_INFO_0 *const info0) { if (info0 == NULL) { @@ -325,8 +325,8 @@ void display_conn_info_0(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info level 1 display function ****************************************************************************/ -void display_conn_info_1(FILE *out_hnd, enum action_type action, - const CONN_INFO_1 *info1, const CONN_INFO_1_STR *str1) +void display_conn_info_1(FILE *out_hnd, enum action_type action, + CONN_INFO_1 *const info1, CONN_INFO_1_STR *const str1) { if (info1 == NULL || str1 == NULL) { @@ -372,8 +372,8 @@ void display_conn_info_1(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info level 0 container display function ****************************************************************************/ -void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action, - const SRV_CONN_INFO_0 *ctr) +void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action, + SRV_CONN_INFO_0 *const ctr) { if (ctr == NULL) { @@ -409,8 +409,8 @@ void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info level 1 container display function ****************************************************************************/ -void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action, - const SRV_CONN_INFO_1 *ctr) +void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action, + SRV_CONN_INFO_1 *const ctr) { if (ctr == NULL) { @@ -446,8 +446,8 @@ void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info container display function ****************************************************************************/ -void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, - const SRV_CONN_INFO_CTR *ctr) +void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, + SRV_CONN_INFO_CTR *const ctr) { if (ctr == NULL || ctr->ptr_conn_ctr == 0) { @@ -459,13 +459,13 @@ void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, { case 0: { - display_srv_conn_info_0_ctr(out_hnd, action, + display_srv_conn_info_0_ctr(out_hnd, action, &(ctr->conn.info0)); break; } case 1: { - display_srv_conn_info_1_ctr(out_hnd, action, + display_srv_conn_info_1_ctr(out_hnd, action, &(ctr->conn.info1)); break; } @@ -481,8 +481,8 @@ void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** transport info level 0 display function ****************************************************************************/ -void display_tprt_info_0(FILE *out_hnd, enum action_type action, - const TPRT_INFO_0 *info0, const TPRT_INFO_0_STR *str0) +void display_tprt_info_0(FILE *out_hnd, enum action_type action, + TPRT_INFO_0 *const info0, TPRT_INFO_0_STR *const str0) { if (info0 == NULL || str0 == NULL) { @@ -526,8 +526,8 @@ void display_tprt_info_0(FILE *out_hnd, enum action_type action, /**************************************************************************** transport info level 0 container display function ****************************************************************************/ -void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action, - const SRV_TPRT_INFO_0 *ctr) +void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action, + const SRV_TPRT_INFO_0 *const ctr) { if (ctr == NULL) { @@ -563,8 +563,8 @@ void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** transport info container display function ****************************************************************************/ -void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, - const SRV_TPRT_INFO_CTR *ctr) +void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, + const SRV_TPRT_INFO_CTR *const ctr) { if (ctr == NULL || ctr->ptr_tprt_ctr == 0) { @@ -576,7 +576,7 @@ void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, { case 0: { - display_srv_tprt_info_0_ctr(out_hnd, action, + display_srv_tprt_info_0_ctr(out_hnd, action, &(ctr->tprt.info0)); break; } @@ -592,8 +592,8 @@ void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** share info level 1 display function ****************************************************************************/ -void display_share_info_1(FILE *out_hnd, enum action_type action, - const SH_INFO_1 *info1, const SH_INFO_1_STR *str1) +void display_share_info_1(FILE *out_hnd, enum action_type action, + SH_INFO_1 *const info1, SH_INFO_1_STR *const str1) { if (info1 == NULL || str1 == NULL) { @@ -632,8 +632,8 @@ void display_share_info_1(FILE *out_hnd, enum action_type action, /**************************************************************************** share info level 2 display function ****************************************************************************/ -void display_share_info_2(FILE *out_hnd, enum action_type action, - const SH_INFO_2 *info2, const SH_INFO_2_STR *str2) +void display_share_info_2(FILE *out_hnd, enum action_type action, + SH_INFO_2 *const info2, SH_INFO_2_STR *const str2) { if (info2 == NULL || str2 == NULL) { @@ -660,8 +660,8 @@ void display_share_info_2(FILE *out_hnd, enum action_type action, unistr2_to_ascii(path, &str2->uni_path, sizeof(path)-1); unistr2_to_ascii(passwd, &str2->uni_passwd, sizeof(passwd)-1); - display_share2(out_hnd, action, net_name, info2->type, remark, - info2->perms, info2->max_uses, info2->num_uses, + display_share2(out_hnd, action, net_name, info2->type, remark, + info2->perms, info2->max_uses, info2->num_uses, path, passwd); break; @@ -678,8 +678,8 @@ void display_share_info_2(FILE *out_hnd, enum action_type action, /**************************************************************************** share info level 1 container display function ****************************************************************************/ -void display_srv_share_info_1_ctr(FILE *out_hnd, enum action_type action, - const SRV_SHARE_INFO_1 *ctr) +void display_srv_share_info_1_ctr(FILE *out_hnd, enum action_type action, + SRV_SHARE_INFO_1 *const ctr) { if (ctr == NULL) { @@ -715,8 +715,8 @@ void display_srv_share_info_1_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** share info level 2 container display function ****************************************************************************/ -void display_srv_share_info_2_ctr(FILE *out_hnd, enum action_type action, - const SRV_SHARE_INFO_2 *ctr) +void display_srv_share_info_2_ctr(FILE *out_hnd, enum action_type action, + SRV_SHARE_INFO_2 *const ctr) { if (ctr == NULL) { @@ -752,8 +752,8 @@ void display_srv_share_info_2_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** share info container display function ****************************************************************************/ -void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action, - const SRV_SHARE_INFO_CTR *ctr) +void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action, + SRV_SHARE_INFO_CTR *const ctr) { if (ctr == NULL || ctr->ptr_share_ctr == 0) { @@ -765,13 +765,13 @@ void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action, { case 1: { - display_srv_share_info_1_ctr(out_hnd, action, + display_srv_share_info_1_ctr(out_hnd, action, &(ctr->share.info1)); break; } case 2: { - display_srv_share_info_2_ctr(out_hnd, action, + display_srv_share_info_2_ctr(out_hnd, action, &(ctr->share.info2)); break; } @@ -787,8 +787,8 @@ void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** file info level 3 display function ****************************************************************************/ -void display_file_info_3(FILE *out_hnd, enum action_type action, - const FILE_INFO_3 *info3, const FILE_INFO_3_STR *str3) +void display_file_info_3(FILE *out_hnd, enum action_type action, + FILE_INFO_3 *const info3, FILE_INFO_3_STR *const str3) { if (info3 == NULL || str3 == NULL) { @@ -808,9 +808,9 @@ void display_file_info_3(FILE *out_hnd, enum action_type action, fstring path_name; fstring user_name; - unistr2_to_ascii(path_name, &str3->uni_path_name, + unistr2_to_ascii(path_name, &str3->uni_path_name, sizeof(path_name)-1); - unistr2_to_ascii(user_name, &str3->uni_user_name, + unistr2_to_ascii(user_name, &str3->uni_user_name, sizeof(user_name)-1); fprintf(out_hnd, "\tid :\t%d\n", info3->id); @@ -834,8 +834,8 @@ void display_file_info_3(FILE *out_hnd, enum action_type action, /**************************************************************************** file info level 3 container display function ****************************************************************************/ -void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action, - const SRV_FILE_INFO_3 *ctr) +void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action, + SRV_FILE_INFO_3 *const ctr) { if (ctr == NULL) { @@ -871,8 +871,8 @@ void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** file info container display function ****************************************************************************/ -void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action, - const SRV_FILE_INFO_CTR *ctr) +void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action, + SRV_FILE_INFO_CTR *const ctr) { if (ctr == NULL || ctr->ptr_file_ctr == 0) { @@ -884,7 +884,7 @@ void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action, { case 3: { - display_srv_file_info_3_ctr(out_hnd, action, + display_srv_file_info_3_ctr(out_hnd, action, &(ctr->file.info3)); break; } @@ -899,8 +899,8 @@ void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** sess info level 0 display function ****************************************************************************/ -void display_sess_info_0(FILE *out_hnd, enum action_type action, - const SESS_INFO_0 *info0, const SESS_INFO_0_STR *str0) +void display_sess_info_0(FILE *out_hnd, enum action_type action, + SESS_INFO_0 *const info0, SESS_INFO_0_STR *const str0) { if (info0 == NULL || str0 == NULL) { @@ -919,7 +919,7 @@ void display_sess_info_0(FILE *out_hnd, enum action_type action, { fstring name; - unistr2_to_ascii(name, &str0->uni_name, + unistr2_to_ascii(name, &str0->uni_name, sizeof(name)-1); fprintf(out_hnd, "\tname:\t%s\n", name); @@ -938,8 +938,8 @@ void display_sess_info_0(FILE *out_hnd, enum action_type action, /**************************************************************************** sess info level 1 display function ****************************************************************************/ -void display_sess_info_1(FILE *out_hnd, enum action_type action, - const SESS_INFO_1 *info1, const SESS_INFO_1_STR *str1) +void display_sess_info_1(FILE *out_hnd, enum action_type action, + SESS_INFO_1 *const info1, SESS_INFO_1_STR *const str1) { if (info1 == NULL || str1 == NULL) { @@ -959,9 +959,9 @@ void display_sess_info_1(FILE *out_hnd, enum action_type action, fstring name; fstring user_name; - unistr2_to_ascii(user_name, &str1->uni_user, + unistr2_to_ascii(user_name, &str1->uni_user, sizeof(user_name)-1); - unistr2_to_ascii(name, &str1->uni_name, + unistr2_to_ascii(name, &str1->uni_name, sizeof(name)-1); fprintf(out_hnd, "\tname:\t%s\n", name); @@ -987,8 +987,8 @@ void display_sess_info_1(FILE *out_hnd, enum action_type action, /**************************************************************************** sess info level 0 container display function ****************************************************************************/ -void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action, - const SRV_SESS_INFO_0 *ctr) +void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action, + SRV_SESS_INFO_0 *const ctr) { if (ctr == NULL) { @@ -1024,8 +1024,8 @@ void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** sess info level 1 container display function ****************************************************************************/ -void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action, - const SRV_SESS_INFO_1 *ctr) +void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action, + SRV_SESS_INFO_1 *const ctr) { if (ctr == NULL) { @@ -1061,8 +1061,8 @@ void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** sess info container display function ****************************************************************************/ -void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action, - const SRV_SESS_INFO_CTR *ctr) +void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action, + SRV_SESS_INFO_CTR *const ctr) { if (ctr == NULL || ctr->ptr_sess_ctr == 0) { @@ -1074,13 +1074,13 @@ void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action, { case 0: { - display_srv_sess_info_0_ctr(out_hnd, action, + display_srv_sess_info_0_ctr(out_hnd, action, &(ctr->sess.info0)); break; } case 1: { - display_srv_sess_info_1_ctr(out_hnd, action, + display_srv_sess_info_1_ctr(out_hnd, action, &(ctr->sess.info1)); break; } @@ -1095,8 +1095,8 @@ void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** print browse connection on a host ****************************************************************************/ -void display_server(FILE *out_hnd, enum action_type action, - const char *sname, uint32 type, const char *comment) +void display_server(FILE *out_hnd, enum action_type action, + char *const sname, uint32 type, char *const comment) { switch (action) { @@ -1106,7 +1106,7 @@ void display_server(FILE *out_hnd, enum action_type action, } case ACTION_ENUMERATE: { - fprintf(out_hnd, "\t%-15.15s%-20s %s\n", + fprintf(out_hnd, "\t%-15.15s%-20s %s\n", sname, get_server_type_str(type), comment); break; } @@ -1120,8 +1120,8 @@ void display_server(FILE *out_hnd, enum action_type action, /**************************************************************************** print shares on a host ****************************************************************************/ -void display_share(FILE *out_hnd, enum action_type action, - const char *sname, uint32 type, const char *comment) +void display_share(FILE *out_hnd, enum action_type action, + char *const sname, uint32 type, char *const comment) { switch (action) { @@ -1131,7 +1131,7 @@ void display_share(FILE *out_hnd, enum action_type action, } case ACTION_ENUMERATE: { - fprintf(out_hnd, "\t%-15.15s%-10.10s%s\n", + fprintf(out_hnd, "\t%-15.15s%-10.10s%s\n", sname, get_share_type_str(type), comment); break; } @@ -1146,10 +1146,10 @@ void display_share(FILE *out_hnd, enum action_type action, /**************************************************************************** print shares on a host, level 2 ****************************************************************************/ -void display_share2(FILE *out_hnd, enum action_type action, - const char *sname, uint32 type, const char *comment, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd) +void display_share2(FILE *out_hnd, enum action_type action, + char *const sname, uint32 type, char *const comment, + uint32 perms, uint32 max_uses, uint32 num_uses, + char *const path, char *const passwd) { switch (action) { @@ -1159,8 +1159,8 @@ void display_share2(FILE *out_hnd, enum action_type action, } case ACTION_ENUMERATE: { - fprintf(out_hnd, "\t%-15.15s%-10.10s%s %x %x %x %s %s\n", - sname, get_share_type_str(type), comment, + fprintf(out_hnd, "\t%-15.15s%-10.10s%s %x %x %x %s %s\n", + sname, get_share_type_str(type), comment, perms, max_uses, num_uses, path, passwd); break; } @@ -1175,8 +1175,8 @@ void display_share2(FILE *out_hnd, enum action_type action, /**************************************************************************** print name info ****************************************************************************/ -void display_name(FILE *out_hnd, enum action_type action, - const char *sname) +void display_name(FILE *out_hnd, enum action_type action, + char *const sname) { switch (action) { @@ -1200,9 +1200,9 @@ void display_name(FILE *out_hnd, enum action_type action, /**************************************************************************** display alias members ****************************************************************************/ -void display_alias_members(FILE *out_hnd, enum action_type action, - uint32 num_mem, const char **sid_mem, - const uint8 *type) +void display_alias_members(FILE *out_hnd, enum action_type action, + uint32 num_mem, char *const *const sid_mem, + uint8 *const type) { switch (action) { @@ -1227,8 +1227,8 @@ void display_alias_members(FILE *out_hnd, enum action_type action, { if (sid_mem[i] != NULL) { - fprintf(out_hnd, "\tMember Name:\t%s\tType:\t%s\n", - sid_mem[i], + fprintf(out_hnd, "\tMember Name:\t%s\tType:\t%s\n", + sid_mem[i], get_sid_name_use_str(type[i])); } } @@ -1247,9 +1247,9 @@ void display_alias_members(FILE *out_hnd, enum action_type action, /**************************************************************************** display alias rid info ****************************************************************************/ -void display_alias_rid_info(FILE *out_hnd, enum action_type action, - const DOM_SID *sid, - uint32 num_rids, const uint32 *rid) +void display_alias_rid_info(FILE *out_hnd, enum action_type action, + DOM_SID *const sid, + uint32 num_rids, uint32 *const rid) { switch (action) { @@ -1290,8 +1290,8 @@ void display_alias_rid_info(FILE *out_hnd, enum action_type action, /**************************************************************************** display group members ****************************************************************************/ -void display_group_members(FILE *out_hnd, enum action_type action, - uint32 num_mem, const char **name, const uint32 *type) +void display_group_members(FILE *out_hnd, enum action_type action, + uint32 num_mem, char *const *const name, uint32 *const type) { switch (action) { @@ -1314,7 +1314,7 @@ void display_group_members(FILE *out_hnd, enum action_type action, for (i = 0; i < num_mem; i++) { - fprintf(out_hnd, "\tMember Name:\t%s\tType:\t%s\n", + fprintf(out_hnd, "\tMember Name:\t%s\tType:\t%s\n", name[i], get_sid_name_use_str(type[i])); } @@ -1332,7 +1332,7 @@ void display_group_members(FILE *out_hnd, enum action_type action, /**************************************************************************** display group info ****************************************************************************/ -void display_group_info1(FILE *out_hnd, enum action_type action, const GROUP_INFO1 *info1) +void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1) { switch (action) @@ -1363,7 +1363,7 @@ void display_group_info1(FILE *out_hnd, enum action_type action, const GROUP_INF /**************************************************************************** display group info ****************************************************************************/ -void display_group_info4(FILE *out_hnd, enum action_type action, const GROUP_INFO4 *info4) +void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4) { switch (action) @@ -1377,7 +1377,7 @@ void display_group_info4(FILE *out_hnd, enum action_type action, const GROUP_INF fstring desc; unistr2_to_ascii(desc, &info4->uni_acct_desc, sizeof(desc)-1); - fprintf(out_hnd, "\tGroup Description:%s\n", + fprintf(out_hnd, "\tGroup Description:%s\n", desc); break; } @@ -1391,8 +1391,8 @@ void display_group_info4(FILE *out_hnd, enum action_type action, const GROUP_INF /**************************************************************************** display sam sync structure ****************************************************************************/ -void display_group_info_ctr(FILE *out_hnd, enum action_type action, - const GROUP_INFO_CTR *ctr) +void display_group_info_ctr(FILE *out_hnd, enum action_type action, + GROUP_INFO_CTR *const ctr) { switch (action) { @@ -1435,8 +1435,8 @@ void display_group_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** display group rid info ****************************************************************************/ -void display_group_rid_info(FILE *out_hnd, enum action_type action, - uint32 num_gids, const DOM_GID *gid) +void display_group_rid_info(FILE *out_hnd, enum action_type action, + uint32 num_gids, DOM_GID *const gid) { switch (action) { @@ -1459,7 +1459,7 @@ void display_group_rid_info(FILE *out_hnd, enum action_type action, for (i = 0; i < num_gids; i++) { - fprintf(out_hnd, "\tGroup RID:\t%8x attr:\t%x\n", + fprintf(out_hnd, "\tGroup RID:\t%8x attr:\t%x\n", gid[i].g_rid, gid[i].attr); } @@ -1477,8 +1477,8 @@ void display_group_rid_info(FILE *out_hnd, enum action_type action, /**************************************************************************** display alias name info ****************************************************************************/ -void display_alias_name_info(FILE *out_hnd, enum action_type action, - uint32 num_aliases, const fstring *alias_name, const uint32 *num_als_usrs) +void display_alias_name_info(FILE *out_hnd, enum action_type action, + uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs) { switch (action) { @@ -1501,7 +1501,7 @@ void display_alias_name_info(FILE *out_hnd, enum action_type action, for (i = 0; i < num_aliases; i++) { - fprintf(out_hnd, "\tAlias Name:\t%s Attributes:\t%3d\n", + fprintf(out_hnd, "\tAlias Name:\t%s Attributes:\t%3d\n", alias_name[i], num_als_usrs[i]); } @@ -1518,7 +1518,7 @@ void display_alias_name_info(FILE *out_hnd, enum action_type action, /**************************************************************************** display alias info ****************************************************************************/ -void display_alias_info3(FILE *out_hnd, enum action_type action, const ALIAS_INFO3 *info3) +void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3) { switch (action) @@ -1545,8 +1545,8 @@ void display_alias_info3(FILE *out_hnd, enum action_type action, const ALIAS_INF /**************************************************************************** display sam sync structure ****************************************************************************/ -void display_alias_info_ctr(FILE *out_hnd, enum action_type action, - const ALIAS_INFO_CTR *ctr) +void display_alias_info_ctr(FILE *out_hnd, enum action_type action, + ALIAS_INFO_CTR *const ctr) { switch (action) { @@ -1583,7 +1583,7 @@ void display_alias_info_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** display sam_user_info_21 structure ****************************************************************************/ -void display_sam_user_info_21(FILE *out_hnd, enum action_type action, const SAM_USER_INFO_21 *usr) +void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr) { switch (action) { @@ -1730,7 +1730,7 @@ char *get_sec_mask_str(uint32 type) /**************************************************************************** display sec_access structure ****************************************************************************/ -void display_sec_access(FILE *out_hnd, enum action_type action, const SEC_ACCESS *info) +void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *const info) { switch (action) { @@ -1740,7 +1740,7 @@ void display_sec_access(FILE *out_hnd, enum action_type action, const SEC_ACCESS } case ACTION_ENUMERATE: { - fprintf(out_hnd, "\t\tPermissions:\t%s\n", + fprintf(out_hnd, "\t\tPermissions:\t%s\n", get_sec_mask_str(info->mask)); } case ACTION_FOOTER: @@ -1753,7 +1753,7 @@ void display_sec_access(FILE *out_hnd, enum action_type action, const SEC_ACCESS /**************************************************************************** display sec_ace structure ****************************************************************************/ -void display_sec_ace(FILE *out_hnd, enum action_type action, const SEC_ACE *ace) +void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *const ace) { switch (action) { @@ -1783,13 +1783,13 @@ void display_sec_ace(FILE *out_hnd, enum action_type action, const SEC_ACE *ace) /**************************************************************************** display sec_acl structure ****************************************************************************/ -void display_sec_acl(FILE *out_hnd, enum action_type action, const SEC_ACL *sec_acl) +void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *const sec_acl) { switch (action) { case ACTION_HEADER: { - fprintf(out_hnd, "\tACL\tNum ACEs:\t%d\trevision:\t%x\n", + fprintf(out_hnd, "\tACL\tNum ACEs:\t%d\trevision:\t%x\n", sec_acl->num_aces, sec_acl->revision); fprintf(out_hnd, "\t---\n"); @@ -1821,13 +1821,13 @@ void display_sec_acl(FILE *out_hnd, enum action_type action, const SEC_ACL *sec_ /**************************************************************************** display sec_desc structure ****************************************************************************/ -void display_sec_desc(FILE *out_hnd, enum action_type action, const SEC_DESC *sec) +void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec) { switch (action) { case ACTION_HEADER: { - fprintf(out_hnd, "\tSecurity Descriptor\trevision:\t%x\ttype:\t%x\n", + fprintf(out_hnd, "\tSecurity Descriptor\trevision:\t%x\ttype:\t%x\n", sec->revision, sec->type); fprintf(out_hnd, "\t-------------------\n"); @@ -1912,7 +1912,7 @@ char *get_reg_val_type_str(uint32 type) } -static void print_reg_value(FILE *out_hnd, const char *val_name, +static void print_reg_value(FILE *out_hnd, const char *val_name, uint32 val_type, const BUFFER2 *value) { fstring type; @@ -1924,9 +1924,9 @@ static void print_reg_value(FILE *out_hnd, const char *val_name, { case 0x01: /* unistr */ { - unibuf_to_ascii(valstr, value->buffer, + unibuf_to_ascii(valstr, value->buffer, MIN(value->buf_len, sizeof(valstr)-1)); - fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, valstr); + fprintf(out_hnd, "\t%s:\t%s:\t%s\n", val_name, type, valstr); break; } @@ -1935,14 +1935,14 @@ static void print_reg_value(FILE *out_hnd, const char *val_name, { if (value->buf_len <= 8) { - fprintf(out_hnd,"\t%s:\t%s:\t", val_name, type); - out_data(out_hnd, (const char*)value->buffer, + fprintf(out_hnd, "\t%s:\t%s:\t", val_name, type); + out_data(out_hnd, (const char*)value->buffer, value->buf_len, 8); } else { - fprintf(out_hnd,"\t%s:\t%s:\n", val_name, type); - out_data(out_hnd, (const char*)value->buffer, + fprintf(out_hnd, "\t%s:\t%s:\n", val_name, type); + out_data(out_hnd, (const char*)value->buffer, value->buf_len, 16); } break; @@ -1950,14 +1950,14 @@ static void print_reg_value(FILE *out_hnd, const char *val_name, case 0x04: /* uint32 */ { - fprintf(out_hnd,"\t%s:\t%s:\t0x%08x\n", val_name, type, buffer2_to_uint32(value)); + fprintf(out_hnd, "\t%s:\t%s:\t0x%08x\n", val_name, type, buffer2_to_uint32(value)); break; } case 0x07: /* multiunistr */ { buffer2_to_multistr(valstr, value, sizeof(valstr)-1); - fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, valstr); + fprintf(out_hnd, "\t%s:\t%s:\t%s\n", val_name, type, valstr); break; } } @@ -1966,8 +1966,8 @@ static void print_reg_value(FILE *out_hnd, const char *val_name, /**************************************************************************** display structure ****************************************************************************/ -void display_reg_value_info(FILE *out_hnd, enum action_type action, - const char *val_name, +void display_reg_value_info(FILE *out_hnd, enum action_type action, + const char *val_name, uint32 val_type, const BUFFER2 *value) { switch (action) @@ -1991,7 +1991,7 @@ void display_reg_value_info(FILE *out_hnd, enum action_type action, /**************************************************************************** display structure ****************************************************************************/ -void display_reg_key_info(FILE *out_hnd, enum action_type action, +void display_reg_key_info(FILE *out_hnd, enum action_type action, const char *key_name, time_t key_mod_time) { switch (action) @@ -2002,7 +2002,7 @@ void display_reg_key_info(FILE *out_hnd, enum action_type action, } case ACTION_ENUMERATE: { - fprintf(out_hnd, "\t%s\t(%s)\n", + fprintf(out_hnd, "\t%s\t(%s)\n", key_name, http_timestring(key_mod_time)); break; } @@ -2037,8 +2037,8 @@ char *get_svc_start_type_str(uint32 type) /**************************************************************************** display structure ****************************************************************************/ -void display_query_svc_cfg(FILE *out_hnd, enum action_type action, - const QUERY_SERVICE_CONFIG *cfg) +void display_query_svc_cfg(FILE *out_hnd, enum action_type action, + const QUERY_SERVICE_CONFIG *const cfg) { switch (action) { @@ -2085,7 +2085,8 @@ void display_query_svc_cfg(FILE *out_hnd, enum action_type action, /**************************************************************************** display structure ****************************************************************************/ -void display_svc_info(FILE *out_hnd, enum action_type action, const ENUM_SRVC_STATUS *svc) +void display_svc_info(FILE *out_hnd, enum action_type action, + const ENUM_SRVC_STATUS *const svc) { switch (action) { @@ -2097,11 +2098,11 @@ void display_svc_info(FILE *out_hnd, enum action_type action, const ENUM_SRVC_ST { fstring name; - unistr_to_ascii(name, svc->uni_srvc_name.buffer, + unistr_to_ascii(name, svc->uni_srvc_name.buffer, sizeof(name)-1); /* service name */ fprintf(out_hnd, "\t%s:", name); - unistr_to_ascii(name, svc->uni_disp_name.buffer, + unistr_to_ascii(name, svc->uni_disp_name.buffer, sizeof(name)-1); /* display name */ fprintf(out_hnd, "\t%s\n", name); break; @@ -2124,7 +2125,7 @@ static char *get_at_time_str(uint32 t) minutes = hours % 60; hours /= 60; - slprintf(timestr, sizeof(timestr)-1, "%2d:%02d:%02d", + slprintf(timestr, sizeof(timestr)-1, "%2d:%02d:%02d", hours, minutes, seconds); return timestr; @@ -2161,7 +2162,7 @@ static char *get_at_days_str(uint32 monthdays, uint8 weekdays, uint8 flags) if (first) first = False; else - fstrcat(days, ","); + fstrcat(days, ", "); slprintf(numstr, sizeof(numstr)-1, "%d", day); fstrcat(days, numstr); @@ -2175,7 +2176,7 @@ static char *get_at_days_str(uint32 monthdays, uint8 weekdays, uint8 flags) if (first) first = False; else - fstrcat(days, ","); + fstrcat(days, ", "); fstrcat(days, daynames_short[day]); } @@ -2187,8 +2188,8 @@ static char *get_at_days_str(uint32 monthdays, uint8 weekdays, uint8 flags) /**************************************************************************** display scheduled jobs ****************************************************************************/ -void display_at_enum_info(FILE *out_hnd, enum action_type action, - uint32 num_jobs, const AT_ENUM_INFO *jobs, const fstring *commands) +void display_at_enum_info(FILE *out_hnd, enum action_type action, + uint32 num_jobs, const AT_ENUM_INFO *const jobs, const fstring *const commands) { switch (action) { @@ -2211,14 +2212,14 @@ void display_at_enum_info(FILE *out_hnd, enum action_type action, for (i = 0; i < num_jobs; i++) { - const AT_JOB_INFO *job = &jobs[i].info; - - fprintf(out_hnd, "\t%d\t%s\t%s\t%s\n", - jobs[i].jobid, - get_at_time_str(job->time), - get_at_days_str(job->monthdays, - job->weekdays, - job->flags), + const AT_JOB_INFO *const job = &jobs[i].info; + + fprintf(out_hnd, "\t%d\t%s\t%s\t%s\n", + jobs[i].jobid, + get_at_time_str(job->time), + get_at_days_str(job->monthdays, + job->weekdays, + job->flags), commands[i]); } @@ -2235,8 +2236,8 @@ void display_at_enum_info(FILE *out_hnd, enum action_type action, /**************************************************************************** display information about a scheduled job ****************************************************************************/ -void display_at_job_info(FILE *out_hnd, enum action_type action, - const AT_JOB_INFO *job, fstring command) +void display_at_job_info(FILE *out_hnd, enum action_type action, + AT_JOB_INFO *const job, fstring command) { switch (action) { @@ -2251,11 +2252,11 @@ void display_at_job_info(FILE *out_hnd, enum action_type action, fprintf(out_hnd, "\tTime: %s\n", get_at_time_str(job->time)); - fprintf(out_hnd, "\tSchedule: %s\n", - get_at_days_str(job->monthdays, job->weekdays, + fprintf(out_hnd, "\tSchedule: %s\n", + get_at_days_str(job->monthdays, job->weekdays, job->flags)); - fprintf(out_hnd, "\tStatus: %s", + fprintf(out_hnd, "\tStatus: %s", (job->flags & JOB_EXEC_ERR) ? "Failed" : "OK"); if (job->flags & JOB_RUNS_TODAY) @@ -2263,7 +2264,7 @@ void display_at_job_info(FILE *out_hnd, enum action_type action, fprintf(out_hnd, ", Runs Today"); } - fprintf(out_hnd, "\n\tInteractive: %s\n", + fprintf(out_hnd, "\n\tInteractive: %s\n", (job->flags & JOB_NONINTERACTIVE) ? "No" : "Yes"); @@ -2281,7 +2282,7 @@ void display_at_job_info(FILE *out_hnd, enum action_type action, /**************************************************************************** display structure ****************************************************************************/ -void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, const EVENTLOGRECORD *ev) +void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev) { switch (action) { @@ -2357,9 +2358,9 @@ void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, const /**************************************************************************** display sam sync structure ****************************************************************************/ -void display_sam_sync_ctr(FILE *out_hnd, enum action_type action, - const SAM_DELTA_HDR *delta, - const SAM_DELTA_CTR *ctr) +void display_sam_sync_ctr(FILE *out_hnd, enum action_type action, + SAM_DELTA_HDR *const delta, + SAM_DELTA_CTR *const ctr) { fstring name; @@ -2412,9 +2413,9 @@ void display_sam_sync_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** display sam sync structure ****************************************************************************/ -void display_sam_sync(FILE *out_hnd, enum action_type action, - const SAM_DELTA_HDR *deltas, - const SAM_DELTA_CTR *ctr, +void display_sam_sync(FILE *out_hnd, enum action_type action, + SAM_DELTA_HDR *const deltas, + SAM_DELTA_CTR *const ctr, uint32 num) { switch (action) @@ -2448,8 +2449,8 @@ void display_sam_sync(FILE *out_hnd, enum action_type action, /**************************************************************************** display sam sync structure ****************************************************************************/ -void display_sam_unk_info_2(FILE *out_hnd, enum action_type action, - const SAM_UNK_INFO_2 *info2) +void display_sam_unk_info_2(FILE *out_hnd, enum action_type action, + SAM_UNK_INFO_2 *const info2) { switch (action) { @@ -2493,8 +2494,8 @@ void display_sam_unk_info_2(FILE *out_hnd, enum action_type action, /**************************************************************************** display sam sync structure ****************************************************************************/ -void display_sam_unk_ctr(FILE *out_hnd, enum action_type action, - uint32 switch_value, const SAM_UNK_CTR *ctr) +void display_sam_unk_ctr(FILE *out_hnd, enum action_type action, + uint32 switch_value, SAM_UNK_CTR *const ctr) { switch (action) { @@ -2530,8 +2531,8 @@ void display_sam_unk_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** printer info level 0 display function ****************************************************************************/ -void display_print_info_0(FILE *out_hnd, enum action_type action, - const PRINTER_INFO_0 *i0) +void display_print_info_0(FILE *out_hnd, enum action_type action, + PRINTER_INFO_0 *const i0) { if (i0 == NULL) { @@ -2572,8 +2573,8 @@ void display_print_info_0(FILE *out_hnd, enum action_type action, /**************************************************************************** printer info level 1 display function ****************************************************************************/ -void display_print_info_1(FILE *out_hnd, enum action_type action, - const PRINTER_INFO_1 *i1) +void display_print_info_1(FILE *out_hnd, enum action_type action, + PRINTER_INFO_1 *const i1) { if (i1 == NULL) { @@ -2617,8 +2618,8 @@ void display_print_info_1(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info level 0 container display function ****************************************************************************/ -void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, - uint32 count, const PRINTER_INFO_0 **ctr) +void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, + uint32 count, PRINTER_INFO_0 *const *const ctr) { if (ctr == NULL) { @@ -2654,8 +2655,8 @@ void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info level 1 container display function ****************************************************************************/ -void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, - uint32 count, const PRINTER_INFO_1 **ctr) +void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, + uint32 count, PRINTER_INFO_1 *const *const ctr) { if (ctr == NULL) { @@ -2691,8 +2692,9 @@ void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, /**************************************************************************** connection info container display function ****************************************************************************/ -void display_printer_info_ctr(FILE *out_hnd, enum action_type action, - uint32 level, uint32 count, const void **ctr) +void display_printer_info_ctr(FILE *out_hnd, enum action_type action, + uint32 level, uint32 count, + void *const *const ctr) { if (ctr == NULL) { @@ -2704,14 +2706,14 @@ void display_printer_info_ctr(FILE *out_hnd, enum action_type action, { case 0: { - display_printer_info_0_ctr(out_hnd, action, - count, (const PRINTER_INFO_0**)ctr); + display_printer_info_0_ctr(out_hnd, action, + count, (PRINTER_INFO_0*const*const)ctr); break; } case 1: { - display_printer_info_1_ctr(out_hnd, action, - count, (const PRINTER_INFO_1**)ctr); + display_printer_info_1_ctr(out_hnd, action, + count, (PRINTER_INFO_1*const*const)ctr); break; } default: diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index e9ddbd3f31..e465a63767 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -885,7 +885,7 @@ static void reg_key_list(const char *full_name, static void reg_val_list(const char *full_name, const char* name, uint32 type, - BUFFER2 *value) + const BUFFER2 *value) { add_chars_to_array(®_list_len, ®_name, name); } @@ -944,12 +944,31 @@ static char *complete_samenum_usr(char *text, int state) if (state == 0) { + fstring srv_name; + fstring domain; + fstring sid; + DOM_SID sid1; + sid_copy(&sid1, &cli_info.dom.level5_sid); + sid_to_string(sid, &sid1); + fstrcpy(domain, cli_info.dom.level5_dom); + + if (sid1.num_auths == 0) + { + return NULL; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, cli_info.dest_host); + strupper(srv_name); + free(sam); sam = NULL; num_usrs = 0; /* Iterate all users */ - if (msrpc_sam_enum_users(&cli_info, &sam, &num_usrs, + if (msrpc_sam_enum_users(smb_cli, + domain, &sid1, srv_name, + &sam, &num_usrs, NULL, NULL, NULL, NULL) == 0) { return NULL; @@ -981,12 +1000,31 @@ static char *complete_samenum_als(char *text, int state) if (state == 0) { + fstring srv_name; + fstring domain; + fstring sid; + DOM_SID sid1; + sid_copy(&sid1, &cli_info.dom.level5_sid); + sid_to_string(sid, &sid1); + fstrcpy(domain, cli_info.dom.level5_dom); + + if (sid1.num_auths == 0) + { + return NULL; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, cli_info.dest_host); + strupper(srv_name); + free(sam); sam = NULL; num_als = 0; /* Iterate all aliases */ - if (msrpc_sam_enum_aliases(&cli_info, &sam, &num_als, + if (msrpc_sam_enum_aliases(smb_cli, + domain, &sid1, srv_name, + &sam, &num_als, NULL, NULL, NULL) == 0) { return NULL; @@ -1018,12 +1056,31 @@ static char *complete_samenum_grp(char *text, int state) if (state == 0) { + fstring srv_name; + fstring domain; + fstring sid; + DOM_SID sid1; + sid_copy(&sid1, &cli_info.dom.level5_sid); + sid_to_string(sid, &sid1); + fstrcpy(domain, cli_info.dom.level5_dom); + + if (sid1.num_auths == 0) + { + return NULL; + } + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, cli_info.dest_host); + strupper(srv_name); + free(sam); sam = NULL; num_grps = 0; /* Iterate all groups */ - if (msrpc_sam_enum_groups(&cli_info, &sam, &num_grps, + if (msrpc_sam_enum_groups(smb_cli, + domain, &sid1, srv_name, + &sam, &num_grps, NULL, NULL, NULL) == 0) { return NULL; |