File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 13
13
*
14
14
*
15
15
* IDENTIFICATION
16
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.218 2009/01/20 18:59:37 heikki Exp $
16
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.219 2009/01/30 17:24:47 heikki Exp $
17
17
*
18
18
*-------------------------------------------------------------------------
19
19
*/
@@ -244,7 +244,13 @@ createdb(const CreatedbStmt *stmt)
244
244
dbctype = strVal (dctype -> arg );
245
245
246
246
if (dconnlimit && dconnlimit -> arg )
247
+ {
247
248
dbconnlimit = intVal (dconnlimit -> arg );
249
+ if (dbconnlimit < -1 )
250
+ ereport (ERROR ,
251
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
252
+ errmsg ("invalid connection limit: %d" , dbconnlimit )));
253
+ }
248
254
249
255
/* obtain OID of proposed owner */
250
256
if (dbowner )
@@ -1319,7 +1325,13 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel)
1319
1325
}
1320
1326
1321
1327
if (dconnlimit )
1328
+ {
1322
1329
connlimit = intVal (dconnlimit -> arg );
1330
+ if (connlimit < -1 )
1331
+ ereport (ERROR ,
1332
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1333
+ errmsg ("invalid connection limit: %d" , connlimit )));
1334
+ }
1323
1335
1324
1336
/*
1325
1337
* Get the old tuple. We don't need a lock on the database per se,
Original file line number Diff line number Diff line change 6
6
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7
7
* Portions Copyright (c) 1994, Regents of the University of California
8
8
*
9
- * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.185 2009/01/22 20:16:02 tgl Exp $
9
+ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.186 2009/01/30 17:24:47 heikki Exp $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -242,7 +242,13 @@ CreateRole(CreateRoleStmt *stmt)
242
242
if (dcanlogin )
243
243
canlogin = intVal (dcanlogin -> arg ) != 0 ;
244
244
if (dconnlimit )
245
+ {
245
246
connlimit = intVal (dconnlimit -> arg );
247
+ if (connlimit < -1 )
248
+ ereport (ERROR ,
249
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
250
+ errmsg ("invalid connection limit: %d" , connlimit )));
251
+ }
246
252
if (daddroleto )
247
253
addroleto = (List * ) daddroleto -> arg ;
248
254
if (drolemembers )
@@ -533,7 +539,13 @@ AlterRole(AlterRoleStmt *stmt)
533
539
if (dcanlogin )
534
540
canlogin = intVal (dcanlogin -> arg );
535
541
if (dconnlimit )
542
+ {
536
543
connlimit = intVal (dconnlimit -> arg );
544
+ if (connlimit < -1 )
545
+ ereport (ERROR ,
546
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
547
+ errmsg ("invalid connection limit: %d" , connlimit )));
548
+ }
537
549
if (drolemembers )
538
550
rolemembers = (List * ) drolemembers -> arg ;
539
551
if (dvalidUntil )
You can’t perform that action at this time.
0 commit comments