diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-06-28 08:27:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:48 -0500 |
commit | 4ddb2d347d86818a13d71d0eb2f0f8983c2cc41f (patch) | |
tree | ead976b86dc26d251caa010a307e03abba8e7da3 | |
parent | 0aba9a2e3fc222625f31cc6fd12f1c7c7021c660 (diff) | |
download | samba-4ddb2d347d86818a13d71d0eb2f0f8983c2cc41f.tar.gz samba-4ddb2d347d86818a13d71d0eb2f0f8983c2cc41f.tar.bz2 samba-4ddb2d347d86818a13d71d0eb2f0f8983c2cc41f.zip |
r1279: rename struct tcon_context to smbsrv_tcon
metze
(This used to be commit 99473fab4b1ff87a795f3c08f4c521d9beb504c0)
-rw-r--r-- | source4/include/context.h | 8 | ||||
-rw-r--r-- | source4/lib/substitute.c | 6 | ||||
-rw-r--r-- | source4/ntvfs/cifs/vfs_cifs.c | 90 | ||||
-rw-r--r-- | source4/ntvfs/ipc/vfs_ipc.c | 24 | ||||
-rw-r--r-- | source4/ntvfs/nbench/vfs_nbench.c | 80 | ||||
-rw-r--r-- | source4/ntvfs/ntvfs.h | 4 | ||||
-rw-r--r-- | source4/ntvfs/ntvfs_base.c | 10 | ||||
-rw-r--r-- | source4/ntvfs/ntvfs_generic.c | 10 | ||||
-rw-r--r-- | source4/ntvfs/print/vfs_print.c | 4 | ||||
-rw-r--r-- | source4/ntvfs/simple/svfs_util.c | 2 | ||||
-rw-r--r-- | source4/ntvfs/simple/vfs_simple.c | 50 | ||||
-rw-r--r-- | source4/smb_server/conn.c | 76 | ||||
-rw-r--r-- | source4/smb_server/connection.c | 26 | ||||
-rw-r--r-- | source4/smb_server/nttrans.c | 2 | ||||
-rw-r--r-- | source4/smb_server/reply.c | 82 | ||||
-rw-r--r-- | source4/smb_server/search.c | 6 | ||||
-rw-r--r-- | source4/smb_server/service.c | 60 | ||||
-rw-r--r-- | source4/smb_server/smb_server.c | 18 | ||||
-rw-r--r-- | source4/smb_server/trans2.c | 38 | ||||
-rw-r--r-- | source4/smbd/rewrite.c | 2 |
20 files changed, 299 insertions, 299 deletions
diff --git a/source4/include/context.h b/source4/include/context.h index 5070228440..2df68b96b9 100644 --- a/source4/include/context.h +++ b/source4/include/context.h @@ -49,8 +49,8 @@ enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC}; include recursion */ struct ntvfs_ops; -struct tcon_context { - struct tcon_context *next, *prev; +struct smbsrv_tcon { + struct smbsrv_tcon *next, *prev; /* the server context that this was created on */ struct smbsrv_context *smb_ctx; @@ -84,7 +84,7 @@ struct request_context { struct smbsrv_context *smb_ctx; /* conn is only set for operations that have a valid TID */ - struct tcon_context *conn; + struct smbsrv_tcon *tcon; /* the user context is derived from the vuid plus smb.conf options */ struct smbsrv_user *user_ctx; @@ -191,7 +191,7 @@ struct files_context { /* the context associated with open tree connects on a smb socket */ struct tree_context { - struct tcon_context *connections; + struct smbsrv_tcon *tcons; /* number of open connections */ struct bitmap *bmap; diff --git a/source4/lib/substitute.c b/source4/lib/substitute.c index 4e4f0bc040..7d3997ecd7 100644 --- a/source4/lib/substitute.c +++ b/source4/lib/substitute.c @@ -165,16 +165,16 @@ char *alloc_sub_advanced(int snum, const char *user, Do some standard substitutions in a string. ****************************************************************************/ -void standard_sub_conn(struct tcon_context *conn, char *str, size_t len) +void standard_sub_tcon(struct smbsrv_tcon *tcon, char *str, size_t len) { } -char *talloc_sub_conn(TALLOC_CTX *mem_ctx, struct tcon_context *conn, char *str) +char *talloc_sub_tcon(TALLOC_CTX *mem_ctx, struct smbsrv_tcon *tcon, char *str) { return talloc_strdup(mem_ctx, str); } -char *alloc_sub_conn(struct tcon_context *conn, char *str) +char *alloc_sub_tcon(struct smbsrv_tcon *tcon, char *str) { return strdup(str); } diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 0c00beecbb..6af8cd1878 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -31,7 +31,7 @@ struct cvfs_private { struct cli_tree *tree; struct cli_transport *transport; - struct tcon_context *conn; + struct smbsrv_tcon *tcon; const char *map_calls; }; @@ -51,8 +51,8 @@ struct async_info { static void idle_func(struct cli_transport *transport, void *p_private) { struct cvfs_private *private = p_private; - if (socket_pending(private->conn->smb_ctx->socket.fd)) { - smbd_process_async(private->conn->smb_ctx); + if (socket_pending(private->tcon->smb_ctx->socket.fd)) { + smbd_process_async(private->tcon->smb_ctx); } } @@ -65,7 +65,7 @@ static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16 struct cvfs_private *private = p_private; DEBUG(5,("vfs_cifs: sending oplock break level %d for fnum %d\n", level, fnum)); - return req_send_oplock_break(private->conn, fnum, level); + return req_send_oplock_break(private->tcon, fnum, level); } /* @@ -74,13 +74,13 @@ static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16 static void cifs_socket_handler(struct event_context *ev, struct fd_event *fde, time_t t, uint16_t flags) { struct cvfs_private *private = fde->private; - struct tcon_context *conn = private->conn; + struct smbsrv_tcon *tcon = private->tcon; DEBUG(5,("cifs_socket_handler event on fd %d\n", fde->fd)); if (!cli_request_receive_next(private->transport)) { /* the connection to our server is dead */ - close_cnum(conn); + close_cnum(tcon); } } @@ -89,7 +89,7 @@ static void cifs_socket_handler(struct event_context *ev, struct fd_event *fde, */ static NTSTATUS cvfs_connect(struct request_context *req, const char *sharename) { - struct tcon_context *conn = req->conn; + struct smbsrv_tcon *tcon = req->tcon; NTSTATUS status; struct cvfs_private *private; const char *map_calls; @@ -100,11 +100,11 @@ static NTSTATUS cvfs_connect(struct request_context *req, const char *sharename) * For now we use parametric options, type cifs. * Later we will use security=server and auth_server.c. */ - host = lp_parm_string(req->conn->service, "cifs", "server"); - user = lp_parm_string(req->conn->service, "cifs", "user"); - pass = lp_parm_string(req->conn->service, "cifs", "password"); - domain = lp_parm_string(req->conn->service, "cifs", "domain"); - remote_share = lp_parm_string(req->conn->service, "cifs", "share"); + host = lp_parm_string(req->tcon->service, "cifs", "server"); + user = lp_parm_string(req->tcon->service, "cifs", "user"); + pass = lp_parm_string(req->tcon->service, "cifs", "password"); + domain = lp_parm_string(req->tcon->service, "cifs", "domain"); + remote_share = lp_parm_string(req->tcon->service, "cifs", "share"); if (!remote_share) { remote_share = sharename; } @@ -114,13 +114,13 @@ static NTSTATUS cvfs_connect(struct request_context *req, const char *sharename) return NT_STATUS_INVALID_PARAMETER; } - private = talloc(req->conn->mem_ctx, sizeof(struct cvfs_private)); + private = talloc(req->tcon->mem_ctx, sizeof(struct cvfs_private)); if (!private) { return NT_STATUS_NO_MEMORY; } ZERO_STRUCTP(private); - req->conn->ntvfs_private = (void *)private; + req->tcon->ntvfs_private = (void *)private; status = cli_tree_full_connection(&private->tree, "vfs_cifs", @@ -135,26 +135,26 @@ static NTSTATUS cvfs_connect(struct request_context *req, const char *sharename) private->transport = private->tree->session->transport; private->tree->session->pid = SVAL(req->in.hdr, HDR_PID); - private->conn = req->conn; + private->tcon = req->tcon; - conn->fs_type = talloc_strdup(conn->mem_ctx, "NTFS"); - conn->dev_type = talloc_strdup(conn->mem_ctx, "A:"); + tcon->fs_type = talloc_strdup(tcon->mem_ctx, "NTFS"); + tcon->dev_type = talloc_strdup(tcon->mem_ctx, "A:"); - map_calls = lp_parm_string(req->conn->service, "cifs", "map calls"); + map_calls = lp_parm_string(req->tcon->service, "cifs", "map calls"); if (map_calls) { - private->map_calls = talloc_strdup(conn->mem_ctx, map_calls); + private->map_calls = talloc_strdup(tcon->mem_ctx, map_calls); } /* if we are mapping trans2, then we need to give a trans2 pointer in the operations structure */ if (private->map_calls && in_list("trans2", private->map_calls, True)) { - struct ntvfs_ops *ops = talloc_memdup(conn->mem_ctx,conn->ntvfs_ops,sizeof(*ops)); + struct ntvfs_ops *ops = talloc_memdup(tcon->mem_ctx,tcon->ntvfs_ops,sizeof(*ops)); static NTSTATUS cvfs_trans2(struct request_context *,struct smb_trans2 *); if (!ops) { return NT_STATUS_NO_MEMORY; } ops->trans2 = cvfs_trans2; - conn->ntvfs_ops = ops; + tcon->ntvfs_ops = ops; } /* we need to tell the event loop that we wish to receive read events @@ -164,7 +164,7 @@ static NTSTATUS cvfs_connect(struct request_context *req, const char *sharename) fde.private = private; fde.handler = cifs_socket_handler; - event_add_fd(conn->smb_ctx->events, &fde); + event_add_fd(tcon->smb_ctx->events, &fde); /* we need to receive oplock break requests from the server */ cli_oplock_handler(private->transport, oplock_handler, private); @@ -176,11 +176,11 @@ static NTSTATUS cvfs_connect(struct request_context *req, const char *sharename) /* disconnect from a share */ -static NTSTATUS cvfs_disconnect(struct tcon_context *conn) +static NTSTATUS cvfs_disconnect(struct smbsrv_tcon *tcon) { - struct cvfs_private *private = conn->ntvfs_private; + struct cvfs_private *private = tcon->ntvfs_private; - event_remove_fd_all(conn->smb_ctx->events, private->transport->socket->fd); + event_remove_fd_all(tcon->smb_ctx->events, private->transport->socket->fd); smb_tree_disconnect(private->tree); cli_tree_close(private->tree); @@ -225,7 +225,7 @@ static void async_simple(struct cli_request *c_req) */ static NTSTATUS cvfs_unlink(struct request_context *req, struct smb_unlink *unl) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; /* see if the front end will allow us to perform this @@ -255,7 +255,7 @@ static void async_ioctl(struct cli_request *c_req) */ static NTSTATUS cvfs_ioctl(struct request_context *req, union smb_ioctl *io) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; /* see if the front end will allow us to perform this @@ -274,7 +274,7 @@ static NTSTATUS cvfs_ioctl(struct request_context *req, union smb_ioctl *io) */ static NTSTATUS cvfs_chkpath(struct request_context *req, struct smb_chkpath *cp) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -302,7 +302,7 @@ static void async_qpathinfo(struct cli_request *c_req) */ static NTSTATUS cvfs_qpathinfo(struct request_context *req, union smb_fileinfo *info) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -330,7 +330,7 @@ static void async_qfileinfo(struct cli_request *c_req) */ static NTSTATUS cvfs_qfileinfo(struct request_context *req, union smb_fileinfo *info) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -348,7 +348,7 @@ static NTSTATUS cvfs_qfileinfo(struct request_context *req, union smb_fileinfo * */ static NTSTATUS cvfs_setpathinfo(struct request_context *req, union smb_setfileinfo *st) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -377,7 +377,7 @@ static void async_open(struct cli_request *c_req) */ static NTSTATUS cvfs_open(struct request_context *req, union smb_open *io) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (private->map_calls && in_list("open", private->map_calls, True) && @@ -399,7 +399,7 @@ static NTSTATUS cvfs_open(struct request_context *req, union smb_open *io) */ static NTSTATUS cvfs_mkdir(struct request_context *req, union smb_mkdir *md) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -416,7 +416,7 @@ static NTSTATUS cvfs_mkdir(struct request_context *req, union smb_mkdir *md) */ static NTSTATUS cvfs_rmdir(struct request_context *req, struct smb_rmdir *rd) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -432,7 +432,7 @@ static NTSTATUS cvfs_rmdir(struct request_context *req, struct smb_rmdir *rd) */ static NTSTATUS cvfs_rename(struct request_context *req, union smb_rename *ren) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -468,7 +468,7 @@ static void async_read(struct cli_request *c_req) */ static NTSTATUS cvfs_read(struct request_context *req, union smb_read *rd) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -496,7 +496,7 @@ static void async_write(struct cli_request *c_req) */ static NTSTATUS cvfs_write(struct request_context *req, union smb_write *wr) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -529,7 +529,7 @@ static NTSTATUS cvfs_flush(struct request_context *req, struct smb_flush *io) */ static NTSTATUS cvfs_close(struct request_context *req, union smb_close *io) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -554,7 +554,7 @@ static NTSTATUS cvfs_exit(struct request_context *req) */ static NTSTATUS cvfs_lock(struct request_context *req, union smb_lock *lck) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -571,7 +571,7 @@ static NTSTATUS cvfs_lock(struct request_context *req, union smb_lock *lck) static NTSTATUS cvfs_setfileinfo(struct request_context *req, union smb_setfileinfo *info) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -599,7 +599,7 @@ static void async_fsinfo(struct cli_request *c_req) */ static NTSTATUS cvfs_fsinfo(struct request_context *req, union smb_fsinfo *fs) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { @@ -626,7 +626,7 @@ static NTSTATUS cvfs_search_first(struct request_context *req, union smb_search_ void *search_private, BOOL (*callback)(void *, union smb_search_data *)) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; return smb_raw_search_first(private->tree, req->mem_ctx, io, search_private, callback); } @@ -636,7 +636,7 @@ static NTSTATUS cvfs_search_next(struct request_context *req, union smb_search_n void *search_private, BOOL (*callback)(void *, union smb_search_data *)) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; return smb_raw_search_next(private->tree, req->mem_ctx, io, search_private, callback); } @@ -644,7 +644,7 @@ static NTSTATUS cvfs_search_next(struct request_context *req, union smb_search_n /* close a search */ static NTSTATUS cvfs_search_close(struct request_context *req, union smb_search_close *io) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; return smb_raw_search_close(private->tree, io); } @@ -663,7 +663,7 @@ static void async_trans2(struct cli_request *c_req) /* raw trans2 */ static NTSTATUS cvfs_trans2(struct request_context *req, struct smb_trans2 *trans2) { - struct cvfs_private *private = req->conn->ntvfs_private; + struct cvfs_private *private = req->tcon->ntvfs_private; struct cli_request *c_req; if (!req->async.send_fn) { diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 8cef711d69..b726dd6116 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -107,18 +107,18 @@ static struct pipe_state *pipe_state_find(struct ipc_private *private, uint16_t */ static NTSTATUS ipc_connect(struct request_context *req, const char *sharename) { - struct tcon_context *conn = req->conn; + struct smbsrv_tcon *tcon = req->tcon; struct ipc_private *private; - conn->fs_type = talloc_strdup(conn->mem_ctx, "IPC"); - conn->dev_type = talloc_strdup(conn->mem_ctx, "IPC"); + tcon->fs_type = talloc_strdup(tcon->mem_ctx, "IPC"); + tcon->dev_type = talloc_strdup(tcon->mem_ctx, "IPC"); /* prepare the private state for this connection */ - private = talloc(conn->mem_ctx, sizeof(struct ipc_private)); + private = talloc(tcon->mem_ctx, sizeof(struct ipc_private)); if (!private) { return NT_STATUS_NO_MEMORY; } - conn->ntvfs_private = (void *)private; + tcon->ntvfs_private = (void *)private; private->pipe_list = NULL; private->next_fnum = 1; @@ -130,7 +130,7 @@ static NTSTATUS ipc_connect(struct request_context *req, const char *sharename) /* disconnect from a share */ -static NTSTATUS ipc_disconnect(struct tcon_context *tcon) +static NTSTATUS ipc_disconnect(struct smbsrv_tcon *tcon) { struct ipc_private *private = tcon->ntvfs_private; @@ -196,7 +196,7 @@ static NTSTATUS ipc_open_generic(struct request_context *req, const char *fname, NTSTATUS status; struct dcesrv_ep_description ep_description; struct auth_session_info *session_info = NULL; - struct ipc_private *private = req->conn->ntvfs_private; + struct ipc_private *private = req->tcon->ntvfs_private; mem_ctx = talloc_init("ipc_open '%s'", fname); if (!mem_ctx) { @@ -374,7 +374,7 @@ static NTSTATUS ipc_copy(struct request_context *req, struct smb_copy *cp) */ static NTSTATUS ipc_read(struct request_context *req, union smb_read *rd) { - struct ipc_private *private = req->conn->ntvfs_private; + struct ipc_private *private = req->tcon->ntvfs_private; DATA_BLOB data; uint16_t fnum; struct pipe_state *p; @@ -426,7 +426,7 @@ static NTSTATUS ipc_read(struct request_context *req, union smb_read *rd) */ static NTSTATUS ipc_write(struct request_context *req, union smb_write *wr) { - struct ipc_private *private = req->conn->ntvfs_private; + struct ipc_private *private = req->tcon->ntvfs_private; DATA_BLOB data; uint16_t fnum; struct pipe_state *p; @@ -495,7 +495,7 @@ static NTSTATUS ipc_flush(struct request_context *req, struct smb_flush *io) */ static NTSTATUS ipc_close(struct request_context *req, union smb_close *io) { - struct ipc_private *private = req->conn->ntvfs_private; + struct ipc_private *private = req->tcon->ntvfs_private; struct pipe_state *p; if (io->generic.level != RAW_CLOSE_CLOSE) { @@ -595,7 +595,7 @@ NTSTATUS ipc_search_close(struct request_context *req, union smb_search_close *i static NTSTATUS ipc_dcerpc_cmd(struct request_context *req, struct smb_trans2 *trans) { struct pipe_state *p; - struct ipc_private *private = req->conn->ntvfs_private; + struct ipc_private *private = req->tcon->ntvfs_private; NTSTATUS status; /* the fnum is in setup[1] */ @@ -640,7 +640,7 @@ static NTSTATUS ipc_dcerpc_cmd(struct request_context *req, struct smb_trans2 *t static NTSTATUS ipc_set_nm_pipe_state(struct request_context *req, struct smb_trans2 *trans) { struct pipe_state *p; - struct ipc_private *private = req->conn->ntvfs_private; + struct ipc_private *private = req->tcon->ntvfs_private; /* the fnum is in setup[1] */ p = pipe_state_find(private, trans->in.setup[1]); diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c index acdeec455a..5e9fd430cc 100644 --- a/source4/ntvfs/nbench/vfs_nbench.c +++ b/source4/ntvfs/nbench/vfs_nbench.c @@ -59,17 +59,17 @@ static void nbench_log(struct nbench_private *private, Then we need to restore both of these after the call, as the next level could modify either of these */ -#define PASS_THRU(conn, op, args) do { \ - conn->ntvfs_private = private->passthru_private; \ - conn->ntvfs_ops = private->passthru_ops; \ +#define PASS_THRU(tcon, op, args) do { \ + tcon->ntvfs_private = private->passthru_private; \ + tcon->ntvfs_ops = private->passthru_ops; \ \ status = private->passthru_ops->op args; \ \ - private->passthru_private = conn->ntvfs_private; \ - private->passthru_ops = conn->ntvfs_ops; \ + private->passthru_private = tcon->ntvfs_private; \ + private->passthru_ops = tcon->ntvfs_ops; \ \ - conn->ntvfs_private = private; \ - conn->ntvfs_ops = private->nbench_ops; \ + tcon->ntvfs_private = private; \ + tcon->ntvfs_ops = private->nbench_ops; \ } while (0) /* @@ -82,7 +82,7 @@ static void nbench_log(struct nbench_private *private, #define PASS_THRU_REQ(req, op, args) do { \ void *send_fn_saved = req->async.send_fn; \ req->async.send_fn = NULL; \ - PASS_THRU(req->conn, op, args); \ + PASS_THRU(req->tcon, op, args); \ req->async.send_fn = send_fn_saved; \ } while (0) @@ -97,7 +97,7 @@ static NTSTATUS nbench_connect(struct request_context *req, const char *sharenam NTSTATUS status; char *logname = NULL; - private = talloc_p(req->conn->mem_ctx, struct nbench_private); + private = talloc_p(req->tcon->mem_ctx, struct nbench_private); if (!private) { return NT_STATUS_NO_MEMORY; } @@ -111,10 +111,10 @@ static NTSTATUS nbench_connect(struct request_context *req, const char *sharenam return NT_STATUS_UNSUCCESSFUL; } - passthru = lp_parm_string(req->conn->service, "nbench", "passthru"); + passthru = lp_parm_string(req->tcon->service, "nbench", "passthru"); private->passthru_private = NULL; - private->nbench_ops = req->conn->ntvfs_ops; + private->nbench_ops = req->tcon->ntvfs_ops; private->passthru_ops = ntvfs_backend_byname(passthru, NTVFS_DISK); if (!private->passthru_ops) { @@ -122,7 +122,7 @@ static NTSTATUS nbench_connect(struct request_context *req, const char *sharenam return NT_STATUS_UNSUCCESSFUL; } - PASS_THRU(req->conn, connect, (req, sharename)); + PASS_THRU(req->tcon, connect, (req, sharename)); return status; } @@ -130,12 +130,12 @@ static NTSTATUS nbench_connect(struct request_context *req, const char *sharenam /* disconnect from a share */ -static NTSTATUS nbench_disconnect(struct tcon_context *conn) +static NTSTATUS nbench_disconnect(struct smbsrv_tcon *tcon) { - struct nbench_private *private = conn->ntvfs_private; + struct nbench_private *private = tcon->ntvfs_private; NTSTATUS status; - PASS_THRU(conn, disconnect, (conn)); + PASS_THRU(tcon, disconnect, (tcon)); close(private->log_fd); @@ -148,7 +148,7 @@ static NTSTATUS nbench_disconnect(struct tcon_context *conn) */ static NTSTATUS nbench_unlink(struct request_context *req, struct smb_unlink *unl) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, unlink, (req, unl)); @@ -165,7 +165,7 @@ static NTSTATUS nbench_unlink(struct request_context *req, struct smb_unlink *un */ static NTSTATUS nbench_ioctl(struct request_context *req, union smb_ioctl *io) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, ioctl, (req, io)); @@ -180,7 +180,7 @@ static NTSTATUS nbench_ioctl(struct request_context *req, union smb_ioctl *io) */ static NTSTATUS nbench_chkpath(struct request_context *req, struct smb_chkpath *cp) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, chkpath, (req, cp)); @@ -197,7 +197,7 @@ static NTSTATUS nbench_chkpath(struct request_context *req, struct smb_chkpath * */ static NTSTATUS nbench_qpathinfo(struct request_context *req, union smb_fileinfo *info) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, qpathinfo, (req, info)); @@ -215,7 +215,7 @@ static NTSTATUS nbench_qpathinfo(struct request_context *req, union smb_fileinfo */ static NTSTATUS nbench_qfileinfo(struct request_context *req, union smb_fileinfo *info) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, qfileinfo, (req, info)); @@ -234,7 +234,7 @@ static NTSTATUS nbench_qfileinfo(struct request_context *req, union smb_fileinfo */ static NTSTATUS nbench_setpathinfo(struct request_context *req, union smb_setfileinfo *st) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, setpathinfo, (req, st)); @@ -252,7 +252,7 @@ static NTSTATUS nbench_setpathinfo(struct request_context *req, union smb_setfil */ static NTSTATUS nbench_open(struct request_context *req, union smb_open *io) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, open, (req, io)); @@ -281,7 +281,7 @@ static NTSTATUS nbench_open(struct request_context *req, union smb_open *io) */ static NTSTATUS nbench_mkdir(struct request_context *req, union smb_mkdir *md) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, mkdir, (req, md)); @@ -296,7 +296,7 @@ static NTSTATUS nbench_mkdir(struct request_context *req, union smb_mkdir *md) */ static NTSTATUS nbench_rmdir(struct request_context *req, struct smb_rmdir *rd) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, rmdir, (req, rd)); @@ -313,7 +313,7 @@ static NTSTATUS nbench_rmdir(struct request_context *req, struct smb_rmdir *rd) */ static NTSTATUS nbench_rename(struct request_context *req, union smb_rename *ren) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, rename, (req, ren)); @@ -340,7 +340,7 @@ static NTSTATUS nbench_rename(struct request_context *req, union smb_rename *ren */ static NTSTATUS nbench_copy(struct request_context *req, struct smb_copy *cp) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, copy, (req, cp)); @@ -355,7 +355,7 @@ static NTSTATUS nbench_copy(struct request_context *req, struct smb_copy *cp) */ static NTSTATUS nbench_read(struct request_context *req, union smb_read *rd) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, read, (req, rd)); @@ -383,7 +383,7 @@ static NTSTATUS nbench_read(struct request_context *req, union smb_read *rd) */ static NTSTATUS nbench_write(struct request_context *req, union smb_write *wr) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, write, (req, wr)); @@ -421,7 +421,7 @@ static NTSTATUS nbench_write(struct request_context *req, union smb_write *wr) */ static NTSTATUS nbench_seek(struct request_context *req, struct smb_seek *io) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, seek, (req, io)); @@ -436,7 +436,7 @@ static NTSTATUS nbench_seek(struct request_context *req, struct smb_seek *io) */ static NTSTATUS nbench_flush(struct request_context *req, struct smb_flush *io) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, flush, (req, io)); @@ -453,7 +453,7 @@ static NTSTATUS nbench_flush(struct request_context *req, struct smb_flush *io) */ static NTSTATUS nbench_close(struct request_context *req, union smb_close *io) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, close, (req, io)); @@ -479,7 +479,7 @@ static NTSTATUS nbench_close(struct request_context *req, union smb_close *io) */ static NTSTATUS nbench_exit(struct request_context *req) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, exit, (req)); @@ -492,7 +492,7 @@ static NTSTATUS nbench_exit(struct request_context *req) */ static NTSTATUS nbench_lock(struct request_context *req, union smb_lock *lck) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, lock, (req, lck)); @@ -525,7 +525,7 @@ static NTSTATUS nbench_lock(struct request_context *req, union smb_lock *lck) static NTSTATUS nbench_setfileinfo(struct request_context *req, union smb_setfileinfo *info) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, setfileinfo, (req, info)); @@ -544,7 +544,7 @@ static NTSTATUS nbench_setfileinfo(struct request_context *req, */ static NTSTATUS nbench_fsinfo(struct request_context *req, union smb_fsinfo *fs) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, fsinfo, (req, fs)); @@ -561,7 +561,7 @@ static NTSTATUS nbench_fsinfo(struct request_context *req, union smb_fsinfo *fs) */ static NTSTATUS nbench_lpq(struct request_context *req, union smb_lpq *lpq) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, lpq, (req, lpq)); @@ -578,7 +578,7 @@ static NTSTATUS nbench_search_first(struct request_context *req, union smb_searc void *search_private, BOOL (*callback)(void *, union smb_search_data *)) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, search_first, (req, io, search_private, callback)); @@ -606,7 +606,7 @@ static NTSTATUS nbench_search_next(struct request_context *req, union smb_search void *search_private, BOOL (*callback)(void *, union smb_search_data *)) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, search_next, (req, io, search_private, callback)); @@ -619,7 +619,7 @@ static NTSTATUS nbench_search_next(struct request_context *req, union smb_search /* close a search */ static NTSTATUS nbench_search_close(struct request_context *req, union smb_search_close *io) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, search_close, (req, io)); @@ -632,7 +632,7 @@ static NTSTATUS nbench_search_close(struct request_context *req, union smb_searc /* SMBtrans - not used on file shares */ static NTSTATUS nbench_trans(struct request_context *req, struct smb_trans2 *trans2) { - struct nbench_private *private = req->conn->ntvfs_private; + struct nbench_private *private = req->tcon->ntvfs_private; NTSTATUS status; PASS_THRU_REQ(req, trans, (req,trans2)); diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index b03ab218c6..dd245b09ce 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -31,7 +31,7 @@ struct ntvfs_ops { /* initial setup */ NTSTATUS (*connect)(struct request_context *req, const char *sharename); - NTSTATUS (*disconnect)(struct tcon_context *conn); + NTSTATUS (*disconnect)(struct smbsrv_tcon *tcon); /* path operations */ NTSTATUS (*unlink)(struct request_context *req, struct smb_unlink *unl); @@ -82,6 +82,6 @@ struct ntvfs_critical_sizes { int interface_version; int sizeof_ntvfs_ops; int sizeof_SMB_OFF_T; - int sizeof_tcon_context; + int sizeof_smbsrv_tcon; int sizeof_request_context; }; diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 7ed8c738b6..bb751bae01 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -102,7 +102,7 @@ const struct ntvfs_critical_sizes *ntvfs_interface_version(void) NTVFS_INTERFACE_VERSION, sizeof(struct ntvfs_ops), sizeof(SMB_OFF_T), - sizeof(struct tcon_context), + sizeof(struct smbsrv_tcon), sizeof(struct request_context), }; @@ -135,12 +135,12 @@ BOOL ntvfs_init(void) */ NTSTATUS ntvfs_init_connection(struct request_context *req) { - const char *handler = lp_ntvfs_handler(req->conn->service); + const char *handler = lp_ntvfs_handler(req->tcon->service); - req->conn->ntvfs_ops = ntvfs_backend_byname(handler, req->conn->type); + req->tcon->ntvfs_ops = ntvfs_backend_byname(handler, req->tcon->type); - if (!req->conn->ntvfs_ops) { - DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handler, req->conn->type)); + if (!req->tcon->ntvfs_ops) { + DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handler, req->tcon->type)); return NT_STATUS_UNSUCCESSFUL; } diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index 0f5f0badcb..b2cf107b7d 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -145,7 +145,7 @@ NTSTATUS ntvfs_map_open(struct request_context *req, union smb_open *io) io2.generic.in.file_attr = io->openx.in.file_attrs; io2.generic.in.fname = io->openx.in.fname; - status = req->conn->ntvfs_ops->open(req, &io2); + status = req->tcon->ntvfs_ops->open(req, &io2); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -227,7 +227,7 @@ NTSTATUS ntvfs_map_open(struct request_context *req, union smb_open *io) DEBUG(9,("ntvfs_map_open(OPEN): mapped flags=0x%x to access_mask=0x%x and share_access=0x%x\n", io->open.in.flags, io2.generic.in.access_mask, io2.generic.in.share_access)); - status = req->conn->ntvfs_ops->open(req, &io2); + status = req->tcon->ntvfs_ops->open(req, &io2); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -261,7 +261,7 @@ NTSTATUS ntvfs_map_fsinfo(struct request_context *req, union smb_fsinfo *fs) /* ask the backend for the generic info */ fs2.generic.level = RAW_QFS_GENERIC; - status = req->conn->ntvfs_ops->fsinfo(req, &fs2); + status = req->tcon->ntvfs_ops->fsinfo(req, &fs2); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -603,7 +603,7 @@ NTSTATUS ntvfs_map_qfileinfo(struct request_context *req, union smb_fileinfo *in info2.generic.level = RAW_FILEINFO_GENERIC; info2.generic.in.fnum = info->generic.in.fnum; - status = req->conn->ntvfs_ops->qfileinfo(req, &info2); + status = req->tcon->ntvfs_ops->qfileinfo(req, &info2); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -626,7 +626,7 @@ NTSTATUS ntvfs_map_qpathinfo(struct request_context *req, union smb_fileinfo *in info2.generic.level = RAW_FILEINFO_GENERIC; info2.generic.in.fname = info->generic.in.fname; - status = req->conn->ntvfs_ops->qpathinfo(req, &info2); + status = req->tcon->ntvfs_ops->qpathinfo(req, &info2); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c index f56b906501..a2ac429458 100644 --- a/source4/ntvfs/print/vfs_print.c +++ b/source4/ntvfs/print/vfs_print.c @@ -37,7 +37,7 @@ static NTSTATUS print_connect(struct request_context *req, const char *sharename /* disconnect from a share */ -static NTSTATUS print_disconnect(struct tcon_context *conn) +static NTSTATUS print_disconnect(struct smbsrv_tcon *tcon) { return NT_STATUS_OK; } @@ -71,7 +71,7 @@ static NTSTATUS print_ioctl(struct request_context *req, union smb_ioctl *io) p = io->ioctl.out.blob.data; SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */); push_string(NULL, p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII); - push_string(NULL, p+18, lp_servicename(req->conn->service), 13, STR_TERMINATE|STR_ASCII); + push_string(NULL, p+18, lp_servicename(req->tcon->service), 13, STR_TERMINATE|STR_ASCII); return NT_STATUS_OK; } diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c index ec1c07dff7..0f0555ac18 100644 --- a/source4/ntvfs/simple/svfs_util.c +++ b/source4/ntvfs/simple/svfs_util.c @@ -31,7 +31,7 @@ */ char *svfs_unix_path(struct request_context *req, const char *name) { - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; char *ret; if (*name != '\\') { diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c index 1abf5ed9af..013419e4ee 100644 --- a/source4/ntvfs/simple/vfs_simple.c +++ b/source4/ntvfs/simple/vfs_simple.c @@ -33,7 +33,7 @@ #define O_DIRECTORY 0 #endif -#define CHECK_READ_ONLY(req) do { if (lp_readonly(req->conn->service)) return NT_STATUS_ACCESS_DENIED; } while (0) +#define CHECK_READ_ONLY(req) do { if (lp_readonly(req->tcon->service)) return NT_STATUS_ACCESS_DENIED; } while (0) #ifndef HAVE_PREAD static ssize_t pread(int __fd, void *__buf, size_t __nbytes, off_t __offset) @@ -64,15 +64,15 @@ static ssize_t pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offs static NTSTATUS svfs_connect(struct request_context *req, const char *sharename) { struct stat st; - struct tcon_context *conn = req->conn; + struct smbsrv_tcon *tcon = req->tcon; struct svfs_private *private; - conn->ntvfs_private = talloc_p(conn->mem_ctx, struct svfs_private); + tcon->ntvfs_private = talloc_p(tcon->mem_ctx, struct svfs_private); - private = conn->ntvfs_private; + private = tcon->ntvfs_private; private->next_search_handle = 0; - private->connectpath = talloc_strdup(conn->mem_ctx, lp_pathname(conn->service)); + private->connectpath = talloc_strdup(tcon->mem_ctx, lp_pathname(tcon->service)); private->open_files = NULL; /* the directory must exist */ @@ -82,8 +82,8 @@ static NTSTATUS svfs_connect(struct request_context *req, const char *sharename) return NT_STATUS_BAD_NETWORK_NAME; } - conn->fs_type = talloc_strdup(conn->mem_ctx, "NTFS"); - conn->dev_type = talloc_strdup(conn->mem_ctx, "A:"); + tcon->fs_type = talloc_strdup(tcon->mem_ctx, "NTFS"); + tcon->dev_type = talloc_strdup(tcon->mem_ctx, "A:"); DEBUG(0,("WARNING: ntvfs simple: connect to share [%s] with ROOT privileges!!!\n",sharename)); @@ -93,7 +93,7 @@ static NTSTATUS svfs_connect(struct request_context *req, const char *sharename) /* disconnect from a share */ -static NTSTATUS svfs_disconnect(struct tcon_context *req) +static NTSTATUS svfs_disconnect(struct smbsrv_tcon *tcon) { return NT_STATUS_OK; } @@ -268,7 +268,7 @@ static NTSTATUS svfs_qpathinfo(struct request_context *req, union smb_fileinfo * */ static NTSTATUS svfs_qfileinfo(struct request_context *req, union smb_fileinfo *info) { - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; struct svfs_file *f; struct stat st; @@ -296,7 +296,7 @@ static NTSTATUS svfs_qfileinfo(struct request_context *req, union smb_fileinfo * */ static NTSTATUS svfs_open(struct request_context *req, union smb_open *io) { - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; char *unix_path; struct stat st; int fd, flags; @@ -307,7 +307,7 @@ static NTSTATUS svfs_open(struct request_context *req, union smb_open *io) return ntvfs_map_open(req, io); } - if (lp_readonly(req->conn->service)) { + if (lp_readonly(req->tcon->service)) { create_flags = 0; rdwr_flags = O_RDONLY; } else { @@ -341,7 +341,7 @@ static NTSTATUS svfs_open(struct request_context *req, union smb_open *io) if (io->generic.in.create_options & NTCREATEX_OPTIONS_DIRECTORY) { flags = O_RDONLY | O_DIRECTORY; - if (lp_readonly(req->conn->service)) { + if (lp_readonly(req->tcon->service)) { goto do_open; } switch (io->generic.in.open_disposition) { @@ -376,9 +376,9 @@ do_open: return map_nt_error_from_unix(errno); } - f = talloc_p(req->conn->mem_ctx, struct svfs_file); + f = talloc_p(req->tcon->mem_ctx, struct svfs_file); f->fd = fd; - f->name = talloc_strdup(req->conn->mem_ctx, unix_path); + f->name = talloc_strdup(req->tcon->mem_ctx, unix_path); DLIST_ADD(private->open_files, f); @@ -562,7 +562,7 @@ static NTSTATUS svfs_flush(struct request_context *req, struct smb_flush *io) */ static NTSTATUS svfs_close(struct request_context *req, union smb_close *io) { - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; struct svfs_file *f; if (io->generic.level != RAW_CLOSE_CLOSE) { @@ -580,8 +580,8 @@ static NTSTATUS svfs_close(struct request_context *req, union smb_close *io) } DLIST_REMOVE(private->open_files, f); - talloc_free(req->conn->mem_ctx, f->name); - talloc_free(req->conn->mem_ctx, f); + talloc_free(req->tcon->mem_ctx, f->name); + talloc_free(req->tcon->mem_ctx, f); return NT_STATUS_OK; } @@ -661,7 +661,7 @@ static NTSTATUS svfs_setfileinfo(struct request_context *req, */ static NTSTATUS svfs_fsinfo(struct request_context *req, union smb_fsinfo *fs) { - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; struct stat st; if (fs->generic.level != RAW_QFS_GENERIC) { @@ -690,8 +690,8 @@ static NTSTATUS svfs_fsinfo(struct request_context *req, union smb_fsinfo *fs) fs->generic.out.quota_soft = 0; fs->generic.out.quota_hard = 0; fs->generic.out.quota_flags = 0; - fs->generic.out.volume_name = talloc_strdup(req->mem_ctx, lp_servicename(req->conn->service)); - fs->generic.out.fs_type = req->conn->fs_type; + fs->generic.out.volume_name = talloc_strdup(req->mem_ctx, lp_servicename(req->tcon->service)); + fs->generic.out.fs_type = req->tcon->fs_type; return NT_STATUS_OK; } @@ -703,7 +703,7 @@ static NTSTATUS svfs_fsinfo(struct request_context *req, union smb_fsinfo *fs) static NTSTATUS svfs_fsattr(struct request_context *req, union smb_fsattr *fs) { struct stat st; - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; if (fs->generic.level != RAW_FSATTR_GENERIC) { return ntvfs_map_fsattr(req, fs); @@ -722,7 +722,7 @@ static NTSTATUS svfs_fsattr(struct request_context *req, union smb_fsattr *fs) fs->generic.out.serial_number = 1; fs->generic.out.fs_type = talloc_strdup(req->mem_ctx, "NTFS"); fs->generic.out.volume_name = talloc_strdup(req->mem_ctx, - lp_servicename(req->conn->service)); + lp_servicename(req->tcon->service)); return NT_STATUS_OK; } @@ -745,7 +745,7 @@ static NTSTATUS svfs_search_first(struct request_context *req, union smb_search_ { struct svfs_dir *dir; int i; - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; struct search_state *search; union smb_search_data file; TALLOC_CTX *mem_ctx; @@ -819,7 +819,7 @@ static NTSTATUS svfs_search_next(struct request_context *req, union smb_search_n { struct svfs_dir *dir; int i; - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; struct search_state *search; union smb_search_data file; uint_t max_count; @@ -902,7 +902,7 @@ found: /* close a search */ static NTSTATUS svfs_search_close(struct request_context *req, union smb_search_close *io) { - struct svfs_private *private = req->conn->ntvfs_private; + struct svfs_private *private = req->tcon->ntvfs_private; struct search_state *search; for (search=private->search; search; search = search->next) { 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;i<conn->vuid_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;i<tcon->vuid_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); } diff --git a/source4/smbd/rewrite.c b/source4/smbd/rewrite.c index fb4fd93c2c..c24b2232fd 100644 --- a/source4/smbd/rewrite.c +++ b/source4/smbd/rewrite.c @@ -35,7 +35,7 @@ BOOL init_change_notify(void) BOOL pcap_printername_ok(const char *service, const char *foo) { return True; } -BOOL share_access_check(struct request_context *req, struct tcon_context *conn, int snum, uint32_t desired_access) +BOOL share_access_check(struct request_context *req, struct smbsrv_tcon *tcon, int snum, uint32_t desired_access) { return True; } BOOL init_names(void) |