summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/close.c10
-rw-r--r--source3/smbd/conn_idle.c3
-rw-r--r--source3/smbd/connection.c7
-rw-r--r--source3/smbd/dfree.c2
-rw-r--r--source3/smbd/dosmode.c2
-rw-r--r--source3/smbd/fake_file.c4
-rw-r--r--source3/smbd/lanman.c25
-rw-r--r--source3/smbd/mangle.c2
-rw-r--r--source3/smbd/message.c12
-rw-r--r--source3/smbd/msdfs.c41
-rw-r--r--source3/smbd/nttrans.c4
-rw-r--r--source3/smbd/open.c2
-rw-r--r--source3/smbd/password.c2
-rw-r--r--source3/smbd/perfcount.c2
-rw-r--r--source3/smbd/process.c11
-rw-r--r--source3/smbd/reply.c16
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/smbd/server_reload.c8
-rw-r--r--source3/smbd/service.c102
-rw-r--r--source3/smbd/share_access.c19
-rw-r--r--source3/smbd/smb2_find.c4
-rw-r--r--source3/smbd/smb2_tcon.c7
-rw-r--r--source3/smbd/trans2.c40
-rw-r--r--source3/smbd/uid.c15
24 files changed, 181 insertions, 161 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index a3eedbfa6b..8633f82c0a 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -46,7 +46,7 @@ static NTSTATUS check_magic(struct files_struct *fsp)
char *fname = NULL;
NTSTATUS status;
- if (!*lp_magicscript(SNUM(conn))) {
+ if (!*lp_magicscript(talloc_tos(), SNUM(conn))) {
return NT_STATUS_OK;
}
@@ -62,13 +62,13 @@ static NTSTATUS check_magic(struct files_struct *fsp)
p++;
}
- if (!strequal(lp_magicscript(SNUM(conn)),p)) {
+ if (!strequal(lp_magicscript(talloc_tos(), SNUM(conn)),p)) {
status = NT_STATUS_OK;
goto out;
}
- if (*lp_magicoutput(SNUM(conn))) {
- magic_output = lp_magicoutput(SNUM(conn));
+ if (*lp_magicoutput(talloc_tos(), SNUM(conn))) {
+ magic_output = lp_magicoutput(talloc_tos(), SNUM(conn));
} else {
magic_output = talloc_asprintf(ctx,
"%s.out",
@@ -906,7 +906,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, files_struct *fsp)
return NT_STATUS_OK;
}
- if(((errno == ENOTEMPTY)||(errno == EEXIST)) && *lp_veto_files(SNUM(conn))) {
+ if(((errno == ENOTEMPTY)||(errno == EEXIST)) && *lp_veto_files(talloc_tos(), SNUM(conn))) {
/*
* Check to see if the only thing in this directory are
* vetoed files/directories. If so then delete them and
diff --git a/source3/smbd/conn_idle.c b/source3/smbd/conn_idle.c
index 60263667c1..916a2067ad 100644
--- a/source3/smbd/conn_idle.c
+++ b/source3/smbd/conn_idle.c
@@ -112,7 +112,8 @@ void conn_force_tdis(struct smbd_server_connection *sconn, const char *sharename
if (close_all) {
do_close = true;
- } else if (strequal(lp_servicename(SNUM(conn)), sharename)) {
+ } else if (strequal(lp_servicename(talloc_tos(), SNUM(conn)),
+ sharename)) {
DEBUG(1, ("conn_force_tdis: Forcing close of "
"share '%s' (wire_id=0x%08x)\n",
tcon->global->share_name,
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 846a173ad7..d334e8bdc1 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -136,7 +136,8 @@ bool connections_snum_used(struct smbd_server_connection *unused, int snum)
{
int active;
- active = count_current_connections(lp_servicename(snum), true);
+ active = count_current_connections(lp_servicename(talloc_tos(), snum),
+ true);
if (active > 0) {
return true;
}
@@ -173,12 +174,12 @@ bool claim_connection(connection_struct *conn, const char *name)
crec.cnum = conn->cnum;
crec.uid = conn->session_info->unix_token->uid;
crec.gid = conn->session_info->unix_token->gid;
- strlcpy(crec.servicename, lp_servicename(SNUM(conn)),
+ strlcpy(crec.servicename, lp_servicename(rec, SNUM(conn)),
sizeof(crec.servicename));
crec.start = time(NULL);
raddr = tsocket_address_inet_addr_string(conn->sconn->remote_address,
- talloc_tos());
+ rec);
if (raddr == NULL) {
return false;
}
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 1a73132ae5..cb80e18d4a 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -80,7 +80,7 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_que
* If external disk calculation specified, use it.
*/
- dfree_command = lp_dfree_command(SNUM(conn));
+ dfree_command = lp_dfree_command(talloc_tos(), SNUM(conn));
if (dfree_command && *dfree_command) {
const char *p;
char **lines = NULL;
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 747ba2169a..836ffd0de5 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -889,7 +889,7 @@ NTSTATUS file_set_sparse(connection_struct *conn,
"on readonly share[%s]\n",
smb_fname_str_dbg(fsp->fsp_name),
sparse,
- lp_servicename(SNUM(conn))));
+ lp_servicename(talloc_tos(), SNUM(conn))));
return NT_STATUS_MEDIA_WRITE_PROTECTED;
}
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index ffc8d78020..d052d4965d 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -134,7 +134,7 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("open_fake_file: smbd_calculate_access_mask "
"on service[%s] file[%s] returned %s\n",
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
smb_fname_str_dbg(smb_fname),
nt_errstr(status)));
return status;
@@ -144,7 +144,7 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
if (geteuid() != sec_initial_uid()) {
DEBUG(3, ("open_fake_file_shared: access_denied to "
"service[%s] file[%s] user[%s]\n",
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
smb_fname_str_dbg(smb_fname),
conn->session_info->unix_info->unix_name));
return NT_STATUS_ACCESS_DENIED;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 5809abdf5f..1b5de57ad4 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -110,13 +110,13 @@ static int CopyExpanded(connection_struct *conn,
*p_space_remaining = 0;
return 0;
}
- buf = talloc_string_sub(ctx, buf,"%S",lp_servicename(snum));
+ buf = talloc_string_sub(ctx, buf,"%S", lp_servicename(ctx, snum));
if (!buf) {
*p_space_remaining = 0;
return 0;
}
buf = talloc_sub_advanced(ctx,
- lp_servicename(SNUM(conn)),
+ lp_servicename(ctx, SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
@@ -162,12 +162,12 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s)
if (!buf) {
return 0;
}
- buf = talloc_string_sub(ctx,buf,"%S",lp_servicename(snum));
+ buf = talloc_string_sub(ctx,buf,"%S",lp_servicename(ctx, snum));
if (!buf) {
return 0;
}
buf = talloc_sub_advanced(ctx,
- lp_servicename(SNUM(conn)),
+ lp_servicename(ctx, SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
@@ -1906,10 +1906,10 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
len = 0;
if (uLevel > 0) {
- len += StrlenExpanded(conn,snum,lp_comment(snum));
+ len += StrlenExpanded(conn,snum,lp_comment(talloc_tos(), snum));
}
if (uLevel > 1) {
- len += strlen(lp_pathname(snum)) + 1;
+ len += strlen(lp_pathname(talloc_tos(), snum)) + 1;
}
if (buflen) {
*buflen = struct_len;
@@ -1938,7 +1938,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
baseaddr = p;
}
- push_ascii(p,lp_servicename(snum),13, STR_TERMINATE);
+ push_ascii(p,lp_servicename(talloc_tos(), snum),13, STR_TERMINATE);
if (uLevel > 0) {
int type;
@@ -1948,12 +1948,12 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
if (lp_print_ok(snum)) {
type = STYPE_PRINTQ;
}
- if (strequal("IPC",lp_fstype(snum))) {
+ if (strequal("IPC",lp_fstype(talloc_tos(),snum))) {
type = STYPE_IPC;
}
SSVAL(p,14,type); /* device type */
SIVAL(p,16,PTR_DIFF(p2,baseaddr));
- len += CopyExpanded(conn,snum,&p2,lp_comment(snum),&l2);
+ len += CopyExpanded(conn,snum,&p2,lp_comment(talloc_tos(),snum),&l2);
}
if (uLevel > 1) {
@@ -1961,7 +1961,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
SSVALS(p,22,-1); /* max uses */
SSVAL(p,24,1); /* current uses */
SIVAL(p,26,PTR_DIFF(p2,baseaddr)); /* local pathname */
- len += CopyAndAdvance(&p2,lp_pathname(snum),&l2);
+ len += CopyAndAdvance(&p2,lp_pathname(talloc_tos(),snum),&l2);
memset(p+30,0,SHPWLEN+2); /* passwd (reserved), pad field */
}
@@ -2101,7 +2101,7 @@ static bool api_RNetShareEnum(struct smbd_server_connection *sconn,
if (!(lp_browseable(i) && lp_snum_ok(i))) {
continue;
}
- push_ascii_fstring(servicename_dos, lp_servicename(i));
+ push_ascii_fstring(servicename_dos, lp_servicename(talloc_tos(), i));
/* Maximum name length = 13. */
if( lp_browseable( i ) && lp_snum_ok( i ) && (strlen(servicename_dos) < 13)) {
total++;
@@ -2133,7 +2133,8 @@ static bool api_RNetShareEnum(struct smbd_server_connection *sconn,
continue;
}
- push_ascii_fstring(servicename_dos, lp_servicename(i));
+ push_ascii_fstring(servicename_dos,
+ lp_servicename(talloc_tos(), i));
if (lp_browseable(i) && lp_snum_ok(i) && (strlen(servicename_dos) < 13)) {
if (fill_share_info( conn,i,uLevel,&p,&f_len,&p2,&s_len,*rdata ) < 0) {
break;
diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c
index 49599c1ee1..55da33a258 100644
--- a/source3/smbd/mangle.c
+++ b/source3/smbd/mangle.c
@@ -45,7 +45,7 @@ static void mangle_init(void)
if (mangle_fns)
return;
- method = lp_mangling_method();
+ method = lp_mangling_method(talloc_tos());
/* find the first mangling method that manages to initialise and
matches the "mangling method" parameter */
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 8ae588b511..59949e21ae 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -51,7 +51,7 @@ static void msg_deliver(struct msg_state *state)
fstring alpha_buf;
char *s;
- if (! (*lp_msg_command())) {
+ if (! (*lp_msg_command(frame))) {
DEBUG(1,("no messaging command specified\n"));
goto done;
}
@@ -96,7 +96,7 @@ static void msg_deliver(struct msg_state *state)
close(fd);
/* run the command */
- s = talloc_strdup(talloc_tos(), lp_msg_command());
+ s = lp_msg_command(frame);
if (s == NULL) {
goto done;
}
@@ -146,7 +146,7 @@ void reply_sends(struct smb_request *req)
START_PROFILE(SMBsends);
- if (!(*lp_msg_command())) {
+ if (!(*lp_msg_command(talloc_tos()))) {
reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
END_PROFILE(SMBsends);
return;
@@ -194,7 +194,7 @@ void reply_sendstrt(struct smb_request *req)
START_PROFILE(SMBsendstrt);
- if (!(*lp_msg_command())) {
+ if (!(*lp_msg_command(talloc_tos()))) {
reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
END_PROFILE(SMBsendstrt);
return;
@@ -244,7 +244,7 @@ void reply_sendtxt(struct smb_request *req)
START_PROFILE(SMBsendtxt);
- if (! (*lp_msg_command())) {
+ if (! (*lp_msg_command(talloc_tos()))) {
reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
END_PROFILE(SMBsendtxt);
return;
@@ -293,7 +293,7 @@ void reply_sendend(struct smb_request *req)
{
START_PROFILE(SMBsendend);
- if (! (*lp_msg_command())) {
+ if (! (*lp_msg_command(talloc_tos()))) {
reply_nterror(req, NT_STATUS_REQUEST_NOT_ACCEPTED);
END_PROFILE(SMBsendend);
return;
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 6f182b4920..97775d6a9d 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -147,9 +147,9 @@ static NTSTATUS parse_dfs_path(connection_struct *conn,
}
/* Is this really our servicename ? */
- if (conn && !( strequal(servicename, lp_servicename(SNUM(conn)))
+ if (conn && !( strequal(servicename, lp_servicename(talloc_tos(), SNUM(conn)))
|| (strequal(servicename, HOMES_NAME)
- && strequal(lp_servicename(SNUM(conn)),
+ && strequal(lp_servicename(talloc_tos(), SNUM(conn)),
get_current_username()) )) ) {
DEBUG(10,("parse_dfs_path: %s is not our servicename\n",
servicename));
@@ -249,7 +249,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
connpath = talloc_string_sub(conn,
connpath,
"%S",
- lp_servicename(snum));
+ lp_servicename(talloc_tos(), snum));
if (!connpath) {
TALLOC_FREE(conn);
return NT_STATUS_NO_MEMORY;
@@ -304,7 +304,8 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
*/
if (conn->session_info) {
share_access_check(conn->session_info->security_token,
- lp_servicename(snum), MAXIMUM_ALLOWED_ACCESS,
+ lp_servicename(talloc_tos(), snum),
+ MAXIMUM_ALLOWED_ACCESS,
&conn->share_access);
if ((conn->share_access & FILE_WRITE_DATA) == 0) {
@@ -313,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(snum)));
+ lp_servicename(talloc_tos(), snum)));
conn_free(conn);
return NT_STATUS_ACCESS_DENIED;
} else {
@@ -333,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(snum), vfs_user) < 0) {
+ if (SMB_VFS_CONNECT(conn, lp_servicename(talloc_tos(), snum), vfs_user) < 0) {
DEBUG(0,("VFS connect failed!\n"));
conn_free(conn);
return NT_STATUS_UNSUCCESSFUL;
@@ -779,9 +780,9 @@ static NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
- if (!( strequal(pdp->servicename, lp_servicename(SNUM(conn)))
+ if (!( strequal(pdp->servicename, lp_servicename(talloc_tos(), SNUM(conn)))
|| (strequal(pdp->servicename, HOMES_NAME)
- && strequal(lp_servicename(SNUM(conn)),
+ && strequal(lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->sanitized_username) )) ) {
/* The given sharename doesn't match this connection. */
@@ -906,7 +907,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
}
}
- if (!lp_msdfs_root(snum) && (*lp_msdfs_proxy(snum) == '\0')) {
+ if (!lp_msdfs_root(snum) && (*lp_msdfs_proxy(talloc_tos(), snum) == '\0')) {
DEBUG(3,("get_referred_path: |%s| in dfs path %s is not "
"a dfs root.\n",
pdp->servicename, dfs_path));
@@ -926,7 +927,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
char *tmp;
struct referral *ref;
- if (*lp_msdfs_proxy(snum) == '\0') {
+ if (*lp_msdfs_proxy(talloc_tos(), snum) == '\0') {
TALLOC_FREE(pdp);
return self_ref(ctx,
dfs_path,
@@ -946,7 +947,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
return NT_STATUS_NO_MEMORY;
}
- if (!(tmp = talloc_strdup(ctx, lp_msdfs_proxy(snum)))) {
+ if (!(tmp = talloc_strdup(ctx, lp_msdfs_proxy(talloc_tos(), snum)))) {
TALLOC_FREE(pdp);
return NT_STATUS_NO_MEMORY;
}
@@ -983,7 +984,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
server_event_context(),
server_messaging_context(),
&conn, snum,
- lp_pathname(snum), NULL, &oldpath);
+ lp_pathname(talloc_tos(), snum), NULL, &oldpath);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(pdp);
return status;
@@ -1133,7 +1134,7 @@ bool create_junction(TALLOC_CTX *ctx,
jucn->service_name = talloc_strdup(ctx, pdp->servicename);
jucn->volume_name = talloc_strdup(ctx, pdp->reqpath);
- jucn->comment = talloc_strdup(ctx, lp_comment(snum));
+ jucn->comment = lp_comment(ctx, snum);
TALLOC_FREE(pdp);
if (!jucn->service_name || !jucn->volume_name || ! jucn->comment) {
@@ -1162,14 +1163,14 @@ static bool junction_to_local_path(const struct junction_map *jucn,
server_event_context(),
server_messaging_context(),
conn_out,
- snum, lp_pathname(snum), NULL, oldpath);
+ snum, lp_pathname(talloc_tos(), snum), NULL, oldpath);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
*pp_path_out = talloc_asprintf(*conn_out,
"%s/%s",
- lp_pathname(snum),
+ lp_pathname(talloc_tos(), snum),
jucn->volume_name);
if (!*pp_path_out) {
vfs_ChDir(*conn_out, *oldpath);
@@ -1309,8 +1310,8 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum)
DIR *dirp = NULL;
const char *dname = NULL;
char *talloced = NULL;
- const char *connect_path = lp_pathname(snum);
- const char *msdfs_proxy = lp_msdfs_proxy(snum);
+ const char *connect_path = lp_pathname(talloc_tos(), snum);
+ const char *msdfs_proxy = lp_msdfs_proxy(talloc_tos(), snum);
connection_struct *conn;
NTSTATUS status;
char *cwd;
@@ -1379,9 +1380,9 @@ static int form_junctions(TALLOC_CTX *ctx,
DIR *dirp = NULL;
const char *dname = NULL;
char *talloced = NULL;
- const char *connect_path = lp_pathname(snum);
- char *service_name = lp_servicename(snum);
- const char *msdfs_proxy = lp_msdfs_proxy(snum);
+ const char *connect_path = lp_pathname(talloc_tos(), snum);
+ char *service_name = lp_servicename(talloc_tos(), snum);
+ const char *msdfs_proxy = lp_msdfs_proxy(talloc_tos(), snum);
connection_struct *conn;
struct referral *ref = NULL;
char *cwd;
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 0cac3a14ec..a0a3f59e08 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2225,7 +2225,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
/* access check */
if (get_current_uid(conn) != 0) {
DEBUG(1,("get_user_quota: access_denied service [%s] user "
- "[%s]\n", lp_servicename(SNUM(conn)),
+ "[%s]\n", lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name));
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
@@ -2497,7 +2497,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
/* access check */
if (get_current_uid(conn) != 0) {
DEBUG(1,("set_user_quota: access_denied service [%s] user "
- "[%s]\n", lp_servicename(SNUM(conn)),
+ "[%s]\n", lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name));
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index a445524f16..15f588885e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2742,7 +2742,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
if(access_mask & ~(conn->share_access)) {
DEBUG(5,("mkdir_internal: failing share access "
- "%s\n", lp_servicename(SNUM(conn))));
+ "%s\n", lp_servicename(talloc_tos(), SNUM(conn))));
return NT_STATUS_ACCESS_DENIED;
}
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index c87f15805e..60ab045283 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -127,7 +127,7 @@ int register_homes_share(const char *username)
if (result != -1) {
DEBUG(3, ("Using static (or previously created) service for "
"user '%s'; path = '%s'\n", username,
- lp_pathname(result)));
+ lp_pathname(talloc_tos(), result)));
return result;
}
diff --git a/source3/smbd/perfcount.c b/source3/smbd/perfcount.c
index 1561893758..a7c268a2fe 100644
--- a/source3/smbd/perfcount.c
+++ b/source3/smbd/perfcount.c
@@ -176,7 +176,7 @@ bool smb_perfcount_init(void)
{
char *perfcount_object;
- perfcount_object = lp_perfcount_module();
+ perfcount_object = lp_perfcount_module(talloc_tos());
/* don't init */
if (!perfcount_object || !perfcount_object[0])
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 80b0c1d79b..adb773d749 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3456,16 +3456,17 @@ void smbd_process(struct tevent_context *ev_ctx,
exit_server("Could not open account policy tdb.\n");
}
- if (*lp_rootdir()) {
- if (chroot(lp_rootdir()) != 0) {
- DEBUG(0,("Failed to change root to %s\n", lp_rootdir()));
+ if (*lp_rootdir(talloc_tos())) {
+ if (chroot(lp_rootdir(talloc_tos())) != 0) {
+ DEBUG(0,("Failed to change root to %s\n",
+ lp_rootdir(talloc_tos())));
exit_server("Failed to chroot()");
}
if (chdir("/") == -1) {
- DEBUG(0,("Failed to chdir to / on chroot to %s\n", lp_rootdir()));
+ DEBUG(0,("Failed to chdir to / on chroot to %s\n", lp_rootdir(talloc_tos())));
exit_server("Failed to chroot()");
}
- DEBUG(0,("Changed root to %s\n", lp_rootdir()));
+ DEBUG(0,("Changed root to %s\n", lp_rootdir(talloc_tos())));
}
if (!srv_init_signing(sconn)) {
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 080be5cc94..03af4ac403 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -838,7 +838,7 @@ void reply_tcon_and_X(struct smb_request *req)
}
} else {
/* NT sets the fstype of IPC$ to the null string */
- const char *fstype = IS_IPC(conn) ? "" : lp_fstype(SNUM(conn));
+ const char *fstype = IS_IPC(conn) ? "" : lp_fstype(ctx, SNUM(conn));
if (tcon_flags & TCONX_FLAG_EXTENDED_RESPONSE) {
/* Return permissions. */
@@ -876,7 +876,7 @@ void reply_tcon_and_X(struct smb_request *req)
if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) {
DEBUG(2,("Serving %s as a Dfs root\n",
- lp_servicename(SNUM(conn)) ));
+ lp_servicename(ctx, SNUM(conn)) ));
SSVAL(req->outbuf, smb_vwv2,
SMB_SHARE_IN_DFS | SVAL(req->outbuf, smb_vwv2));
}
@@ -973,7 +973,9 @@ void reply_ioctl(struct smb_request *req)
STR_TERMINATE|STR_ASCII);
if (conn) {
srvstr_push((char *)req->outbuf, req->flags2,
- p+18, lp_servicename(SNUM(conn)),
+ p+18,
+ lp_servicename(talloc_tos(),
+ SNUM(conn)),
13, STR_TERMINATE|STR_ASCII);
} else {
memset(p+18, 0, 13);
@@ -1542,7 +1544,7 @@ void reply_search(struct smb_request *req)
if ((dirtype&0x1F) == FILE_ATTRIBUTE_VOLUME) {
char buf[DIR_STRUCT_SIZE];
memcpy(buf,status,21);
- if (!make_dir_struct(ctx,buf,"???????????",volume_label(SNUM(conn)),
+ if (!make_dir_struct(ctx,buf,"???????????",volume_label(ctx, SNUM(conn)),
0,FILE_ATTRIBUTE_VOLUME,0,!allow_long_path_components)) {
reply_nterror(req, NT_STATUS_NO_MEMORY);
goto out;
@@ -1568,8 +1570,8 @@ void reply_search(struct smb_request *req)
/DIR_STRUCT_SIZE));
DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n",
- directory,lp_dontdescend(SNUM(conn))));
- if (in_list(directory, lp_dontdescend(SNUM(conn)),True)) {
+ directory,lp_dontdescend(ctx, SNUM(conn))));
+ if (in_list(directory, lp_dontdescend(ctx, SNUM(conn)),True)) {
check_descend = True;
}
@@ -5349,7 +5351,7 @@ void reply_printqueue(struct smb_request *req)
TALLOC_CTX *mem_ctx = talloc_tos();
NTSTATUS status;
WERROR werr;
- const char *sharename = lp_servicename(SNUM(conn));
+ const char *sharename = lp_servicename(mem_ctx, SNUM(conn));
struct rpc_pipe_client *cli = NULL;
struct dcerpc_binding_handle *b = NULL;
struct policy_handle handle;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 94a25109fb..28374fa985 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1158,7 +1158,7 @@ extern void build_options(bool screen);
gain_root_group_privilege();
fault_setup();
- dump_core_setup("smbd", lp_logfile());
+ dump_core_setup("smbd", lp_logfile(talloc_tos()));
/* we are never interested in SIGPIPE */
BlockSignals(True,SIGPIPE);
diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c
index bab622d11f..e5d7102744 100644
--- a/source3/smbd/server_reload.c
+++ b/source3/smbd/server_reload.c
@@ -95,7 +95,7 @@ void delete_and_reload_printers(struct tevent_context *ev,
}
sname = lp_const_servicename(snum);
- pname = lp_printername(snum);
+ pname = lp_printername(session_info, snum);
/* check printer, but avoid removing non-autoloaded printers */
if (!pcap_printername_ok(pname) && lp_autoloaded(snum)) {
@@ -103,7 +103,9 @@ void delete_and_reload_printers(struct tevent_context *ev,
if (is_printer_published(session_info, session_info,
msg_ctx,
- NULL, lp_servicename(snum),
+ NULL,
+ lp_servicename(session_info,
+ snum),
NULL, &pinfo2)) {
nt_printer_publish(session_info,
session_info,
@@ -140,7 +142,7 @@ bool reload_services(struct smbd_server_connection *sconn,
bool ret;
if (lp_loaded()) {
- char *fname = lp_configfile();
+ char *fname = lp_configfile(talloc_tos());
if (file_exist(fname) &&
!strcsequal(fname, get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index da5d763ad8..a1d009cb44 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -160,7 +160,7 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
}
DEBUG(10,("set_conn_connectpath: service %s, connectpath = %s\n",
- lp_servicename(SNUM(conn)), destname ));
+ lp_servicename(talloc_tos(), SNUM(conn)), destname ));
string_set(&conn->connectpath, destname);
SAFE_FREE(destname);
@@ -250,7 +250,7 @@ static NTSTATUS share_sanity_checks(const struct tsocket_address *remote_address
if (dev[0] == '?' || !dev[0]) {
if (lp_print_ok(snum)) {
fstrcpy(dev,"LPT1:");
- } else if (strequal(lp_fstype(snum), "IPC")) {
+ } else if (strequal(lp_fstype(talloc_tos(), snum), "IPC")) {
fstrcpy(dev, "IPC");
} else {
fstrcpy(dev,"A:");
@@ -263,7 +263,7 @@ static NTSTATUS share_sanity_checks(const struct tsocket_address *remote_address
if (!strequal(dev, "LPT1:")) {
return NT_STATUS_BAD_DEVICE_TYPE;
}
- } else if (strequal(lp_fstype(snum), "IPC")) {
+ } else if (strequal(lp_fstype(talloc_tos(), snum), "IPC")) {
if (!strequal(dev, "IPC")) {
return NT_STATUS_BAD_DEVICE_TYPE;
}
@@ -299,7 +299,7 @@ static NTSTATUS find_forced_group(bool force_user,
bool user_must_be_member = False;
gid_t gid;
- groupname = talloc_strdup(talloc_tos(), lp_force_group(snum));
+ groupname = lp_force_group(talloc_tos(), snum);
if (groupname == NULL) {
DEBUG(1, ("talloc_strdup failed\n"));
result = NT_STATUS_NO_MEMORY;
@@ -312,7 +312,7 @@ static NTSTATUS find_forced_group(bool force_user,
}
groupname = talloc_string_sub(talloc_tos(), groupname,
- "%S", lp_servicename(snum));
+ "%S", lp_servicename(talloc_tos(), snum));
if (groupname == NULL) {
DEBUG(1, ("talloc_string_sub failed\n"));
result = NT_STATUS_NO_MEMORY;
@@ -395,7 +395,7 @@ static NTSTATUS create_connection_session_info(struct smbd_server_connection *sc
if (!lp_guest_ok(snum)) {
DEBUG(2, ("guest user (from session setup) "
"not permitted to access this share "
- "(%s)\n", lp_servicename(snum)));
+ "(%s)\n", lp_servicename(talloc_tos(), snum)));
return NT_STATUS_ACCESS_DENIED;
}
} else {
@@ -406,7 +406,7 @@ static NTSTATUS create_connection_session_info(struct smbd_server_connection *sc
"permitted to access this share "
"(%s)\n",
session_info->unix_info->unix_name,
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
return NT_STATUS_ACCESS_DENIED;
}
}
@@ -429,7 +429,7 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
{
NTSTATUS status;
- if (*lp_force_user(snum)) {
+ if (*lp_force_user(talloc_tos(), snum)) {
/*
* Replace conn->session_info with a completely faked up one
@@ -441,7 +441,7 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
struct auth_session_info *forced_serverinfo;
bool guest;
- fuser = talloc_string_sub(conn, lp_force_user(snum), "%S",
+ fuser = talloc_string_sub(conn, lp_force_user(talloc_tos(), snum), "%S",
lp_const_servicename(snum));
if (fuser == NULL) {
return NT_STATUS_NO_MEMORY;
@@ -479,7 +479,7 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
* any groupid stored for the connecting user.
*/
- if (*lp_force_group(snum)) {
+ if (*lp_force_group(talloc_tos(), snum)) {
status = find_forced_group(
conn->force_user, snum, conn->session_info->unix_info->unix_name,
@@ -511,7 +511,7 @@ static void create_share_access_mask(connection_struct *conn, int snum)
const struct security_token *token = conn->session_info->security_token;
share_access_check(token,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
MAXIMUM_ALLOWED_ACCESS,
&conn->share_access);
@@ -610,13 +610,13 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
{
char *s = talloc_sub_advanced(talloc_tos(),
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
conn->session_info->unix_info->sanitized_username,
conn->session_info->info->domain_name,
- lp_pathname(snum));
+ lp_pathname(talloc_tos(), snum));
if (!s) {
status = NT_STATUS_NO_MEMORY;
goto err_root_exit;
@@ -628,7 +628,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
goto err_root_exit;
}
DEBUG(3,("Connect path is '%s' for service [%s]\n",s,
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
TALLOC_FREE(s);
}
@@ -647,7 +647,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
DEBUG(0,("make_connection: connection to %s "
"denied due to security "
"descriptor.\n",
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
status = NT_STATUS_ACCESS_DENIED;
goto err_root_exit;
} else {
@@ -658,7 +658,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
if (!smbd_vfs_init(conn)) {
DEBUG(0, ("vfs_init failed for service %s\n",
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
status = NT_STATUS_BAD_NETWORK_NAME;
goto err_root_exit;
}
@@ -673,11 +673,12 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
*/
if ((lp_max_connections(snum) > 0)
- && (count_current_connections(lp_servicename(SNUM(conn)), True) >=
+ && (count_current_connections(lp_servicename(talloc_tos(), SNUM(conn)), True) >=
lp_max_connections(snum))) {
DEBUG(1, ("Max connections (%d) exceeded for %s\n",
- lp_max_connections(snum), lp_servicename(snum)));
+ lp_max_connections(snum),
+ lp_servicename(talloc_tos(), snum)));
status = NT_STATUS_INSUFFICIENT_RESOURCES;
goto err_root_exit;
}
@@ -685,7 +686,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
/*
* Get us an entry in the connections db
*/
- if (!claim_connection(conn, lp_servicename(snum))) {
+ if (!claim_connection(conn, lp_servicename(talloc_tos(), snum))) {
DEBUG(1, ("Could not store connections entry\n"));
status = NT_STATUS_INTERNAL_DB_ERROR;
goto err_root_exit;
@@ -695,7 +696,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
/* Invoke VFS make connection hook - this must be the first
filesystem operation that we do. */
- if (SMB_VFS_CONNECT(conn, lp_servicename(snum),
+ if (SMB_VFS_CONNECT(conn, lp_servicename(talloc_tos(), snum),
conn->session_info->unix_info->unix_name) < 0) {
DEBUG(0,("make_connection: VFS make connection failed!\n"));
status = NT_STATUS_UNSUCCESSFUL;
@@ -736,15 +737,15 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
/* Preexecs are done here as they might make the dir we are to ChDir
* to below */
/* execute any "root preexec = " line */
- if (*lp_rootpreexec(snum)) {
+ if (*lp_rootpreexec(talloc_tos(), snum)) {
char *cmd = talloc_sub_advanced(talloc_tos(),
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
conn->session_info->unix_info->sanitized_username,
conn->session_info->info->domain_name,
- lp_rootpreexec(snum));
+ lp_rootpreexec(talloc_tos(), snum));
DEBUG(5,("cmd=%s\n",cmd));
ret = smbrun(cmd,NULL);
TALLOC_FREE(cmd);
@@ -774,15 +775,15 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
* to below */
/* execute any "preexec = " line */
- if (*lp_preexec(snum)) {
+ if (*lp_preexec(talloc_tos(), snum)) {
char *cmd = talloc_sub_advanced(talloc_tos(),
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
conn->session_info->unix_info->sanitized_username,
conn->session_info->info->domain_name,
- lp_preexec(snum));
+ lp_preexec(talloc_tos(), snum));
ret = smbrun(cmd,NULL);
TALLOC_FREE(cmd);
if (ret != 0 && lp_preexec_close(snum)) {
@@ -818,7 +819,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
if (!canonicalize_connect_path(conn)) {
DEBUG(0, ("canonicalize_connect_path failed "
"for service %s, path %s\n",
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
conn->connectpath));
status = NT_STATUS_BAD_NETWORK_NAME;
goto err_root_exit;
@@ -827,11 +828,14 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
/* Add veto/hide lists */
if (!IS_IPC(conn) && !IS_PRINT(conn)) {
- set_namearray( &conn->veto_list, lp_veto_files(snum));
- set_namearray( &conn->hide_list, lp_hide_files(snum));
- set_namearray( &conn->veto_oplock_list, lp_veto_oplocks(snum));
+ set_namearray( &conn->veto_list,
+ lp_veto_files(talloc_tos(), snum));
+ set_namearray( &conn->hide_list,
+ lp_hide_files(talloc_tos(), snum));
+ set_namearray( &conn->veto_oplock_list,
+ lp_veto_oplocks(talloc_tos(), snum));
set_namearray( &conn->aio_write_behind_list,
- lp_aio_write_behind(snum));
+ lp_aio_write_behind(talloc_tos(), snum));
}
status = create_synthetic_smb_fname(talloc_tos(), conn->connectpath,
NULL, NULL, &smb_fname_cpath);
@@ -850,11 +854,12 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
if (ret == 0 && !S_ISDIR(smb_fname_cpath->st.st_ex_mode)) {
DEBUG(0,("'%s' is not a directory, when connecting to "
"[%s]\n", conn->connectpath,
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
} else {
DEBUG(0,("'%s' does not exist or permission denied "
"when connecting to [%s] Error was %s\n",
- conn->connectpath, lp_servicename(snum),
+ conn->connectpath,
+ lp_servicename(talloc_tos(), snum),
strerror(errno) ));
}
status = NT_STATUS_BAD_NETWORK_NAME;
@@ -882,7 +887,8 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
tsocket_address_string(conn->sconn->remote_address,
talloc_tos()) );
dbgtext( "%s", srv_is_signing_active(sconn) ? "signed " : "");
- dbgtext( "connect to service %s ", lp_servicename(snum) );
+ dbgtext( "connect to service %s ",
+ lp_servicename(talloc_tos(), snum) );
dbgtext( "initially as user %s ",
conn->session_info->unix_info->unix_name );
dbgtext( "(uid=%d, gid=%d) ", (int)effuid, (int)effgid );
@@ -903,7 +909,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
SMB_VFS_DISCONNECT(conn);
}
if (claimed_connection) {
- yield_connection(conn, lp_servicename(snum));
+ yield_connection(conn, lp_servicename(talloc_tos(), snum));
}
return status;
}
@@ -921,7 +927,6 @@ static connection_struct *make_connection_smb1(struct smbd_server_connection *sc
NTSTATUS status;
NTTIME now = 0;
struct connection_struct *conn;
- const char *share_name;
status = smb1srv_tcon_create(sconn->conn, now, &tcon);
if (!NT_STATUS_IS_OK(status)) {
@@ -954,8 +959,7 @@ static connection_struct *make_connection_smb1(struct smbd_server_connection *sc
return NULL;
}
- share_name = lp_servicename(SNUM(conn));
- tcon->global->share_name = talloc_strdup(tcon->global, share_name);
+ tcon->global->share_name = lp_servicename(tcon->global, SNUM(conn));
if (tcon->global->share_name == NULL) {
conn_free(conn);
TALLOC_FREE(tcon);
@@ -1075,7 +1079,7 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
dev, status);
} else if ((vuser->homes_snum != -1)
&& strequal(service_in,
- lp_servicename(vuser->homes_snum))) {
+ lp_servicename(talloc_tos(), vuser->homes_snum))) {
DEBUG(5, ("making a connection to 'homes' service [%s] "
"created at session setup time\n", service_in));
return make_connection_smb1(sconn,
@@ -1116,10 +1120,10 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
}
/* Handle non-Dfs clients attempting connections to msdfs proxy */
- if (lp_host_msdfs() && (*lp_msdfs_proxy(snum) != '\0')) {
+ if (lp_host_msdfs() && (*lp_msdfs_proxy(talloc_tos(), snum) != '\0')) {
DEBUG(3, ("refusing connection to dfs proxy share '%s' "
"(pointing to %s)\n",
- service, lp_msdfs_proxy(snum)));
+ service, lp_msdfs_proxy(talloc_tos(), snum)));
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
}
@@ -1148,27 +1152,27 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
get_remote_machine_name(),
tsocket_address_string(conn->sconn->remote_address,
talloc_tos()),
- lp_servicename(SNUM(conn))));
+ lp_servicename(talloc_tos(), SNUM(conn))));
/* Call VFS disconnect hook */
SMB_VFS_DISCONNECT(conn);
- yield_connection(conn, lp_servicename(SNUM(conn)));
+ yield_connection(conn, lp_servicename(talloc_tos(), SNUM(conn)));
/* make sure we leave the directory available for unmount */
vfs_ChDir(conn, "/");
/* execute any "postexec = " line */
- if (*lp_postexec(SNUM(conn)) &&
+ if (*lp_postexec(talloc_tos(), SNUM(conn)) &&
change_to_user(conn, vuid)) {
char *cmd = talloc_sub_advanced(talloc_tos(),
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
conn->session_info->unix_info->sanitized_username,
conn->session_info->info->domain_name,
- lp_postexec(SNUM(conn)));
+ lp_postexec(talloc_tos(), SNUM(conn)));
smbrun(cmd,NULL);
TALLOC_FREE(cmd);
change_to_root_user();
@@ -1176,15 +1180,15 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
change_to_root_user();
/* execute any "root postexec = " line */
- if (*lp_rootpostexec(SNUM(conn))) {
+ if (*lp_rootpostexec(talloc_tos(), SNUM(conn))) {
char *cmd = talloc_sub_advanced(talloc_tos(),
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name,
conn->connectpath,
conn->session_info->unix_token->gid,
conn->session_info->unix_info->sanitized_username,
conn->session_info->info->domain_name,
- lp_rootpostexec(SNUM(conn)));
+ lp_rootpostexec(talloc_tos(), SNUM(conn)));
smbrun(cmd,NULL);
TALLOC_FREE(cmd);
}
diff --git a/source3/smbd/share_access.c b/source3/smbd/share_access.c
index 2a4775d2dd..7087a985a9 100644
--- a/source3/smbd/share_access.c
+++ b/source3/smbd/share_access.c
@@ -203,7 +203,7 @@ bool user_ok_token(const char *username, const char *domain,
{
if (lp_invalid_users(snum) != NULL) {
if (token_contains_name_in_list(username, domain,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
token,
lp_invalid_users(snum))) {
DEBUG(10, ("User %s in 'invalid users'\n", username));
@@ -213,7 +213,8 @@ bool user_ok_token(const char *username, const char *domain,
if (lp_valid_users(snum) != NULL) {
if (!token_contains_name_in_list(username, domain,
- lp_servicename(snum), token,
+ lp_servicename(talloc_tos(), snum),
+ token,
lp_valid_users(snum))) {
DEBUG(10, ("User %s not in 'valid users'\n",
username));
@@ -223,14 +224,14 @@ bool user_ok_token(const char *username, const char *domain,
if (lp_onlyuser(snum)) {
const char *list[2];
- list[0] = lp_username(snum);
+ list[0] = lp_username(talloc_tos(), snum);
list[1] = NULL;
if ((list[0] == NULL) || (*list[0] == '\0')) {
DEBUG(0, ("'only user = yes' and no 'username ='\n"));
return False;
}
if (!token_contains_name_in_list(NULL, domain,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
token, list)) {
DEBUG(10, ("%s != 'username'\n", username));
return False;
@@ -238,7 +239,7 @@ bool user_ok_token(const char *username, const char *domain,
}
DEBUG(10, ("user_ok_token: share %s is ok for unix user %s\n",
- lp_servicename(snum), username));
+ lp_servicename(talloc_tos(), snum), username));
return True;
}
@@ -267,7 +268,8 @@ bool is_share_read_only_for_token(const char *username,
if (lp_readlist(snum) != NULL) {
if (token_contains_name_in_list(username, domain,
- lp_servicename(snum), token,
+ lp_servicename(talloc_tos(), snum),
+ token,
lp_readlist(snum))) {
result = True;
}
@@ -275,14 +277,15 @@ bool is_share_read_only_for_token(const char *username,
if (lp_writelist(snum) != NULL) {
if (token_contains_name_in_list(username, domain,
- lp_servicename(snum), token,
+ lp_servicename(talloc_tos(), snum),
+ token,
lp_writelist(snum))) {
result = False;
}
}
DEBUG(10,("is_share_read_only_for_user: share %s is %s for unix user "
- "%s\n", lp_servicename(snum),
+ "%s\n", lp_servicename(talloc_tos(), snum),
result ? "read-only" : "read-write", username));
return result;
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index ef6887d3b7..bb5e934a87 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -369,9 +369,9 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
DEBUG(8,("smbd_smb2_find_send: dirpath=<%s> dontdescend=<%s>, "
"in_output_buffer_length = %u\n",
- fsp->fsp_name->base_name, lp_dontdescend(SNUM(conn)),
+ fsp->fsp_name->base_name, lp_dontdescend(talloc_tos(), SNUM(conn)),
(unsigned int)in_output_buffer_length ));
- if (in_list(fsp->fsp_name->base_name,lp_dontdescend(SNUM(conn)),
+ if (in_list(fsp->fsp_name->base_name,lp_dontdescend(talloc_tos(), SNUM(conn)),
conn->case_sensitive)) {
dont_descend = true;
}
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c
index ceb145ff63..4549d3aa84 100644
--- a/source3/smbd/smb2_tcon.c
+++ b/source3/smbd/smb2_tcon.c
@@ -185,7 +185,6 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
connection_struct *compat_conn = NULL;
struct user_struct *compat_vuser = req->session->compat;
NTSTATUS status;
- const char *share_name = NULL;
if (strncmp(share, "\\\\", 2) == 0) {
const char *p = strchr(share+2, '\\');
@@ -217,7 +216,7 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
snum = compat_vuser->homes_snum;
} else if ((compat_vuser->homes_snum != -1)
&& strequal(service,
- lp_servicename(compat_vuser->homes_snum))) {
+ lp_servicename(talloc_tos(), compat_vuser->homes_snum))) {
snum = compat_vuser->homes_snum;
} else {
snum = find_service(talloc_tos(), service, &service);
@@ -248,8 +247,8 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
return status;
}
- share_name = lp_servicename(SNUM(compat_conn));
- tcon->global->share_name = talloc_strdup(tcon->global, share_name);
+ tcon->global->share_name = lp_servicename(tcon->global,
+ SNUM(compat_conn));
if (tcon->global->share_name == NULL) {
conn_free(compat_conn);
TALLOC_FREE(tcon);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 682b3c4e4f..73feaf8798 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2495,8 +2495,8 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
a different TRANS2 call. */
DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n",
- directory,lp_dontdescend(SNUM(conn))));
- if (in_list(directory,lp_dontdescend(SNUM(conn)),conn->case_sensitive))
+ directory,lp_dontdescend(ctx, SNUM(conn))));
+ if (in_list(directory,lp_dontdescend(ctx, SNUM(conn)),conn->case_sensitive))
dont_descend = True;
p = pdata;
@@ -2824,8 +2824,8 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
a different TRANS2 call. */
DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n",
- directory,lp_dontdescend(SNUM(conn))));
- if (in_list(directory,lp_dontdescend(SNUM(conn)),conn->case_sensitive))
+ directory,lp_dontdescend(ctx, SNUM(conn))));
+ if (in_list(directory,lp_dontdescend(ctx, SNUM(conn)),conn->case_sensitive))
dont_descend = True;
p = pdata;
@@ -2943,7 +2943,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16])
{
- E_md4hash(lp_servicename(SNUM(conn)),objid);
+ E_md4hash(lp_servicename(talloc_tos(), SNUM(conn)),objid);
return objid;
}
@@ -2992,9 +2992,9 @@ NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
{
char *pdata, *end_data;
int data_len = 0, len;
- const char *vname = volume_label(SNUM(conn));
+ const char *vname = volume_label(talloc_tos(), SNUM(conn));
int snum = SNUM(conn);
- char *fstype = lp_fstype(SNUM(conn));
+ char *fstype = lp_fstype(talloc_tos(), SNUM(conn));
uint32 additional_flags = 0;
struct smb_filename smb_fname_dot;
SMB_STRUCT_STAT st;
@@ -3073,7 +3073,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_ex_dev, (u
* Add volume serial number - hash of a combination of
* the called hostname and the service name.
*/
- SIVAL(pdata,0,str_checksum(lp_servicename(snum)) ^ (str_checksum(get_local_machine_name())<<16) );
+ SIVAL(pdata,0,str_checksum(lp_servicename(talloc_tos(), snum)) ^ (str_checksum(get_local_machine_name())<<16) );
/*
* Win2k3 and previous mess this up by sending a name length
* one byte short. I believe only older clients (OS/2 Win9x) use
@@ -3139,7 +3139,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_ex_dev, (u
* Add volume serial number - hash of a combination of
* the called hostname and the service name.
*/
- SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^
+ SIVAL(pdata,8,str_checksum(lp_servicename(talloc_tos(), snum)) ^
(str_checksum(get_local_machine_name())<<16));
/* Max label len is 32 characters. */
@@ -3150,7 +3150,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_ex_dev, (u
data_len = 18+len;
DEBUG(5,("smbd_do_qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol=%s serv=%s\n",
- (int)strlen(vname),vname, lp_servicename(snum)));
+ (int)strlen(vname),vname,
+ lp_servicename(talloc_tos(), snum)));
break;
case SMB_QUERY_FS_SIZE_INFO:
@@ -3271,20 +3272,20 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
if (get_current_uid(conn) != 0) {
DEBUG(0,("set_user_quota: access_denied "
"service [%s] user [%s]\n",
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name));
return NT_STATUS_ACCESS_DENIED;
}
if (vfs_get_ntquota(&fsp, SMB_USER_FS_QUOTA_TYPE, NULL, &quotas)!=0) {
- DEBUG(0,("vfs_get_ntquota() failed for service [%s]\n",lp_servicename(SNUM(conn))));
+ DEBUG(0,("vfs_get_ntquota() failed for service [%s]\n",lp_servicename(talloc_tos(), SNUM(conn))));
return map_nt_error_from_unix(errno);
}
data_len = 48;
DEBUG(10,("SMB_FS_QUOTA_INFORMATION: for service [%s]\n",
- lp_servicename(SNUM(conn))));
+ lp_servicename(talloc_tos(), SNUM(conn))));
/* Unknown1 24 NULL bytes*/
SBIG_UINT(pdata,0,(uint64_t)0);
@@ -3401,7 +3402,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
return NT_STATUS_INVALID_LEVEL;
#endif /* EOPNOTSUPP */
} else {
- DEBUG(0,("vfs_statvfs() failed for service [%s]\n",lp_servicename(SNUM(conn))));
+ DEBUG(0,("vfs_statvfs() failed for service [%s]\n",lp_servicename(talloc_tos(), SNUM(conn))));
return NT_STATUS_DOS(ERRSRV, ERRerror);
}
break;
@@ -3511,7 +3512,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
* Thursby MAC extension... ONLY on NTFS filesystems
* once we do streams then we don't need this
*/
- if (strequal(lp_fstype(SNUM(conn)),"NTFS")) {
+ if (strequal(lp_fstype(talloc_tos(), SNUM(conn)),"NTFS")) {
data_len = 88;
SIVAL(pdata,84,0x100); /* Don't support mac... */
break;
@@ -3594,7 +3595,8 @@ static void call_trans2setfsinfo(connection_struct *conn,
char *params = *pparams;
uint16 info_level;
- DEBUG(10,("call_trans2setfsinfo: for service [%s]\n",lp_servicename(SNUM(conn))));
+ DEBUG(10,("call_trans2setfsinfo: for service [%s]\n",
+ lp_servicename(talloc_tos(), SNUM(conn))));
/* */
if (total_params < 4) {
@@ -3757,7 +3759,7 @@ static void call_trans2setfsinfo(connection_struct *conn,
/* access check */
if ((get_current_uid(conn) != 0) || !CAN_WRITE(conn)) {
DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n",
- lp_servicename(SNUM(conn)),
+ lp_servicename(talloc_tos(), SNUM(conn)),
conn->session_info->unix_info->unix_name));
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
@@ -3801,7 +3803,7 @@ static void call_trans2setfsinfo(connection_struct *conn,
/* now set the quotas */
if (vfs_set_ntquota(fsp, SMB_USER_FS_QUOTA_TYPE, NULL, &quotas)!=0) {
- DEBUG(0,("vfs_set_ntquota() failed for service [%s]\n",lp_servicename(SNUM(conn))));
+ DEBUG(0,("vfs_set_ntquota() failed for service [%s]\n",lp_servicename(talloc_tos(), SNUM(conn))));
reply_nterror(req, map_nt_error_from_unix(errno));
return;
}
@@ -8424,7 +8426,7 @@ static void call_trans2ioctl(connection_struct *conn,
lp_netbios_name(), 15,
STR_ASCII|STR_TERMINATE); /* Our NetBIOS name */
srvstr_push(pdata, req->flags2, pdata+18,
- lp_servicename(SNUM(conn)), 13,
+ lp_servicename(talloc_tos(), SNUM(conn)), 13,
STR_ASCII|STR_TERMINATE); /* Service name */
send_trans2_replies(conn, req, *pparams, 0, *ppdata, 32,
max_data_bytes);
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 27d7d1a413..eac5d9d97e 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -122,7 +122,8 @@ static bool check_user_ok(connection_struct *conn,
if (!readonly_share &&
!share_access_check(session_info->security_token,
- lp_servicename(snum), FILE_WRITE_DATA,
+ lp_servicename(talloc_tos(), snum),
+ FILE_WRITE_DATA,
NULL)) {
/* smb.conf allows r/w, but the security descriptor denies
* write. Fall back to looking at readonly. */
@@ -132,7 +133,7 @@ static bool check_user_ok(connection_struct *conn,
}
if (!share_access_check(session_info->security_token,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
readonly_share ?
FILE_READ_DATA : FILE_WRITE_DATA,
NULL)) {
@@ -209,7 +210,7 @@ static bool change_to_user_internal(connection_struct *conn,
"not permitted access to share %s.\n",
session_info->unix_info->sanitized_username,
session_info->unix_info->unix_name,
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
return false;
}
@@ -222,7 +223,7 @@ static bool change_to_user_internal(connection_struct *conn,
* See if we should force group for this service. If so this overrides
* any group set in the force user code.
*/
- if((group_c = *lp_force_group(snum))) {
+ if((group_c = *lp_force_group(talloc_tos(), snum))) {
SMB_ASSERT(conn->force_group_gid != (gid_t)-1);
@@ -299,7 +300,8 @@ bool change_to_user(connection_struct *conn, uint64_t vuid)
if (vuser == NULL) {
/* Invalid vuid sent */
DEBUG(2,("Invalid vuid %llu used on share %s.\n",
- (unsigned long long)vuid, lp_servicename(snum)));
+ (unsigned long long)vuid, lp_servicename(talloc_tos(),
+ snum)));
return false;
}
@@ -307,7 +309,8 @@ bool change_to_user(connection_struct *conn, uint64_t vuid)
if (!conn->force_user && vuser == NULL) {
DEBUG(2,("Invalid vuid used %llu in accessing share %s.\n",
- (unsigned long long)vuid, lp_servicename(snum)));
+ (unsigned long long)vuid,
+ lp_servicename(talloc_tos(), snum)));
return False;
}