summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-23 13:06:55 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-24 14:12:32 +0200
commita92f7176bd7f198a547952142b7d361a9b4e9146 (patch)
tree7252d83613ae3a87c9ca4461714ea7440aa97660
parent0733183594dbd3ce07ddaf9e1fcf8102b80fc605 (diff)
downloadsamba-a92f7176bd7f198a547952142b7d361a9b4e9146.tar.gz
samba-a92f7176bd7f198a547952142b7d361a9b4e9146.tar.bz2
samba-a92f7176bd7f198a547952142b7d361a9b4e9146.zip
s3:smbd/msdfs: let create_conn_struct() also fake the 'smbd_server_connection'
metze
-rw-r--r--source3/printing/nt_printing.c15
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c10
-rw-r--r--source3/smbd/msdfs.c48
-rw-r--r--source3/smbd/proto.h13
4 files changed, 63 insertions, 23 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 96947f199b..f52b6ae86a 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -616,7 +616,10 @@ static uint32 get_correct_cversion(struct auth_session_info *session_info,
return -1;
}
- nt_status = create_conn_struct(talloc_tos(), smbd_server_conn, &conn,
+ nt_status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ &conn,
printdollar_snum,
lp_pathname(printdollar_snum),
session_info, &oldcwd);
@@ -1000,7 +1003,10 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info,
return WERR_NO_SUCH_SHARE;
}
- nt_status = create_conn_struct(talloc_tos(), smbd_server_conn, &conn,
+ nt_status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ &conn,
printdollar_snum,
lp_pathname(printdollar_snum),
session_info, &oldcwd);
@@ -1533,7 +1539,10 @@ bool delete_driver_files(const struct auth_session_info *session_info,
return false;
}
- nt_status = create_conn_struct(talloc_tos(), smbd_server_conn, &conn,
+ nt_status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ &conn,
printdollar_snum,
lp_pathname(printdollar_snum),
session_info, &oldcwd);
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index c9f8ceb6f8..38f272c55a 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -2133,7 +2133,10 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
goto error_exit;
}
- nt_status = create_conn_struct(talloc_tos(), smbd_server_conn, &conn,
+ nt_status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ &conn,
snum, lp_pathname(snum),
p->session_info, &oldcwd);
if (!NT_STATUS_IS_OK(nt_status)) {
@@ -2274,7 +2277,10 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
goto error_exit;
}
- nt_status = create_conn_struct(talloc_tos(), smbd_server_conn, &conn,
+ nt_status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ &conn,
snum, lp_pathname(snum),
p->session_info, &oldcwd);
if (!NT_STATUS_IS_OK(nt_status)) {
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index b7a505284e..82859c3be4 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -223,12 +223,13 @@ static NTSTATUS parse_dfs_path(connection_struct *conn,
*********************************************************/
NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
- struct smbd_server_connection *sconn,
- connection_struct **pconn,
- int snum,
- const char *path,
- const struct auth_session_info *session_info,
- char **poldcwd)
+ struct tevent_context *ev,
+ struct messaging_context *msg,
+ connection_struct **pconn,
+ int snum,
+ const char *path,
+ const struct auth_session_info *session_info,
+ char **poldcwd)
{
connection_struct *conn;
char *connpath;
@@ -254,6 +255,18 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
return NT_STATUS_NO_MEMORY;
}
+ conn->sconn = talloc_zero(conn, struct smbd_server_connection);
+ if (conn->sconn == NULL) {
+ TALLOC_FREE(conn);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ conn->sconn->ev_ctx = ev;
+ conn->sconn->msg_ctx = msg;
+ conn->sconn->sock = -1;
+ conn->sconn->smb1.echo_handler.trusted_fd = -1;
+ conn->sconn->smb1.echo_handler.socket_lock_fd = -1;
+
/* needed for smbd_vfs_init() */
if (!(conn->params = talloc_zero(conn, struct share_params))) {
@@ -265,8 +278,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
conn->params->service = snum;
conn->cnum = (unsigned)-1;
- conn->sconn = sconn;
- DLIST_ADD(sconn->connections, conn);
+ DLIST_ADD(conn->sconn->connections, conn);
conn->sconn->num_connections++;
if (session_info != NULL) {
@@ -967,7 +979,10 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
- status = create_conn_struct(ctx, sconn, &conn, snum,
+ status = create_conn_struct(ctx,
+ server_event_context(),
+ server_messaging_context(),
+ &conn, snum,
lp_pathname(snum), NULL, &oldpath);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(pdp);
@@ -1143,7 +1158,10 @@ static bool junction_to_local_path(const struct junction_map *jucn,
if(snum < 0) {
return False;
}
- status = create_conn_struct(talloc_tos(), smbd_server_conn, conn_out,
+ status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ conn_out,
snum, lp_pathname(snum), NULL, oldpath);
if (!NT_STATUS_IS_OK(status)) {
return False;
@@ -1305,7 +1323,10 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum)
* Fake up a connection struct for the VFS layer.
*/
- status = create_conn_struct(talloc_tos(), smbd_server_conn, &conn,
+ status = create_conn_struct(talloc_tos(),
+ server_event_context(),
+ server_messaging_context(),
+ &conn,
snum, connect_path, NULL, &cwd);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("create_conn_struct failed: %s\n",
@@ -1378,7 +1399,10 @@ static int form_junctions(TALLOC_CTX *ctx,
* Fake up a connection struct for the VFS layer.
*/
- status = create_conn_struct(ctx, smbd_server_conn, &conn, snum, connect_path, NULL,
+ status = create_conn_struct(ctx,
+ server_event_context(),
+ server_messaging_context(),
+ &conn, snum, connect_path, NULL,
&cwd);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("create_conn_struct failed: %s\n",
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 4dc63cc7fb..f8a8281806 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -480,12 +480,13 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
char **pp_name_out,
bool *ppath_contains_wcard);
NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
- struct smbd_server_connection *sconn,
- connection_struct **pconn,
- int snum,
- const char *path,
- const struct auth_session_info *session_info,
- char **poldcwd);
+ struct tevent_context *ev,
+ struct messaging_context *msg,
+ connection_struct **pconn,
+ int snum,
+ const char *path,
+ const struct auth_session_info *session_info,
+ char **poldcwd);
/* The following definitions come from smbd/negprot.c */