-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cacti regular expression searching does not quote expressions #4080
Comments
That's quite odd. |
@andyb2000, I'm going to commit a simple fix and I need you to test it out. Let me know if it fixes the issue. The issue is with regular expression quoting for special character handling I think, but you will need to update graph_view.php to the 1.2.x branch version and then test and provide feedback. If you don't want to take the whole file, just look at the diff. The changes are very small. |
- Cacti regular expression searching does not quote expressions
Okay, changes are in. |
Thanks for taking a look @TheWitness No search results and in the search box it doesn't populate Gi1/0/14 |
Is external_id even included. I have to check that. |
So, open graph view, and goto line ~458 and add the following: cacti_log(str_replace("\n", " ", $sql_where)); Then run your tests and post back what you find in the Cacti log. Then, play with the following logic, using the regular expression: SELECT title_cache FROM graph_templates_graph RLIKE 'whatever from thelog'; Let me know what you find. |
This change provides additional fixups. Though the problems is really the regular expression and beyond Cacti's control.
I've made another change. I think this may go back to a MySQL/MariaDB issue. They have made some changes recently to the way they handle regular expressions. You should upgrade your database, implement the minor changes that I have made, and if you still have problems, use my advice above. It's all working for simple cases for me. |
Describe the bug
A clear and concise description of what the bug is.
I use an external tool to link and search specific graphs, I do this by referencing graph_view.php with get variables to carry out the search. An example url is:
/cacti/graph_view.php?action=preview&external_id=191&rfilter=Gi1/0/12
This returns no matches, and the "Search" filter box is empty. If you then type in Gi1/0/12 into the Search filter box it works. (POST'd variable?)
There appears to be a bug in the parser for rfilter that uses get_request_var (lib/html_utility.php) called from graph_view.php Some work and some do not. So for example:
/cacti/graph_view.php?action=preview&external_id=191&rfilter=Gi1/0/1
WORKS
/cacti/graph_view.php?action=preview&external_id=191&rfilter=Gi1/0/10
DOES NOT
It appears to be when two digits or more are on the end of the gig int variable. I suspect this is due to the slashes being stripped/interpreted.
To Reproduce
Use a get/query to search for something that is known to exist using the Gi1/0/12 prefix or similar Cisco naming convention:
/cacti/graph_view.php?action=preview&external_id=191&rfilter=Gi1/0/12
Fails, whilst:
/cacti/graph_view.php?action=preview&external_id=191&rfilter=Gi1/0/1
Would succeed.
Expected behavior
Search would return values and Search box would show the get query.
Desktop (please complete the following information)
OS: Windows 10 enterprise
Browser Chrome (Also tested with Edge and firefox on different operating systems)
Additional context
Cacti version 1.2.10
Ubuntu 20.04.1
The text was updated successfully, but these errors were encountered: