mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:mdssvc: make use of lp_parm_const_string()
We don't need any substitution for elasticsearch options. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
236857b434
commit
564049fbc9
@ -965,7 +965,7 @@ sub setup_fileserver
|
||||
spotlight backend = elasticsearch
|
||||
elasticsearch:address = 127.0.0.35
|
||||
elasticsearch:port = 8080
|
||||
elasticsearch:mappings = \"$srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json\"
|
||||
elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json
|
||||
|
||||
usershare path = $usershare_dir
|
||||
usershare max shares = 10
|
||||
|
@ -39,7 +39,7 @@ int main(int argc, char **argv)
|
||||
json_t *mappings = NULL;
|
||||
json_error_t json_error;
|
||||
char *default_path = NULL;
|
||||
char *path = NULL;
|
||||
const char *path = NULL;
|
||||
const char *query_string = NULL;
|
||||
const char *path_scope = NULL;
|
||||
char *es_query = NULL;
|
||||
@ -67,12 +67,10 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
path = lp_parm_talloc_string(mem_ctx,
|
||||
GLOBAL_SECTION_SNUM,
|
||||
"elasticsearch",
|
||||
"mappings",
|
||||
default_path);
|
||||
TALLOC_FREE(default_path);
|
||||
path = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"elasticsearch",
|
||||
"mappings",
|
||||
default_path);
|
||||
if (path == NULL) {
|
||||
TALLOC_FREE(mem_ctx);
|
||||
return 1;
|
||||
|
@ -55,7 +55,7 @@ static bool mdssvc_es_init(struct mdssvc_ctx *mdssvc_ctx)
|
||||
struct mdssvc_es_ctx *mdssvc_es_ctx = NULL;
|
||||
json_error_t json_error;
|
||||
char *default_path = NULL;
|
||||
char *path = NULL;
|
||||
const char *path = NULL;
|
||||
|
||||
mdssvc_es_ctx = talloc_zero(mdssvc_ctx, struct mdssvc_es_ctx);
|
||||
if (mdssvc_es_ctx == NULL) {
|
||||
@ -78,12 +78,10 @@ static bool mdssvc_es_init(struct mdssvc_ctx *mdssvc_ctx)
|
||||
return false;
|
||||
}
|
||||
|
||||
path = lp_parm_talloc_string(mdssvc_es_ctx,
|
||||
GLOBAL_SECTION_SNUM,
|
||||
"elasticsearch",
|
||||
"mappings",
|
||||
default_path);
|
||||
TALLOC_FREE(default_path);
|
||||
path = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"elasticsearch",
|
||||
"mappings",
|
||||
default_path);
|
||||
if (path == NULL) {
|
||||
TALLOC_FREE(mdssvc_es_ctx);
|
||||
return false;
|
||||
@ -93,11 +91,10 @@ static bool mdssvc_es_init(struct mdssvc_ctx *mdssvc_ctx)
|
||||
if (mdssvc_es_ctx->mappings == NULL) {
|
||||
DBG_ERR("Opening mapping file [%s] failed: %s\n",
|
||||
path, json_error.text);
|
||||
TALLOC_FREE(path);
|
||||
TALLOC_FREE(mdssvc_es_ctx);
|
||||
return false;
|
||||
}
|
||||
TALLOC_FREE(path);
|
||||
TALLOC_FREE(default_path);
|
||||
|
||||
mdssvc_ctx->backend_private = mdssvc_es_ctx;
|
||||
return true;
|
||||
@ -187,6 +184,7 @@ static struct tevent_req *mds_es_connect_send(
|
||||
struct tevent_req *req = NULL;
|
||||
struct tevent_req *subreq = NULL;
|
||||
struct mds_es_connect_state *state = NULL;
|
||||
const char *server_addr = NULL;
|
||||
bool use_tls;
|
||||
NTSTATUS status;
|
||||
|
||||
@ -199,12 +197,16 @@ static struct tevent_req *mds_es_connect_send(
|
||||
.mds_es_ctx = mds_es_ctx,
|
||||
};
|
||||
|
||||
state->server_addr = lp_parm_talloc_string(
|
||||
state,
|
||||
server_addr = lp_parm_const_string(
|
||||
mds_es_ctx->mds_ctx->snum,
|
||||
"elasticsearch",
|
||||
"address",
|
||||
"localhost");
|
||||
state->server_addr = talloc_strdup(state, server_addr);
|
||||
if (tevent_req_nomem(state->server_addr, req)) {
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
state->server_port = lp_parm_int(
|
||||
mds_es_ctx->mds_ctx->snum,
|
||||
"elasticsearch",
|
||||
|
Loading…
Reference in New Issue
Block a user