Closed (cannot reproduce)
Project:
Image
Version:
6.x-1.x-dev
Component:
image_gallery
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jul 2006 at 19:35 UTC
Updated:
21 Dec 2010 at 02:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
JamieR commentedFound the security risk:
On the "my account" page the user can access tac_lite settings for themselves and change thier level of access.
Comment #2
JamieR commentedI closed this as I looks like this has more to do with the image.module than tac_lite. Thanks.
Comment #3
JamieR commentedMoving to image.module
Comment #4
Dave Cohen commentedJust FYI, the tests with na.realm='tac_lite' are added by tac_lite in hook_db_rewrite_sql. They are designed to alter the query to return only nodes the current user is allowed to see. If they are in fact causing a problem, please let me know.
If you give users administer_tac_lite privelege, it should bypass adding that stuff to the query. So if doing that solves the problem, the problem may be somehow caused by db_rewrite_sql. You should not give those users that permission, however. It will allow them to see all content as if tac_lite were not installed. Perhaps in your case you do not need it???
I wrote tac_lite. I don't have a postgres environment to test. I've only tried it with mysql.
Comment #5
JamieR commentedExcellent - just the guy I'd want to talk to then! Yes the module is behaving exactly as you describe. All users can view all the image galleries. Which is actually bad. I just hadn't found that until after I brought up the other issue. Please let me know how I can help you. How I can help you help me! ;)
Thanks a lot - I guess I should move this back to tac_lite...
Comment #6
Dave Cohen commentedI'm pretty sure the issue is not with tac_lite so I'm moving it back to image. Not sure it's there, either. It's hard to know which module is generating those queries.
You have two problems, each query is failing for a different reason.
The first is related to http://drupal.org/node/69560. Change the query that begins "SELECT DISTINCT(n.nid) FROM node n" to begin "SELECT DISTINCT(n.nid), n.sticky, n.created FROM node n". In other words, put all the fields used in the order by clause into the select clause.
The second query simply ends with "AND n.nid = ". There needs to be a numerical nid there. Probably a case of code not checking that an nid exists before executing the query.
I don't use the image module or postgres, so I may have reached my limit on how to help with this.
Comment #7
JamieR commentedI added the ORDER BY fields to the SELECT statements in the two query strings in function image_gallery_page. They end up looking like this:
This fixed the first error I was getting but the other persisted:
I was unable to track down anything in the image_gallery.module or the tac_lite.module having to do with this error. So, I went and created a new Drupal installation and started over with these two modules, thinking that perhaps the error was having to do with the other error saving a wrong setting in the database.
The good news is that the new installation worked! No errors. Tested all options and configurations that I could think of. the bad news is that I have put A LOT of work into my installation that is still getting the errors, and I could really use some help finding that bug and getting it out of my database!
I've tried:
- enabling/unenabling the gallery and tac_lite modules
- removing some image gallery related row in the variable and vocabulary database tables
- dropping all the image nodes and recreating them as well as the gallery pages
Any other suggestions? I should probably post this on the forums... more traffic.
This revision should be implemented into the repository
Thank you! Jamie.
Comment #8
JamieR commentedTracked down the other error. It had nothing to do with a clean installation. Here is are the patches. I've done two more but can't commit into this project. Someone please help.
First one fixes the error messages that result from querying when there are no nodes showing up in a gallery:
The important line is:
if($last->nid > 0) { $galleries[$i]->latest = node_load(array('nid' => $last->nid)); }The rest of the changes were just so that I could debug.
The second patch just hides the display of the gallery if there are no images in it (or if no images show up because of tac_lite - the gallery page itself can't be controled by tac_lite because it is not a node)
Here the important lines are:
if ($gallery->count > 0) {and the '}' that closes the statement.
I really hope this helps someone else, as I've spent more time on it than I'd have liked. ;)
Comment #9
JamieR commentedI'm attaching the revised image_gallery.module for someone to commit. Thanks!
Comment #10
walkah commentedcan you please provide a proper patch file? Thanks.
For more information check : http://drupal.org/diffandpatch
Comment #11
JamieR commentedThanks for bearing with me - my first patch file... There are a few style changes that show up in the patch file that aren't really necessary, but that helped me troubleshoot. If you don't like them, can you just edit the patch file? Let me know if I should do something. Thank you!
Comment #12
drewish commentedthe patch is correct but you've added newlines to break up several of the queries. this makes it very hard to visually inspect the changes and is discouraged.
Comment #13
sunComment #14
xurizaemonremoving line breaks in SQL queries
Comment #15
sunNeeds to be re-rolled, because some other patches landed. Also, the coding-style lacks in some places. Please read http://drupal.org/coding-standards
Comment #16
sunSorry, but it doesn't look like this is still an issue.
Feel free to re-open this issue if you want to provide further information. Thanks.