From bce62e600085270f26053882c5a4e35f5fe4fb5e Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Fri, 17 Jan 2014 10:16:12 +1300 Subject: s4: pass down a memory context when performing share_string_option, to allow substitutions Signed-off-by: Garming Sam Change-Id: I24b36db3ac11834c3268b2da929e214c10268b16 Reviewed-by: Andrew Bartlett Reviewed-by: Nadezhda Ivanova --- source4/smb_server/smb/service.c | 5 +++-- source4/smb_server/smb2/tcon.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/smb_server') diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c index 9ad0f3894e..e25be1c382 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 6ee2eb5f8e..e7d28479c1 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) { -- cgit