Skip to content

Commit bf3eb21

Browse files
committed
Fixed an issue with privileges that prevented the startup() function from bringing the database up
1 parent 0ee0d93 commit bf3eb21

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ Thin Mode Changes
7575
Thick Mode Changes
7676
+++++++++++++++++++
7777

78+
#) Fixed an issue with privileges that prevented the startup() function from
79+
bringing up the database.
80+
7881
#) Tightened code to avoid possible unexpected runtime errors during token
7982
callback.
8083

lib/oracledb.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,23 @@ function _initializeThinDriver() {
124124
// Returns a boolean indicating if the supplied value is a valid privilege.
125125
//---------------------------------------------------------------------------
126126
function _isPrivilege(value) {
127+
// Privileges are mutually exclusive and cannot be specified together
128+
// except SYSPRELIM, which cannot be specified alone, it is specified in a
129+
// combo with SYSOPER or SYSDBA. SYSPRELIM is used only for
130+
// startup/shutdown
131+
132+
// If SYSPRELIM specified, clear the bit
133+
if (value & constants.SYSPRELIM) {
134+
value = value ^ constants.SYSPRELIM;
135+
}
136+
127137
return (
128138
value === constants.SYSASM ||
129139
value === constants.SYSBACKUP ||
130140
value === constants.SYSDBA ||
131141
value === constants.SYSDG ||
132142
value === constants.SYSKM ||
133143
value === constants.SYSOPER ||
134-
value === constants.SYSPRELIM ||
135144
value === constants.SYSRAC
136145
);
137146
}

test/connection.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,16 @@ describe('1. connection.js', function() {
362362
await pool.close(0);
363363
});
364364

365+
it('1.7.6 negative test case SYSPRELIM & SYSASM', async function() {
366+
const credential = {...dbConfig,
367+
privilege: oracledb.SYSASM | oracledb.SYSPRELIM
368+
};
369+
await assert.rejects(
370+
async () => await oracledb.getConnection(credential),
371+
/ORA-01031:/
372+
);
373+
});
374+
365375
}); // 1.7
366376

367377
describe('1.8 Ping method', function() {

test/list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Overview of node-oracledb functional tests
2424
1.7.3 Negative value - random constants
2525
1.7.4 Negative value - NaN
2626
1.7.5 gets ignored when acquiring a connection from Pool
27+
1.7.6 negative test case SYSPRELIM & SYSASM
2728
1.8 Ping method
2829
1.8.1 ping() checks the connection is usable
2930
1.8.2 closed connection

0 commit comments

Comments
 (0)