From a781b78417b6d7b875230dd2edcb932445aa4197 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 12 Oct 2008 23:09:18 +0200 Subject: Remove smb_np_struct --- source3/smbd/connection.c | 106 ---------------------------------------------- source3/smbd/pipes.c | 26 ------------ source3/smbd/process.c | 1 - source3/smbd/service.c | 7 ++- 4 files changed, 3 insertions(+), 137 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index fd83f77725..3b72a9505a 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -224,109 +224,3 @@ bool register_message_flags(bool doreg, uint32 msg_flags) return True; } - -/********************************************************************* -*********************************************************************/ - -static TDB_DATA* make_pipe_rec_key( struct pipe_open_rec *prec ) -{ - TDB_DATA *kbuf = NULL; - fstring key_string; - - if ( !prec ) - return NULL; - - if ( (kbuf = TALLOC_P(prec, TDB_DATA)) == NULL ) { - return NULL; - } - - snprintf( key_string, sizeof(key_string), "%s/%d/%d", - prec->name, procid_to_pid(&prec->pid), prec->pnum ); - - *kbuf = string_term_tdb_data(talloc_strdup(prec, key_string)); - if (kbuf->dptr == NULL ) - return NULL; - - return kbuf; -} - -/********************************************************************* -*********************************************************************/ - -static void fill_pipe_open_rec( struct pipe_open_rec *prec, smb_np_struct *p ) -{ - prec->pid = pid_to_procid(sys_getpid()); - prec->pnum = p->pnum; - prec->uid = geteuid(); - fstrcpy( prec->name, p->name ); - - return; -} - -/********************************************************************* -*********************************************************************/ - -bool store_pipe_opendb( smb_np_struct *p ) -{ - struct db_record *dbrec; - struct pipe_open_rec *prec; - TDB_DATA *key; - TDB_DATA data; - bool ret = False; - - if ( (prec = TALLOC_P( talloc_tos(), struct pipe_open_rec)) == NULL ) { - DEBUG(0,("store_pipe_opendb: talloc failed!\n")); - return False; - } - - fill_pipe_open_rec( prec, p ); - if ( (key = make_pipe_rec_key( prec )) == NULL ) { - goto done; - } - - data.dptr = (uint8 *)prec; - data.dsize = sizeof(struct pipe_open_rec); - - if (!(dbrec = connections_fetch_record(prec, *key))) { - DEBUG(0, ("connections_fetch_record failed\n")); - goto done; - } - - ret = NT_STATUS_IS_OK(dbrec->store(dbrec, data, TDB_REPLACE)); - -done: - TALLOC_FREE( prec ); - return ret; -} - -/********************************************************************* -*********************************************************************/ - -bool delete_pipe_opendb( smb_np_struct *p ) -{ - struct db_record *dbrec; - struct pipe_open_rec *prec; - TDB_DATA *key; - bool ret = False; - - if ( (prec = TALLOC_P( talloc_tos(), struct pipe_open_rec)) == NULL ) { - DEBUG(0,("store_pipe_opendb: talloc failed!\n")); - return False; - } - - fill_pipe_open_rec( prec, p ); - if ( (key = make_pipe_rec_key( prec )) == NULL ) { - goto done; - } - - if (!(dbrec = connections_fetch_record(prec, *key))) { - DEBUG(0, ("connections_fetch_record failed\n")); - goto done; - } - - ret = NT_STATUS_IS_OK(dbrec->delete_rec(dbrec)); - -done: - TALLOC_FREE( prec ); - return ret; -} diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 16d8ed1c11..af363689c9 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -312,29 +312,3 @@ void reply_pipe_read_and_X(struct smb_request *req) chain_reply(req); } - -/**************************************************************************** - Reply to a close. -****************************************************************************/ - -void reply_pipe_close(connection_struct *conn, struct smb_request *req) -{ - smb_np_struct *p = get_rpc_pipe_p(SVAL(req->inbuf,smb_vwv0)); - - if (!p) { - reply_doserror(req, ERRDOS, ERRbadfid); - return; - } - - DEBUG(5,("reply_pipe_close: pnum:%x\n", p->pnum)); - - if (!close_rpc_pipe_hnd(p)) { - reply_doserror(req, ERRDOS, ERRbadfid); - return; - } - - /* TODO: REMOVE PIPE FROM DB */ - - reply_outbuf(req, 0, 0); - return; -} diff --git a/source3/smbd/process.c b/source3/smbd/process.c index be45d7ad7c..ba3b45d522 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1487,7 +1487,6 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc struct smb_request *req; chain_size = 0; - reset_chain_p(); if (!(req = talloc(talloc_tos(), struct smb_request))) { smb_panic("could not allocate smb_request"); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 0b851f1e48..05197021a3 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -1296,10 +1296,9 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password, void close_cnum(connection_struct *conn, uint16 vuid) { - if (IS_IPC(conn)) { - pipe_close_conn(conn); - } else { - file_close_conn(conn); + file_close_conn(conn); + + if (!IS_IPC(conn)) { dptr_closecnum(conn); } -- cgit