mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-event: Force symbolic link targets to be absolute
If CTDB_BASE is relative then symbolic link targets will be incorrect. Don't force CTDB_BASE to be absolute because this can result in Unix domain socket names that are too long. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
108aca0a9e
commit
61b54193fe
@ -308,6 +308,7 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx,
|
||||
char *subdir = NULL;
|
||||
char *data_dir = NULL;
|
||||
char *etc_dir = NULL;
|
||||
char *t = NULL;
|
||||
struct event_script_list *data_list = NULL;
|
||||
struct event_script_list *etc_list = NULL;
|
||||
unsigned int i, j, matched;
|
||||
@ -328,6 +329,20 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx,
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
t = talloc_size(mem_ctx, PATH_MAX);
|
||||
if (t == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
data_dir = realpath(data_dir, t);
|
||||
if (data_dir == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
return errno;
|
||||
}
|
||||
D_ERR("Command script list finished with result=%d\n", ENOENT);
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
etc_dir = path_etcdir_append(mem_ctx, subdir);
|
||||
if (etc_dir == NULL) {
|
||||
return ENOMEM;
|
||||
@ -550,6 +565,7 @@ static int event_command_script_enable(TALLOC_CTX *mem_ctx,
|
||||
return EINVAL;
|
||||
} else {
|
||||
if (errno == ENOENT) {
|
||||
char *t;
|
||||
char *data_script;
|
||||
|
||||
data_script = path_datadir_append(mem_ctx, script);
|
||||
@ -557,6 +573,22 @@ static int event_command_script_enable(TALLOC_CTX *mem_ctx,
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
t = talloc_size(mem_ctx, PATH_MAX);
|
||||
if (t == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
data_script = realpath(data_script, t);
|
||||
if (data_script == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
return errno;
|
||||
}
|
||||
printf("Script %s does not exist in %s\n",
|
||||
argv[1],
|
||||
argv[0]);
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
ret = stat(data_script, &statbuf);
|
||||
if (ret != 0) {
|
||||
printf("Script %s does not exist in %s\n",
|
||||
|
Loading…
Reference in New Issue
Block a user