Skip to content
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

!= searches could sneak through and not be negated #146

Merged
merged 2 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sal/version.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>version</key>
<string>3.2.4.976</string>
<string>3.2.5.984</string>
</dict>
</plist>
16 changes: 14 additions & 2 deletions search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,32 @@ def search_machines(search_id, machines, full=False):
querystring = {
'%s%s' % (search_row.search_field, operator): search_row.search_term
}
if operator != '':
q_object = Q(**querystring)
else:
q_object = ~Q(**querystring)
elif search_row.search_models == 'Facter':
model = Fact
prepend = 'facts__'
querystring = {
'facts__fact_name': search_row.search_field,
'facts__fact_data%s' % (operator): search_row.search_term
}
if operator != '':
q_object = Q(**querystring)
else:
q_object = ~Q(**querystring)

elif search_row.search_models == 'Condition':
model = Condition
querystring = {
'conditions__condition_name': search_row.search_field,
'conditions__condition_data%s' % (operator): search_row.search_term
}
if operator != '':
q_object = Q(**querystring)
else:
q_object = ~Q(**querystring)


elif search_row.search_models == 'Application Inventory':
Expand All @@ -149,12 +161,11 @@ def search_machines(search_id, machines, full=False):
'inventoryitem__application__%s%s' % (search_field, operator): search_row.search_term
}

if model != None:
if operator != '':
q_object = Q(**querystring)

else:
q_object = ~Q(**querystring)

elif search_row.search_models == 'External Script':
# It must be an exernal thingie if we're here
model = PluginScriptRow
Expand Down Expand Up @@ -210,6 +221,7 @@ def search_machines(search_id, machines, full=False):
queries = row_queries

search_group_counter = search_group_counter + 1
print queries

if full == True:
machines = machines.filter(queries).distinct()
Expand Down
2 changes: 1 addition & 1 deletion set_build_no.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

current_version="3.2.4"
current_version="3.2.5"
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`

Expand Down