Fix quoting of function identifiers in postgresql_privs (issue 703

in ansible/ansible-modules-core on GitHub).

PR:		197325
Submitted by:	olgeni
Approved by:	maintainer
This commit is contained in:
Jimmy Olgeni 2015-02-04 19:24:26 +00:00
parent 862278ac2c
commit 44aa2cc47a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=378411
2 changed files with 21 additions and 1 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= ansible
PORTVERSION= 1.8.2
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils python
MASTER_SITES= http://releases.ansible.com/ansible/

View file

@ -0,0 +1,20 @@
$FreeBSD$
--- lib/ansible/modules/core/database/postgresql/postgresql_privs.py.orig
+++ lib/ansible/modules/core/database/postgresql/postgresql_privs.py
@@ -462,10 +462,13 @@
if obj_type == 'group':
set_what = ','.join(pg_quote_identifier(i, 'role') for i in obj_ids)
else:
+ # function types are already quoted above
+ if obj_type != 'function':
+ obj_ids = [pg_quote_identifier(i, 'table') for i in obj_ids]
# Note: obj_type has been checked against a set of string literals
# and privs was escaped when it was parsed
set_what = '%s ON %s %s' % (','.join(privs), obj_type,
- ','.join(pg_quote_identifier(i, 'table') for i in obj_ids))
+ ','.join(obj_ids))
# for_whom: SQL-fragment specifying for whom to set the above
if roles == 'PUBLIC':