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 | 0ce128e3550794d4dbbd1def00e87c020f72c992 (patch) | |
tree | 9ff25319ff380a5bb219788d8a116ff5110a3343 /source3/lsarpcd | |
parent | 12ca139d5cb79f7e61a84d7dfe8a4c64ed56d82b (diff) | |
download | samba-0ce128e3550794d4dbbd1def00e87c020f72c992.tar.gz samba-0ce128e3550794d4dbbd1def00e87c020f72c992.tar.bz2 samba-0ce128e3550794d4dbbd1def00e87c020f72c992.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()...)
(This used to be commit aa3c659a8dba0437c17c60055a6ed30fdfecdb6d)
Diffstat (limited to 'source3/lsarpcd')
-rw-r--r-- | source3/lsarpcd/lsarpcd.c | 3 | ||||
-rw-r--r-- | source3/lsarpcd/lsarpcd_process.c | 58 | ||||
-rw-r--r-- | source3/lsarpcd/srv_lsa.c | 20 |
3 files changed, 57 insertions, 24 deletions
diff --git a/source3/lsarpcd/lsarpcd.c b/source3/lsarpcd/lsarpcd.c index 3c883029f0..ed665e85c5 100644 --- a/source3/lsarpcd/lsarpcd.c +++ b/source3/lsarpcd/lsarpcd.c @@ -40,6 +40,7 @@ extern int DEBUGLEVEL; extern fstring remote_machine; extern pstring myhostname; +extern pstring OriginalDir; /**************************************************************************** when exiting, take the whole family @@ -456,6 +457,8 @@ static void usage(char *pname) so set our umask to 0 */ umask(0); + dos_GetWd(OriginalDir); + init_uid(); /* this is for people who can't start the program correctly */ diff --git a/source3/lsarpcd/lsarpcd_process.c b/source3/lsarpcd/lsarpcd_process.c index 47a4f9a86c..e33de5ce57 100644 --- a/source3/lsarpcd/lsarpcd_process.c +++ b/source3/lsarpcd/lsarpcd_process.c @@ -181,7 +181,7 @@ do a switch on the message type, and return the response size ****************************************************************************/ static int do_message(char *inbuf,char *outbuf,int size,int bufsize) { - static int pid= -1; + static int pid= -1; pipes_struct *p = &static_pipe; prs_struct pd; @@ -195,24 +195,16 @@ static int do_message(char *inbuf,char *outbuf,int size,int bufsize) pid = getpid(); /* dce/rpc command */ - if (rpc_command(p, &pd)) + if (rpc_to_smb(p, smb_base(inbuf), smb_len(inbuf))) { char *copy_into = smb_base(outbuf); - outsize = mem_buf_len(p->rhdr.data); - if (!mem_buf_copy(copy_into, p->rhdr.data, 0, outsize)) + outsize = mem_buf_len(p->rsmb_pdu.data); + if (!mem_buf_copy(copy_into, p->rsmb_pdu.data, 0, outsize)) { return -1; } + mem_free_data(p->rsmb_pdu.data); } - mem_free_data(pd.data); - - mem_free_data(p->rhdr .data); - mem_free_data(p->rfault .data); - mem_free_data(p->rdata .data); - mem_free_data(p->rdata_i.data); - mem_free_data(p->rauth .data); - mem_free_data(p->rverf .data); - mem_free_data(p->rntlm .data); return outsize; } @@ -393,6 +385,7 @@ BOOL get_user_creds(struct user_creds *usr) void lsarpcd_process(void) { struct user_creds usr; + gid_t *groups = NULL; ZERO_STRUCT(static_pipe); @@ -405,8 +398,45 @@ void lsarpcd_process(void) return; } + if (usr.uxs.num_grps != 0) + { + int i; + groups = malloc(usr.uxs.num_grps * sizeof(groups[0])); + if (groups == NULL) + { + return; + } + for (i = 0; i < usr.uxs.num_grps; i++) + { + groups[i] = (gid_t)usr.uxs.grps[i]; + } + } + + static_pipe.vuid = create_vuid(usr.uxs.uid, usr.uxs.gid, + usr.uxs.num_grps, groups, + usr.uxc.user_name, + usr.uxc.requested_name, + usr.uxc.real_name, + usr.uxc.guest, + usr.ntc.pwd.sess_key); + + if (static_pipe.vuid == UID_FIELD_INVALID) + { + return; + } + free_user_creds(&usr); + become_vuser(static_pipe.vuid); + + static_pipe.l = malloc(sizeof(*static_pipe.l)); + if (static_pipe.l == NULL) + { + return; + } + + ZERO_STRUCTP(static_pipe.l); + InBuffer = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); OutBuffer = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); if ((InBuffer == NULL) || (OutBuffer == NULL)) @@ -457,7 +487,7 @@ void lsarpcd_process(void) t = time(NULL); /* become root again if waiting */ - unbecome_user(); + unbecome_vuser(); /* check for smb.conf reload */ if (counter >= service_load_counter + SMBD_RELOAD_CHECK) diff --git a/source3/lsarpcd/srv_lsa.c b/source3/lsarpcd/srv_lsa.c index 9b6a98e9a6..fbe83b02c8 100644 --- a/source3/lsarpcd/srv_lsa.c +++ b/source3/lsarpcd/srv_lsa.c @@ -140,7 +140,7 @@ static void lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata, { /* set up the LSA QUERY INFO response */ - r_q.undoc_buffer = 0x1; /* bizarre */ + r_q.undoc_buffer = 0x1; r_q.info_class = q_q->info_class; make_dom_query(&r_q.dom.id5, dom_name, dom_sid); @@ -448,7 +448,7 @@ static void lsa_reply_lookup_names(prs_struct *rdata, /*************************************************************************** api_lsa_open_policy ***************************************************************************/ -static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data, +static void api_lsa_open_policy2( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_OPEN_POL2 q_o; @@ -467,7 +467,7 @@ static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_open_policy ***************************************************************************/ -static void api_lsa_open_policy( pipes_struct *p, prs_struct *data, +static void api_lsa_open_policy( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_OPEN_POL q_o; @@ -486,7 +486,7 @@ static void api_lsa_open_policy( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_enum_trust_dom ***************************************************************************/ -static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data, +static void api_lsa_enum_trust_dom( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_ENUM_TRUST_DOM q_e; @@ -503,7 +503,7 @@ static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_query_info ***************************************************************************/ -static void api_lsa_query_info( pipes_struct *p, prs_struct *data, +static void api_lsa_query_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_QUERY_INFO q_i; @@ -545,7 +545,7 @@ static void api_lsa_query_info( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_lookup_sids ***************************************************************************/ -static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data, +static void api_lsa_lookup_sids( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_LOOKUP_SIDS q_l; @@ -561,7 +561,7 @@ static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_lookup_names ***************************************************************************/ -static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data, +static void api_lsa_lookup_names( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_LOOKUP_NAMES q_l; @@ -578,7 +578,7 @@ static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_close ***************************************************************************/ -static void api_lsa_close( pipes_struct *p, prs_struct *data, +static void api_lsa_close( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { LSA_R_CLOSE r_c; @@ -607,7 +607,7 @@ static void api_lsa_close( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_open_secret ***************************************************************************/ -static void api_lsa_open_secret( pipes_struct *p, prs_struct *data, +static void api_lsa_open_secret( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { /* XXXX this is NOT good */ @@ -648,7 +648,7 @@ static struct api_struct api_lsa_cmds[] = /*************************************************************************** api_ntLsarpcTNP ***************************************************************************/ -BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data) +BOOL api_ntlsa_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_ntlsa_rpc", api_lsa_cmds, data); } |