From 195e3d44daccc3b6457486018ba0322ac9d44566 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 7 Feb 2000 16:25:15 +0000 Subject: spoolss definitions. also added some prs_struct functions, 'cause I'm handling buffers as prs_struct. J.F. (This used to be commit 81e375bbbe0fb022a44a2aaaa3729a9518b7a854) --- source3/rpc_server/srv_pipe_srv.c | 47 +++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe_srv.c b/source3/rpc_server/srv_pipe_srv.c index 236558ba70..2cebc8148b 100644 --- a/source3/rpc_server/srv_pipe_srv.c +++ b/source3/rpc_server/srv_pipe_srv.c @@ -465,6 +465,7 @@ static struct api_cmd api_fd_commands[] = #if DISABLED_IN_2_0 { "winreg", "winreg", api_reg_rpc }, #endif + { "spoolss", "spoolss", api_spoolss_rpc }, { NULL, NULL, NULL } }; @@ -585,7 +586,7 @@ static BOOL setup_bind_nak(pipes_struct *p, prs_struct *pd) Respond to a pipe bind request. *******************************************************************/ -static BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_bind_and_alt_req(pipes_struct *p, prs_struct *pd, enum RPC_PKT_TYPE pkt_type) { RPC_HDR_BA hdr_ba; RPC_HDR_RB hdr_rb; @@ -684,9 +685,21 @@ static BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *pd) p->ntlmssp_auth_requested = True; } - /* name has to be \PIPE\xxxxx */ - fstrcpy(ack_pipe_name, "\\PIPE\\"); - fstrcat(ack_pipe_name, p->pipe_srv_name); + switch (pkt_type) { + case RPC_BINDACK: + /* name has to be \PIPE\xxxxx */ + fstrcpy(ack_pipe_name, "\\PIPE\\"); + fstrcat(ack_pipe_name, p->pipe_srv_name); + case RPC_ALTCONTRESP: + /* secondary address CAN be NULL + * as the specs says it's ignored. + * It MUST NULL to have the spoolss working. + */ + fstrcpy(ack_pipe_name, ""); + break; + default: + return False; + } DEBUG(5,("api_pipe_bind_req: make response. %d\n", __LINE__)); @@ -831,6 +844,29 @@ static BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *pd) return False; } +/******************************************************************* + Respond to a pipe bind request. +*******************************************************************/ + +static BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *pd) +{ + return api_pipe_bind_and_alt_req(p, pd, RPC_BINDACK); +} + +/******************************************************************* + Respond to a pipe alter request. + + The RPC Alter-Context call is used only by the spoolss pipe + simply because there is a bug (?) in the MS unmarshalling code + or in the marshalling code. If it's in the later, then Samba + have the same bug. +*******************************************************************/ + +static BOOL api_pipe_altercontext_req(pipes_struct *p, prs_struct *pd) +{ + return api_pipe_bind_and_alt_req(p, pd, RPC_ALTCONTRESP); +} + /**************************************************************************** Deal with sign & seal processing on an RPC request. ****************************************************************************/ @@ -1011,6 +1047,9 @@ BOOL rpc_command(pipes_struct *p, char *input_data, int data_len) case RPC_BIND: reply = api_pipe_bind_req(p, &rpc_in); break; + case RPC_ALTCONT: + reply = api_pipe_altercontext_req(p, &rpc_in); + break; case RPC_REQUEST: if (p->ntlmssp_auth_requested && !p->ntlmssp_auth_validated) { /* authentication _was_ requested -- cgit