Fri Oct 26 13:57:49 PDT 2007
- Previous message: [Slony1-commit] slony1-engine/src Makefile
- Next message: [Slony1-commit] slony1-engine RELEASE
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slonik
In directory main.slony.info:/tmp/cvs-serv31696
Modified Files:
Tag: REL_1_2_STABLE
dbutil.c
Log Message:
Check to make sure we are a superuser and if not error indicationg which node we are not a
superuser on.
Index: dbutil.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slonik/dbutil.c,v
retrieving revision 1.12.2.1
retrieving revision 1.12.2.2
diff -C2 -d -r1.12.2.1 -r1.12.2.2
*** dbutil.c 18 Apr 2007 19:28:27 -0000 1.12.2.1
--- dbutil.c 26 Oct 2007 20:57:47 -0000 1.12.2.2
***************
*** 139,146 ****
#endif /* !HAVE_PQSETNOTICERECEIVER */
dstring_init(&query);
slon_mkquery(&query,"SET datestyle to 'ISO'");
- adminfo->dbconn = dbconn;
if (db_exec_command(stmt, adminfo, &query) < 0)
{
--- 139,157 ----
#endif /* !HAVE_PQSETNOTICERECEIVER */
+ adminfo->dbconn = dbconn;
+
+ dstring_init(&query);
+ slon_mkquery(&query,"SELECT 1 FROM pg_catalog.pg_shadow WHERE usename = user "
+ "AND usesuper");
+ if (PQntuples(db_exec_select(stmt, adminfo, &query)) != 1)
+ {
+ printf("Error: You are not a superuser on node %d\n",adminfo->no_id);
+ dstring_free(&query);
+ return -1;
+ }
+
dstring_init(&query);
slon_mkquery(&query,"SET datestyle to 'ISO'");
if (db_exec_command(stmt, adminfo, &query) < 0)
{
- Previous message: [Slony1-commit] slony1-engine/src Makefile
- Next message: [Slony1-commit] slony1-engine RELEASE
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list