From 4ddb2d347d86818a13d71d0eb2f0f8983c2cc41f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 28 Jun 2004 08:27:36 +0000 Subject: r1279: rename struct tcon_context to smbsrv_tcon metze (This used to be commit 99473fab4b1ff87a795f3c08f4c521d9beb504c0) --- source4/smb_server/conn.c | 76 +++++++++++++++++++------------------- source4/smb_server/connection.c | 26 ++++++------- source4/smb_server/nttrans.c | 2 +- source4/smb_server/reply.c | 82 ++++++++++++++++++++--------------------- source4/smb_server/search.c | 6 +-- source4/smb_server/service.c | 60 +++++++++++++++--------------- source4/smb_server/smb_server.c | 18 ++++----- source4/smb_server/trans2.c | 38 +++++++++---------- 8 files changed, 154 insertions(+), 154 deletions(-) (limited to 'source4/smb_server') diff --git a/source4/smb_server/conn.c b/source4/smb_server/conn.c index 4a5a6a6ed0..e275854325 100644 --- a/source4/smb_server/conn.c +++ b/source4/smb_server/conn.c @@ -1,6 +1,6 @@ /* Unix SMB/CIFS implementation. - Manage connections_struct structures + Manage smbsrv_tcon structures Copyright (C) Andrew Tridgell 1998 Copyright (C) Alexander Bokovoy 2002 @@ -28,7 +28,7 @@ #define MAX_CONNECTIONS 128 /**************************************************************************** -init the conn structures +init the tcon structures ****************************************************************************/ void conn_init(struct smbsrv_context *smb_ctx) { @@ -40,9 +40,9 @@ check if a snum is in use ****************************************************************************/ BOOL conn_snum_used(struct smbsrv_context *smb_ctx, int snum) { - struct tcon_context *conn; - for (conn=smb_ctx->tree.connections;conn;conn=conn->next) { - if (conn->service == snum) { + struct smbsrv_tcon *tcon; + for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next) { + if (tcon->service == snum) { return(True); } } @@ -51,19 +51,19 @@ BOOL conn_snum_used(struct smbsrv_context *smb_ctx, int snum) /**************************************************************************** -find a conn given a cnum +find a tcon given a cnum ****************************************************************************/ -struct tcon_context *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) +struct smbsrv_tcon *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) { int count=0; - struct tcon_context *conn; + struct smbsrv_tcon *tcon; - for (conn=smb_ctx->tree.connections;conn;conn=conn->next,count++) { - if (conn->cnum == cnum) { + for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next,count++) { + if (tcon->cnum == cnum) { if (count > 10) { - DLIST_PROMOTE(smb_ctx->tree.connections, conn); + DLIST_PROMOTE(smb_ctx->tree.tcons, tcon); } - return conn; + return tcon; } } @@ -76,10 +76,10 @@ struct tcon_context *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) The randomisation stops problems with the server dieing and clients thinking the server is still available. ****************************************************************************/ -struct tcon_context *conn_new(struct smbsrv_context *smb_ctx) +struct smbsrv_tcon *conn_new(struct smbsrv_context *smb_ctx) { TALLOC_CTX *mem_ctx; - struct tcon_context *conn; + struct smbsrv_tcon *tcon; int i; i = bitmap_find(smb_ctx->tree.bmap, 1); @@ -89,35 +89,35 @@ struct tcon_context *conn_new(struct smbsrv_context *smb_ctx) return NULL; } - mem_ctx = talloc_init("tcon_context[%d]", i); + mem_ctx = talloc_init("smbsrv_tcon[%d]", i); - conn = (struct tcon_context *)talloc(mem_ctx, sizeof(*conn)); - if (!conn) return NULL; + tcon = talloc_p(mem_ctx, struct smbsrv_tcon); + if (!tcon) return NULL; - ZERO_STRUCTP(conn); + ZERO_STRUCTP(tcon); - conn->mem_ctx = mem_ctx; - conn->cnum = i; - conn->smb_ctx = smb_ctx; + tcon->mem_ctx = mem_ctx; + tcon->cnum = i; + tcon->smb_ctx = smb_ctx; bitmap_set(smb_ctx->tree.bmap, i); smb_ctx->tree.num_open++; - DLIST_ADD(smb_ctx->tree.connections, conn); + DLIST_ADD(smb_ctx->tree.tcons, tcon); - return conn; + return tcon; } /**************************************************************************** -close all conn structures +close all tcon structures ****************************************************************************/ void conn_close_all(struct smbsrv_context *smb_ctx) { - struct tcon_context *conn, *next; - for (conn=smb_ctx->tree.connections;conn;conn=next) { - next=conn->next; - close_cnum(conn); + struct smbsrv_tcon *tcon, *next; + for (tcon=smb_ctx->tree.tcons;tcon;tcon=next) { + next=tcon->next; + close_cnum(tcon); } } @@ -128,13 +128,13 @@ clear a vuid out of the validity cache, and as the 'owner' of a connection. ****************************************************************************/ void conn_clear_vuid_cache(struct smbsrv_context *smb_ctx, uint16_t vuid) { - struct tcon_context *conn; + struct smbsrv_tcon *tcon; uint_t i; - for (conn=smb_ctx->tree.connections;conn;conn=conn->next) { - for (i=0;ivuid_cache.entries && i< VUID_CACHE_SIZE;i++) { - if (conn->vuid_cache.list[i] == vuid) { - conn->vuid_cache.list[i] = UID_FIELD_INVALID; + for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next) { + for (i=0;ivuid_cache.entries && i< VUID_CACHE_SIZE;i++) { + if (tcon->vuid_cache.list[i] == vuid) { + tcon->vuid_cache.list[i] = UID_FIELD_INVALID; } } } @@ -142,16 +142,16 @@ void conn_clear_vuid_cache(struct smbsrv_context *smb_ctx, uint16_t vuid) #endif /**************************************************************************** - Free a conn structure. + Free a tcon structure. ****************************************************************************/ -void conn_free(struct smbsrv_context *smb_ctx, struct tcon_context *conn) +void conn_free(struct smbsrv_context *smb_ctx, struct smbsrv_tcon *tcon) { - DLIST_REMOVE(smb_ctx->tree.connections, conn); + DLIST_REMOVE(smb_ctx->tree.tcons, tcon); - bitmap_clear(smb_ctx->tree.bmap, conn->cnum); + bitmap_clear(smb_ctx->tree.bmap, tcon->cnum); smb_ctx->tree.num_open--; - talloc_destroy(conn->mem_ctx); + talloc_destroy(tcon->mem_ctx); } diff --git a/source4/smb_server/connection.c b/source4/smb_server/connection.c index 8b984754ba..7757ffe6d6 100644 --- a/source4/smb_server/connection.c +++ b/source4/smb_server/connection.c @@ -23,11 +23,11 @@ static TDB_CONTEXT *tdb; -static void make_conn_key(struct tcon_context *conn, const char *name, TDB_DATA *pkbuf, struct connections_key *pkey) +static void make_conn_key(struct smbsrv_tcon *tcon, const char *name, TDB_DATA *pkbuf, struct connections_key *pkey) { ZERO_STRUCTP(pkey); pkey->pid = getpid(); - pkey->cnum = conn?conn->cnum:-1; + pkey->cnum = tcon?tcon->cnum:-1; fstrcpy(pkey->name, name); pkbuf->dptr = (char *)pkey; @@ -38,7 +38,7 @@ static void make_conn_key(struct tcon_context *conn, const char *name, TDB_DATA Delete a connection record. ****************************************************************************/ -BOOL yield_connection(struct tcon_context *conn, const char *name) +BOOL yield_connection(struct smbsrv_tcon *tcon, const char *name) { struct connections_key key; TDB_DATA kbuf; @@ -48,10 +48,10 @@ BOOL yield_connection(struct tcon_context *conn, const char *name) DEBUG(3,("Yielding connection to %s\n",name)); - make_conn_key(conn, name, &kbuf, &key); + make_conn_key(tcon, name, &kbuf, &key); if (tdb_delete(tdb, kbuf) != 0) { - int dbg_lvl = (!conn && (tdb_error(tdb) == TDB_ERR_NOEXIST)) ? 3 : 0; + int dbg_lvl = (!tcon && (tdb_error(tdb) == TDB_ERR_NOEXIST)) ? 3 : 0; DEBUG(dbg_lvl,("yield_connection: tdb_delete for name %s failed with error %s.\n", name, tdb_errorstr(tdb) )); return (False); @@ -104,14 +104,14 @@ static int count_fn( TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *u Claim an entry in the connections database. ****************************************************************************/ -BOOL claim_connection(struct tcon_context *conn, const char *name,int max_connections,BOOL Clear, uint32_t msg_flags) +BOOL claim_connection(struct smbsrv_tcon *tcon, const char *name,int max_connections,BOOL Clear, uint32_t msg_flags) { struct connections_key key; struct connections_data crec; TDB_DATA kbuf, dbuf; if (!tdb) - tdb = tdb_open_log(lock_path(conn->mem_ctx, "connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, + tdb = tdb_open_log(lock_path(tcon->mem_ctx, "connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); if (!tdb) @@ -126,7 +126,7 @@ BOOL claim_connection(struct tcon_context *conn, const char *name,int max_connec cs.mypid = getpid(); cs.curr_connections = 0; - cs.name = lp_servicename(SNUM(conn)); + cs.name = lp_servicename(SNUM(tcon)); cs.Clear = Clear; /* @@ -149,24 +149,24 @@ BOOL claim_connection(struct tcon_context *conn, const char *name,int max_connec DEBUG(5,("claiming %s %d\n",name,max_connections)); - make_conn_key(conn, name, &kbuf, &key); + make_conn_key(tcon, name, &kbuf, &key); /* fill in the crec */ ZERO_STRUCT(crec); crec.magic = 0x280267; crec.pid = getpid(); - crec.cnum = conn?conn->cnum:-1; - if (conn) { + crec.cnum = tcon?tcon->cnum:-1; + if (tcon) { crec.uid = -1; crec.gid = -1; StrnCpy(crec.name, - lp_servicename(SNUM(conn)),sizeof(crec.name)-1); + lp_servicename(SNUM(tcon)),sizeof(crec.name)-1); } crec.start = time(NULL); crec.bcast_msg_flags = msg_flags; StrnCpy(crec.machine,sub_get_remote_machine(),sizeof(crec.machine)-1); - StrnCpy(crec.addr,conn?conn->smb_ctx->socket.client_addr:"NONE",sizeof(crec.addr)-1); + StrnCpy(crec.addr,tcon?tcon->smb_ctx->socket.client_addr:"NONE",sizeof(crec.addr)-1); dbuf.dptr = (char *)&crec; dbuf.dsize = sizeof(crec); diff --git a/source4/smb_server/nttrans.c b/source4/smb_server/nttrans.c index 955c9c493b..14977f9bd2 100644 --- a/source4/smb_server/nttrans.c +++ b/source4/smb_server/nttrans.c @@ -94,7 +94,7 @@ static NTSTATUS nttrans_ioctl(struct request_context *req, nttrans_setup_reply(req, trans, 0, 0, 1); trans->out.setup[0] = 0; - return req->conn->ntvfs_ops->ioctl(req, &nt); + return req->tcon->ntvfs_ops->ioctl(req, &nt); } /* diff --git a/source4/smb_server/reply.c b/source4/smb_server/reply.c index 7ff8929a65..3356ce9925 100644 --- a/source4/smb_server/reply.c +++ b/source4/smb_server/reply.c @@ -111,7 +111,7 @@ void reply_tcon(struct request_context *req) SSVAL(req->out.vwv, VWV(0), con.tcon.out.max_xmit); SSVAL(req->out.vwv, VWV(1), con.tcon.out.cnum); - SSVAL(req->out.hdr, HDR_TID, req->conn->cnum); + SSVAL(req->out.hdr, HDR_TID, req->tcon->cnum); req_send_reply(req); } @@ -240,7 +240,7 @@ void reply_ioctl(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->ioctl(req, io); + req->async.status = req->tcon->ntvfs_ops->ioctl(req, io); REQ_ASYNC_TAIL; } @@ -259,7 +259,7 @@ void reply_chkpth(struct request_context *req) req->async.send_fn = reply_simple_send; - req->async.status = req->conn->ntvfs_ops->chkpath(req, io); + req->async.status = req->tcon->ntvfs_ops->chkpath(req, io); REQ_ASYNC_TAIL; } @@ -308,7 +308,7 @@ void reply_getatr(struct request_context *req) req->async.private = st; /* call backend */ - req->async.status = req->conn->ntvfs_ops->qpathinfo(req, st); + req->async.status = req->tcon->ntvfs_ops->qpathinfo(req, st); REQ_ASYNC_TAIL; } @@ -339,7 +339,7 @@ void reply_setatr(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->setpathinfo(req, st); + req->async.status = req->tcon->ntvfs_ops->setpathinfo(req, st); REQ_ASYNC_TAIL; } @@ -383,7 +383,7 @@ void reply_dskattr(struct request_context *req) req->async.private = fs; /* call backend */ - req->async.status = req->conn->ntvfs_ops->fsinfo(req, fs); + req->async.status = req->tcon->ntvfs_ops->fsinfo(req, fs); REQ_ASYNC_TAIL; } @@ -437,7 +437,7 @@ void reply_open(struct request_context *req) req->async.private = oi; /* call backend */ - req->async.status = req->conn->ntvfs_ops->open(req, oi); + req->async.status = req->tcon->ntvfs_ops->open(req, oi); REQ_ASYNC_TAIL; } @@ -512,7 +512,7 @@ void reply_open_and_X(struct request_context *req) req->async.private = oi; /* call the backend */ - req->async.status = req->conn->ntvfs_ops->open(req, oi); + req->async.status = req->tcon->ntvfs_ops->open(req, oi); REQ_ASYNC_TAIL; } @@ -562,7 +562,7 @@ void reply_mknew(struct request_context *req) req->async.private = oi; /* call the backend */ - req->async.status = req->conn->ntvfs_ops->open(req, oi); + req->async.status = req->tcon->ntvfs_ops->open(req, oi); REQ_ASYNC_TAIL; } @@ -615,7 +615,7 @@ void reply_ctemp(struct request_context *req) req->async.private = oi; /* call the backend */ - req->async.status = req->conn->ntvfs_ops->open(req, oi); + req->async.status = req->tcon->ntvfs_ops->open(req, oi); REQ_ASYNC_TAIL; } @@ -639,7 +639,7 @@ void reply_unlink(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->unlink(req, unl); + req->async.status = req->tcon->ntvfs_ops->unlink(req, unl); REQ_ASYNC_TAIL; } @@ -688,7 +688,7 @@ void reply_readbraw(struct request_context *req) io.readbraw.out.data = req->out.buffer + NBT_HDR_SIZE; /* call the backend */ - status = req->conn->ntvfs_ops->read(req, &io); + status = req->tcon->ntvfs_ops->read(req, &io); if (!NT_STATUS_IS_OK(status)) { goto failed; @@ -762,7 +762,7 @@ void reply_lockread(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->read(req, io); + req->async.status = req->tcon->ntvfs_ops->read(req, io); REQ_ASYNC_TAIL; } @@ -820,7 +820,7 @@ void reply_read(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->read(req, io); + req->async.status = req->tcon->ntvfs_ops->read(req, io); REQ_ASYNC_TAIL; } @@ -891,7 +891,7 @@ void reply_read_and_X(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->read(req, io); + req->async.status = req->tcon->ntvfs_ops->read(req, io); REQ_ASYNC_TAIL; } @@ -957,7 +957,7 @@ void reply_writeunlock(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->write(req, io); + req->async.status = req->tcon->ntvfs_ops->write(req, io); REQ_ASYNC_TAIL; } @@ -1014,7 +1014,7 @@ void reply_write(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->write(req, io); + req->async.status = req->tcon->ntvfs_ops->write(req, io); REQ_ASYNC_TAIL; } @@ -1080,7 +1080,7 @@ void reply_write_and_X(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->write(req, io); + req->async.status = req->tcon->ntvfs_ops->write(req, io); REQ_ASYNC_TAIL; } @@ -1121,7 +1121,7 @@ void reply_lseek(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->seek(req, io); + req->async.status = req->tcon->ntvfs_ops->seek(req, io); REQ_ASYNC_TAIL; } @@ -1142,7 +1142,7 @@ void reply_flush(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->flush(req, io); + req->async.status = req->tcon->ntvfs_ops->flush(req, io); REQ_ASYNC_TAIL; } @@ -1157,13 +1157,13 @@ void reply_exit(struct request_context *req) req->async.send_fn = reply_simple_send; - if (!req->conn) { + if (!req->tcon) { req_reply_error(req, NT_STATUS_INVALID_HANDLE); return; } /* call backend */ - req->async.status = req->conn->ntvfs_ops->exit(req); + req->async.status = req->tcon->ntvfs_ops->exit(req); REQ_ASYNC_TAIL; } @@ -1189,7 +1189,7 @@ void reply_close(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->close(req, io); + req->async.status = req->tcon->ntvfs_ops->close(req, io); REQ_ASYNC_TAIL; } @@ -1244,7 +1244,7 @@ void reply_writeclose(struct request_context *req) req->async.private = io; /* call backend */ - req->async.status = req->conn->ntvfs_ops->write(req, io); + req->async.status = req->tcon->ntvfs_ops->write(req, io); REQ_ASYNC_TAIL; } @@ -1268,7 +1268,7 @@ void reply_lock(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->lock(req, lck); + req->async.status = req->tcon->ntvfs_ops->lock(req, lck); REQ_ASYNC_TAIL; } @@ -1293,7 +1293,7 @@ void reply_unlock(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->lock(req, lck); + req->async.status = req->tcon->ntvfs_ops->lock(req, lck); REQ_ASYNC_TAIL; } @@ -1306,7 +1306,7 @@ void reply_tdis(struct request_context *req) { REQ_CHECK_WCT(req, 0); - close_cnum(req->conn); + close_cnum(req->tcon); /* construct reply */ req_setup_reply(req, 0, 0); @@ -1386,7 +1386,7 @@ void reply_printopen(struct request_context *req) req->async.private = oi; /* call backend */ - req->async.status = req->conn->ntvfs_ops->open(req, oi); + req->async.status = req->tcon->ntvfs_ops->open(req, oi); REQ_ASYNC_TAIL; } @@ -1408,7 +1408,7 @@ void reply_printclose(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->close(req, io); + req->async.status = req->tcon->ntvfs_ops->close(req, io); REQ_ASYNC_TAIL; } @@ -1477,7 +1477,7 @@ void reply_printqueue(struct request_context *req) req->async.private = lpq; /* call backend */ - req->async.status = req->conn->ntvfs_ops->lpq(req, lpq); + req->async.status = req->tcon->ntvfs_ops->lpq(req, lpq); REQ_ASYNC_TAIL; } @@ -1514,7 +1514,7 @@ void reply_printwrite(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->write(req, io); + req->async.status = req->tcon->ntvfs_ops->write(req, io); REQ_ASYNC_TAIL; } @@ -1537,7 +1537,7 @@ void reply_mkdir(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->mkdir(req, io); + req->async.status = req->tcon->ntvfs_ops->mkdir(req, io); REQ_ASYNC_TAIL; } @@ -1559,7 +1559,7 @@ void reply_rmdir(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->rmdir(req, io); + req->async.status = req->tcon->ntvfs_ops->rmdir(req, io); REQ_ASYNC_TAIL; } @@ -1592,7 +1592,7 @@ void reply_mv(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->rename(req, io); + req->async.status = req->tcon->ntvfs_ops->rename(req, io); REQ_ASYNC_TAIL; } @@ -1627,7 +1627,7 @@ void reply_ntrename(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->rename(req, io); + req->async.status = req->tcon->ntvfs_ops->rename(req, io); REQ_ASYNC_TAIL; } @@ -1678,7 +1678,7 @@ void reply_copy(struct request_context *req) req->async.private = cp; /* call backend */ - req->async.status = req->conn->ntvfs_ops->copy(req, cp); + req->async.status = req->tcon->ntvfs_ops->copy(req, cp); REQ_ASYNC_TAIL; } @@ -1778,7 +1778,7 @@ void reply_lockingX(struct request_context *req) req->async.private = lck; /* call backend */ - req->async.status = req->conn->ntvfs_ops->lock(req, lck); + req->async.status = req->tcon->ntvfs_ops->lock(req, lck); REQ_ASYNC_TAIL; } @@ -1813,7 +1813,7 @@ void reply_setattrE(struct request_context *req) req->async.send_fn = reply_simple_send; /* call backend */ - req->async.status = req->conn->ntvfs_ops->setfileinfo(req, info); + req->async.status = req->tcon->ntvfs_ops->setfileinfo(req, info); REQ_ASYNC_TAIL; } @@ -1880,7 +1880,7 @@ void reply_getattrE(struct request_context *req) req->async.private = info; /* call backend */ - req->async.status = req->conn->ntvfs_ops->qfileinfo(req, info); + req->async.status = req->tcon->ntvfs_ops->qfileinfo(req, info); REQ_ASYNC_TAIL; } @@ -2138,7 +2138,7 @@ void reply_findclose(struct request_context *req) io.findclose.in.handle = SVAL(req->in.vwv, VWV(0)); /* call backend */ - status = req->conn->ntvfs_ops->search_close(req, &io); + status = req->tcon->ntvfs_ops->search_close(req, &io); if (!NT_STATUS_IS_OK(status)) { req_reply_error(req, status); @@ -2236,7 +2236,7 @@ void reply_ntcreate_and_X(struct request_context *req) req->async.private = io; /* call the backend */ - req->async.status = req->conn->ntvfs_ops->open(req, io); + req->async.status = req->tcon->ntvfs_ops->open(req, io); REQ_ASYNC_TAIL; } diff --git a/source4/smb_server/search.c b/source4/smb_server/search.c index 63ae521783..40ea53c235 100644 --- a/source4/smb_server/search.c +++ b/source4/smb_server/search.c @@ -153,7 +153,7 @@ void reply_search(struct request_context *req) sn->search_next.in.max_count = SVAL(req->in.vwv, VWV(0)); /* call backend */ - req->async.status = req->conn->ntvfs_ops->search_next(req, + req->async.status = req->tcon->ntvfs_ops->search_next(req, sn, &state, find_callback); SSVAL(req->out.vwv, VWV(0), sn->search_next.out.count); } else { @@ -164,7 +164,7 @@ void reply_search(struct request_context *req) sf->search_first.in.max_count = SVAL(req->in.vwv, VWV(0)); /* call backend */ - req->async.status = req->conn->ntvfs_ops->search_first(req, + req->async.status = req->tcon->ntvfs_ops->search_first(req, sf, &state, find_callback); SSVAL(req->out.vwv, VWV(0), sf->search_first.out.count); } @@ -222,7 +222,7 @@ void reply_fclose(struct request_context *req) req->async.private = sn; /* call backend */ - req->async.status = req->conn->ntvfs_ops->search_next(req, sn, + req->async.status = req->tcon->ntvfs_ops->search_next(req, sn, NULL, NULL); REQ_ASYNC_TAIL; diff --git a/source4/smb_server/service.c b/source4/smb_server/service.c index a7b1c33395..61cc8c718d 100644 --- a/source4/smb_server/service.c +++ b/source4/smb_server/service.c @@ -140,18 +140,18 @@ static NTSTATUS make_connection_snum(struct request_context *req, DATA_BLOB password, const char *dev) { - struct tcon_context *conn; + struct smbsrv_tcon *tcon; NTSTATUS status; - conn = conn_new(req->smb_ctx); - if (!conn) { + tcon = conn_new(req->smb_ctx); + if (!tcon) { DEBUG(0,("Couldn't find free connection.\n")); return NT_STATUS_INSUFFICIENT_RESOURCES; } - req->conn = conn; + req->tcon = tcon; - conn->service = snum; - conn->type = type; + tcon->service = snum; + tcon->type = type; /* * New code to check if there's a share security descripter @@ -160,42 +160,42 @@ static NTSTATUS make_connection_snum(struct request_context *req, * */ - if (!share_access_check(req, conn, snum, SA_RIGHT_FILE_WRITE_DATA)) { - if (!share_access_check(req, conn, snum, SA_RIGHT_FILE_READ_DATA)) { + if (!share_access_check(req, tcon, snum, SA_RIGHT_FILE_WRITE_DATA)) { + if (!share_access_check(req, tcon, snum, SA_RIGHT_FILE_READ_DATA)) { /* No access, read or write. */ DEBUG(0,( "make_connection: connection to %s denied due to security descriptor.\n", lp_servicename(snum))); - conn_free(req->smb_ctx, conn); + conn_free(req->smb_ctx, tcon); return NT_STATUS_ACCESS_DENIED; } else { - conn->read_only = True; + tcon->read_only = True; } } /* check number of connections */ - if (!claim_connection(conn, - lp_servicename(SNUM(conn)), - lp_max_connections(SNUM(conn)), + if (!claim_connection(tcon, + lp_servicename(SNUM(tcon)), + lp_max_connections(SNUM(tcon)), False,0)) { DEBUG(1,("too many connections - rejected\n")); - conn_free(req->smb_ctx, conn); + conn_free(req->smb_ctx, tcon); return NT_STATUS_INSUFFICIENT_RESOURCES; } /* init ntvfs function pointers */ status = ntvfs_init_connection(req); if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("ntvfs_init_connection failed for service %s\n", lp_servicename(SNUM(conn)))); - conn_free(req->smb_ctx, conn); + DEBUG(0, ("ntvfs_init_connection failed for service %s\n", lp_servicename(SNUM(tcon)))); + conn_free(req->smb_ctx, tcon); return status; } /* Invoke NTVFS connection hook */ - if (conn->ntvfs_ops->connect) { - status = conn->ntvfs_ops->connect(req, lp_servicename(snum)); + if (tcon->ntvfs_ops->connect) { + status = tcon->ntvfs_ops->connect(req, lp_servicename(snum)); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("make_connection: NTVFS make connection failed!\n")); - conn_free(req->smb_ctx, conn); + conn_free(req->smb_ctx, tcon); return status; } } @@ -256,17 +256,17 @@ static NTSTATUS make_connection(struct request_context *req, /**************************************************************************** close a cnum ****************************************************************************/ -void close_cnum(struct tcon_context *conn) +void close_cnum(struct smbsrv_tcon *tcon) { DEBUG(3,("%s closed connection to service %s\n", - conn->smb_ctx->socket.client_addr, lp_servicename(SNUM(conn)))); + tcon->smb_ctx->socket.client_addr, lp_servicename(SNUM(tcon)))); - yield_connection(conn, lp_servicename(SNUM(conn))); + yield_connection(tcon, lp_servicename(SNUM(tcon))); /* tell the ntvfs backend that we are disconnecting */ - conn->ntvfs_ops->disconnect(conn); + tcon->ntvfs_ops->disconnect(tcon); - conn_free(conn->smb_ctx, conn); + conn_free(tcon->smb_ctx, tcon); } @@ -294,7 +294,7 @@ NTSTATUS tcon_backend(struct request_context *req, union smb_tcon *con) } con->tcon.out.max_xmit = req->smb_ctx->negotiate.max_recv; - con->tcon.out.cnum = req->conn->cnum; + con->tcon.out.cnum = req->tcon->cnum; return status; } @@ -305,11 +305,11 @@ NTSTATUS tcon_backend(struct request_context *req, union smb_tcon *con) return status; } - con->tconx.out.cnum = req->conn->cnum; - con->tconx.out.dev_type = talloc_strdup(req->mem_ctx, req->conn->dev_type); - con->tconx.out.fs_type = talloc_strdup(req->mem_ctx, req->conn->fs_type); - con->tconx.out.options = SMB_SUPPORT_SEARCH_BITS | (lp_csc_policy(req->conn->service) << 2); - if (lp_msdfs_root(req->conn->service) && lp_host_msdfs()) { + con->tconx.out.cnum = req->tcon->cnum; + con->tconx.out.dev_type = talloc_strdup(req->mem_ctx, req->tcon->dev_type); + con->tconx.out.fs_type = talloc_strdup(req->mem_ctx, req->tcon->fs_type); + con->tconx.out.options = SMB_SUPPORT_SEARCH_BITS | (lp_csc_policy(req->tcon->service) << 2); + if (lp_msdfs_root(req->tcon->service) && lp_host_msdfs()) { con->tconx.out.options |= SMB_SHARE_IN_DFS; } diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 823757ff3b..6fdfdb6097 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -25,16 +25,16 @@ /* send an oplock break request to a client */ -BOOL req_send_oplock_break(struct tcon_context *conn, uint16_t fnum, uint8_t level) +BOOL req_send_oplock_break(struct smbsrv_tcon *tcon, uint16_t fnum, uint8_t level) { struct request_context *req; - req = init_smb_request(conn->smb_ctx); + req = init_smb_request(tcon->smb_ctx); req_setup_reply(req, 8, 0); SCVAL(req->out.hdr,HDR_COM,SMBlockingX); - SSVAL(req->out.hdr,HDR_TID,conn->cnum); + SSVAL(req->out.hdr,HDR_TID,tcon->cnum); SSVAL(req->out.hdr,HDR_PID,0xFFFF); SSVAL(req->out.hdr,HDR_UID,0); SSVAL(req->out.hdr,HDR_MID,0xFFFF); @@ -456,7 +456,7 @@ static void switch_message(int type, struct request_context *req) UID_FIELD_INVALID : SVAL(req->in.hdr,HDR_UID); - req->conn = conn_find(smb_ctx, SVAL(req->in.hdr,HDR_TID)); + req->tcon = conn_find(smb_ctx, SVAL(req->in.hdr,HDR_TID)); /* setup the user context for this request */ setup_user_context(req); @@ -475,7 +475,7 @@ static void switch_message(int type, struct request_context *req) } /* does this protocol need a valid tree connection? */ - if ((flags & AS_USER) && !req->conn) { + if ((flags & AS_USER) && !req->tcon) { req_reply_error(req, NT_STATUS_NETWORK_NAME_DELETED); return; } @@ -490,7 +490,7 @@ static void switch_message(int type, struct request_context *req) /* does this protocol need to be run as the connected user? */ #if HACK_REWRITE - if ((flags & AS_USER) && !change_to_user(req->conn,session_tag)) { + if ((flags & AS_USER) && !change_to_user(req->tcon,session_tag)) { if (!(flags & AS_GUEST)) { req_reply_error(req, NT_STATUS_ACCESS_DENIED); return; @@ -509,19 +509,19 @@ static void switch_message(int type, struct request_context *req) } /* does it need write permission? */ - if ((flags & NEED_WRITE) && !CAN_WRITE(req->conn)) { + if ((flags & NEED_WRITE) && !CAN_WRITE(req->tcon)) { req_reply_error(req, NT_STATUS_ACCESS_DENIED); return; } /* ipc services are limited */ - if (req->conn && req->conn->type == NTVFS_IPC && (flags & AS_USER) && !(flags & CAN_IPC)) { + if (req->tcon && req->tcon->type == NTVFS_IPC && (flags & AS_USER) && !(flags & CAN_IPC)) { req_reply_error(req, NT_STATUS_ACCESS_DENIED); return; } /* load service specific parameters */ - if (req->conn && !set_current_service(req->conn,(flags & AS_USER)?True:False)) { + if (req->tcon && !set_current_service(req->tcon,(flags & AS_USER)?True:False)) { req_reply_error(req, NT_STATUS_ACCESS_DENIED); return; } diff --git a/source4/smb_server/trans2.c b/source4/smb_server/trans2.c index 922d225a8b..738247b713 100644 --- a/source4/smb_server/trans2.c +++ b/source4/smb_server/trans2.c @@ -215,7 +215,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_ALLOCATION: fsinfo.allocation.level = RAW_QFS_ALLOCATION; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -233,7 +233,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_VOLUME: fsinfo.volume.level = RAW_QFS_VOLUME; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -253,7 +253,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_VOLUME_INFORMATION: fsinfo.volume_info.level = RAW_QFS_VOLUME_INFO; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -272,7 +272,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_SIZE_INFORMATION: fsinfo.size_info.level = RAW_QFS_SIZE_INFO; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -290,7 +290,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_DEVICE_INFORMATION: fsinfo.device_info.level = RAW_QFS_DEVICE_INFO; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -304,7 +304,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_ATTRIBUTE_INFORMATION: fsinfo.attribute_info.level = RAW_QFS_ATTRIBUTE_INFO; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -325,7 +325,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_QUOTA_INFORMATION: fsinfo.quota_information.level = RAW_QFS_QUOTA_INFORMATION; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -345,7 +345,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_FULL_SIZE_INFORMATION: fsinfo.full_size_information.level = RAW_QFS_FULL_SIZE_INFORMATION; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -363,7 +363,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t case SMB_QFS_OBJECTID_INFORMATION: fsinfo.objectid_information.level = RAW_QFS_OBJECTID_INFORMATION; - status = req->conn->ntvfs_ops->fsinfo(req, &fsinfo); + status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -639,7 +639,7 @@ static NTSTATUS trans2_qpathinfo(struct request_context *req, struct smb_trans2 } /* call the backend */ - status = req->conn->ntvfs_ops->qpathinfo(req, &st); + status = req->tcon->ntvfs_ops->qpathinfo(req, &st); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -675,7 +675,7 @@ static NTSTATUS trans2_qfileinfo(struct request_context *req, struct smb_trans2 } /* call the backend */ - status = req->conn->ntvfs_ops->qfileinfo(req, &st); + status = req->tcon->ntvfs_ops->qfileinfo(req, &st); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -811,7 +811,7 @@ static NTSTATUS trans2_setfileinfo(struct request_context *req, struct smb_trans return status; } - status = req->conn->ntvfs_ops->setfileinfo(req, &st); + status = req->tcon->ntvfs_ops->setfileinfo(req, &st); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -850,7 +850,7 @@ static NTSTATUS trans2_setpathinfo(struct request_context *req, struct smb_trans return status; } - status = req->conn->ntvfs_ops->setpathinfo(req, &st); + status = req->tcon->ntvfs_ops->setpathinfo(req, &st); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -1109,7 +1109,7 @@ static NTSTATUS trans2_findfirst(struct request_context *req, struct smb_trans2 trans2_setup_reply(req, trans, 10, 0, 0); /* call the backend */ - status = req->conn->ntvfs_ops->search_first(req, &search, &state, find_callback); + status = req->tcon->ntvfs_ops->search_first(req, &search, &state, find_callback); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -1169,7 +1169,7 @@ static NTSTATUS trans2_findnext(struct request_context *req, struct smb_trans2 * trans2_setup_reply(req, trans, 8, 0, 0); /* call the backend */ - status = req->conn->ntvfs_ops->search_next(req, &search, &state, find_callback); + status = req->tcon->ntvfs_ops->search_next(req, &search, &state, find_callback); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -1190,9 +1190,9 @@ static NTSTATUS trans2_findnext(struct request_context *req, struct smb_trans2 * */ static NTSTATUS trans2_backend(struct request_context *req, struct smb_trans2 *trans) { - if (req->conn->ntvfs_ops->trans2 != NULL) { + if (req->tcon->ntvfs_ops->trans2 != NULL) { /* direct trans2 pass thru */ - return req->conn->ntvfs_ops->trans2(req, trans); + return req->tcon->ntvfs_ops->trans2(req, trans); } /* must have at least one setup word */ @@ -1228,10 +1228,10 @@ static NTSTATUS trans2_backend(struct request_context *req, struct smb_trans2 *t */ static NTSTATUS trans_backend(struct request_context *req, struct smb_trans2 *trans) { - if (!req->conn->ntvfs_ops->trans) { + if (!req->tcon->ntvfs_ops->trans) { return NT_STATUS_NOT_IMPLEMENTED; } - return req->conn->ntvfs_ops->trans(req, trans); + return req->tcon->ntvfs_ops->trans(req, trans); } -- cgit