Cacti - Validation error on new graph

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

hellup
Posts: 2
Joined: Sun Jul 13, 2014 5:56 pm

Cacti - Validation error on new graph

Post by hellup »

Hi All,

New on the forum and was 'forced' to post something since i have an issue with my cacti installation. I am running Debian 7, 32-bit with Cacti from apt repo.

When i try to add graph to a tree it gives the error 'Validation error' when i submit with 'Go'. I already removed (apt-get remove --purge) the install and reinstalled from scratch, however this didn't help. I have searched for it online, but can online find very old posts dating 2006/2007 which were fixed after an upgrade. The page that is required for this action is 'graphs.php' which runs fine, except doing this action.

Could somebody please help me out? Thanks!
Lamneth
Posts: 2
Joined: Mon Oct 15, 2012 1:49 pm

Re: Cacti - Validation error on new graph

Post by Lamneth »

I'm also having the same issue. Currently running version 0.8.8b.
hellup
Posts: 2
Joined: Sun Jul 13, 2014 5:56 pm

Re: Cacti - Validation error on new graph

Post by hellup »

I just installed cacti from source, version 8.8b, this works without issues.
rune
Posts: 7
Joined: Thu Jul 17, 2014 2:28 pm

Re: Cacti - Validation error on new graph

Post by rune »

I am having the same issue on Debian 7 (64bit) after most recent package update. Anyone?
justruss
Posts: 8
Joined: Thu Jul 17, 2014 2:33 pm

Re: Cacti - Validation error on new graph

Post by justruss »

I ran into this same exact message. It happened on an older Debian 6.0.9 box I have.

I read through the code. The problem is that when you do the form execute to add a graph to the tree, it calls a function in graphs.php, called "form_actions".

Inside that function, one of the first things it does is input validation with a function call "input_validate_input_number(get_request_var_post('drp_action'))". This function makes sure the option value for the form submission is a number.

However, if you look at the form submission HTML on that graph page, for the add to graph tree submission, the options are all numbers except for the add to tree stuff. Like this:

Code: Select all

<option value="2">Change Graph Template</option>
<option value="5">Change Host</option>
<option value="6">Reapply Suggested Names</option>
<option value="7">Resize Graphs</option>
<option value="3">Duplicate</option>
<option value="4">Convert to Graph Template</option>
<option value="tr_2">Place on a Tree (ActiveMQ)</option>
<option value="tr_3">Place on a Tree (Backup)</option>
<option value="tr_4">Place on a Tree (Caching)</option>
Since tr_3 or tr_4 or whatever, is not a number, it will always bail out with a validation error.

I just commented out the input validation at the top of that function and it all began to work.

I'm not sure if this is a bug or something else on these systems is screwed up. I run a lot of Cacti installs and this is the only one that had the problem. On my newer Cacti installs this integer check is done inside if/else statements further within the function.

Hope this helps!
justruss
Posts: 8
Joined: Thu Jul 17, 2014 2:33 pm

Re: Cacti - Validation error on new graph

Post by justruss »

This is the bit I commented out in graphs.php:

Code: Select all

function form_actions() {
        global $colors, $graph_actions;

        /* ================= input validation ================= */
        //input_validate_input_number(get_request_var_post('drp_action'));
        /* ==================================================== */
cigamit
Developer
Posts: 3363
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Cacti - Validation error on new graph

Post by cigamit »

It is a bug with the automate plugin. We had to ensure validation on the forums to stop a security exploit. The form is indeed suppose to be a number, and automate will need to be changed to conform to this.
rune
Posts: 7
Joined: Thu Jul 17, 2014 2:28 pm

Re: Cacti - Validation error on new graph

Post by rune »

justruss wrote:This is the bit I commented out in graphs.php:

Code: Select all

function form_actions() {
        global $colors, $graph_actions;

        /* ================= input validation ================= */
        //input_validate_input_number(get_request_var_post('drp_action'));
        /* ==================================================== */

Thanks, but that did not work for me.
Commented out, removed, didn't matter... same "validation error" on submit. (yes, I restarted the web server post edit). I was hopeful.

I did find a bug submission:
http://www.mail-archive.com/debian-bugs ... 38007.html
justruss
Posts: 8
Joined: Thu Jul 17, 2014 2:33 pm

Re: Cacti - Validation error on new graph

Post by justruss »

Try going into /usr/share/cacti/site/lib/html_validate.php

In there you'll see a few small functions for validation, each of them ends with:

Code: Select all

die_html_input_error();
Prior to that line add a couple debug lines like this:

Code: Select all


function input_validate_input_number($value) {
        if ((!is_numeric($value)) && ($value != "")) {
                echo "<h2>input_validate_input_number</h2>";
                echo "Value: $value";
                die_html_input_error();
        }
}

Then try doing the submission again and paste the result. You shouldn't need to reload the web server.
rune
Posts: 7
Joined: Thu Jul 17, 2014 2:28 pm

Re: Cacti - Validation error on new graph

Post by rune »

justruss wrote:Try going into /usr/share/cacti/site/lib/html_validate.php

In there you'll see a few small functions for validation, each of them ends with:

Code: Select all

die_html_input_error();
Prior to that line add a couple debug lines like this:

Code: Select all


function input_validate_input_number($value) {
        if ((!is_numeric($value)) && ($value != "")) {
                echo "<h2>input_validate_input_number</h2>";
                echo "Value: $value";
                die_html_input_error();
        }
}

Then try doing the submission again and paste the result. You shouldn't need to reload the web server.


Adding that segment causes a white screen, the app does nothing until I remove it.
justruss
Posts: 8
Joined: Thu Jul 17, 2014 2:33 pm

Re: Cacti - Validation error on new graph

Post by justruss »

You must have a typo, it's blank screening because PHP found a syntax error.

Try running the php from the command line like:

php /usr/share/cacti/site/lib/html_validate.php

Look for missing semi-colons, unclosed brackets, etc.
rune
Posts: 7
Joined: Thu Jul 17, 2014 2:28 pm

Re: Cacti - Validation error on new graph

Post by rune »

justruss wrote:You must have a typo, it's blank screening because PHP found a syntax error.

Try running the php from the command line like:

php /usr/share/cacti/site/lib/html_validate.php

Look for missing semi-colons, unclosed brackets, etc.


got it. sorry.
result:
---
input_validate_input_number

Value: tr_1
Validation error.
---
justruss
Posts: 8
Joined: Thu Jul 17, 2014 2:33 pm

Re: Cacti - Validation error on new graph

Post by justruss »

Well the good new is you're running into the same issue I described, the bad news is you should have been all set by commenting out that bit I referred to earlier.

Can you paste the first 100 lines or so from the function form_actions() inside /usr/share/cacti/site/graphs.php?
yorkdata
Posts: 5
Joined: Tue Jul 22, 2014 5:32 am

Re: Cacti - Validation error on new graph

Post by yorkdata »

Hi,

Did you manage to find a fix for this? I too am experiencing this issue, I am using CentOS and have commented out the suggested line however it still says validation error.


Andy
justruss
Posts: 8
Joined: Thu Jul 17, 2014 2:33 pm

Re: Cacti - Validation error on new graph

Post by justruss »

You can try looking for every call in graphs.php to the function input_validate_input_number and comment it out. Then verify if it works, and through the process of elimination, start uncommenting them and see which one breaks it. This approach is a bit hamfisted but will get it working if you're desperate. I modified the code to make it so I could track down where it was breaking for me, but it's a bit much to be able to walk through over the forum.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests