diff options
author | Luke Leighton <lkcl@samba.org> | 1999-12-12 01:25:49 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-12-12 01:25:49 +0000 |
commit | aa3c659a8dba0437c17c60055a6ed30fdfecdb6d (patch) | |
tree | 7b2944bd50eb23a3df886effcc2d7592c280422b /source/include | |
parent | e1d2b174caf5f0c48a8fac25778f72a868ec6eb7 (diff) | |
download | samba-aa3c659a8dba0437c17c60055a6ed30fdfecdb6d.tar.gz samba-aa3c659a8dba0437c17c60055a6ed30fdfecdb6d.tar.xz samba-aa3c659a8dba0437c17c60055a6ed30fdfecdb6d.zip |
delineation between smb and msrpc more marked. smbd now constructs
pdus, and then feeds them over either a "local" function call or a "remote"
function call to an msrpc service. the "remote" msrpc daemon, on the
other side of a unix socket, then calls the same "local" function that
smbd would, if the msrpc service were being run from inside smbd.
this allows a transition from local msrpc services (inside the same smbd
process) to remote (over a unix socket).
removed reference to pipes_struct in msrpc services. all msrpc processing
functions take rpcsrv_struct which is a structure containing state info
for the msrpc functions to decode and create pdus.
created become_vuser() which does everything not related to connection_struct
that become_user() does.
removed, as best i could, connection_struct dependencies from the nt spoolss
printing code.
todo: remove dcinfo from rpcsrv_struct because this stores NETLOGON-specific
info on a per-connection basis, and if the connection dies then so does
the info, and that's a fairly serious problem.
had to put pretty much everything that is in user_struct into parse_creds.c
to feed unix user info over to the msrpc daemons. why? because it's
expensive to do unix password/group database lookups, and it's definitely
expensive to do nt user profile lookups, not to mention pretty difficult
and if you did either of these it would introduce a complication /
unnecessary interdependency. so, send uid/gid/num_groups/gid_t* +
SID+num_rids+domain_group_rids* + unix username + nt username + nt domain
+ user session key etc. this is the MINIMUM info identified so far that's
actually implemented. missing bits include the called and calling
netbios names etc. (basically, anything that can be loaded into
standard_sub() and standard_sub_basic()...)
Diffstat (limited to 'source/include')
-rw-r--r-- | source/include/ntdomain.h | 49 | ||||
-rw-r--r-- | source/include/proto.h | 63 | ||||
-rw-r--r-- | source/include/rpc_creds.h | 6 | ||||
-rwxr-xr-x | source/include/rpc_spoolss.h | 2 | ||||
-rw-r--r-- | source/include/smb.h | 7 |
5 files changed, 81 insertions, 46 deletions
diff --git a/source/include/ntdomain.h b/source/include/ntdomain.h index 95ba141b10e..096e7cd66ca 100644 --- a/source/include/ntdomain.h +++ b/source/include/ntdomain.h @@ -62,20 +62,8 @@ typedef struct } prs_struct; -typedef struct pipes_struct +typedef struct rpcsrv_struct { - struct pipes_struct *next, *prev; - int pnum; - connection_struct *conn; - uint16 vuid; - BOOL open; /* open connection */ - uint16 device_state; - uint16 priority; - fstring name; - fstring pipe_srv_name; - - struct msrpc_state *m; - prs_struct rhdr; /* output header */ prs_struct rfault; /* fault */ prs_struct rdata; /* output data */ @@ -107,6 +95,39 @@ typedef struct pipes_struct fstring domain; fstring wks; + uchar user_sess_key[16]; + + /* per-user authentication info. hmm, this not appropriate, but + it will do for now. dcinfo contains NETLOGON-specific info, + so have to think of a better method. + */ + struct dcinfo dc; + +} rpcsrv_struct; + +typedef struct pipes_struct +{ + struct pipes_struct *next, *prev; + int pnum; + connection_struct *conn; + uint16 vuid; + BOOL open; /* open connection */ + uint16 device_state; + uint16 priority; + fstring name; + fstring pipe_srv_name; + + /* remote, server-side rpc redirection */ + struct msrpc_state *m; + + /* local, server-side rpc state processing */ + rpcsrv_struct *l; + + /* to store pdus being constructed / communicated from smb to msrpc */ + prs_struct smb_pdu; + prs_struct rsmb_pdu; + + /* state-based info used in processing smbs to/from msrpc pdus */ uint32 file_offset; uint32 prev_pdu_file_offset; uint32 hdr_offsets; @@ -117,7 +138,7 @@ struct api_struct { char *name; uint8 opnum; - void (*fn) (pipes_struct*, prs_struct*, prs_struct*); + void (*fn) (rpcsrv_struct*, prs_struct*, prs_struct*); }; struct mem_desc diff --git a/source/include/proto.h b/source/include/proto.h index a18b498ba50..db5aa0b9b43 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -325,7 +325,7 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass, uchar challenge[8], const char *user, const char *domain, uchar *lm_pass, size_t lm_pwd_len, uchar *nt_pass, size_t nt_pwd_len, - uchar sess_key[16]); + uchar user_sess_key[16]); BOOL pass_check_smb(struct smb_passwd *smb_pass, char *domain, uchar *chal, uchar *lm_pwd, size_t lm_pwd_len, uchar *nt_pwd, size_t nt_pwd_len, @@ -728,6 +728,10 @@ void start_agent(struct vagent_ops *va); user_struct *get_valid_user_struct(uint16 vuid); void invalidate_vuid(uint16 vuid); char *validated_username(uint16 vuid); +uint16 create_vuid(uid_t uid, gid_t gid, int n_groups, gid_t *groups, + char *unix_name, char *requested_name, + char *real_name, + BOOL guest, uchar user_sess_key[16]); uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest, uchar user_sess_key[16]); /*The following definitions come from libsmb/clientgen.c */ @@ -1810,7 +1814,7 @@ int get_ntforms(nt_forms_struct **list); int write_ntforms(nt_forms_struct **list, int number); void add_a_form(nt_forms_struct **list, FORM form, int *count); void update_a_form(nt_forms_struct **list, FORM form, int count); -int get_ntdrivers(connection_struct *conn, fstring **list, char *architecture); +int get_ntdrivers(fstring **list, char *architecture); void get_short_archi(char *short_archi, char *long_archi); void dump_a_param(NT_PRINTER_PARAM *param); BOOL add_a_specific_param(NT_PRINTER_INFO_LEVEL_2 *info_2, NT_PRINTER_PARAM *param); @@ -1841,9 +1845,8 @@ int sysv_printername_ok(char *name); /*The following definitions come from printing/printing.c */ void lpq_reset(int snum); -void print_file(connection_struct *conn, files_struct *file); -int get_printqueue(int snum, - connection_struct *conn,print_queue_struct **queue, +void print_file(connection_struct *conn, int snum, files_struct *file); +int get_printqueue(int snum, connection_struct *conn, print_queue_struct **queue, print_status_struct *status); void del_printqueue(connection_struct *conn,int snum,int jobid); void status_printjob(connection_struct *conn,int snum,int jobid,int status); @@ -2470,13 +2473,18 @@ BOOL brs_io_r_query_info(char *desc, BRS_R_QUERY_INFO *r_u, prs_struct *ps, int /*The following definitions come from rpc_parse/parse_creds.c */ -BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name); +BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name, + const char* requested_name, + const char* real_name, + BOOL guest); BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth); void creds_free_unix(CREDS_UNIX *r_u); BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, - uint32 uid, uint32 gid, uint32 num_grps, uint32 *grps); + uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps); BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth); void creds_free_unix_sec(CREDS_UNIX_SEC *r_u); +BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u, + DOM_SID *sid, uint32 num_grps, uint32 *grps); BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth); void creds_free_nt_sec(CREDS_NT_SEC *r_u); BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth); @@ -2755,14 +2763,16 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], /*The following definitions come from rpc_parse/parse_prs.c */ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name); -void prs_debug_out(prs_struct *ps, int level); +void prs_debug_out(prs_struct *ps, char *msg, int level); void prs_init(prs_struct *ps, uint32 size, uint8 align, uint32 margin, BOOL io); +BOOL prs_copy(prs_struct *ps, const prs_struct *from); void prs_mem_free(prs_struct *ps); void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next); void prs_align(prs_struct *ps); -BOOL prs_grow(prs_struct *ps); +BOOL prs_grow(prs_struct *ps, uint32 new_size); +BOOL prs_append_data(prs_struct *ps, const char *data, int len); BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8); BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16); BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]); @@ -2879,7 +2889,7 @@ BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc, BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth); BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - char *pipe_addr, + const char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer); BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth); @@ -3646,7 +3656,7 @@ BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int /*The following definitions come from rpc_server/srv_brs.c */ -BOOL api_brs_rpc(pipes_struct *p, prs_struct *data); +BOOL api_brs_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_lookup.c */ @@ -3671,23 +3681,26 @@ uint32 lookup_name(char *name, DOM_SID *sid, uint8 *type); /*The following definitions come from rpc_server/srv_lsa.c */ -BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data); +BOOL api_ntlsa_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_netlog.c */ -BOOL api_netlog_rpc(pipes_struct *p, prs_struct *data); +BOOL api_netlog_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_pipe.c */ -BOOL create_rpc_reply(pipes_struct *p, - uint32 data_start, uint32 data_end); +void rpcsrv_free_temp(rpcsrv_struct *l); +BOOL create_rpc_reply(rpcsrv_struct *l, uint32 data_start); void close_msrpc_command_processor(void); void add_msrpc_command_processor(char* pipe_name, char* process_name, - BOOL (*fn) (pipes_struct *, prs_struct *)); -BOOL rpc_command(pipes_struct *p, prs_struct *pd); -BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds, + BOOL (*fn) (rpcsrv_struct *, prs_struct *)); +BOOL rpc_add_to_pdu(prs_struct *ps, const char *data, int len); +BOOL rpc_send_and_rcv_pdu(pipes_struct *p); +BOOL rpc_to_smb(pipes_struct *p, char *data, int len); +BOOL api_rpcTNP(rpcsrv_struct *l, char *rpc_name, struct api_struct *api_rpc_cmds, prs_struct *data); +BOOL is_complete_pdu(prs_struct *ps); /*The following definitions come from rpc_server/srv_pipe_hnd.c */ @@ -3706,30 +3719,30 @@ pipes_struct *get_rpc_pipe(int pnum); /*The following definitions come from rpc_server/srv_reg.c */ -BOOL api_reg_rpc(pipes_struct *p, prs_struct *data); +BOOL api_reg_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_samr.c */ -BOOL api_samr_rpc(pipes_struct *p, prs_struct *data); +BOOL api_samr_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_spoolss.c */ void init_printer_hnd(void); uint32 size_of_notify_info_data(uint16 type, uint16 field); BOOL type_of_notify_info_data(uint16 type, uint16 field); -BOOL api_spoolss_rpc(pipes_struct *p, prs_struct *data); +BOOL api_spoolss_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_srvsvc.c */ -BOOL api_srvsvc_rpc(pipes_struct *p, prs_struct *data); +BOOL api_srvsvc_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_svcctl.c */ -BOOL api_svcctl_rpc(pipes_struct *p, prs_struct *data); +BOOL api_svcctl_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpc_server/srv_wkssvc.c */ -BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data); +BOOL api_wkssvc_rpc(rpcsrv_struct *p, prs_struct *data); /*The following definitions come from rpcclient/cmd_atsvc.c */ @@ -4396,6 +4409,8 @@ int reply_trans2(connection_struct *conn, void init_uid(void); BOOL become_guest(void); +BOOL become_vuser(uint16 vuid); +BOOL unbecome_vuser(void); BOOL become_user(connection_struct *conn, uint16 vuid); BOOL unbecome_user(void ); void become_root(BOOL save_dir) ; diff --git a/source/include/rpc_creds.h b/source/include/rpc_creds.h index 54293a67d06..c389c64d1d7 100644 --- a/source/include/rpc_creds.h +++ b/source/include/rpc_creds.h @@ -36,6 +36,9 @@ typedef struct ntuser_creds typedef struct unixuser_creds { fstring user_name; + fstring requested_name; + fstring real_name; + BOOL guest; } CREDS_UNIX; @@ -51,7 +54,8 @@ typedef struct unixsec_creds typedef struct ntsec_creds { DOM_SID sid; - SEC_DESC_BUF sd ; + uint32 num_grps; + uint32 *grp_rids; } CREDS_NT_SEC; diff --git a/source/include/rpc_spoolss.h b/source/include/rpc_spoolss.h index 65975e4754b..5143b389fc6 100755 --- a/source/include/rpc_spoolss.h +++ b/source/include/rpc_spoolss.h @@ -850,7 +850,7 @@ struct s_notify_info_data_table uint16 field; char *name; uint32 size; - void (*fn) (connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer); + void (*fn) (int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer); }; typedef struct spool_q_getprinterdriver2 diff --git a/source/include/smb.h b/source/include/smb.h index 22bba17e62c..b06cfe2b7b8 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -613,7 +613,6 @@ struct dcinfo uchar sess_key[8]; /* Session key */ uchar md4pw[16]; /* md4(machine password) */ - uchar user_sess_key[16]; /* user session key (md4 nt#) */ }; typedef struct @@ -631,11 +630,7 @@ typedef struct int n_groups; gid_t *groups; - int n_sids; - int *sids; - - /* per-user authentication information on NT RPCs */ - struct dcinfo dc; + uchar user_sess_key[16]; } user_struct; |