diff options
author | Ronnie Sahlberg <sahlberg@ronnie> | 2007-08-21 09:22:14 +1000 |
---|---|---|
committer | Ronnie Sahlberg <sahlberg@ronnie> | 2007-08-21 09:22:14 +1000 |
commit | b582e13cae11483add6e95433b04b9fe3006794f (patch) | |
tree | fe19c4953654b768e1310e65fe8bd255d9dffb83 /ctdb/server/eventscript.c | |
parent | aed2c58c641e4fb6ebb28a16062c75974b7d2d1c (diff) | |
download | samba-b582e13cae11483add6e95433b04b9fe3006794f.tar.gz samba-b582e13cae11483add6e95433b04b9fe3006794f.tar.xz samba-b582e13cae11483add6e95433b04b9fe3006794f.zip |
make sure that the event script is executable and just ignore it
othervise
(This used to be ctdb commit 65eb7845c70489d654acaaf99cd2c8eac7df11dc)
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r-- | ctdb/server/eventscript.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index ec4fb80e35..afb86d742d 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -98,6 +98,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li while ((de=readdir(dir)) != NULL) { int namlen; unsigned num; + char *str; namlen = strlen(de->d_name); @@ -117,6 +118,18 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li if (sscanf(de->d_name, "%02u.", &num) != 1) { 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 */ script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name)); |