diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-02-09 16:51:46 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-02-09 16:51:46 +0100 |
commit | 9b366d703210b493aa1389bbdd288a2b00958766 (patch) | |
tree | 12acaf89af2c6bd2610018d267e2d8030d9b4bd6 /source3/rpc_server | |
parent | 6d139ca4680abcbda5110f2f0886aa038ff62088 (diff) | |
parent | 1dadf17be847e3f93b72988bcc7e8620a8d5908c (diff) | |
download | samba-9b366d703210b493aa1389bbdd288a2b00958766.tar.gz samba-9b366d703210b493aa1389bbdd288a2b00958766.tar.bz2 samba-9b366d703210b493aa1389bbdd288a2b00958766.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_eventlog_lib.c | 6 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 211 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe_hnd.c | 54 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss.c | 423 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 1264 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 2 |
7 files changed, 1269 insertions, 693 deletions
diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index 57b3be43ad..d8c5c3d453 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -551,9 +551,11 @@ bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, struct eventlog_Record_tdb entry->sid_length = rpcstr_push_talloc(mem_ctx, &dummy, stop); + if (entry->sid_length == (uint32_t)-1) { + return false; + } entry->sid = data_blob_talloc(mem_ctx, dummy, entry->sid_length); - if (entry->sid_length == (uint32_t)-1 || - entry->sid.data == NULL) { + if (entry->sid.data == NULL) { return false; } } else if ( 0 == strncmp( start, "STR", stop - start ) ) { diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 924226bc4f..09b1f66440 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -61,7 +61,6 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) uint32 data_space_available; uint32 data_len_left; uint32 data_len; - prs_struct outgoing_pdu; NTSTATUS status; DATA_BLOB auth_blob; RPC_HDR_AUTH auth_info; @@ -105,8 +104,8 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) return False; } - data_space_available = sizeof(p->out_data.current_pdu) - RPC_HEADER_LEN - RPC_HDR_RESP_LEN - - RPC_HDR_AUTH_LEN - NTLMSSP_SIG_SIZE; + data_space_available = RPC_MAX_PDU_FRAG_LEN - RPC_HEADER_LEN + - RPC_HDR_RESP_LEN - RPC_HDR_AUTH_LEN - NTLMSSP_SIG_SIZE; /* * The amount we send is the minimum of the available @@ -150,27 +149,27 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) * data. */ - prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); - prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* Store the header in the data stream. */ - if(!smb_io_rpc_hdr("hdr", &p->hdr, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr("hdr", &p->hdr, &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to marshall RPC_HDR.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } - if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to marshall RPC_HDR_RESP.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } /* Copy the data into the PDU. */ - if(!prs_append_some_prs_data(&outgoing_pdu, &p->out_data.rdata, p->out_data.data_sent_length, data_len)) { + if(!prs_append_some_prs_data(&p->out_data.frag, &p->out_data.rdata, + p->out_data.data_sent_length, data_len)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to copy %u bytes of data.\n", (unsigned int)data_len)); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } @@ -179,10 +178,11 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) char pad[8]; memset(pad, '\0', 8); - if (!prs_copy_data_in(&outgoing_pdu, pad, ss_padding_len)) { + if (!prs_copy_data_in(&p->out_data.frag, pad, + ss_padding_len)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to add %u bytes of pad data.\n", (unsigned int)ss_padding_len)); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } } @@ -201,9 +201,10 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) } init_rpc_hdr_auth(&auth_info, auth_type, auth_level, ss_padding_len, 1 /* context id. */); - if(!smb_io_rpc_hdr_auth("hdr_auth", &auth_info, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_auth("hdr_auth", &auth_info, &p->out_data.frag, + 0)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to marshall RPC_HDR_AUTH.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } @@ -212,43 +213,48 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) switch (p->auth.auth_level) { case PIPE_AUTH_LEVEL_PRIVACY: /* Data portion is encrypted. */ - status = ntlmssp_seal_packet(a->ntlmssp_state, - (unsigned char *)prs_data_p(&outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, - data_len + ss_padding_len, - (unsigned char *)prs_data_p(&outgoing_pdu), - (size_t)prs_offset(&outgoing_pdu), - &auth_blob); + status = ntlmssp_seal_packet( + a->ntlmssp_state, + (uint8_t *)prs_data_p(&p->out_data.frag) + + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, + data_len + ss_padding_len, + (unsigned char *)prs_data_p(&p->out_data.frag), + (size_t)prs_offset(&p->out_data.frag), + &auth_blob); if (!NT_STATUS_IS_OK(status)) { data_blob_free(&auth_blob); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } break; case PIPE_AUTH_LEVEL_INTEGRITY: /* Data is signed. */ - status = ntlmssp_sign_packet(a->ntlmssp_state, - (unsigned char *)prs_data_p(&outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, - data_len + ss_padding_len, - (unsigned char *)prs_data_p(&outgoing_pdu), - (size_t)prs_offset(&outgoing_pdu), - &auth_blob); + status = ntlmssp_sign_packet( + a->ntlmssp_state, + (unsigned char *)prs_data_p(&p->out_data.frag) + + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, + data_len + ss_padding_len, + (unsigned char *)prs_data_p(&p->out_data.frag), + (size_t)prs_offset(&p->out_data.frag), + &auth_blob); if (!NT_STATUS_IS_OK(status)) { data_blob_free(&auth_blob); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } break; default: - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } /* Append the auth blob. */ - if (!prs_copy_data_in(&outgoing_pdu, (char *)auth_blob.data, NTLMSSP_SIG_SIZE)) { + if (!prs_copy_data_in(&p->out_data.frag, (char *)auth_blob.data, + NTLMSSP_SIG_SIZE)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to add %u bytes auth blob.\n", (unsigned int)NTLMSSP_SIG_SIZE)); data_blob_free(&auth_blob); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } @@ -259,10 +265,8 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) */ p->out_data.data_sent_length += data_len; - p->out_data.current_pdu_len = p->hdr.frag_len; p->out_data.current_pdu_sent = 0; - prs_mem_free(&outgoing_pdu); return True; } @@ -278,7 +282,6 @@ static bool create_next_pdu_schannel(pipes_struct *p) uint32 data_len; uint32 data_space_available; uint32 data_len_left; - prs_struct outgoing_pdu; uint32 data_pos; /* @@ -318,8 +321,9 @@ static bool create_next_pdu_schannel(pipes_struct *p) return False; } - data_space_available = sizeof(p->out_data.current_pdu) - RPC_HEADER_LEN - RPC_HDR_RESP_LEN - - RPC_HDR_AUTH_LEN - RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN; + data_space_available = RPC_MAX_PDU_FRAG_LEN - RPC_HEADER_LEN + - RPC_HDR_RESP_LEN - RPC_HDR_AUTH_LEN + - RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN; /* * The amount we send is the minimum of the available @@ -357,30 +361,30 @@ static bool create_next_pdu_schannel(pipes_struct *p) * data. */ - prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); - prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* Store the header in the data stream. */ - if(!smb_io_rpc_hdr("hdr", &p->hdr, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr("hdr", &p->hdr, &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_schannel: failed to marshall RPC_HDR.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } - if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_schannel: failed to marshall RPC_HDR_RESP.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } /* Store the current offset. */ - data_pos = prs_offset(&outgoing_pdu); + data_pos = prs_offset(&p->out_data.frag); /* Copy the data into the PDU. */ - if(!prs_append_some_prs_data(&outgoing_pdu, &p->out_data.rdata, p->out_data.data_sent_length, data_len)) { + if(!prs_append_some_prs_data(&p->out_data.frag, &p->out_data.rdata, + p->out_data.data_sent_length, data_len)) { DEBUG(0,("create_next_pdu_schannel: failed to copy %u bytes of data.\n", (unsigned int)data_len)); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } @@ -388,9 +392,10 @@ static bool create_next_pdu_schannel(pipes_struct *p) if (ss_padding_len) { char pad[8]; memset(pad, '\0', 8); - if (!prs_copy_data_in(&outgoing_pdu, pad, ss_padding_len)) { + if (!prs_copy_data_in(&p->out_data.frag, pad, + ss_padding_len)) { DEBUG(0,("create_next_pdu_schannel: failed to add %u bytes of pad data.\n", (unsigned int)ss_padding_len)); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } } @@ -399,11 +404,9 @@ static bool create_next_pdu_schannel(pipes_struct *p) /* * Schannel processing. */ - char *data; RPC_HDR_AUTH auth_info; RPC_AUTH_SCHANNEL_CHK verf; - data = prs_data_p(&outgoing_pdu) + data_pos; /* Check it's the type of reply we were expecting to decode */ init_rpc_hdr_auth(&auth_info, @@ -412,20 +415,21 @@ static bool create_next_pdu_schannel(pipes_struct *p) RPC_AUTH_LEVEL_PRIVACY : RPC_AUTH_LEVEL_INTEGRITY, ss_padding_len, 1); - if(!smb_io_rpc_hdr_auth("hdr_auth", &auth_info, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_auth("hdr_auth", &auth_info, + &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_schannel: failed to marshall RPC_HDR_AUTH.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } schannel_encode(p->auth.a_u.schannel_auth, - p->auth.auth_level, - SENDER_IS_ACCEPTOR, - &verf, data, data_len + ss_padding_len); + p->auth.auth_level, SENDER_IS_ACCEPTOR, &verf, + prs_data_p(&p->out_data.frag) + data_pos, + data_len + ss_padding_len); if (!smb_io_rpc_auth_schannel_chk("", RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN, - &verf, &outgoing_pdu, 0)) { - prs_mem_free(&outgoing_pdu); + &verf, &p->out_data.frag, 0)) { + prs_mem_free(&p->out_data.frag); return False; } @@ -437,10 +441,8 @@ static bool create_next_pdu_schannel(pipes_struct *p) */ p->out_data.data_sent_length += data_len; - p->out_data.current_pdu_len = p->hdr.frag_len; p->out_data.current_pdu_sent = 0; - prs_mem_free(&outgoing_pdu); return True; } @@ -455,7 +457,6 @@ static bool create_next_pdu_noauth(pipes_struct *p) uint32 data_len; uint32 data_space_available; uint32 data_len_left; - prs_struct outgoing_pdu; /* * If we're in the fault state, keep returning fault PDU's until @@ -494,7 +495,8 @@ static bool create_next_pdu_noauth(pipes_struct *p) return False; } - data_space_available = sizeof(p->out_data.current_pdu) - RPC_HEADER_LEN - RPC_HDR_RESP_LEN; + data_space_available = RPC_MAX_PDU_FRAG_LEN - RPC_HEADER_LEN + - RPC_HDR_RESP_LEN; /* * The amount we send is the minimum of the available @@ -530,27 +532,27 @@ static bool create_next_pdu_noauth(pipes_struct *p) * data. */ - prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); - prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* Store the header in the data stream. */ - if(!smb_io_rpc_hdr("hdr", &p->hdr, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr("hdr", &p->hdr, &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_noath: failed to marshall RPC_HDR.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } - if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &p->out_data.frag, 0)) { DEBUG(0,("create_next_pdu_noath: failed to marshall RPC_HDR_RESP.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } /* Copy the data into the PDU. */ - if(!prs_append_some_prs_data(&outgoing_pdu, &p->out_data.rdata, p->out_data.data_sent_length, data_len)) { + if(!prs_append_some_prs_data(&p->out_data.frag, &p->out_data.rdata, + p->out_data.data_sent_length, data_len)) { DEBUG(0,("create_next_pdu_noauth: failed to copy %u bytes of data.\n", (unsigned int)data_len)); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } @@ -559,10 +561,8 @@ static bool create_next_pdu_noauth(pipes_struct *p) */ p->out_data.data_sent_length += data_len; - p->out_data.current_pdu_len = p->hdr.frag_len; p->out_data.current_pdu_sent = 0; - prs_mem_free(&outgoing_pdu); return True; } @@ -778,7 +778,6 @@ bool api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p) static bool setup_bind_nak(pipes_struct *p) { - prs_struct outgoing_rpc; RPC_HDR nak_hdr; uint16 zero = 0; @@ -791,8 +790,7 @@ static bool setup_bind_nak(pipes_struct *p) * header and are never sending more than one PDU here. */ - prs_init_empty( &outgoing_rpc, p->mem_ctx, MARSHALL); - prs_give_memory( &outgoing_rpc, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* * Initialize a bind_nak header. @@ -805,9 +803,9 @@ static bool setup_bind_nak(pipes_struct *p) * Marshall the header into the outgoing PDU. */ - if(!smb_io_rpc_hdr("", &nak_hdr, &outgoing_rpc, 0)) { + if(!smb_io_rpc_hdr("", &nak_hdr, &p->out_data.frag, 0)) { DEBUG(0,("setup_bind_nak: marshalling of RPC_HDR failed.\n")); - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); return False; } @@ -815,13 +813,12 @@ static bool setup_bind_nak(pipes_struct *p) * Now add the reject reason. */ - if(!prs_uint16("reject code", &outgoing_rpc, 0, &zero)) { - prs_mem_free(&outgoing_rpc); + if(!prs_uint16("reject code", &p->out_data.frag, 0, &zero)) { + prs_mem_free(&p->out_data.frag); return False; } p->out_data.data_sent_length = 0; - p->out_data.current_pdu_len = prs_offset(&outgoing_rpc); p->out_data.current_pdu_sent = 0; if (p->auth.auth_data_free_func) { @@ -840,7 +837,6 @@ static bool setup_bind_nak(pipes_struct *p) bool setup_fault_pdu(pipes_struct *p, NTSTATUS status) { - prs_struct outgoing_pdu; RPC_HDR fault_hdr; RPC_HDR_RESP hdr_resp; RPC_HDR_FAULT fault_resp; @@ -854,8 +850,7 @@ bool setup_fault_pdu(pipes_struct *p, NTSTATUS status) * header and are never sending more than one PDU here. */ - prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); - prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* * Initialize a fault header. @@ -877,29 +872,27 @@ bool setup_fault_pdu(pipes_struct *p, NTSTATUS status) * Marshall the header into the outgoing PDU. */ - if(!smb_io_rpc_hdr("", &fault_hdr, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr("", &fault_hdr, &p->out_data.frag, 0)) { DEBUG(0,("setup_fault_pdu: marshalling of RPC_HDR failed.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } - if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_resp("resp", &hdr_resp, &p->out_data.frag, 0)) { DEBUG(0,("setup_fault_pdu: failed to marshall RPC_HDR_RESP.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } - if(!smb_io_rpc_hdr_fault("fault", &fault_resp, &outgoing_pdu, 0)) { + if(!smb_io_rpc_hdr_fault("fault", &fault_resp, &p->out_data.frag, 0)) { DEBUG(0,("setup_fault_pdu: failed to marshall RPC_HDR_FAULT.\n")); - prs_mem_free(&outgoing_pdu); + prs_mem_free(&p->out_data.frag); return False; } p->out_data.data_sent_length = 0; - p->out_data.current_pdu_len = prs_offset(&outgoing_pdu); p->out_data.current_pdu_sent = 0; - prs_mem_free(&outgoing_pdu); return True; } @@ -1525,7 +1518,6 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) fstring ack_pipe_name; prs_struct out_hdr_ba; prs_struct out_auth; - prs_struct outgoing_rpc; int i = 0; int auth_len = 0; unsigned int auth_type = RPC_ANONYMOUS_AUTH_TYPE; @@ -1537,7 +1529,7 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) return setup_bind_nak(p); } - prs_init_empty( &outgoing_rpc, p->mem_ctx, MARSHALL); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* * Marshall directly into the outgoing PDU space. We @@ -1545,8 +1537,6 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) * header and are never sending more than one PDU here. */ - prs_give_memory( &outgoing_rpc, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); - /* * Setup the memory to marshall the ba header, and the * auth footers. @@ -1554,13 +1544,13 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) if(!prs_init(&out_hdr_ba, 1024, p->mem_ctx, MARSHALL)) { DEBUG(0,("api_pipe_bind_req: malloc out_hdr_ba failed.\n")); - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); return False; } if(!prs_init(&out_auth, 1024, p->mem_ctx, MARSHALL)) { DEBUG(0,("api_pipe_bind_req: malloc out_auth failed.\n")); - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); prs_mem_free(&out_hdr_ba); return False; } @@ -1606,7 +1596,7 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) if (NT_STATUS_IS_ERR(status)) { DEBUG(3,("api_pipe_bind_req: Unknown pipe name %s in bind request.\n", get_pipe_name_from_iface(&hdr_rb.rpc_context[0].abstract))); - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); prs_mem_free(&out_hdr_ba); prs_mem_free(&out_auth); @@ -1764,7 +1754,7 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) * Marshall the header into the outgoing PDU. */ - if(!smb_io_rpc_hdr("", &p->hdr, &outgoing_rpc, 0)) { + if(!smb_io_rpc_hdr("", &p->hdr, &p->out_data.frag, 0)) { DEBUG(0,("api_pipe_bind_req: marshalling of RPC_HDR failed.\n")); goto err_exit; } @@ -1773,12 +1763,12 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) * Now add the RPC_HDR_BA and any auth needed. */ - if(!prs_append_prs_data( &outgoing_rpc, &out_hdr_ba)) { + if(!prs_append_prs_data(&p->out_data.frag, &out_hdr_ba)) { DEBUG(0,("api_pipe_bind_req: append of RPC_HDR_BA failed.\n")); goto err_exit; } - if (auth_len && !prs_append_prs_data( &outgoing_rpc, &out_auth)) { + if (auth_len && !prs_append_prs_data( &p->out_data.frag, &out_auth)) { DEBUG(0,("api_pipe_bind_req: append of auth info failed.\n")); goto err_exit; } @@ -1788,7 +1778,6 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) */ p->out_data.data_sent_length = 0; - p->out_data.current_pdu_len = prs_offset(&outgoing_rpc); p->out_data.current_pdu_sent = 0; prs_mem_free(&out_hdr_ba); @@ -1798,7 +1787,7 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) err_exit: - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); prs_mem_free(&out_hdr_ba); prs_mem_free(&out_auth); return setup_bind_nak(p); @@ -1818,10 +1807,9 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) fstring ack_pipe_name; prs_struct out_hdr_ba; prs_struct out_auth; - prs_struct outgoing_rpc; int auth_len = 0; - prs_init_empty( &outgoing_rpc, p->mem_ctx, MARSHALL); + prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); /* * Marshall directly into the outgoing PDU space. We @@ -1829,8 +1817,6 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) * header and are never sending more than one PDU here. */ - prs_give_memory( &outgoing_rpc, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); - /* * Setup the memory to marshall the ba header, and the * auth footers. @@ -1838,13 +1824,13 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) if(!prs_init(&out_hdr_ba, 1024, p->mem_ctx, MARSHALL)) { DEBUG(0,("api_pipe_alter_context: malloc out_hdr_ba failed.\n")); - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); return False; } if(!prs_init(&out_auth, 1024, p->mem_ctx, MARSHALL)) { DEBUG(0,("api_pipe_alter_context: malloc out_auth failed.\n")); - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); prs_mem_free(&out_hdr_ba); return False; } @@ -1958,7 +1944,7 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) * Marshall the header into the outgoing PDU. */ - if(!smb_io_rpc_hdr("", &p->hdr, &outgoing_rpc, 0)) { + if(!smb_io_rpc_hdr("", &p->hdr, &p->out_data.frag, 0)) { DEBUG(0,("api_pipe_alter_context: marshalling of RPC_HDR failed.\n")); goto err_exit; } @@ -1967,12 +1953,12 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) * Now add the RPC_HDR_BA and any auth needed. */ - if(!prs_append_prs_data( &outgoing_rpc, &out_hdr_ba)) { + if(!prs_append_prs_data(&p->out_data.frag, &out_hdr_ba)) { DEBUG(0,("api_pipe_alter_context: append of RPC_HDR_BA failed.\n")); goto err_exit; } - if (auth_len && !prs_append_prs_data( &outgoing_rpc, &out_auth)) { + if (auth_len && !prs_append_prs_data(&p->out_data.frag, &out_auth)) { DEBUG(0,("api_pipe_alter_context: append of auth info failed.\n")); goto err_exit; } @@ -1982,7 +1968,6 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) */ p->out_data.data_sent_length = 0; - p->out_data.current_pdu_len = prs_offset(&outgoing_rpc); p->out_data.current_pdu_sent = 0; prs_mem_free(&out_hdr_ba); @@ -1992,7 +1977,7 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) err_exit: - prs_mem_free(&outgoing_rpc); + prs_mem_free(&p->out_data.frag); prs_mem_free(&out_hdr_ba); prs_mem_free(&out_auth); return setup_bind_nak(p); diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 4cbe8d67a3..6dfe7a0911 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -65,10 +65,9 @@ static bool pipe_init_outgoing_data(pipes_struct *p) /* Reset the offset counters. */ o_data->data_sent_length = 0; - o_data->current_pdu_len = 0; o_data->current_pdu_sent = 0; - memset(o_data->current_pdu, '\0', sizeof(o_data->current_pdu)); + prs_mem_free(&o_data->frag); /* Free any memory in the current return data buffer. */ prs_mem_free(&o_data->rdata); @@ -77,7 +76,7 @@ static bool pipe_init_outgoing_data(pipes_struct *p) * Initialize the outgoing RPC data buffer. * we will use this as the raw data area for replying to rpc requests. */ - if(!prs_init(&o_data->rdata, RPC_MAX_PDU_FRAG_LEN, p->mem_ctx, MARSHALL)) { + if(!prs_init(&o_data->rdata, 128, p->mem_ctx, MARSHALL)) { DEBUG(0,("pipe_init_outgoing_data: malloc fail.\n")); return False; } @@ -128,7 +127,7 @@ static struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx, * change the type to UNMARSALLING before processing the stream. */ - if(!prs_init(&p->in_data.data, RPC_MAX_PDU_FRAG_LEN, p->mem_ctx, MARSHALL)) { + if(!prs_init(&p->in_data.data, 128, p->mem_ctx, MARSHALL)) { DEBUG(0,("open_rpc_pipe_p: malloc fail for in_data struct.\n")); talloc_destroy(p->mem_ctx); close_policy_by_pipe(p); @@ -192,6 +191,15 @@ static ssize_t fill_rpc_header(pipes_struct *p, char *data, size_t data_to_copy) (unsigned int)data_to_copy, (unsigned int)len_needed_to_complete_hdr, (unsigned int)p->in_data.pdu_received_len )); + if (p->in_data.current_in_pdu == NULL) { + p->in_data.current_in_pdu = talloc_array(p, uint8_t, + RPC_HEADER_LEN); + } + if (p->in_data.current_in_pdu == NULL) { + DEBUG(0, ("talloc failed\n")); + return -1; + } + memcpy((char *)&p->in_data.current_in_pdu[p->in_data.pdu_received_len], data, len_needed_to_complete_hdr); p->in_data.pdu_received_len += len_needed_to_complete_hdr; @@ -312,6 +320,14 @@ static ssize_t unmarshall_rpc_header(pipes_struct *p) prs_mem_free(&rpc_in); + p->in_data.current_in_pdu = TALLOC_REALLOC_ARRAY( + p, p->in_data.current_in_pdu, uint8_t, p->hdr.frag_len); + if (p->in_data.current_in_pdu == NULL) { + DEBUG(0, ("talloc failed\n")); + set_incoming_fault(p); + return -1; + } + return 0; /* No extra data processed. */ } @@ -635,6 +651,7 @@ static void process_complete_pdu(pipes_struct *p) /* * Reset the lengths. We're ready for a new pdu. */ + TALLOC_FREE(p->in_data.current_in_pdu); p->in_data.pdu_needed_len = 0; p->in_data.pdu_received_len = 0; } @@ -811,17 +828,24 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_ * PDU. */ - if((pdu_remaining = p->out_data.current_pdu_len - p->out_data.current_pdu_sent) > 0) { + pdu_remaining = prs_offset(&p->out_data.frag) + - p->out_data.current_pdu_sent; + + if (pdu_remaining > 0) { data_returned = (ssize_t)MIN(n, pdu_remaining); DEBUG(10,("read_from_pipe: %s: current_pdu_len = %u, " "current_pdu_sent = %u returning %d bytes.\n", get_pipe_name_from_iface(&p->syntax), - (unsigned int)p->out_data.current_pdu_len, + (unsigned int)prs_offset(&p->out_data.frag), (unsigned int)p->out_data.current_pdu_sent, (int)data_returned)); - memcpy( data, &p->out_data.current_pdu[p->out_data.current_pdu_sent], (size_t)data_returned); + memcpy(data, + prs_data_p(&p->out_data.frag) + + p->out_data.current_pdu_sent, + data_returned); + p->out_data.current_pdu_sent += (uint32)data_returned; goto out; } @@ -858,14 +882,14 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_ return -1; } - data_returned = MIN(n, p->out_data.current_pdu_len); + data_returned = MIN(n, prs_offset(&p->out_data.frag)); - memcpy( data, p->out_data.current_pdu, (size_t)data_returned); + memcpy( data, prs_data_p(&p->out_data.frag), (size_t)data_returned); p->out_data.current_pdu_sent += (uint32)data_returned; out: + (*is_data_outstanding) = prs_offset(&p->out_data.frag) > n; - (*is_data_outstanding) = p->out_data.current_pdu_len > n; return data_returned; } @@ -880,6 +904,7 @@ static int close_internal_rpc_pipe_hnd(struct pipes_struct *p) return False; } + prs_mem_free(&p->out_data.frag); prs_mem_free(&p->out_data.rdata); prs_mem_free(&p->in_data.data); @@ -1195,11 +1220,12 @@ static void np_write_done(struct async_req *subreq) { struct async_req *req = talloc_get_type_abort( subreq->async.priv, struct async_req); - NTSTATUS status; + int err; + ssize_t ret; - status = sendall_recv(subreq); - if (!NT_STATUS_IS_OK(status)) { - async_req_nterror(req, status); + ret = sendall_recv(subreq, &err); + if (ret < 0) { + async_req_nterror(req, map_nt_error_from_unix(err)); return; } async_req_done(req); diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 5f616ecd19..0b8cb35a84 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -1173,9 +1173,7 @@ NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, *r->out.sam = samr_array; *r->out.num_entries = num_groups; - /* this was missing, IMHO: *r->out.resume_handle = num_groups + *r->in.resume_handle; - */ DEBUG(5,("_samr_EnumDomainGroups: %d\n", __LINE__)); diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index d3045028bf..bf11bc6914 100644 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -27,6 +27,27 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV +/******************************************************************* + ********************************************************************/ + +static bool proxy_spoolss_call(pipes_struct *p, uint8_t opnum) +{ + struct api_struct *fns; + int n_fns; + + spoolss_get_pipe_fns(&fns, &n_fns); + + if (opnum >= n_fns) { + return false; + } + + if (fns[opnum].opnum != opnum) { + smb_panic("SPOOLSS function table not sorted"); + } + + return fns[opnum].fn(p); +} + /******************************************************************** * api_spoolss_open_printer_ex (rarely seen - older call) ********************************************************************/ @@ -126,28 +147,7 @@ static bool api_spoolss_getprinterdata(pipes_struct *p) static bool api_spoolss_deleteprinterdata(pipes_struct *p) { - SPOOL_Q_DELETEPRINTERDATA q_u; - SPOOL_R_DELETEPRINTERDATA r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - /* read the stream and fill the struct */ - if (!spoolss_io_q_deleteprinterdata("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteprinterdata: unable to unmarshall SPOOL_Q_DELETEPRINTERDATA.\n")); - return False; - } - - r_u.status = _spoolss_deleteprinterdata( p, &q_u, &r_u ); - - if (!spoolss_io_r_deleteprinterdata("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_deleteprinterdata: unable to marshall SPOOL_R_DELETEPRINTERDATA.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDATA); } /******************************************************************** @@ -158,27 +158,7 @@ static bool api_spoolss_deleteprinterdata(pipes_struct *p) static bool api_spoolss_closeprinter(pipes_struct *p) { - SPOOL_Q_CLOSEPRINTER q_u; - SPOOL_R_CLOSEPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!spoolss_io_q_closeprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_closeprinter: unable to unmarshall SPOOL_Q_CLOSEPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_closeprinter(p, &q_u, &r_u); - - if (!spoolss_io_r_closeprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_closeprinter: unable to marshall SPOOL_R_CLOSEPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_CLOSEPRINTER); } /******************************************************************** @@ -189,27 +169,7 @@ static bool api_spoolss_closeprinter(pipes_struct *p) static bool api_spoolss_abortprinter(pipes_struct *p) { - SPOOL_Q_ABORTPRINTER q_u; - SPOOL_R_ABORTPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!spoolss_io_q_abortprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_abortprinter: unable to unmarshall SPOOL_Q_ABORTPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_abortprinter(p, &q_u, &r_u); - - if (!spoolss_io_r_abortprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_abortprinter: unable to marshall SPOOL_R_ABORTPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_ABORTPRINTER); } /******************************************************************** @@ -220,30 +180,9 @@ static bool api_spoolss_abortprinter(pipes_struct *p) static bool api_spoolss_deleteprinter(pipes_struct *p) { - SPOOL_Q_DELETEPRINTER q_u; - SPOOL_R_DELETEPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!spoolss_io_q_deleteprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_deleteprinter(p, &q_u, &r_u); - - if (!spoolss_io_r_deleteprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTER); } - /******************************************************************** * api_spoolss_deleteprinterdriver * @@ -252,27 +191,7 @@ static bool api_spoolss_deleteprinter(pipes_struct *p) static bool api_spoolss_deleteprinterdriver(pipes_struct *p) { - SPOOL_Q_DELETEPRINTERDRIVER q_u; - SPOOL_R_DELETEPRINTERDRIVER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!spoolss_io_q_deleteprinterdriver("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteprinterdriver: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVER.\n")); - return False; - } - - r_u.status = _spoolss_deleteprinterdriver(p, &q_u, &r_u); - - if (!spoolss_io_r_deleteprinterdriver("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDRIVER); } @@ -448,27 +367,7 @@ static bool api_spoolss_getprinterdriver2(pipes_struct *p) static bool api_spoolss_startpageprinter(pipes_struct *p) { - SPOOL_Q_STARTPAGEPRINTER q_u; - SPOOL_R_STARTPAGEPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_startpageprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_startpageprinter: unable to unmarshall SPOOL_Q_STARTPAGEPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_startpageprinter(p, &q_u, &r_u); - - if(!spoolss_io_r_startpageprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_startpageprinter: unable to marshall SPOOL_R_STARTPAGEPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_STARTPAGEPRINTER); } /******************************************************************** @@ -479,27 +378,7 @@ static bool api_spoolss_startpageprinter(pipes_struct *p) static bool api_spoolss_endpageprinter(pipes_struct *p) { - SPOOL_Q_ENDPAGEPRINTER q_u; - SPOOL_R_ENDPAGEPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_endpageprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_endpageprinter: unable to unmarshall SPOOL_Q_ENDPAGEPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_endpageprinter(p, &q_u, &r_u); - - if(!spoolss_io_r_endpageprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_endpageprinter: unable to marshall SPOOL_R_ENDPAGEPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_ENDPAGEPRINTER); } /******************************************************************** @@ -535,27 +414,7 @@ static bool api_spoolss_startdocprinter(pipes_struct *p) static bool api_spoolss_enddocprinter(pipes_struct *p) { - SPOOL_Q_ENDDOCPRINTER q_u; - SPOOL_R_ENDDOCPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_enddocprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_enddocprinter: unable to unmarshall SPOOL_Q_ENDDOCPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_enddocprinter(p, &q_u, &r_u); - - if(!spoolss_io_r_enddocprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_enddocprinter: unable to marshall SPOOL_R_ENDDOCPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_ENDDOCPRINTER); } /******************************************************************** @@ -563,27 +422,7 @@ static bool api_spoolss_enddocprinter(pipes_struct *p) static bool api_spoolss_writeprinter(pipes_struct *p) { - SPOOL_Q_WRITEPRINTER q_u; - SPOOL_R_WRITEPRINTER r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_writeprinter("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_writeprinter: unable to unmarshall SPOOL_Q_WRITEPRINTER.\n")); - return False; - } - - r_u.status = _spoolss_writeprinter(p, &q_u, &r_u); - - if(!spoolss_io_r_writeprinter("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_writeprinter: unable to marshall SPOOL_R_WRITEPRINTER.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_WRITEPRINTER); } /**************************************************************************** @@ -620,27 +459,7 @@ static bool api_spoolss_setprinter(pipes_struct *p) static bool api_spoolss_fcpn(pipes_struct *p) { - SPOOL_Q_FCPN q_u; - SPOOL_R_FCPN r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_fcpn("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_fcpn: unable to unmarshall SPOOL_Q_FCPN.\n")); - return False; - } - - r_u.status = _spoolss_fcpn(p, &q_u, &r_u); - - if(!spoolss_io_r_fcpn("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY); } /**************************************************************************** @@ -788,27 +607,7 @@ static bool api_spoolss_enumprinterdrivers(pipes_struct *p) static bool api_spoolss_getform(pipes_struct *p) { - SPOOL_Q_GETFORM q_u; - SPOOL_R_GETFORM r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!spoolss_io_q_getform("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_getform: unable to unmarshall SPOOL_Q_GETFORM.\n")); - return False; - } - - r_u.status = _spoolss_getform(p, &q_u, &r_u); - - if (!spoolss_io_r_getform("",&r_u,rdata,0)) { - DEBUG(0,("spoolss_io_r_getform: unable to marshall SPOOL_R_GETFORM.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_GETFORM); } /**************************************************************************** @@ -1047,27 +846,7 @@ static bool api_spoolss_reset_printer(pipes_struct *p) ****************************************************************************/ static bool api_spoolss_addform(pipes_struct *p) { - SPOOL_Q_ADDFORM q_u; - SPOOL_R_ADDFORM r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_addform("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_addform: unable to unmarshall SPOOL_Q_ADDFORM.\n")); - return False; - } - - r_u.status = _spoolss_addform(p, &q_u, &r_u); - - if(!spoolss_io_r_addform("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_addform: unable to marshall SPOOL_R_ADDFORM.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_ADDFORM); } /**************************************************************************** @@ -1075,27 +854,7 @@ static bool api_spoolss_addform(pipes_struct *p) static bool api_spoolss_deleteform(pipes_struct *p) { - SPOOL_Q_DELETEFORM q_u; - SPOOL_R_DELETEFORM r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_deleteform("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteform: unable to unmarshall SPOOL_Q_DELETEFORM.\n")); - return False; - } - - r_u.status = _spoolss_deleteform(p, &q_u, &r_u); - - if(!spoolss_io_r_deleteform("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_deleteform: unable to marshall SPOOL_R_DELETEFORM.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEFORM); } /**************************************************************************** @@ -1103,27 +862,7 @@ static bool api_spoolss_deleteform(pipes_struct *p) static bool api_spoolss_setform(pipes_struct *p) { - SPOOL_Q_SETFORM q_u; - SPOOL_R_SETFORM r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_setform("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_setform: unable to unmarshall SPOOL_Q_SETFORM.\n")); - return False; - } - - r_u.status = _spoolss_setform(p, &q_u, &r_u); - - if(!spoolss_io_r_setform("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_setform: unable to marshall SPOOL_R_SETFORM.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_SETFORM); } /**************************************************************************** @@ -1420,27 +1159,7 @@ static bool api_spoolss_getprintprocessordirectory(pipes_struct *p) static bool api_spoolss_deleteprinterdataex(pipes_struct *p) { - SPOOL_Q_DELETEPRINTERDATAEX q_u; - SPOOL_R_DELETEPRINTERDATAEX r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_deleteprinterdataex("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteprinterdataex: unable to unmarshall SPOOL_Q_DELETEPRINTERDATAEX.\n")); - return False; - } - - r_u.status = _spoolss_deleteprinterdataex(p, &q_u, &r_u); - - if(!spoolss_io_r_deleteprinterdataex("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_deleteprinterdataex: unable to marshall SPOOL_R_DELETEPRINTERDATAEX.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDATAEX); } /**************************************************************************** @@ -1448,27 +1167,7 @@ static bool api_spoolss_deleteprinterdataex(pipes_struct *p) static bool api_spoolss_deleteprinterkey(pipes_struct *p) { - SPOOL_Q_DELETEPRINTERKEY q_u; - SPOOL_R_DELETEPRINTERKEY r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_deleteprinterkey("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteprinterkey: unable to unmarshall SPOOL_Q_DELETEPRINTERKEY.\n")); - return False; - } - - r_u.status = _spoolss_deleteprinterkey(p, &q_u, &r_u); - - if(!spoolss_io_r_deleteprinterkey("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_deleteprinterkey: unable to marshall SPOOL_R_DELETEPRINTERKEY.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERKEY); } /**************************************************************************** @@ -1513,27 +1212,7 @@ static bool api_spoolss_addprinterdriverex(pipes_struct *p) static bool api_spoolss_deleteprinterdriverex(pipes_struct *p) { - SPOOL_Q_DELETEPRINTERDRIVEREX q_u; - SPOOL_R_DELETEPRINTERDRIVEREX r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!spoolss_io_q_deleteprinterdriverex("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_deleteprinterdriverex: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVEREX.\n")); - return False; - } - - r_u.status = _spoolss_deleteprinterdriverex(p, &q_u, &r_u); - - if(!spoolss_io_r_deleteprinterdriverex("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_deleteprinterdriverex: unable to marshall SPOOL_R_DELETEPRINTERDRIVEREX.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDRIVEREX); } /**************************************************************************** @@ -1624,35 +1303,13 @@ static bool api_spoolss_xcvdataport(pipes_struct *p) {"SPOOLSS_XCVDATAPORT", SPOOLSS_XCVDATAPORT, api_spoolss_xcvdataport }, }; -void spoolss_get_pipe_fns( struct api_struct **fns, int *n_fns ) +void spoolss2_get_pipe_fns( struct api_struct **fns, int *n_fns ) { *fns = api_spoolss_cmds; *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct); } -static const char * const spoolss_endpoint_strings[] = { - "ncacn_np:[\\pipe\\spoolss]", -}; - -static const struct ndr_interface_string_array spoolss_endpoints = { - .count = 1, - .names = spoolss_endpoint_strings -}; - -const struct ndr_interface_table ndr_table_spoolss = { - .name = "spoolss", - .syntax_id = { - { 0x12345678, 0x1234, 0xabcd, { 0xef, 0x00 }, - { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } }, 0x01 - }, - .helpstring = "Spooler SubSystem", - .num_calls = 0x60, - .calls = NULL, /* unused in s3 so far */ - .endpoints = &spoolss_endpoints, - .authservices = NULL /* unused in s3 so far */ -}; - -NTSTATUS rpc_spoolss_init(void) +NTSTATUS rpc_spoolss2_init(void) { return rpc_srv_register( SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index e61d343731..31ab2ca43d 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -1913,13 +1913,14 @@ static WERROR _spoolss_enddocprinter_internal(pipes_struct *p, POLICY_HND *handl return WERR_OK; } -/******************************************************************** - * api_spoolss_closeprinter - ********************************************************************/ +/**************************************************************** + _spoolss_ClosePrinter +****************************************************************/ -WERROR _spoolss_closeprinter(pipes_struct *p, SPOOL_Q_CLOSEPRINTER *q_u, SPOOL_R_CLOSEPRINTER *r_u) +WERROR _spoolss_ClosePrinter(pipes_struct *p, + struct spoolss_ClosePrinter *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; Printer_entry *Printer=find_printer_index_by_hnd(p, handle); @@ -1934,27 +1935,25 @@ WERROR _spoolss_closeprinter(pipes_struct *p, SPOOL_Q_CLOSEPRINTER *q_u, SPOOL_R Previous code just copied the value of the closed handle. --jerry */ - memset(&r_u->handle, '\0', sizeof(r_u->handle)); + ZERO_STRUCTP(r->out.handle); return WERR_OK; } -/******************************************************************** - * api_spoolss_deleteprinter +/**************************************************************** + _spoolss_DeletePrinter +****************************************************************/ - ********************************************************************/ - -WERROR _spoolss_deleteprinter(pipes_struct *p, SPOOL_Q_DELETEPRINTER *q_u, SPOOL_R_DELETEPRINTER *r_u) +WERROR _spoolss_DeletePrinter(pipes_struct *p, + struct spoolss_DeletePrinter *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; Printer_entry *Printer=find_printer_index_by_hnd(p, handle); WERROR result; if (Printer && Printer->document_started) _spoolss_enddocprinter_internal(p, handle); /* print job was not closed */ - memcpy(&r_u->handle, &q_u->handle, sizeof(r_u->handle)); - result = delete_printer_handle(p, handle); update_c_setprinter(False); @@ -1991,14 +1990,15 @@ static int get_version_id (char * arch) return -1; } -/******************************************************************** - * _spoolss_deleteprinterdriver - ********************************************************************/ +/**************************************************************** + _spoolss_DeletePrinterDriver +****************************************************************/ -WERROR _spoolss_deleteprinterdriver(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVER *q_u, SPOOL_R_DELETEPRINTERDRIVER *r_u) +WERROR _spoolss_DeletePrinterDriver(pipes_struct *p, + struct spoolss_DeletePrinterDriver *r) { - fstring driver; - fstring arch; + char *driver; + char *arch; NT_PRINTER_DRIVER_INFO_LEVEL info; NT_PRINTER_DRIVER_INFO_LEVEL info_win2k; int version; @@ -2019,9 +2019,6 @@ WERROR _spoolss_deleteprinterdriver(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVER return WERR_ACCESS_DENIED; } - unistr2_to_ascii(driver, &q_u->driver, sizeof(driver)); - unistr2_to_ascii(arch, &q_u->arch, sizeof(arch)); - /* check that we have a valid driver name first */ if ((version=get_version_id(arch)) == -1) @@ -2030,6 +2027,9 @@ WERROR _spoolss_deleteprinterdriver(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVER ZERO_STRUCT(info); ZERO_STRUCT(info_win2k); + driver = CONST_DISCARD(char *, r->in.driver); + arch = CONST_DISCARD(char *, r->in.architecture); + if (!W_ERROR_IS_OK(get_a_printer_driver(&info, 3, driver, arch, version))) { /* try for Win2k driver if "Windows NT x86" */ @@ -2087,18 +2087,19 @@ done: return status; } -/******************************************************************** - * spoolss_deleteprinterdriverex - ********************************************************************/ +/**************************************************************** + _spoolss_DeletePrinterDriverEx +****************************************************************/ -WERROR _spoolss_deleteprinterdriverex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, SPOOL_R_DELETEPRINTERDRIVEREX *r_u) +WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p, + struct spoolss_DeletePrinterDriverEx *r) { - fstring driver; - fstring arch; + char *driver; + char *arch; NT_PRINTER_DRIVER_INFO_LEVEL info; NT_PRINTER_DRIVER_INFO_LEVEL info_win2k; int version; - uint32 flags = q_u->delete_flags; + uint32_t flags = r->in.delete_flags; bool delete_files; WERROR status; WERROR status_win2k = WERR_ACCESS_DENIED; @@ -2116,8 +2117,8 @@ WERROR _spoolss_deleteprinterdriverex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIV return WERR_ACCESS_DENIED; } - unistr2_to_ascii(driver, &q_u->driver, sizeof(driver)); - unistr2_to_ascii(arch, &q_u->arch, sizeof(arch)); + driver = CONST_DISCARD(char *, r->in.driver); + arch = CONST_DISCARD(char *, r->in.architecture); /* check that we have a valid driver name first */ if ((version=get_version_id(arch)) == -1) { @@ -2126,7 +2127,7 @@ WERROR _spoolss_deleteprinterdriverex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIV } if ( flags & DPD_DELETE_SPECIFIC_VERSION ) - version = q_u->version; + version = r->in.version; ZERO_STRUCT(info); ZERO_STRUCT(info_win2k); @@ -4562,7 +4563,7 @@ static WERROR enum_all_printers_info_1_network(fstring name, RPC_BUFFER *buffer, if (is_myname_or_ipaddr(s)) return WERR_CAN_NOT_COMPLETE; - return enum_all_printers_info_1(PRINTER_ENUM_UNKNOWN_8, buffer, offered, needed, returned); + return enum_all_printers_info_1(PRINTER_ENUM_NAME, buffer, offered, needed, returned); } /******************************************************************** @@ -5780,17 +5781,21 @@ WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_ return WERR_UNKNOWN_LEVEL; } -/**************************************************************************** -****************************************************************************/ -WERROR _spoolss_startpageprinter(pipes_struct *p, SPOOL_Q_STARTPAGEPRINTER *q_u, SPOOL_R_STARTPAGEPRINTER *r_u) +/**************************************************************** + _spoolss_StartPagePrinter +****************************************************************/ + +WERROR _spoolss_StartPagePrinter(pipes_struct *p, + struct spoolss_StartPagePrinter *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); if (!Printer) { - DEBUG(3,("Error in startpageprinter printer handle\n")); + DEBUG(3,("_spoolss_StartPagePrinter: " + "Error in startpageprinter printer handle\n")); return WERR_BADFID; } @@ -5798,18 +5803,21 @@ WERROR _spoolss_startpageprinter(pipes_struct *p, SPOOL_Q_STARTPAGEPRINTER *q_u, return WERR_OK; } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_EndPagePrinter +****************************************************************/ -WERROR _spoolss_endpageprinter(pipes_struct *p, SPOOL_Q_ENDPAGEPRINTER *q_u, SPOOL_R_ENDPAGEPRINTER *r_u) +WERROR _spoolss_EndPagePrinter(pipes_struct *p, + struct spoolss_EndPagePrinter *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; int snum; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); if (!Printer) { - DEBUG(2,("_spoolss_endpageprinter: Invalid handle (%s:%u:%u).\n",OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_EndPagePrinter: Invalid handle (%s:%u:%u).\n", + OUR_HANDLE(handle))); return WERR_BADFID; } @@ -5884,34 +5892,36 @@ WERROR _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, S return WERR_OK; } -/******************************************************************** - * api_spoolss_getprinter - * called from the spoolss dispatcher - * - ********************************************************************/ +/**************************************************************** + _spoolss_EndDocPrinter +****************************************************************/ -WERROR _spoolss_enddocprinter(pipes_struct *p, SPOOL_Q_ENDDOCPRINTER *q_u, SPOOL_R_ENDDOCPRINTER *r_u) +WERROR _spoolss_EndDocPrinter(pipes_struct *p, + struct spoolss_EndDocPrinter *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; return _spoolss_enddocprinter_internal(p, handle); } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_WritePrinter +****************************************************************/ -WERROR _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R_WRITEPRINTER *r_u) +WERROR _spoolss_WritePrinter(pipes_struct *p, + struct spoolss_WritePrinter *r) { - POLICY_HND *handle = &q_u->handle; - uint32 buffer_size = q_u->buffer_size; - uint8 *buffer = q_u->buffer; - uint32 *buffer_written = &q_u->buffer_size2; + POLICY_HND *handle = r->in.handle; + uint32 buffer_size = r->in._data_size; + uint8 *buffer = r->in.data.data; + uint32 *buffer_written = &r->in._data_size; int snum; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); if (!Printer) { - DEBUG(2,("_spoolss_writeprinter: Invalid handle (%s:%u:%u)\n",OUR_HANDLE(handle))); - r_u->buffer_written = q_u->buffer_size2; + DEBUG(2,("_spoolss_WritePrinter: Invalid handle (%s:%u:%u)\n", + OUR_HANDLE(handle))); + *r->out.num_written = r->in._data_size; return WERR_BADFID; } @@ -5921,14 +5931,14 @@ WERROR _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R (*buffer_written) = (uint32)print_job_write(snum, Printer->jobid, (const char *)buffer, (SMB_OFF_T)-1, (size_t)buffer_size); if (*buffer_written == (uint32)-1) { - r_u->buffer_written = 0; + *r->out.num_written = 0; if (errno == ENOSPC) return WERR_NO_SPOOL_SPACE; else return WERR_ACCESS_DENIED; } - r_u->buffer_written = q_u->buffer_size2; + *r->out.num_written = r->in._data_size; return WERR_OK; } @@ -5978,21 +5988,24 @@ static WERROR control_printer(POLICY_HND *handle, uint32 command, return errcode; } -/******************************************************************** - * api_spoolss_abortprinter + +/**************************************************************** + _spoolss_AbortPrinter * From MSDN: "Deletes printer's spool file if printer is configured * for spooling" - ********************************************************************/ +****************************************************************/ -WERROR _spoolss_abortprinter(pipes_struct *p, SPOOL_Q_ABORTPRINTER *q_u, SPOOL_R_ABORTPRINTER *r_u) +WERROR _spoolss_AbortPrinter(pipes_struct *p, + struct spoolss_AbortPrinter *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); int snum; WERROR errcode = WERR_OK; if (!Printer) { - DEBUG(2,("_spoolss_abortprinter: Invalid handle (%s:%u:%u)\n",OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_AbortPrinter: Invalid handle (%s:%u:%u)\n", + OUR_HANDLE(handle))); return WERR_BADFID; } @@ -6559,16 +6572,19 @@ WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SET } } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_FindClosePrinterNotify +****************************************************************/ -WERROR _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u) +WERROR _spoolss_FindClosePrinterNotify(pipes_struct *p, + struct spoolss_FindClosePrinterNotify *r) { - POLICY_HND *handle = &q_u->handle; + POLICY_HND *handle = r->in.handle; Printer_entry *Printer= find_printer_index_by_hnd(p, handle); if (!Printer) { - DEBUG(2,("_spoolss_fcpn: Invalid handle (%s:%u:%u)\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_FindClosePrinterNotify: " + "Invalid handle (%s:%u:%u)\n", OUR_HANDLE(handle))); return WERR_BADFID; } @@ -7237,6 +7253,27 @@ static void fill_form_1(FORM_1 *form, nt_forms_struct *list) /**************************************************************************** ****************************************************************************/ +static WERROR fill_form_info_1(TALLOC_CTX *mem_ctx, + struct spoolss_FormInfo1 *form, + nt_forms_struct *list) +{ + form->form_name = talloc_strdup(mem_ctx, list->name); + W_ERROR_HAVE_NO_MEMORY(form->form_name); + + form->flags = list->flag; + form->size.width = list->width; + form->size.height = list->length; + form->area.left = list->left; + form->area.top = list->top; + form->area.right = list->right; + form->area.bottom = list->bottom; + + return WERR_OK; +} + +/**************************************************************************** +****************************************************************************/ + WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u) { uint32 level = q_u->level; @@ -7346,41 +7383,35 @@ WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMF } } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_GetForm +****************************************************************/ -WERROR _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *r_u) +WERROR _spoolss_GetForm(pipes_struct *p, + struct spoolss_GetForm *r) { - uint32 level = q_u->level; - UNISTR2 *uni_formname = &q_u->formname; - RPC_BUFFER *buffer = NULL; - uint32 offered = q_u->offered; - uint32 *needed = &r_u->needed; + uint32 level = r->in.level; + uint32 offered = r->in.offered; + uint32 *needed = r->out.needed; nt_forms_struct *list=NULL; nt_forms_struct builtin_form; bool foundBuiltin; - FORM_1 form_1; - fstring form_name; - int buffer_size=0; + union spoolss_FormInfo info; + struct spoolss_FormInfo1 form_1; int numofforms=0, i=0; /* that's an [in out] buffer */ - if (!q_u->buffer && (offered!=0)) { + if (!r->in.buffer && (offered!=0)) { return WERR_INVALID_PARAM; } - rpcbuf_move(q_u->buffer, &r_u->buffer); - buffer = r_u->buffer; - - unistr2_to_ascii(form_name, uni_formname, sizeof(form_name)); - - DEBUG(4,("_spoolss_getform\n")); + DEBUG(4,("_spoolss_GetForm\n")); DEBUGADD(5,("Offered buffer size [%d]\n", offered)); DEBUGADD(5,("Info level [%d]\n", level)); - foundBuiltin = get_a_builtin_ntform(uni_formname,&builtin_form); + foundBuiltin = get_a_builtin_ntform_by_string(r->in.form_name, &builtin_form); if (!foundBuiltin) { numofforms = get_ntforms(&list); DEBUGADD(5,("Number of forms [%d]\n", numofforms)); @@ -7392,17 +7423,19 @@ WERROR _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM * switch (level) { case 1: if (foundBuiltin) { - fill_form_1(&form_1, &builtin_form); + fill_form_info_1(p->mem_ctx, &form_1, &builtin_form); } else { /* Check if the requested name is in the list of form structures */ for (i=0; i<numofforms; i++) { - DEBUG(4,("_spoolss_getform: checking form %s (want %s)\n", list[i].name, form_name)); + DEBUG(4,("_spoolss_GetForm: checking form %s (want %s)\n", + list[i].name, r->in.form_name)); - if (strequal(form_name, list[i].name)) { - DEBUGADD(6,("Found form %s number [%d]\n", form_name, i)); - fill_form_1(&form_1, &list[i]); + if (strequal(r->in.form_name, list[i].name)) { + DEBUGADD(6,("Found form %s number [%d]\n", + r->in.form_name, i)); + fill_form_info_1(p->mem_ctx, &form_1, &list[i]); break; } } @@ -7414,17 +7447,20 @@ WERROR _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM * } /* check the required size. */ - *needed=spoolss_size_form_1(&form_1); + info.info1 = form_1; - if (*needed > offered) + *needed = ndr_size_spoolss_FormInfo(&info, 1, NULL, 0); + + if (*needed > offered) { + r->out.info = NULL; return WERR_INSUFFICIENT_BUFFER; + } - if (!rpcbuf_alloc_size(buffer, buffer_size)) - return WERR_NOMEM; + r->out.info->info1 = form_1; /* fill the buffer with the form structures */ - DEBUGADD(6,("adding form %s [%d] to buffer\n", form_name, i)); - smb_io_form_1("", buffer, &form_1, 0); + DEBUGADD(6,("adding form %s [%d] to buffer\n", + r->in.form_name, i)); return WERR_OK; @@ -7882,7 +7918,7 @@ WERROR _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u, * server. Right now, we just need to send ourselves a message * to update each printer bound to this driver. --jerry */ - + if (!srv_spoolss_drv_upgrade_printer(driver_name)) { DEBUG(0,("_spoolss_addprinterdriver: Failed to send message about upgrading driver [%s]!\n", driver_name)); @@ -8389,26 +8425,24 @@ WERROR _spoolss_resetprinter(pipes_struct *p, SPOOL_Q_RESETPRINTER *q_u, SPOOL_R return WERR_OK; } +/**************************************************************** + _spoolss_DeletePrinterData +****************************************************************/ -/**************************************************************************** -****************************************************************************/ - -WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_u, SPOOL_R_DELETEPRINTERDATA *r_u) +WERROR _spoolss_DeletePrinterData(pipes_struct *p, + struct spoolss_DeletePrinterData *r) { - POLICY_HND *handle = &q_u->handle; - UNISTR2 *value = &q_u->valuename; - + POLICY_HND *handle = r->in.handle; NT_PRINTER_INFO_LEVEL *printer = NULL; int snum=0; WERROR status = WERR_OK; Printer_entry *Printer=find_printer_index_by_hnd(p, handle); - char *valuename = NULL; - TALLOC_CTX *ctx = p->mem_ctx; - DEBUG(5,("spoolss_deleteprinterdata\n")); + DEBUG(5,("_spoolss_DeletePrinterData\n")); if (!Printer) { - DEBUG(2,("_spoolss_deleteprinterdata: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_DeletePrinterData: Invalid handle (%s:%u:%u).\n", + OUR_HANDLE(handle))); return WERR_BADFID; } @@ -8416,7 +8450,8 @@ WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_ return WERR_BADFID; if (Printer->access_granted != PRINTER_ACCESS_ADMINISTER) { - DEBUG(3, ("_spoolss_deleteprinterdata: printer properties change denied by handle\n")); + DEBUG(3, ("_spoolss_DeletePrinterData: " + "printer properties change denied by handle\n")); return WERR_ACCESS_DENIED; } @@ -8424,30 +8459,31 @@ WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_ if (!W_ERROR_IS_OK(status)) return status; - valuename = unistr2_to_ascii_talloc(ctx, value); - if (!valuename) { + if (!r->in.value_name) { free_a_printer(&printer, 2); return WERR_NOMEM; } - status = delete_printer_dataex( printer, SPOOL_PRINTERDATA_KEY, valuename ); + status = delete_printer_dataex( printer, SPOOL_PRINTERDATA_KEY, + r->in.value_name ); if ( W_ERROR_IS_OK(status) ) mod_a_printer( printer, 2 ); free_a_printer(&printer, 2); - TALLOC_FREE(valuename); return status; } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_AddForm +****************************************************************/ -WERROR _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM *r_u) +WERROR _spoolss_AddForm(pipes_struct *p, + struct spoolss_AddForm *r) { - POLICY_HND *handle = &q_u->handle; - FORM *form = &q_u->form; + POLICY_HND *handle = r->in.handle; + struct spoolss_AddFormInfo1 *form = r->in.info.info1; nt_forms_struct tmpForm; int snum; WERROR status = WERR_OK; @@ -8457,10 +8493,11 @@ WERROR _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM nt_forms_struct *list=NULL; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); - DEBUG(5,("spoolss_addform\n")); + DEBUG(5,("_spoolss_AddForm\n")); if (!Printer) { - DEBUG(2,("_spoolss_addform: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_AddForm: Invalid handle (%s:%u:%u).\n", + OUR_HANDLE(handle))); return WERR_BADFID; } @@ -8485,7 +8522,7 @@ WERROR _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM /* can't add if builtin */ - if (get_a_builtin_ntform(&form->name,&tmpForm)) { + if (get_a_builtin_ntform_by_string(form->form_name, &tmpForm)) { status = WERR_FILE_EXISTS; goto done; } @@ -8514,13 +8551,15 @@ done: return status; } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_DeleteForm +****************************************************************/ -WERROR _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DELETEFORM *r_u) +WERROR _spoolss_DeleteForm(pipes_struct *p, + struct spoolss_DeleteForm *r) { - POLICY_HND *handle = &q_u->handle; - UNISTR2 *form_name = &q_u->name; + POLICY_HND *handle = r->in.handle; + const char *form_name = r->in.form_name; nt_forms_struct tmpForm; int count=0; nt_forms_struct *list=NULL; @@ -8529,10 +8568,11 @@ WERROR _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DE WERROR status = WERR_OK; NT_PRINTER_INFO_LEVEL *printer = NULL; - DEBUG(5,("spoolss_deleteform\n")); + DEBUG(5,("_spoolss_DeleteForm\n")); if (!Printer) { - DEBUG(2,("_spoolss_deleteform: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_DeleteForm: Invalid handle (%s:%u:%u).\n", + OUR_HANDLE(handle))); return WERR_BADFID; } @@ -8549,14 +8589,14 @@ WERROR _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DE } if ( !(Printer->access_granted & (PRINTER_ACCESS_ADMINISTER|SERVER_ACCESS_ADMINISTER)) ) { - DEBUG(2,("_spoolss_deleteform: denied by handle permissions.\n")); + DEBUG(2,("_spoolss_DeleteForm: denied by handle permissions.\n")); status = WERR_ACCESS_DENIED; goto done; } /* can't delete if builtin */ - if (get_a_builtin_ntform(form_name,&tmpForm)) { + if (get_a_builtin_ntform_by_string(form_name,&tmpForm)) { status = WERR_INVALID_PARAM; goto done; } @@ -8581,13 +8621,15 @@ done: return status; } -/**************************************************************************** -****************************************************************************/ +/**************************************************************** + _spoolss_SetForm +****************************************************************/ -WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *r_u) +WERROR _spoolss_SetForm(pipes_struct *p, + struct spoolss_SetForm *r) { - POLICY_HND *handle = &q_u->handle; - FORM *form = &q_u->form; + POLICY_HND *handle = r->in.handle; + struct spoolss_AddFormInfo1 *form = r->in.info.info1; nt_forms_struct tmpForm; int snum; WERROR status = WERR_OK; @@ -8597,10 +8639,11 @@ WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM * nt_forms_struct *list=NULL; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); - DEBUG(5,("spoolss_setform\n")); + DEBUG(5,("_spoolss_SetForm\n")); if (!Printer) { - DEBUG(2,("_spoolss_setform: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_SetForm: Invalid handle (%s:%u:%u).\n", + OUR_HANDLE(handle))); return WERR_BADFID; } @@ -8617,13 +8660,13 @@ WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM * } if ( !(Printer->access_granted & (PRINTER_ACCESS_ADMINISTER|SERVER_ACCESS_ADMINISTER)) ) { - DEBUG(2,("_spoolss_setform: denied by handle permissions\n")); + DEBUG(2,("_spoolss_SetForm: denied by handle permissions\n")); status = WERR_ACCESS_DENIED; goto done; } /* can't set if builtin */ - if (get_a_builtin_ntform(&form->name,&tmpForm)) { + if (get_a_builtin_ntform_by_string(form->form_name, &tmpForm)) { status = WERR_INVALID_PARAM; goto done; } @@ -9325,29 +9368,24 @@ WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, return status; } +/**************************************************************** + _spoolss_DeletePrinterDataEx +****************************************************************/ -/******************************************************************** - * spoolss_deleteprinterdataex - ********************************************************************/ - -WERROR _spoolss_deleteprinterdataex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATAEX *q_u, SPOOL_R_DELETEPRINTERDATAEX *r_u) +WERROR _spoolss_DeletePrinterDataEx(pipes_struct *p, + struct spoolss_DeletePrinterDataEx *r) { - POLICY_HND *handle = &q_u->handle; - UNISTR2 *value = &q_u->valuename; - UNISTR2 *key = &q_u->keyname; - + POLICY_HND *handle = r->in.handle; NT_PRINTER_INFO_LEVEL *printer = NULL; int snum=0; WERROR status = WERR_OK; Printer_entry *Printer=find_printer_index_by_hnd(p, handle); - char *valuename = NULL; - char *keyname = NULL; - TALLOC_CTX *ctx = p->mem_ctx; - DEBUG(5,("spoolss_deleteprinterdataex\n")); + DEBUG(5,("_spoolss_DeletePrinterDataEx\n")); if (!Printer) { - DEBUG(2,("_spoolss_deleteprinterdata: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_DeletePrinterDataEx: " + "Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); return WERR_BADFID; } @@ -9355,13 +9393,12 @@ WERROR _spoolss_deleteprinterdataex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATAEX return WERR_BADFID; if (Printer->access_granted != PRINTER_ACCESS_ADMINISTER) { - DEBUG(3, ("_spoolss_deleteprinterdataex: printer properties change denied by handle\n")); + DEBUG(3, ("_spoolss_DeletePrinterDataEx: " + "printer properties change denied by handle\n")); return WERR_ACCESS_DENIED; } - valuename = unistr2_to_ascii_talloc(ctx, value); - keyname = unistr2_to_ascii_talloc(ctx, key); - if (!valuename || !keyname) { + if (!r->in.value_name || !r->in.key_name) { return WERR_NOMEM; } @@ -9369,7 +9406,7 @@ WERROR _spoolss_deleteprinterdataex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATAEX if (!W_ERROR_IS_OK(status)) return status; - status = delete_printer_dataex( printer, keyname, valuename ); + status = delete_printer_dataex( printer, r->in.key_name, r->in.value_name ); if ( W_ERROR_IS_OK(status) ) mod_a_printer( printer, 2 ); @@ -9451,36 +9488,38 @@ done: return status; } -/******************************************************************** - * spoolss_deleteprinterkey - ********************************************************************/ +/**************************************************************** + _spoolss_DeletePrinterKey +****************************************************************/ -WERROR _spoolss_deleteprinterkey(pipes_struct *p, SPOOL_Q_DELETEPRINTERKEY *q_u, SPOOL_R_DELETEPRINTERKEY *r_u) +WERROR _spoolss_DeletePrinterKey(pipes_struct *p, + struct spoolss_DeletePrinterKey *r) { - POLICY_HND *handle = &q_u->handle; - Printer_entry *Printer = find_printer_index_by_hnd(p, &q_u->handle); - fstring key; + POLICY_HND *handle = r->in.handle; + Printer_entry *Printer = find_printer_index_by_hnd(p, handle); NT_PRINTER_INFO_LEVEL *printer = NULL; int snum=0; WERROR status; - DEBUG(5,("spoolss_deleteprinterkey\n")); + DEBUG(5,("_spoolss_DeletePrinterKey\n")); if (!Printer) { - DEBUG(2,("_spoolss_deleteprinterkey: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_DeletePrinterKey: Invalid handle (%s:%u:%u).\n", + OUR_HANDLE(handle))); return WERR_BADFID; } /* if keyname == NULL, return error */ - if ( !q_u->keyname.buffer ) + if ( !r->in.key_name ) return WERR_INVALID_PARAM; if (!get_printer_snum(p, handle, &snum, NULL)) return WERR_BADFID; if (Printer->access_granted != PRINTER_ACCESS_ADMINISTER) { - DEBUG(3, ("_spoolss_deleteprinterkey: printer properties change denied by handle\n")); + DEBUG(3, ("_spoolss_DeletePrinterKey: " + "printer properties change denied by handle\n")); return WERR_ACCESS_DENIED; } @@ -9490,9 +9529,7 @@ WERROR _spoolss_deleteprinterkey(pipes_struct *p, SPOOL_Q_DELETEPRINTERKEY *q_u, /* delete the key and all subneys */ - unistr2_to_ascii(key, &q_u->keyname, sizeof(key)); - - status = delete_all_printer_data( printer->info_2, key ); + status = delete_all_printer_data( printer->info_2, r->in.key_name ); if ( W_ERROR_IS_OK(status) ) status = mod_a_printer(printer, 2); @@ -9941,3 +9978,872 @@ WERROR _spoolss_xcvdataport(pipes_struct *p, SPOOL_Q_XCVDATAPORT *q_u, SPOOL_R_X return WERR_INVALID_PRINT_MONITOR; } +/**************************************************************** + _spoolss_EnumPrinters +****************************************************************/ + +WERROR _spoolss_EnumPrinters(pipes_struct *p, + struct spoolss_EnumPrinters *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_OpenPrinter +****************************************************************/ + +WERROR _spoolss_OpenPrinter(pipes_struct *p, + struct spoolss_OpenPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_SetJob +****************************************************************/ + +WERROR _spoolss_SetJob(pipes_struct *p, + struct spoolss_SetJob *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetJob +****************************************************************/ + +WERROR _spoolss_GetJob(pipes_struct *p, + struct spoolss_GetJob *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumJobs +****************************************************************/ + +WERROR _spoolss_EnumJobs(pipes_struct *p, + struct spoolss_EnumJobs *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrinter +****************************************************************/ + +WERROR _spoolss_AddPrinter(pipes_struct *p, + struct spoolss_AddPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_SetPrinter +****************************************************************/ + +WERROR _spoolss_SetPrinter(pipes_struct *p, + struct spoolss_SetPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrinter +****************************************************************/ + +WERROR _spoolss_GetPrinter(pipes_struct *p, + struct spoolss_GetPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrinterDriver +****************************************************************/ + +WERROR _spoolss_AddPrinterDriver(pipes_struct *p, + struct spoolss_AddPrinterDriver *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPrinterDrivers +****************************************************************/ + +WERROR _spoolss_EnumPrinterDrivers(pipes_struct *p, + struct spoolss_EnumPrinterDrivers *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrinterDriver +****************************************************************/ + +WERROR _spoolss_GetPrinterDriver(pipes_struct *p, + struct spoolss_GetPrinterDriver *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrinterDriverDirectory +****************************************************************/ + +WERROR _spoolss_GetPrinterDriverDirectory(pipes_struct *p, + struct spoolss_GetPrinterDriverDirectory *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrintProcessor +****************************************************************/ + +WERROR _spoolss_AddPrintProcessor(pipes_struct *p, + struct spoolss_AddPrintProcessor *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPrintProcessors +****************************************************************/ + +WERROR _spoolss_EnumPrintProcessors(pipes_struct *p, + struct spoolss_EnumPrintProcessors *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrintProcessorDirectory +****************************************************************/ + +WERROR _spoolss_GetPrintProcessorDirectory(pipes_struct *p, + struct spoolss_GetPrintProcessorDirectory *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_StartDocPrinter +****************************************************************/ + +WERROR _spoolss_StartDocPrinter(pipes_struct *p, + struct spoolss_StartDocPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ReadPrinter +****************************************************************/ + +WERROR _spoolss_ReadPrinter(pipes_struct *p, + struct spoolss_ReadPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddJob +****************************************************************/ + +WERROR _spoolss_AddJob(pipes_struct *p, + struct spoolss_AddJob *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ScheduleJob +****************************************************************/ + +WERROR _spoolss_ScheduleJob(pipes_struct *p, + struct spoolss_ScheduleJob *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrinterData +****************************************************************/ + +WERROR _spoolss_GetPrinterData(pipes_struct *p, + struct spoolss_GetPrinterData *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_SetPrinterData +****************************************************************/ + +WERROR _spoolss_SetPrinterData(pipes_struct *p, + struct spoolss_SetPrinterData *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_WaitForPrinterChange +****************************************************************/ + +WERROR _spoolss_WaitForPrinterChange(pipes_struct *p, + struct spoolss_WaitForPrinterChange *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumForms +****************************************************************/ + +WERROR _spoolss_EnumForms(pipes_struct *p, + struct spoolss_EnumForms *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPorts +****************************************************************/ + +WERROR _spoolss_EnumPorts(pipes_struct *p, + struct spoolss_EnumPorts *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumMonitors +****************************************************************/ + +WERROR _spoolss_EnumMonitors(pipes_struct *p, + struct spoolss_EnumMonitors *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPort +****************************************************************/ + +WERROR _spoolss_AddPort(pipes_struct *p, + struct spoolss_AddPort *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ConfigurePort +****************************************************************/ + +WERROR _spoolss_ConfigurePort(pipes_struct *p, + struct spoolss_ConfigurePort *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_DeletePort +****************************************************************/ + +WERROR _spoolss_DeletePort(pipes_struct *p, + struct spoolss_DeletePort *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_CreatePrinterIC +****************************************************************/ + +WERROR _spoolss_CreatePrinterIC(pipes_struct *p, + struct spoolss_CreatePrinterIC *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_PlayGDIScriptOnPrinterIC +****************************************************************/ + +WERROR _spoolss_PlayGDIScriptOnPrinterIC(pipes_struct *p, + struct spoolss_PlayGDIScriptOnPrinterIC *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_DeletePrinterIC +****************************************************************/ + +WERROR _spoolss_DeletePrinterIC(pipes_struct *p, + struct spoolss_DeletePrinterIC *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrinterConnection +****************************************************************/ + +WERROR _spoolss_AddPrinterConnection(pipes_struct *p, + struct spoolss_AddPrinterConnection *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_DeletePrinterConnection +****************************************************************/ + +WERROR _spoolss_DeletePrinterConnection(pipes_struct *p, + struct spoolss_DeletePrinterConnection *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_PrinterMessageBox +****************************************************************/ + +WERROR _spoolss_PrinterMessageBox(pipes_struct *p, + struct spoolss_PrinterMessageBox *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddMonitor +****************************************************************/ + +WERROR _spoolss_AddMonitor(pipes_struct *p, + struct spoolss_AddMonitor *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_DeleteMonitor +****************************************************************/ + +WERROR _spoolss_DeleteMonitor(pipes_struct *p, + struct spoolss_DeleteMonitor *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_DeletePrintProcessor +****************************************************************/ + +WERROR _spoolss_DeletePrintProcessor(pipes_struct *p, + struct spoolss_DeletePrintProcessor *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrintProvidor +****************************************************************/ + +WERROR _spoolss_AddPrintProvidor(pipes_struct *p, + struct spoolss_AddPrintProvidor *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_DeletePrintProvidor +****************************************************************/ + +WERROR _spoolss_DeletePrintProvidor(pipes_struct *p, + struct spoolss_DeletePrintProvidor *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPrintProcDataTypes +****************************************************************/ + +WERROR _spoolss_EnumPrintProcDataTypes(pipes_struct *p, + struct spoolss_EnumPrintProcDataTypes *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ResetPrinter +****************************************************************/ + +WERROR _spoolss_ResetPrinter(pipes_struct *p, + struct spoolss_ResetPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrinterDriver2 +****************************************************************/ + +WERROR _spoolss_GetPrinterDriver2(pipes_struct *p, + struct spoolss_GetPrinterDriver2 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_FindFirstPrinterChangeNotification +****************************************************************/ + +WERROR _spoolss_FindFirstPrinterChangeNotification(pipes_struct *p, + struct spoolss_FindFirstPrinterChangeNotification *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_FindNextPrinterChangeNotification +****************************************************************/ + +WERROR _spoolss_FindNextPrinterChangeNotification(pipes_struct *p, + struct spoolss_FindNextPrinterChangeNotification *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_RouterFindFirstPrinterChangeNotificationOld +****************************************************************/ + +WERROR _spoolss_RouterFindFirstPrinterChangeNotificationOld(pipes_struct *p, + struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ReplyOpenPrinter +****************************************************************/ + +WERROR _spoolss_ReplyOpenPrinter(pipes_struct *p, + struct spoolss_ReplyOpenPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_RouterReplyPrinter +****************************************************************/ + +WERROR _spoolss_RouterReplyPrinter(pipes_struct *p, + struct spoolss_RouterReplyPrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ReplyClosePrinter +****************************************************************/ + +WERROR _spoolss_ReplyClosePrinter(pipes_struct *p, + struct spoolss_ReplyClosePrinter *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPortEx +****************************************************************/ + +WERROR _spoolss_AddPortEx(pipes_struct *p, + struct spoolss_AddPortEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_RouterFindFirstPrinterChangeNotification +****************************************************************/ + +WERROR _spoolss_RouterFindFirstPrinterChangeNotification(pipes_struct *p, + struct spoolss_RouterFindFirstPrinterChangeNotification *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_SpoolerInit +****************************************************************/ + +WERROR _spoolss_SpoolerInit(pipes_struct *p, + struct spoolss_SpoolerInit *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_ResetPrinterEx +****************************************************************/ + +WERROR _spoolss_ResetPrinterEx(pipes_struct *p, + struct spoolss_ResetPrinterEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_RemoteFindFirstPrinterChangeNotifyEx +****************************************************************/ + +WERROR _spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p, + struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_RouterRefreshPrinterChangeNotification +****************************************************************/ + +WERROR _spoolss_RouterRefreshPrinterChangeNotification(pipes_struct *p, + struct spoolss_RouterRefreshPrinterChangeNotification *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_RemoteFindNextPrinterChangeNotifyEx +****************************************************************/ + +WERROR _spoolss_RemoteFindNextPrinterChangeNotifyEx(pipes_struct *p, + struct spoolss_RemoteFindNextPrinterChangeNotifyEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_44 +****************************************************************/ + +WERROR _spoolss_44(pipes_struct *p, + struct spoolss_44 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_OpenPrinterEx +****************************************************************/ + +WERROR _spoolss_OpenPrinterEx(pipes_struct *p, + struct spoolss_OpenPrinterEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrinterEx +****************************************************************/ + +WERROR _spoolss_AddPrinterEx(pipes_struct *p, + struct spoolss_AddPrinterEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_47 +****************************************************************/ + +WERROR _spoolss_47(pipes_struct *p, + struct spoolss_47 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPrinterData +****************************************************************/ + +WERROR _spoolss_EnumPrinterData(pipes_struct *p, + struct spoolss_EnumPrinterData *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_4a +****************************************************************/ + +WERROR _spoolss_4a(pipes_struct *p, + struct spoolss_4a *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_4b +****************************************************************/ + +WERROR _spoolss_4b(pipes_struct *p, + struct spoolss_4b *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_4c +****************************************************************/ + +WERROR _spoolss_4c(pipes_struct *p, + struct spoolss_4c *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_SetPrinterDataEx +****************************************************************/ + +WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, + struct spoolss_SetPrinterDataEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_GetPrinterDataEx +****************************************************************/ + +WERROR _spoolss_GetPrinterDataEx(pipes_struct *p, + struct spoolss_GetPrinterDataEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPrinterDataEx +****************************************************************/ + +WERROR _spoolss_EnumPrinterDataEx(pipes_struct *p, + struct spoolss_EnumPrinterDataEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_EnumPrinterKey +****************************************************************/ + +WERROR _spoolss_EnumPrinterKey(pipes_struct *p, + struct spoolss_EnumPrinterKey *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_53 +****************************************************************/ + +WERROR _spoolss_53(pipes_struct *p, + struct spoolss_53 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_55 +****************************************************************/ + +WERROR _spoolss_55(pipes_struct *p, + struct spoolss_55 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_56 +****************************************************************/ + +WERROR _spoolss_56(pipes_struct *p, + struct spoolss_56 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_57 +****************************************************************/ + +WERROR _spoolss_57(pipes_struct *p, + struct spoolss_57 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_XcvData +****************************************************************/ + +WERROR _spoolss_XcvData(pipes_struct *p, + struct spoolss_XcvData *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_AddPrinterDriverEx +****************************************************************/ + +WERROR _spoolss_AddPrinterDriverEx(pipes_struct *p, + struct spoolss_AddPrinterDriverEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_5a +****************************************************************/ + +WERROR _spoolss_5a(pipes_struct *p, + struct spoolss_5a *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_5b +****************************************************************/ + +WERROR _spoolss_5b(pipes_struct *p, + struct spoolss_5b *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_5c +****************************************************************/ + +WERROR _spoolss_5c(pipes_struct *p, + struct spoolss_5c *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_5d +****************************************************************/ + +WERROR _spoolss_5d(pipes_struct *p, + struct spoolss_5d *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_5e +****************************************************************/ + +WERROR _spoolss_5e(pipes_struct *p, + struct spoolss_5e *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** + _spoolss_5f +****************************************************************/ + +WERROR _spoolss_5f(pipes_struct *p, + struct spoolss_5f *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 073f92d45c..056236f22d 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -2328,6 +2328,8 @@ WERROR _srvsvc_NetDiskEnum(pipes_struct *p, /*allow one struct srvsvc_NetDiskInfo0 for null terminator*/ + r->out.info->count = 0; + for(i = 0; i < MAX_SERVER_DISK_ENTRIES -1 && (disk_name = next_server_disk_enum(&resume)); i++) { r->out.info->count++; |