Skip to content

Commit 9241e98

Browse files
committed
Check username for external authentication and update error text
1 parent 7176bac commit 9241e98

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/dpi/include/dpiException.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ enum DpiError // error type
4949
DpiErrNoEnv = 003, // "No OCI environment handle created"
5050
DpiErrInvalidState = 004, // "Invalid state while working with timestamp"
5151
DpiErrUninitialized = 005, // "Uninitialized state while working with timestamp"
52-
DpiErrPasswdExtAuth = 006, // "password specified with external authentication"
52+
DpiErrExtAuth= 006, // "user and password should not be set when using external authentication"
5353
};
5454

5555

src/dpi/src/dpiConnImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ try : env_(env), pool_(NULL),
9494

9595
if (isExternalAuth)
9696
{
97-
if (password.length())
98-
throw ExceptionImpl(DpiErrPasswdExtAuth);
97+
if (password.length() || user.length())
98+
throw ExceptionImpl(DpiErrExtAuth);
9999
}
100100
else
101101
{

src/dpi/src/dpiExceptionImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static const char *dpiErrors[] =
5555
"no OCI environment handle created", // DpiErrNoEnv
5656
"invalid state while working with timestamp", // DpiErrInvalidState
5757
"uninitialized state while working with timestamp", // DpiErrUninitialized
58-
"password specified with external authentication" // DpiErrPasswdExtAuth
58+
"user and password should not be set when using external authentication", // DpiErrExtAuth
5959
};
6060

6161

src/dpi/src/dpiPoolImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ PoolImpl::PoolImpl(EnvImpl *env, OCIEnv *envh,
9595

9696
unsigned char spoolMode = OCI_SPOOL_ATTRVAL_NOWAIT; // spoolMode is a ub1
9797

98-
if (isExternalAuth && password.length())
99-
throw ExceptionImpl(DpiErrPasswdExtAuth);
98+
if (isExternalAuth && (password.length() || user.length()))
99+
throw ExceptionImpl(DpiErrExtAuth);
100100

101101
ociCallEnv(OCIHandleAlloc((void *)envh_, (dvoid **)&errh_,
102102
OCI_HTYPE_ERROR, 0, (dvoid **)0), envh_);

0 commit comments

Comments
 (0)