From 3478427f2e5ab634d61e6863f41bba84cce8d05e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 8 Dec 2000 03:34:00 +0000 Subject: Port of lsa_lookup_sids() and lsa_lookup_names() rpc client functions from TNG branch. Re-instated lsa_lookup_sids and lsa_lookup_names functions in rpcclient. This requires most samba binaries to link in another handful of object files due to uncessary coupling between modules. )-: (This used to be commit 817819d0cc3ecf642be5a1656be3b71bed260ee4) --- source3/include/proto.h | 28 ++++++++++++----- source3/include/rpc_client_proto.h | 62 ++++++++++++++++++++++++++++++++++++++ source3/include/rpc_lsa.h | 2 +- 3 files changed, 84 insertions(+), 8 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 5c8adc8ca4..c6574e139f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -863,7 +863,7 @@ int name_len(char *s1); /*The following definitions come from libsmb/nterr.c */ BOOL get_safe_nt_error_msg(uint32 nt_code,char *msg, size_t len); -const char *get_nt_error_msg(uint32 nt_code); +char *get_nt_error_msg(uint32 nt_code); /*The following definitions come from libsmb/passchange.c */ @@ -1934,6 +1934,13 @@ BOOL do_lsa_query_info_pol(struct cli_state *cli, fstring domain_name, DOM_SID *domain_sid); BOOL do_lsa_close(struct cli_state *cli, POLICY_HND *hnd); BOOL cli_lsa_get_domain_sid(struct cli_state *cli, char *server); +uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd, + BOOL sec_qos, uint32 des_access); +uint32 lsa_close(POLICY_HND *hnd); +uint32 lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids, + char ***names, uint32 **types, int *num_names); +uint32 lsa_lookup_names(POLICY_HND *hnd, int num_names, char **names, + DOM_SID **sids, uint32 **types, int *num_sids); /*The following definitions come from rpc_client/cli_netlogon.c */ @@ -2266,7 +2273,8 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos); -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth); +BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, + int depth); BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth); void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, uint32 attributes, @@ -2285,14 +2293,14 @@ void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 status); BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth); BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth); -void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids); +void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids); void init_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, - int num_sids, DOM_SID **sids, - uint16 level); -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth); + int num_sids, DOM_SID *sids, uint16 level); +BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, + prs_struct *ps, int depth); BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth); void init_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names); + int num_names, char **names); BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth); BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth); void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd); @@ -3338,6 +3346,12 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid); BOOL api_wkssvc_rpc(pipes_struct *p); #endif +/*The following definitions come from rpcclient/cmd_lsarpc.c */ + +uint32 cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]); +uint32 cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]); +void add_lsa_commands(void); + /*The following definitions come from rpcclient/cmd_spoolss.c */ uint32 cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]); diff --git a/source3/include/rpc_client_proto.h b/source3/include/rpc_client_proto.h index 90d675dbb4..f74cf62602 100644 --- a/source3/include/rpc_client_proto.h +++ b/source3/include/rpc_client_proto.h @@ -3,6 +3,35 @@ /* This file is automatically generated with "make proto". DO NOT EDIT */ +/*The following definitions come from lib/util_list.c */ + +BOOL copy_policy_hnd (POLICY_HND *dest, const POLICY_HND *src); +BOOL compare_rpc_hnd_node(const RPC_HND_NODE *x, + const RPC_HND_NODE *y); +BOOL RpcHndList_set_connection(const POLICY_HND *hnd, + struct cli_connection *con); +BOOL RpcHndList_del_connection(const POLICY_HND *hnd); +struct cli_connection* RpcHndList_get_connection(const POLICY_HND *hnd); + +/*The following definitions come from rpc_client/cli_connect.c */ + +void init_connections(void); +void free_connections(void); +void cli_connection_free(struct cli_connection *con); +void cli_connection_unlink(struct cli_connection *con); +BOOL cli_connection_init(const char *srv_name, char *pipe_name, + struct cli_connection **con); +BOOL cli_connection_init_auth(const char *srv_name, char *pipe_name, + struct cli_connection **con, + cli_auth_fns * auth, void *auth_creds); +struct _cli_auth_fns *cli_conn_get_authfns(struct cli_connection *con); +void *cli_conn_get_auth_creds(struct cli_connection *con); +BOOL rpc_hnd_pipe_req(const POLICY_HND * hnd, uint8 op_num, + prs_struct * data, prs_struct * rdata); +BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num, + prs_struct * data, prs_struct * rdata); +BOOL rpc_con_ok(struct cli_connection *con); + /*The following definitions come from rpc_client/cli_login.c */ BOOL cli_nt_setup_creds(struct cli_state *cli, unsigned char mach_pwd[16]); @@ -32,6 +61,13 @@ BOOL do_lsa_query_info_pol(struct cli_state *cli, fstring domain_name, DOM_SID *domain_sid); BOOL do_lsa_close(struct cli_state *cli, POLICY_HND *hnd); BOOL cli_lsa_get_domain_sid(struct cli_state *cli, char *server); +uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd, + BOOL sec_qos, uint32 des_access); +uint32 lsa_close(POLICY_HND *hnd); +uint32 lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids, + char ***names, uint32 **types, int *num_names); +uint32 lsa_lookup_names(POLICY_HND *hnd, int num_names, char **names, + DOM_SID **sids, uint32 **types, int *num_sids); /*The following definitions come from rpc_client/cli_netlogon.c */ @@ -171,9 +207,35 @@ BOOL do_srv_net_srv_file_enum(struct cli_state *cli, BOOL do_srv_net_srv_get_info(struct cli_state *cli, char *server_name, uint32 switch_value, SRV_INFO_CTR *ctr); +/*The following definitions come from rpc_client/cli_use.c */ + +void init_cli_use(void); +void free_cli_use(void); +struct cli_state *cli_net_use_add(const char *srv_name, + const struct ntuser_creds *usr_creds, + BOOL reuse, BOOL *is_new); +BOOL cli_net_use_del(const char *srv_name, + const struct ntuser_creds *usr_creds, + BOOL force_close, BOOL *connection_closed); +void cli_net_use_enum(uint32 *num_cons, struct use_info ***use); +void cli_use_wait_keyboard(void); + /*The following definitions come from rpc_client/cli_wkssvc.c */ BOOL do_wks_query_info(struct cli_state *cli, char *server_name, uint32 switch_value, WKS_INFO_100 *wks100); + +/*The following definitions come from rpc_client/ncacn_np_use.c */ + +BOOL ncacn_np_use_del(const char *srv_name, const char *pipe_name, + const vuser_key * key, + BOOL force_close, BOOL *connection_closed); +struct ncacn_np *ncacn_np_initialise(struct ncacn_np *msrpc, + const vuser_key * key); +struct ncacn_np *ncacn_np_use_add(const char *pipe_name, + const vuser_key * key, + const char *srv_name, + const struct ntuser_creds *ntc, + BOOL reuse, BOOL *is_new_connection); #endif /* _PROTO_H_ */ diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index b2e2e3c813..0ef54587dc 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -96,7 +96,7 @@ typedef struct obj_attr_info typedef struct lsa_q_open_pol_info { uint32 ptr; /* undocumented buffer pointer */ - uint16 system_name; /* 0x5c - system name */ + uint16 system_name; /* system name BUG!!! (should be \\server!) */ LSA_OBJ_ATTR attr ; /* object attributes */ uint32 des_access; /* desired access attributes */ -- cgit