*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
BOOL *is_data_outstanding);
static ssize_t write_to_internal_pipe(void *np_conn, char *data, size_t n);
static BOOL close_internal_rpc_pipe_hnd(void *np_conn);
-static void *make_internal_rpc_pipe_p(char *pipe_name,
+static void *make_internal_rpc_pipe_p(const char *pipe_name,
connection_struct *conn, uint16 vuid);
/****************************************************************************
Find first available pipe slot.
****************************************************************************/
-smb_np_struct *open_rpc_pipe_p(char *pipe_name,
+smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
connection_struct *conn, uint16 vuid)
{
int i;
Make an internal namedpipes structure
****************************************************************************/
-static void *make_internal_rpc_pipe_p(char *pipe_name,
+static void *make_internal_rpc_pipe_p(const char *pipe_name,
connection_struct *conn, uint16 vuid)
{
pipes_struct *p;
DEBUG(0,("open_rpc_pipe_p: malloc fail for in_data struct.\n"));
talloc_destroy(p->mem_ctx);
talloc_destroy(p->pipe_state_mem_ctx);
+ close_policy_by_pipe(p);
+ SAFE_FREE(p);
return NULL;
}
DEBUG(10,("process_complete_pdu: pipe %s in fault state.\n",
p->name ));
set_incoming_fault(p);
- setup_fault_pdu(p, NT_STATUS(0x1c010002));
+ setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
return;
}
if (!reply) {
DEBUG(3,("process_complete_pdu: DCE/RPC fault sent on pipe %s\n", p->pipe_srv_name));
set_incoming_fault(p);
- setup_fault_pdu(p, NT_STATUS(0x1c010002));
+ setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
prs_mem_free(&rpc_in);
} else {
/*
DEBUG(6,(" name: %s open: %s len: %d\n",
p->name, BOOLSTR(p->open), (int)n));
- dump_data(50, data, n);
+ dump_data(50, (uint8 *)data, n);
return p->namedpipe_write(p->np_state, data, n);
}
if(n > RPC_MAX_PDU_FRAG_LEN) {
DEBUG(5,("read_from_pipe: too large read (%u) requested on \
pipe %s. We can only service %d sized reads.\n", (unsigned int)n, p->name, RPC_MAX_PDU_FRAG_LEN ));
+ n = RPC_MAX_PDU_FRAG_LEN;
}
/*
p->name, p->pnum, pipes_open));
DLIST_REMOVE(Pipes, p);
+
+ /* TODO: Remove from pipe open db */
+
+ if ( !delete_pipe_opendb( p ) ) {
+ DEBUG(3,("close_rpc_pipe_hnd: failed to delete %s "
+ "pipe from open db.\n", p->name));
+ }
ZERO_STRUCTP(p);
/* Free the handles database. */
close_policy_by_pipe(p);
- talloc_free(p->pipe_user.nt_user_token);
+ TALLOC_FREE(p->pipe_user.nt_user_token);
data_blob_free(&p->session_key);
SAFE_FREE(p->pipe_user.ut.groups);
Find an rpc pipe given a pipe handle in a buffer and an offset.
****************************************************************************/
-smb_np_struct *get_rpc_pipe_p(char *buf, int where)
+smb_np_struct *get_rpc_pipe_p(uint16 pnum)
{
- int pnum = SVAL(buf,where);
-
if (chain_p) {
return chain_p;
}