1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

make sure that the event script is executable and just ignore it

othervise

(This used to be ctdb commit 65eb7845c70489d654acaaf99cd2c8eac7df11dc)
This commit is contained in:
Ronnie Sahlberg 2007-08-21 09:22:14 +10:00
parent aed2c58c64
commit b582e13cae

View File

@ -98,6 +98,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
while ((de=readdir(dir)) != NULL) { while ((de=readdir(dir)) != NULL) {
int namlen; int namlen;
unsigned num; unsigned num;
char *str;
namlen = strlen(de->d_name); namlen = strlen(de->d_name);
@ -118,6 +119,18 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
continue; continue;
} }
/* Make sure the event script is executable */
str = talloc_asprintf(tree, "%s/%s", ctdb->takeover.event_script_dir, de->d_name);
if (stat(str, &st) != 0) {
DEBUG(0,("Could not stat event script %s. Ignoring this event script\n", str));
continue;
}
if (!(st.st_mode & S_IXUSR)) {
DEBUG(0,("Event script %s is not executable. Ignoring this event script\n", str));
continue;
}
/* store the event script in the tree */ /* store the event script in the tree */
script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name)); script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name));
if (script != NULL) { if (script != NULL) {