summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-01-08 16:26:50 -0800
committerAndrew Bartlett <abartlet@samba.org>2013-01-09 14:54:23 +1100
commitb6fe9ec6835c322f6d2d6e831bece311100bf051 (patch)
tree724e3e95d35c48c34bfdf9abfe6668fa4b5f296a
parent97eb0493fc263fabe63b6846b6f6add7068098e6 (diff)
downloadsamba-b6fe9ec6835c322f6d2d6e831bece311100bf051.tar.gz
samba-b6fe9ec6835c322f6d2d6e831bece311100bf051.tar.bz2
samba-b6fe9ec6835c322f6d2d6e831bece311100bf051.zip
Allow create_conn_struct() to be called with snum == -1.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/smbd/msdfs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 8e80cbb764..4bf7aba34a 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -235,6 +235,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
char *connpath;
const char *vfs_user;
struct smbd_server_connection *sconn;
+ const char *servicename = lp_const_servicename(snum);
sconn = talloc_zero(ctx, struct smbd_server_connection);
if (sconn == NULL) {
@@ -257,6 +258,10 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
* for a proper talloc tree */
talloc_steal(conn, sconn);
+ if (snum == -1 && servicename == NULL) {
+ servicename = "Unknown Service (snum == -1)";
+ }
+
connpath = talloc_strdup(conn, path);
if (!connpath) {
TALLOC_FREE(conn);
@@ -265,7 +270,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
connpath = talloc_string_sub(conn,
connpath,
"%S",
- lp_servicename(talloc_tos(), snum));
+ servicename);
if (!connpath) {
TALLOC_FREE(conn);
return NT_STATUS_NO_MEMORY;
@@ -299,7 +304,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
*/
if (conn->session_info) {
share_access_check(conn->session_info->security_token,
- lp_servicename(talloc_tos(), snum),
+ servicename,
MAXIMUM_ALLOWED_ACCESS,
&conn->share_access);
@@ -309,7 +314,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
DEBUG(0,("create_conn_struct: connection to %s "
"denied due to security "
"descriptor.\n",
- lp_servicename(talloc_tos(), snum)));
+ servicename));
conn_free(conn);
return NT_STATUS_ACCESS_DENIED;
} else {
@@ -329,7 +334,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
}
/* this must be the first filesystem operation that we do */
- if (SMB_VFS_CONNECT(conn, lp_servicename(talloc_tos(), snum), vfs_user) < 0) {
+ if (SMB_VFS_CONNECT(conn, servicename, vfs_user) < 0) {
DEBUG(0,("VFS connect failed!\n"));
conn_free(conn);
return NT_STATUS_UNSUCCESSFUL;