2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Server side RPC handler. 2N/A * Allocate and associate a service context with a fid. 2N/A * Release the context associated with a fid when an opipe is closed. 2N/A * Release twice: once for the lookup above 2N/A * and again to close the fid. 2N/A * Write RPC request data to the input stream. Input data is buffered 2N/A * until the response is requested. 2N/A * Read RPC response data. 2N/A * Nothing left, cleanup the output stream. 2N/A * If the input stream contains an RPC request, process the RPC transaction, 2N/A * which will place the RPC response in the output (frags) stream. 2N/A * arg is freed here; it must have been allocated by malloc(). 2N/A * Process a server-side RPC request. 2N/A * Copy the input data and reset the input stream. 2N/A * Must be called with ndr_pipe_lock held. 2N/A * Must be called with ndr_pipe_lock held. 2N/A * Must be called with ndr_pipe_lock held. 2N/A * If the desired space exceeds the current pipe size, try to expand 2N/A * the pipe. Leave the current pipe intact if the realloc fails. 2N/A * Must be called with ndr_pipe_lock held. 2N/A * Must be called with ndr_pipe_lock held. 2N/A * Ensure that there are no RPC service policy handles 2N/A * (associated with this fid) left around. 2N/A * Rewind the input data stream, ready for the next write. 2N/A * Flush the output data stream. 2N/A * Check whether or not the specified user has administrator privileges, 2N/A * i.e. is a member of Domain Admins or Administrators. 2N/A * Returns true if the user is an administrator, otherwise returns false. 2N/A * Check whether or not the specified user has power-user privileges, 2N/A * i.e. is a member of Domain Admins, Administrators or Power Users. 2N/A * This is typically required for operations such as managing shares. 2N/A * Returns true if the user is a power user, otherwise returns false. 2N/A * This is the entry point for all server-side RPC processing. 2N/A * It is assumed that the PDU has already been received. 2N/A * Multi-fragment request. Preserve the PDU scan 2N/A * offset and size during defrag so that we can 2N/A * continue as if we had received contiguous data. 2N/A * Remove RPC fragment headers from the received data stream. 2N/A * The first fragment has already been accounted for before this call. 2N/A * NDR stream on entry: 2N/A * |<-- frag 2 -->|<-- frag 3 -->| ... |<- last frag ->| 2N/A * +-----+--------+-----+--------+-----+-----+---------+ 2N/A * | hdr | data | hdr | data | ... | hdr | data | 2N/A * +-----+--------+-----+--------+-----+-----+---------+ 2N/A * NDR stream on return: 2N/A * +----------------------------------+ 2N/A * +----------------------------------+ 2N/A * Multiple p_cont_elem[]s, multiple transfer_syntaxes[] and multiple 2N/A * p_results[] not supported. 2N/A /* acquire targets */ 2N/A * Set up temporary secondary address port. 2N/A * We will correct this later (below). 2N/A * Duplicate presentation context id. 2N/A * No free binding slot 2N/A * We can now use the correct secondary address port. 2N/A /* mbind->context set by app */ 2N/A * Call the service-specific bind() handler. If 2N/A * this fails, we shouild send a specific error 2N/A * ndr_svc_alter_context 2N/A * The alter context request is used to request additional presentation 2N/A * context for another interface and/or version. It is very similar to 2N/A /* mbind->context set by app */ 2N/A * Make room for the response hdr. 2N/A * The transaction and the two nds streams use the same heap, which 2N/A * should already exist at this point. The heap will also be available 2N/A * We can perform some initial setup of the response header here. 2N/A * We also need to cache some of the information from the bind 2N/A * negotiation for use during subsequent RPC calls. 2N/A * Save the maximum fragment sizes 2N/A * for use with subsequent requests. 2N/A /* mxa->send_hdr.response_hdr.alloc_hint */ 2N/A * The max_xmit_frag, max_recv_frag and assoc_group_id are 2N/A * ignored by the client but it's useful to fill them in. 2N/A * Signal an RPC fault. The stream is reset and we overwrite whatever 2N/A * was in the response header with the fault information. 2N/A * Note that the frag_length for bind ack and alter context is 2N/A * Single fragment response. The PDU size may be zero 2N/A * here (i.e. bind or fault response). So don't make 2N/A * any assumptions about it until after the header is 2N/A * Multiple fragment response. 2N/A * We need to update the 24-byte header in subsequent fragments. 2N/A * pdu_data_size: total data remaining to be handled 2N/A * frag_size: total fragment size including header 2N/A * frag_data_size: data in fragment 2N/A * (i.e. frag_size - NDR_RSP_HDR_SIZE) 2N/A * Build an RPC PDU fragment from the specified buffer. 2N/A * If malloc fails, the client will see a header/pdu inconsistency 2N/A * and report an error.