Commit graph

39 commits

Author SHA1 Message Date
Holger Weiss
dc0f25cf76 lib/parse_ini.c: Print proper read error message
Print a useful error message if opening the configuration file fails.
2014-06-18 23:42:57 +02:00
Holger Weiss
48025ff39c lib/parse_ini.c: Drop privileges for reading file
Read the configuration file with privileges temporarily dropped if the
code is used by a setuid plugin.
2014-06-18 23:22:12 +02:00
Holger Weiss
2bf7647be6 lib/parse_ini.c: Add newline to die() calls
Our die() function doesn't append a newline character to the message.
2014-06-18 23:15:21 +02:00
Holger Weiss
b81c10e00c lib/parse_ini.c: Cosmetic change
Replace an "if" with the ternary operator.
2014-06-18 23:09:02 +02:00
Holger Weiss
f0b22b37f9 lib/parse_ini.c: Search for INI file in subdirs
Add two path names to the list of default INI file locations, as some
users/distributions prefer to put configuration files into
subdirectories.
2014-06-18 18:39:32 +02:00
Holger Weiss
6da7dba782 lib/parse_ini.c: Add comment on NAGIOS_CONFIG_PATH
We might want to spit out a warning when NAGIOS_CONFIG_PATH is used.

While at it, move the function that handles this environment variable to
the bottom.
2014-06-18 10:53:44 +02:00
Holger Weiss
1890cfccdf lib/parse_ini.c: Cosmetic changes to comments 2014-06-18 10:52:09 +02:00
Holger Weiss
f627b3f33b lib/parse_ini.c: Fix Clang warnings 2014-06-18 10:45:14 +02:00
Holger Weiss
11bfb0def2 lib/parse_ini.[ch]: Change code formatting
Change the indentation and formatting of the code in lib/parse_ini.c.
This breaks patches against that file and makes it harder to track its
history, but it (hopefully) improves readability a lot.
2014-06-18 10:37:10 +02:00
Holger Weiss
e2b8169869 lib/parse_ini.c: Don't cast malloc(3) result
There's no need to cast malloc(3)'s return value.
2014-06-18 01:21:31 +02:00
Holger Weiss
95ed0a996c lib/parse_ini.c: Remove outdated comment and code
The lib/parse_ini.c:np_get_defaults() function now dies if no
configuration file is found.
2014-06-18 00:50:48 +02:00
Holger Weiss
fbe13d8f32 lib/parse_ini.c: Read $MP_CONFIG_FILE
Read $MP_CONFIG_FILE if that variable is set in the environment.
2014-06-18 00:47:35 +02:00
Holger Weiss
f94e95785c lib/parse_ini.c: Read "monitoring-plugins.ini"
Read "monitoring-plugins.ini" if that file exists, but fall back to
reading "plugins.ini" or "nagios-plugins.ini" for backward
compatibility.
2014-06-18 00:39:38 +02:00
Holger Weiss
f02b3f6b28 lib/parse_ini.[ch]: Simplify code
Rewrite the code that looks up the INI configuration file path (used by
the Extra-Opts feature) in order to improve readability.  The behaviour
should not have changed.
2014-06-18 00:37:45 +02:00
Thomas Guyot-Sionnest
25a289f307 Clean up parse_ini error messages, add missing newlines 2014-01-25 04:13:32 -05:00
Thomas Guyot-Sionnest
c2c24bc564 Use access() instead of stat() in parse_ini.c 2014-01-24 08:30:57 -05:00
Holger Weiss
a8c9b696f4 Minor fixes to be amended into "rename" commit 2014-01-20 03:01:55 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
This is an initial take at renaming the project to Monitoring Plugins.
It's not expected to be fully complete, and it is expected to break
things (The perl module for instance). More testing will be required
before this goes mainline.
2014-01-19 14:18:47 -05:00
Thomas Guyot-Sionnest
485f306868 Return UNKNOWN if none of the default files can be found.
It makes no sense to return unknown if an implicit section is not found, but
go on if the file is missing
2009-01-22 02:24:39 -05:00
Thomas Guyot-Sionnest
6fbd14fea5 Removing CVS/SVN tags and replacing with git-based versioning
For contrib/, full tags have been imported from subversion


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-23 05:38:47 +00:00
Thomas Guyot-Sionnest
caa8bd6423 Bulk EOL cleanup
$ git diff --ignore-space-change|diffstat
 0 files changed


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2087 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-19 06:45:18 +00:00
Thomas Guyot-Sionnest
51ec51a8dc Make extra-opts (C plugins) behave more like N::P:
N::P allows both '#' and ';' for comments. Extra-opts used to allow only '#', it now allows both (';' is the standard for ini files)
  Extra-opts does not allow trailing comments anymore (like N::P)



git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2063 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-04 17:41:53 +00:00
Thomas Guyot-Sionnest
77362a18ba Typos in comments
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2035 f882894a-f735-0410-b71e-b25c423dba1c
2008-08-21 04:17:25 +00:00
Thomas Guyot-Sionnest
2a4640f671 make parse_ini die like in N::P if section isn't found
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1976 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-04 10:11:22 +00:00
Thomas Guyot-Sionnest
0d13deb0e4 - Add --enable-extra-opts configure option for compiling extra-opts support
- Auto-update po/pot files


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1973 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-02 09:11:44 +00:00
Thomas Guyot-Sionnest
63897a4179 fix the obvious...
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1972 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-01 09:38:37 +00:00
Thomas Guyot-Sionnest
20a8bf1a3f Fix for last commit - I accidentaly broke my local Makefile and tests weren't being re-compiled.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1968 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-31 05:31:14 +00:00
Thomas Guyot-Sionnest
af71e9fc0e write ini-file lookup function + tests
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1962 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-26 09:46:27 +00:00
Thomas Guyot-Sionnest
dce143e354 Replace broken usage of NAGIOS_CONFIG_PATH with a stub function (that will try to find a config file in the future...)
Allow NULL locator (default file/section)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1960 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-24 06:28:46 +00:00
Thomas Guyot-Sionnest
92b969e239 parse_ini now reads the default section if the request one can't be found.
All tests should return ok now.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1950 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-15 22:42:01 +00:00
Thomas Guyot-Sionnest
252d9a78cc Oops - this line shouldn't have been here (doesn't even work anyways) ;)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1949 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-15 21:51:43 +00:00
Thomas Guyot-Sionnest
1a0ed0d6bb - Make equal-less parameters illegal
- parameters without argument after '=' are now assumed to be argument-less
- Add a testcase for space in stanza and various argument-less parameters


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1948 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-15 20:47:43 +00:00
Thomas Guyot-Sionnest
40c123148a Fix handling of leading and trailing spaces in stanza
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1947 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-15 20:34:15 +00:00
Thomas Guyot-Sionnest
ffab7ee68b Fix segfault in test_ini.c and uncomment the affected tests
Fix bug in stanza parsing where full section could be skipped
Fix single-argument options


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1946 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-15 16:17:49 +00:00
Thomas Guyot-Sionnest
6004d95868 This commit consist of two changes:
1. Make np_get_defaults return a linked list instead of a string. It will then be easy to convert the linked list back to an argument array.
2. Fix tests 3-4 of test_ini.c.

A test_ini.t was added too. parse_ini and test_ini aren't included yet in the build makefiles.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1945 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-15 04:51:45 +00:00
Thomas Guyot-Sionnest
fafb8ead9d Bump /lib to GPLv3
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1913 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-30 09:33:43 +00:00
Thomas Guyot-Sionnest
60b672d496 new standardized GPLv3 header (will be applied to all C files)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1912 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-30 09:03:29 +00:00
Ton Voon
88ff556670 Added test files to test the parse_ini.c routines. Requires libtap
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1614 f882894a-f735-0410-b71e-b25c423dba1c
2007-02-07 14:46:50 +00:00
M. Sean Finney
a70fb5becf initial version of ini file parsing routines in C
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1610 f882894a-f735-0410-b71e-b25c423dba1c
2007-02-06 19:33:55 +00:00