summaryrefslogtreecommitdiff
path: root/source4/smb_server
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-01-17 10:16:12 +1300
committerAndrew Bartlett <abartlet@samba.org>2014-02-20 10:11:00 +1300
commitbce62e600085270f26053882c5a4e35f5fe4fb5e (patch)
tree36be15d3c9867498693ae247c119c18b933e835f /source4/smb_server
parent497f0327a08fbfa444308c90a418ccb6b45b96d6 (diff)
downloadsamba-bce62e600085270f26053882c5a4e35f5fe4fb5e.tar.gz
s4: pass down a memory context when performing share_string_option, to allow substitutions
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Change-Id: I24b36db3ac11834c3268b2da929e214c10268b16 Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
Diffstat (limited to 'source4/smb_server')
-rw-r--r--source4/smb_server/smb/service.c5
-rw-r--r--source4/smb_server/smb2/tcon.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c
index 9ad0f3894ed..e25be1c382d 100644
--- a/source4/smb_server/smb/service.c
+++ b/source4/smb_server/smb/service.c
@@ -111,7 +111,7 @@ static NTSTATUS make_connection(struct smbsrv_request *req,
enum ntvfs_type type;
const char *type_str;
struct share_config *scfg;
- const char *sharetype;
+ char *sharetype;
/* the service might be of the form \\SERVER\SHARE. Should we put
the server name we get from this somewhere? */
@@ -138,7 +138,7 @@ static NTSTATUS make_connection(struct smbsrv_request *req,
}
/* work out what sort of connection this is */
- sharetype = share_string_option(scfg, "type", "DISK");
+ sharetype = share_string_option(req, scfg, "type", "DISK");
if (sharetype && strcmp(sharetype, "IPC") == 0) {
type = NTVFS_IPC;
type_str = "IPC";
@@ -149,6 +149,7 @@ static NTSTATUS make_connection(struct smbsrv_request *req,
type = NTVFS_DISK;
type_str = "A:";
}
+ TALLOC_FREE(sharetype);
if (strcmp(dev, "?????") != 0 && strcasecmp(type_str, dev) != 0) {
/* the client gave us the wrong device type */
diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c
index 6ee2eb5f8ec..e7d28479c14 100644
--- a/source4/smb_server/smb2/tcon.c
+++ b/source4/smb_server/smb2/tcon.c
@@ -241,7 +241,7 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
enum ntvfs_type type;
const char *service = io->smb2.in.path;
struct share_config *scfg;
- const char *sharetype;
+ char *sharetype;
uint64_t ntvfs_caps = 0;
if (strncmp(service, "\\\\", 2) == 0) {
@@ -265,7 +265,7 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
}
/* work out what sort of connection this is */
- sharetype = share_string_option(scfg, SHARE_TYPE, "DISK");
+ sharetype = share_string_option(req, scfg, SHARE_TYPE, "DISK");
if (sharetype && strcmp(sharetype, "IPC") == 0) {
type = NTVFS_IPC;
} else if (sharetype && strcmp(sharetype, "PRINTER") == 0) {
@@ -273,6 +273,7 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
} else {
type = NTVFS_DISK;
}
+ TALLOC_FREE(sharetype);
tcon = smbsrv_smb2_tcon_new(req->session, scfg->name);
if (!tcon) {