[Xymon] FILE type=symlink
Mike Williams
mike.williams at sectigo.com
Wed Dec 11 12:20:40 CET 2019
Hi,
I've come across two threads regarding Xymon checking that FILE is
type=symlink.
Both talked about an untested patch, which has been included for "some
time".
However, it doesn't work. I'd get the same "File is a file - should be
symlink" (
https://xymon.xymon.narkive.com/Fn4s9A2v/checking-for-symlinks)
So I fixed it, I think.
Patch attached.
In case the attachment doesn't come through, the only code change is
this;
Index: xymond/client_config.c
===================================================================
--- xymond/client_config.c (revision 8119)
+++ xymond/client_config.c (working copy)
@@ -2665,13 +2665,13 @@
tstr = strchr(boln, '(');
if (tstr) {
- if (strncmp(tstr, "(file", 5) == 0)
ftype = S_IFREG;
+ if (strncmp(tstr, "(file)", 6) == 0)
ftype = S_IFREG;
else if (strncmp(tstr, "(directory",
10) == 0) ftype = S_IFDIR;
else if (strncmp(tstr, "(char-device",
12) == 0) ftype = S_IFCHR;
else if (strncmp(tstr, "(block-device",
13) == 0) ftype = S_IFBLK;
else if (strncmp(tstr, "(FIFO", 5) ==
0) ftype = S_IFIFO;
else if (strncmp(tstr, "(socket", 7) ==
0) ftype = S_IFSOCK;
- else if (strstr(tstr, ", symlink -> ")
== 0) islink = 1;
+ else if (strncmp(tstr, "(file, symlink
-> ", 18) == 0) ftype = S_IFLNK, islink = 1;
}
}
else if (strncmp(boln, "mode:", 5) == 0) {
The rest is just changing the references to "Triggers warning if the
file is not of the specified type" to include "symlink".
I'm not convinced by changing the S_IFREG match to '"(file)", 6', maybe
there are other types of file I don't know about.
Possibly putting the revised S_IFLNK match before an unmodified S_IFREG
match is best.
Also I haven't checked that setting 'ftype = S_IFLNK' is necessary.
--
Mike Williams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20191211/71c88415/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: type-symlink.patch
Type: text/x-patch
Size: 4124 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20191211/71c88415/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5629 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20191211/71c88415/attachment-0001.bin>
More information about the Xymon
mailing list