xWyatt / check_rest_api

Nagios Core plugin to check output from a RESTful JSON API
GNU General Public License v3.0
10 stars 5 forks source link

Error with compiling the program #10

Closed Gianni-Caselli closed 3 years ago

Gianni-Caselli commented 3 years ago

Hi again :)

Firts, thanks for the quick response to my last question.

Now I donwloaded the new release but I get this error when I try to compile it:

read_input.c: In function ‘validateArguments’: read_input.c:290:14: error: format not a string literal and no format arguments [-Werror=format-security] printf(version); ^ read_input.c:291:14: error: format not a string literal and no format arguments [-Werror=format-security] printf(helpMessage); ^ read_input.c:297:14: error: format not a string literal and no format arguments [-Werror=format-security] printf(version); ^ read_input.c:449:12: error: format not a string literal and no format arguments [-Werror=format-security] printf(helpMessage); ^ cc1: all warnings being treated as errors Makefile:8: recipe for target 'read_input.o' failed make: *** [read_input.o] Error 1

Can you upload the program already compiling as in the release 1.0.0?

For more information, I use a server Ubuntu 16.04.7 LTS X86-64

Thanks!

BR.

xWyatt commented 3 years ago

Oops - I attached the binary to the v1.0.1 release. You should be able to download it now.

Interesting that format-security is an error by default. I'm assuming that's a Debian/Ubuntu hardening thing but I'll need to look into it further.

You could probably get around that by appending -Wno-error=format-security to CLAGS in the Makefile. I don't have an Ubuntu machine laying around to test though.

Gianni-Caselli commented 3 years ago

Wyatt, I added this line to CFLAG and the warnings messages persist but it doesn't stop the Make, the compiling finished.

to make --insecure work, I added the line curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); too. with the VERIFYPEER = 0and VERIFYHOST = 0 It worked for me.

if (argVals->insecureSSL == 1) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); }

Another thing, when I use the -K option I get the error "Bad argument: key", with the --key= option it response 200-OK, although the key doesn't exist. And if I add for example: --key=alerts -w 1 -c 2, I get this error: Number of -w, --warning values must match number of -K, --key values! (only one alerts key exist)

The latest errors maybe due to a bad compilation?

xWyatt commented 3 years ago

Just want to confirm the --insecure option was not working without SSL_VERIFYHOST being present. If so I'll add that in addition to the SSL_VERIFYPEER option that I had changed.

The --key issue, I believe, is due to bad documentation/bad help text. The syntax should not include =. Example: