Skip to content

Commit

Permalink
Merge pull request sijms#563 from wes-pro/add-other-sys-privs
Browse files Browse the repository at this point in the history
Add authentication for SYSDG and other roles
  • Loading branch information
sijms authored Jul 7, 2024
2 parents 83fd55e + 44a8067 commit 78d53fd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions v2/configurations/database_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const (
NONE DBAPrivilege = 0
SYSDBA DBAPrivilege = 0x20
SYSOPER DBAPrivilege = 0x40
SYSASM DBAPrivilege = 0x00400000
SYSBKP DBAPrivilege = 0x01000000
SYSDGD DBAPrivilege = 0x02000000
SYSKMT DBAPrivilege = 0x04000000
SYSRAC DBAPrivilege = 0x08000000
)

type AuthType int
Expand Down Expand Up @@ -159,6 +164,16 @@ func DBAPrivilegeFromString(s string) DBAPrivilege {
return SYSDBA
} else if S == "SYSOPER" {
return SYSOPER
} else if S == "SYSASM" {
return SYSASM
} else if S == "SYSBKP" {
return SYSBKP
} else if S == "SYSDGD" {
return SYSDGD
} else if S == "SYSKMT" {
return SYSKMT
} else if S == "SYSRAC" {
return SYSRAC
} else {
return NONE
}
Expand Down
15 changes: 15 additions & 0 deletions v2/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const (
NoNewPass LogonMode = 0x1
SysDba LogonMode = 0x20
SysOper LogonMode = 0x40
SysAsm LogonMode = 0x00400000
SysBkp LogonMode = 0x01000000
SysDgd LogonMode = 0x02000000
SysKmt LogonMode = 0x04000000
SysRac LogonMode = 0x08000000
UserAndPass LogonMode = 0x100
//WithNewPass LogonMode = 0x2
//PROXY LogonMode = 0x400
Expand Down Expand Up @@ -406,6 +411,16 @@ func (conn *Connection) OpenWithContext(ctx context.Context) error {
conn.LogonMode |= SysDba
case configurations.SYSOPER:
conn.LogonMode |= SysOper
case configurations.SYSASM:
conn.LogonMode |= SysAsm
case configurations.SYSBKP:
conn.LogonMode |= SysBkp
case configurations.SYSDGD:
conn.LogonMode |= SysDgd
case configurations.SYSKMT:
conn.LogonMode |= SysKmt
case configurations.SYSRAC:
conn.LogonMode |= SysRac
default:
conn.LogonMode = 0
}
Expand Down

0 comments on commit 78d53fd

Please sign in to comment.