- Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathsecurity.cpp
124 lines (102 loc) · 2.47 KB
/
security.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
*
* PROGRAM: Security data base manager
* MODULE: security.cpp
* DESCRIPTION: Security routines
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Alex Peshkoff
*/
#include"firebird.h"
#include"../common/security.h"
#include"../common/StatusArg.h"
#include"../utilities/gsec/gsec.h"// gsec error codes
#include"../common/db_alias.h"
usingnamespaceFirebird;
namespace {
voidraise()
{
Arg::Gds(isc_user_manager).raise();
}
} // anonymous namespace
namespaceAuth {
Get::Get(const Config* firebirdConf)
: GetPlugins<Firebird::IManagement>(IPluginManager::TYPE_AUTH_USER_MANAGEMENT, firebirdConf)
{
if (!hasData())
{
raise();
}
}
Get::Get(const Config* firebirdConf, constchar* plugName)
: GetPlugins<Firebird::IManagement>(IPluginManager::TYPE_AUTH_USER_MANAGEMENT, firebirdConf, plugName)
{
if (!hasData())
{
raise();
}
}
voidUserData::clear(Firebird::CheckStatusWrapper*)
{
op = 0;
// interface fields
user.clear();
pass.clear();
first.clear();
last.clear();
middle.clear();
com.clear();
attr.clear();
adm.clear();
act.clear();
// internally used fields
database.clear();
dba.clear();
dbaPassword.clear();
role.clear();
// never clear this permanent block! authenticationBlock.clear();
// internal support for deprecated fields
group.clear();
u.clear();
g.clear();
}
// This function sets typical gsec return code based on requested operation if it was not set by plugin
intsetGsecCode(int code, unsignedint operation)
{
if (code >= 0)
{
return code;
}
switch(operation)
{
case ADD_OPER:
return GsecMsg19;
case MOD_OPER:
return GsecMsg20;
case DEL_OPER:
return GsecMsg23;
case OLD_DIS_OPER:
case DIS_OPER:
return GsecMsg28;
case MAP_DROP_OPER:
case MAP_SET_OPER:
return GsecMsg97;
}
return GsecMsg17;
}
} // namespace Auth