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;
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;
/* 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;
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);
}
struct cvfs_private {
struct cli_tree *tree;
struct cli_transport *transport;
- struct tcon_context *conn;
+ struct smbsrv_tcon *tcon;
const char *map_calls;
};
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);
}
}
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);
}
/*
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);
}
}
*/
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;
* 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;
}
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",
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
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);
/*
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);
*/
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
*/
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
*/
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) {
*/
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) {
*/
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) {
*/
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) {
*/
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) &&
*/
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) {
*/
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) {
*/
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) {
*/
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) {
*/
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) {
*/
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) {
*/
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) {
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) {
*/
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) {
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);
}
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);
}
/* 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);
}
/* 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) {
*/
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;
/*
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;
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) {
*/
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;
*/
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;
*/
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) {
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] */
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]);
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)
/*
#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)
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;
}
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) {
return NT_STATUS_UNSUCCESSFUL;
}
- PASS_THRU(req->conn, connect, (req, sharename));
+ PASS_THRU(req->tcon, connect, (req, sharename));
return status;
}
/*
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);
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
*/
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));
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));
*/
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));
*/
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));
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));
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));
/* 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));
/* 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));
/* 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);
int interface_version;
int sizeof_ntvfs_ops;
int sizeof_SMB_OFF_T;
- int sizeof_tcon_context;
+ int sizeof_smbsrv_tcon;
int sizeof_request_context;
};
NTVFS_INTERFACE_VERSION,
sizeof(struct ntvfs_ops),
sizeof(SMB_OFF_T),
- sizeof(struct tcon_context),
+ sizeof(struct smbsrv_tcon),
sizeof(struct request_context),
};
*/
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;
}
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;
}
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;
}
/* 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;
}
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;
}
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;
}
/*
disconnect from a share
*/
-static NTSTATUS print_disconnect(struct tcon_context *conn)
+static NTSTATUS print_disconnect(struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
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;
}
*/
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 != '\\') {
#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)
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 */
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));
/*
disconnect from a share
*/
-static NTSTATUS svfs_disconnect(struct tcon_context *req)
+static NTSTATUS svfs_disconnect(struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
*/
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;
*/
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;
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 {
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) {
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);
*/
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) {
}
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;
}
*/
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) {
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;
}
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);
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;
}
{
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;
{
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;
/* 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) {
/*
Unix SMB/CIFS implementation.
- Manage connections_struct structures
+ Manage smbsrv_tcon structures
Copyright (C) Andrew Tridgell 1998
Copyright (C) Alexander Bokovoy 2002
#define MAX_CONNECTIONS 128
/****************************************************************************
-init the conn structures
+init the tcon structures
****************************************************************************/
void conn_init(struct smbsrv_context *smb_ctx)
{
****************************************************************************/
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);
}
}
/****************************************************************************
-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;
}
}
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);
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);
}
}
****************************************************************************/
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;
}
}
}
#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);
}
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;
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;
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);
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)
cs.mypid = getpid();
cs.curr_connections = 0;
- cs.name = lp_servicename(SNUM(conn));
+ cs.name = lp_servicename(SNUM(tcon));
cs.Clear = Clear;
/*
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);
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);
}
/*
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);
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
{
REQ_CHECK_WCT(req, 0);
- close_cnum(req->conn);
+ close_cnum(req->tcon);
/* construct reply */
req_setup_reply(req, 0, 0);
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
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 {
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);
}
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;
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
*
*/
- 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;
}
}
/****************************************************************************
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);
}
}
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;
}
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;
}
/*
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);
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);
}
/* 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;
}
/* 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;
}
/* 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
/* 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;
}
}
/* 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;
}
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;
}
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;
}
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;
}
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;
}
*/
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 */
*/
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);
}
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)