bool machine_account;
bool s4u2proxy;
const char* sharename;
+ TALLOC_CTX *tmp_ctx;
+
+ tmp_ctx = talloc_new(req);
+ if (tmp_ctx == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
switch (tcon->generic.level) {
case RAW_TCON_TCON:
/* Here we need to determine which server to connect to.
* For now we use parametric options, type cifs.
*/
- host = share_string_option(scfg, CIFS_SERVER, NULL);
- user = share_string_option(scfg, CIFS_USER, NULL);
- pass = share_string_option(scfg, CIFS_PASSWORD, NULL);
- domain = share_string_option(scfg, CIFS_DOMAIN, NULL);
- remote_share = share_string_option(scfg, CIFS_SHARE, NULL);
+ host = share_string_option(tmp_ctx, scfg, CIFS_SERVER, NULL);
+ user = share_string_option(tmp_ctx, scfg, CIFS_USER, NULL);
+ pass = share_string_option(tmp_ctx, scfg, CIFS_PASSWORD, NULL);
+ domain = share_string_option(tmp_ctx, scfg, CIFS_DOMAIN, NULL);
+ remote_share = share_string_option(tmp_ctx, scfg, CIFS_SHARE, NULL);
if (!remote_share) {
remote_share = sharename;
}
p = talloc_zero(ntvfs, struct cvfs_private);
if (!p) {
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
DEBUG(5, ("CIFS backend: Using specified password\n"));
credentials = cli_credentials_init(p);
if (!credentials) {
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
}
status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(tmp_ctx);
return status;
}
} else if (req->session_info->credentials) {
}
status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(tmp_ctx);
return status;
}
cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
status = NT_STATUS_CROSSREALM_DELEGATION_FAILURE;
DEBUG(1,("S4U2Proxy: cli_credentials_get_ccache() gave: ret[%d] str[%s] - %s\n",
ret, err_str, nt_errstr(status)));
+ TALLOC_FREE(tmp_ctx);
return status;
}
} else {
DEBUG(1,("CIFS backend: NO delegated credentials found: You must supply server, user and password or the client must supply delegated credentials\n"));
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_INTERNAL_ERROR;
}
lpcfg_resolve_context(ntvfs->ctx->lp_ctx),
ntvfs->ctx->event_ctx);
status = smb_composite_connect_recv(creq, p);
- NT_STATUS_NOT_OK_RETURN(status);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(tmp_ctx);
+ return status;
+ }
p->tree = io.out.tree;
p->ntvfs = ntvfs;
ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
- NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
+ if (!ntvfs->ctx->fs_type) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
- NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
+ if (!ntvfs->ctx->dev_type) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
if (tcon->generic.level == RAW_TCON_TCONX) {
tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
p->map_trans2 = share_bool_option(scfg, CIFS_MAP_TRANS2, CIFS_MAP_TRANS2_DEFAULT);
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_OK;
}
NT_STATUS_HAVE_NO_MEMORY(p);
p->ntvfs = ntvfs;
p->next_search_handle = 0;
- p->connectpath = talloc_strdup(p, share_string_option(scfg, SHARE_PATH, ""));
+ p->connectpath = share_string_option(p, scfg, SHARE_PATH, "");
p->open_files = NULL;
p->search = NULL;
sizeof(r->out.info[0].info1.share_name));
r->out.info[i].info1.reserved1 = 0;
r->out.info[i].info1.share_type = dcesrv_common_get_share_type(mem_ctx, NULL, scfg);
- r->out.info[i].info1.comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
+ r->out.info[i].info1.comment = share_string_option(mem_ctx, scfg, SHARE_COMMENT, "");
talloc_free(scfg);
j++;
}
static void pvfs_setup_options(struct pvfs_state *pvfs)
{
struct share_config *scfg = pvfs->ntvfs->ctx->config;
- const char *eadb;
+ char *eadb;
+ char *xattr_backend;
bool def_perm_override = false;
if (share_bool_option(scfg, SHARE_MAP_HIDDEN, SHARE_MAP_HIDDEN_DEFAULT))
FS_ATTR_SPARSE_FILES;
/* allow xattrs to be stored in a external tdb */
- eadb = share_string_option(scfg, PVFS_EADB, NULL);
+ eadb = share_string_option(pvfs, scfg, PVFS_EADB, NULL);
if (eadb != NULL) {
pvfs->ea_db = tdb_wrap_open(pvfs, eadb, 50000,
TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
pvfs->ntvfs->ctx->lp_ctx);
+ TALLOC_FREE(eadb);
if (pvfs->ea_db != NULL) {
pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
} else {
}
/* enable an ACL backend */
- pvfs->acl_ops = pvfs_acl_backend_byname(share_string_option(scfg, PVFS_ACL, "xattr"));
+ xattr_backend = share_string_option(pvfs, scfg, PVFS_ACL, "xattr");
+ pvfs->acl_ops = pvfs_acl_backend_byname(xattr_backend);
+ TALLOC_FREE(xattr_backend);
}
static int pvfs_state_destructor(struct pvfs_state *pvfs)
NT_STATUS_HAVE_NO_MEMORY(pvfs);
/* for simplicity of path construction, remove any trailing slash now */
- base_directory = talloc_strdup(pvfs, share_string_option(ntvfs->ctx->config, SHARE_PATH, ""));
+ base_directory = share_string_option(pvfs, ntvfs->ctx->config, SHARE_PATH, "");
NT_STATUS_HAVE_NO_MEMORY(base_directory);
if (strcmp(base_directory, "/") != 0) {
trim_string(base_directory, NULL, "/");
NT_STATUS_HAVE_NO_MEMORY(p);
p->ntvfs = ntvfs;
p->next_search_handle = 0;
- p->connectpath = talloc_strdup(p, share_string_option(scfg, SHARE_PATH, ""));
+ p->connectpath = share_string_option(p, scfg, SHARE_PATH, "");
p->open_files = NULL;
p->search = NULL;
struct cli_credentials *credentials;
bool machine_account;
struct smbcli_options options;
+ TALLOC_CTX *tmp_ctx;
+
+ tmp_ctx = talloc_new(req);
+ if (tmp_ctx == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
switch (tcon->generic.level) {
case RAW_TCON_TCON:
sharename = tcon->smb2.in.path;
break;
default:
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_INVALID_LEVEL;
}
/* Here we need to determine which server to connect to.
* For now we use parametric options, type cifs.
*/
- host = share_string_option(scfg, SMB2_SERVER, NULL);
- user = share_string_option(scfg, SMB2_USER, NULL);
- pass = share_string_option(scfg, SMB2_PASSWORD, NULL);
- domain = share_string_option(scfg, SMB2_DOMAIN, NULL);
- remote_share = share_string_option(scfg, SMB2_SHARE, NULL);
+ host = share_string_option(tmp_ctx, scfg, SMB2_SERVER, NULL);
+ user = share_string_option(tmp_ctx, scfg, SMB2_USER, NULL);
+ pass = share_string_option(tmp_ctx, scfg, SMB2_PASSWORD, NULL);
+ domain = share_string_option(tmp_ctx, scfg, SMB2_DOMAIN, NULL);
+ remote_share = share_string_option(tmp_ctx, scfg, SMB2_SHARE, NULL);
if (!remote_share) {
remote_share = sharename;
}
p = talloc_zero(ntvfs, struct cvfs_private);
if (!p) {
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
if (!host) {
DEBUG(1,("CIFS backend: You must supply server\n"));
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_INVALID_PARAMETER;
}
DEBUG(5, ("CIFS backend: Using specified password\n"));
credentials = cli_credentials_init(p);
if (!credentials) {
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
}
status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(tmp_ctx);
return status;
}
} else if (req->session_info->credentials) {
credentials = req->session_info->credentials;
} else {
DEBUG(1,("CIFS backend: NO delegated credentials found: You must supply server, user and password or the client must supply delegated credentials\n"));
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_INVALID_PARAMETER;
}
ntvfs->ctx->event_ctx, &options,
lpcfg_socket_options(ntvfs->ctx->lp_ctx),
lpcfg_gensec_settings(p, ntvfs->ctx->lp_ctx));
- NT_STATUS_NOT_OK_RETURN(status);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(tmp_ctx);
+ return status;
+ }
status = smb2_get_roothandle(tree, &p->roothandle);
- NT_STATUS_NOT_OK_RETURN(status);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(tmp_ctx);
+ return status;
+ }
p->tree = tree;
p->transport = p->tree->session->transport;
p->ntvfs = ntvfs;
ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
- NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
+ if (!ntvfs->ctx->fs_type) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
- NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
+ if (!ntvfs->ctx->dev_type) {
+ TALLOC_FREE(tmp_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
if (tcon->generic.level == RAW_TCON_TCONX) {
tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
/* TODO: enable oplocks
smbcli_oplock_handler(p->transport, oplock_handler, p);
*/
+
+ TALLOC_FREE(tmp_ctx);
return NT_STATUS_OK;
}
const char *bname;
int i;
NTSTATUS status;
+ TALLOC_CTX * tmp_ctx;
if (num_backends == 0) {
return NULL;
return NULL;
}
+ tmp_ctx = talloc_new(ctx);
+ if (tmp_ctx == NULL) {
+ return NULL;
+ }
+
ctx->event_ctx = ev;
ctx->msg_ctx = msg;
ctx->break_send = break_send;
- bname = share_string_option(scfg, LEASE_BACKEND, NULL);
+ bname = share_string_option(tmp_ctx, scfg, LEASE_BACKEND, NULL);
if (!bname) {
talloc_free(ctx);
return NULL;
return NULL;
}
+ TALLOC_FREE(tmp_ctx);
return ctx;
}
ctx->ev = ev;
- bname = share_string_option(scfg, NOTIFY_BACKEND, NULL);
+ bname = share_string_option(ctx, scfg, NOTIFY_BACKEND, NULL);
if (!bname) {
if (num_backends) {
bname = backends[0].name;
#include "param/param.h"
#include "lib/util/samba_modules.h"
-const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
+char *share_string_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name, const char *defval)
{
- return scfg->ctx->ops->string_option(scfg, opt_name, defval);
+ return scfg->ctx->ops->string_option(mem_ctx, scfg, opt_name, defval);
}
int share_int_option(struct share_config *scfg, const char *opt_name, int defval)
NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct tevent_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct share_context **);
- const char *(*string_option)(struct share_config *, const char *, const char *);
+ char *(*string_option)(TALLOC_CTX *, struct share_config *, const char *, const char *);
int (*int_option)(struct share_config *, const char *, int);
bool (*bool_option)(struct share_config *, const char *, bool);
const char **(*string_list_option)(TALLOC_CTX *, struct share_config *, const char *);
struct loadparm_context;
-const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval);
+char *share_string_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name, const char *defval);
int share_int_option(struct share_config *scfg, const char *opt_name, int defval);
bool share_bool_option(struct share_config *scfg, const char *opt_name, bool defval);
const char **share_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name);
return NT_STATUS_OK;
}
-static const char *sclassic_string_option(struct share_config *scfg,
- const char *opt_name,
- const char *defval)
+static char *sclassic_string_option(TALLOC_CTX *mem_ctx,
+ struct share_config *scfg,
+ const char *opt_name,
+ const char *defval)
{
struct loadparm_service *s = talloc_get_type(scfg->opaque,
struct loadparm_service);
ret = defval;
}
talloc_free(parm);
- return ret;
+ return talloc_strdup(mem_ctx, ret);
}
if (strcmp(opt_name, SHARE_NAME) == 0) {
- return scfg->name;
+ return talloc_strdup(mem_ctx, scfg->name);
}
if (strcmp(opt_name, SHARE_PATH) == 0) {
}
if (strcmp(opt_name, SHARE_VOLUME) == 0) {
- return lpcfg_volume_label(s, lpcfg_default_service(lp_ctx));
+ return talloc_strdup(mem_ctx, lpcfg_volume_label(s, lpcfg_default_service(lp_ctx)));
}
if (strcmp(opt_name, SHARE_TYPE) == 0) {
if (lpcfg_printable(s, lpcfg_default_service(lp_ctx))) {
- return "PRINTER";
+ return talloc_strdup(mem_ctx, "PRINTER");
}
if (strcmp("NTFS", lpcfg_fstype(s, lpcfg_default_service(lp_ctx))) == 0) {
- return "DISK";
+ return talloc_strdup(mem_ctx, "DISK");
}
- return lpcfg_fstype(s, lpcfg_default_service(lp_ctx));
+ return talloc_strdup(mem_ctx, lpcfg_fstype(s, lpcfg_default_service(lp_ctx)));
}
if (strcmp(opt_name, SHARE_PASSWORD) == 0) {
- return defval;
+ return talloc_strdup(mem_ctx, defval);
}
DEBUG(0,("request for unknown share string option '%s'\n",
opt_name));
- return defval;
+ return talloc_strdup(mem_ctx, defval);
}
static int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval)
return NT_STATUS_OK;
}
-static const char *sldb_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
+static char *sldb_string_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name, const char *defval)
{
struct ldb_message *msg;
struct ldb_message_element *el;
const char *colon;
- if (scfg == NULL) return defval;
+ if (scfg == NULL) return talloc_strdup(mem_ctx, defval);
msg = talloc_get_type(scfg->opaque, struct ldb_message);
}
if (el == NULL) {
- return defval;
+ return talloc_strdup(mem_ctx, defval);
}
- return (const char *)(el->values[0].data);
+ return (char *)(el->values[0].data);
}
static int sldb_int_option(struct share_config *scfg, const char *opt_name, int defval)
{
- const char *val;
+ char *val;
int ret;
- val = sldb_string_option(scfg, opt_name, NULL);
+ val = sldb_string_option(scfg, scfg, opt_name, NULL);
if (val == NULL) return defval;
errno = 0;
ret = (int)strtol(val, NULL, 10);
+ TALLOC_FREE(val);
+
if (errno) return -1;
return ret;
static bool sldb_bool_option(struct share_config *scfg, const char *opt_name, bool defval)
{
- const char *val;
+ char *val;
- val = sldb_string_option(scfg, opt_name, NULL);
+ val = sldb_string_option(scfg, scfg, opt_name, NULL);
if (val == NULL) return defval;
- if (strcasecmp(val, "true") == 0) return true;
+ if (strcasecmp(val, "true") == 0) {
+ TALLOC_FREE(val);
+ return true;
+ }
+ TALLOC_FREE(val);
return false;
}
* this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
*/
enum srvsvc_ShareType share_type = 0;
- const char *sharetype;
+ char *sharetype;
if (!share_bool_option(scfg, SHARE_BROWSEABLE, SHARE_BROWSEABLE_DEFAULT)) {
share_type |= STYPE_HIDDEN;
}
- sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
+ sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
share_type |= STYPE_IPC;
+ TALLOC_FREE(sharetype);
return share_type;
}
if (sharetype && strcasecmp(sharetype, "PRINTER") == 0) {
share_type |= STYPE_PRINTQ;
+ TALLOC_FREE(sharetype);
return share_type;
}
+ TALLOC_FREE(sharetype);
share_type |= STYPE_DISKTREE;
return share_type;
/* This hardcoded value should go into a ldb database! */
const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
- const char *sharetype;
+ char *sharetype;
char *p;
-
- sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
+ char *path;
+
+ sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
+ TALLOC_FREE(sharetype);
return talloc_strdup(mem_ctx, "");
}
- p = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PATH, ""));
+ TALLOC_FREE(sharetype);
+
+ p = share_string_option(mem_ctx, scfg, SHARE_PATH, "");
if (!p) {
return NULL;
}
}
all_string_sub(p, "/", "\\", 0);
- return talloc_asprintf(mem_ctx, "C:%s", p);
+ path = talloc_asprintf(mem_ctx, "C:%s", p);
+ TALLOC_FREE(p);
+ return path;
}
/* This hardcoded value should go into a ldb database! */
info->info1->name = talloc_strdup(mem_ctx, scfg->name);
W_ERROR_HAVE_NO_MEMORY(info->info1->name);
info->info1->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg);
- info->info1->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
+ info->info1->comment = share_string_option(mem_ctx, scfg, SHARE_COMMENT, "");
W_ERROR_HAVE_NO_MEMORY(info->info1->comment);
return WERR_OK;
info->info2->name = talloc_strdup(mem_ctx, scfg->name);
W_ERROR_HAVE_NO_MEMORY(info->info2->name);
info->info2->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg);
- info->info2->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
+ info->info2->comment = share_string_option(mem_ctx, scfg, SHARE_COMMENT, "");
W_ERROR_HAVE_NO_MEMORY(info->info2->comment);
info->info2->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, scfg);
info->info2->max_users = share_int_option(scfg, SHARE_MAX_CONNECTIONS, SHARE_MAX_CONNECTIONS_DEFAULT);
info->info2->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, scfg);
info->info2->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, scfg);
W_ERROR_HAVE_NO_MEMORY(info->info2->path);
- info->info2->password = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PASSWORD, NULL));
+ info->info2->password = share_string_option(mem_ctx, scfg, SHARE_PASSWORD, NULL);
return WERR_OK;
}
info->info501->name = talloc_strdup(mem_ctx, scfg->name);
W_ERROR_HAVE_NO_MEMORY(info->info501->name);
info->info501->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg);
- info->info501->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
+ info->info501->comment = share_string_option(mem_ctx, scfg, SHARE_COMMENT, "");
W_ERROR_HAVE_NO_MEMORY(info->info501->comment);
info->info501->csc_policy = share_int_option(scfg, SHARE_CSC_POLICY, SHARE_CSC_POLICY_DEFAULT);
info->info502->name = talloc_strdup(mem_ctx, scfg->name);
W_ERROR_HAVE_NO_MEMORY(info->info502->name);
info->info502->type = dcesrv_common_get_share_type(mem_ctx, dce_ctx, scfg);
- info->info502->comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
+ info->info502->comment = share_string_option(mem_ctx, scfg, SHARE_COMMENT, "");
W_ERROR_HAVE_NO_MEMORY(info->info502->comment);
info->info502->permissions = dcesrv_common_get_share_permissions(mem_ctx, dce_ctx, scfg);
info->info502->max_users = share_int_option(scfg, SHARE_MAX_CONNECTIONS, SHARE_MAX_CONNECTIONS_DEFAULT);
info->info502->current_users = dcesrv_common_get_share_current_users(mem_ctx, dce_ctx, scfg);
info->info502->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, scfg);
W_ERROR_HAVE_NO_MEMORY(info->info502->path);
- info->info502->password = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PASSWORD, NULL));
+ info->info502->password = share_string_option(mem_ctx, scfg, SHARE_PASSWORD, NULL);
info->info502->sd_buf.sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, scfg);
return WERR_OK;
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
- path = share_string_option(scfg, SHARE_PATH, NULL);
+ path = share_string_option(mem_ctx, scfg, SHARE_PATH, NULL);
if (!path) continue;
- if (strcmp(device, path) == 0) {
- type = share_string_option(scfg, SHARE_TYPE, NULL);
+ if (strcmp(device, path) == 0) {
+ type = share_string_option(mem_ctx, scfg, SHARE_TYPE, NULL);
if (!type) continue;
if (strcmp(type, "DISK") == 0) {
enum ntvfs_type type;
struct share_context *sctx;
struct share_config *scfg;
- const char *sharetype;
+ char *sharetype;
union smb_tcon tcon;
const struct tsocket_address *local_address;
const struct tsocket_address *remote_address;
#endif
/* work out what sort of connection this is */
- sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
+ sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
if (sharetype && strcmp(sharetype, "IPC") == 0) {
type = NTVFS_IPC;
} else if (sharetype && strcmp(sharetype, "PRINTER")) {
type = NTVFS_DISK;
}
+ TALLOC_FREE(sharetype);
+
c = talloc(mem_ctx, struct srvsvc_ntvfs_ctx);
NT_STATUS_HAVE_NO_MEMORY(c);
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? */
}
/* 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";
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 */
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) {
}
/* 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) {
} else {
type = NTVFS_DISK;
}
+ TALLOC_FREE(sharetype);
tcon = smbsrv_smb2_tcon_new(req->session, scfg->name);
if (!tcon) {