-
-
Notifications
You must be signed in to change notification settings - Fork 205
/
LegacyManagement.epp
765 lines (671 loc) · 20 KB
/
LegacyManagement.epp
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
/*
* PROGRAM: Security data base manager
* MODULE: security.epp
* 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): ______________________________________.
*/
#include "firebird.h"
#include "../common/classes/alloc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../jrd/ibase.h"
#include "../auth/SecurityDatabase/LegacyHash.h"
#include "../common/enc_proto.h"
#include "../yvalve/gds_proto.h"
#include "../common/isc_proto.h"
#include "../utilities/gsec/gsec.h"
#include "../common/utils_proto.h"
#include "../common/classes/init.h"
#include "../common/classes/UserBlob.h"
#include "../common/config/config_file.h"
#include "../auth/SecurityDatabase/LegacyManagement.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/StatusHolder.h"
#include "firebird/Interface.h"
// Here we use version-independent symbolic link (or copy) of actual database
DATABASE database = STATIC FILENAME "security.fdb";
static Firebird::GlobalPtr<Firebird::Mutex> execLineMutex; // protects various gpre generated structures
static bool grantRevokeAdmin(ISC_STATUS* isc_status, FB_API_HANDLE database, FB_API_HANDLE trans,
Firebird::IUser* user)
{
if (!user->admin()->entered())
{
return true;
}
Firebird::string userName(user->userName()->get());
for (unsigned i = 0; i < userName.length(); ++i)
{
if (userName[i] == '"')
{
userName.insert(i++, 1, '"');
}
}
Firebird::string sql;
sql.printf((user->admin()->get() ? "GRANT %s TO \"%s\"" : "REVOKE %s FROM \"%s\""),
ADMIN_ROLE, userName.c_str());
isc_dsql_execute_immediate(isc_status, &database, &trans, sql.length(), sql.c_str(), SQL_DIALECT_V6, NULL);
if (isc_status[1] && user->admin()->get() == 0)
{
isc_req_handle request = 0;
FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) R IN RDB$USER_PRIVILEGES
WITH R.RDB$USER EQ user->userName()->get()
AND R.RDB$RELATION_NAME EQ 'RDB$ADMIN'
AND R.RDB$PRIVILEGE EQ 'M'
sql.printf("REVOKE " ADMIN_ROLE " FROM \"%s\" GRANTED BY \"%s\"",
userName.c_str(), R.RDB$GRANTOR);
END_FOR
if (request)
{
ISC_STATUS_ARRAY s;
if (isc_release_request(s, &request) != FB_SUCCESS)
{
return false;
}
}
isc_dsql_execute_immediate(isc_status, &database, &trans, sql.length(), sql.c_str(), SQL_DIALECT_V6, NULL);
}
return isc_status[1] == 0;
}
const static unsigned int INIT_KEY = ((~0) - 1);
static unsigned int secDbKey = INIT_KEY;
namespace Auth {
SecurityDatabaseManagement::SecurityDatabaseManagement(Firebird::IPluginConfig* par)
: database(0), transaction(0)
{
Firebird::LocalStatus s;
Firebird::CheckStatusWrapper statusWrapper(&s);
config.assignRefNoIncr(par->getFirebirdConf(&statusWrapper));
check(&s);
}
void SecurityDatabaseManagement::start(Firebird::CheckStatusWrapper* st, Firebird::ILogonInfo* logonInfo)
{
try
{
st->init();
if (secDbKey == INIT_KEY)
{
secDbKey = config->getKey("SecurityDatabase");
}
const char* secDbName = config->asString(secDbKey);
if (!(secDbName && secDbName[0]))
{
Firebird::Arg::Gds(isc_secdb_name).raise();
}
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE);
dpb.insertByte(isc_dpb_sec_attach, TRUE);
dpb.insertString(isc_dpb_config, EMBEDDED_PROVIDERS, fb_strlen(EMBEDDED_PROVIDERS));
unsigned int authBlockSize;
const unsigned char* authBlock = logonInfo->authBlock(&authBlockSize);
if (authBlockSize)
dpb.insertBytes(isc_dpb_auth_block, authBlock, authBlockSize);
else
{
const char* logon = logonInfo->name();
if (logon && logon[0])
dpb.insertString(isc_dpb_trusted_auth, logon, fb_strlen(logon));
}
const char* role = logonInfo->role();
if (role && role[0])
dpb.insertString(isc_dpb_sql_role_name, role, fb_strlen(role));
ISC_STATUS_ARRAY status;
if (isc_attach_database(status, 0, secDbName, &database,
dpb.getBufferLength(), reinterpret_cast<const char*>(dpb.getBuffer())))
{
Firebird::status_exception::raise(status);
}
if (isc_start_transaction(status, &transaction, 1, &database, 0, NULL))
{
Firebird::status_exception::raise(status);
}
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(st);
}
}
void SecurityDatabaseManagement::commit(Firebird::CheckStatusWrapper* st)
{
try
{
st->init();
ISC_STATUS_ARRAY status;
if (transaction)
{
if (isc_commit_transaction(status, &transaction))
{
Firebird::status_exception::raise(status);
}
}
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(st);
}
}
void SecurityDatabaseManagement::rollback(Firebird::CheckStatusWrapper* st)
{
try
{
st->init();
ISC_STATUS_ARRAY status;
if (transaction)
{
if (isc_rollback_transaction(status, &transaction))
{
Firebird::status_exception::raise(status);
}
}
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(st);
}
}
int SecurityDatabaseManagement::release()
{
if (--refCounter == 0)
{
ISC_STATUS_ARRAY status;
if (transaction)
isc_rollback_transaction(status, &transaction);
if (database)
isc_detach_database(status, &database);
delete this;
return 0;
}
return 1;
}
#define STR_STORE(to, from) fb_utils::copy_terminate(to, from, sizeof(to))
int SecurityDatabaseManagement::execute(Firebird::CheckStatusWrapper* st, Firebird::IUser* user,
Firebird::IListUsers* callback)
{
/*************************************
*
* S E C U R I T Y _ e x e c _ l i n e
*
**************************************
*
* Functional description
* Process a command line for the security data base manager.
* This is used to add and delete users from the user information
* database (security2.fdb). It also displays information
* about current users and allows modification of current
* users' parameters.
* Returns 0 on success, otherwise returns a Gsec message number
* and the status vector containing the error info.
* The syntax is:
*
* Adding a new user:
*
* gsec -add <name> [ <parameter> ... ] -- command line
* add <name> [ <parameter> ... ] -- interactive
*
* Deleting a current user:
*
* gsec -delete <name> -- command line
* delete <name> -- interactive
*
* Displaying all current users:
*
* gsec -display -- command line
* display -- interactive
*
* Displaying one user:
*
* gsec -display <name> -- command line
* display <name> -- interactive
*
* Modifying a user's parameters:
*
* gsec -modify <name> <parameter> [ <parameter> ... ] -- command line
* modify <name> <parameter> [ <parameter> ... ] -- interactive
*
* Get help:
*
* gsec -help -- command line
* ? -- interactive
* help -- interactive
*
* Quit interactive session:
*
* quit -- interactive
*
* where <parameter> can be one of:
*
* -uid <uid>
* -gid <gid>
* -fname <firstname>
* -mname <middlename>
* -lname <lastname>
*
**************************************/
int ret = 0;
try
{
ISC_STATUS_ARRAY isc_status;
fb_utils::init_status(isc_status);
st->init();
Firebird::MutexLockGuard guard(execLineMutex, FB_FUNCTION);
SCHAR encrypted1[MAX_LEGACY_PASSWORD_LENGTH + 2];
Firebird::string encrypted2;
bool found;
// check for non-printable characters in user name
for (const TEXT* p = user->userName()->get(); *p; p++)
{
if (!isprint(*p))
{
return GsecMsg75; // Add special error message for this case ?
}
}
isc_req_handle request = 0;
isc_req_handle request2 = 0;
switch (user->operation())
{
case Firebird::IUser::OP_USER_DROP_MAP:
case Firebird::IUser::OP_USER_SET_MAP:
{
Firebird::string sql;
sql.printf("ALTER ROLE " ADMIN_ROLE " %s AUTO ADMIN MAPPING",
user->operation() == Firebird::IUser::OP_USER_SET_MAP ? "SET" : "DROP");
isc_dsql_execute_immediate(isc_status, &database, &transaction, sql.length(), sql.c_str(), 1, NULL);
if (isc_status[1] != 0)
{
ret = GsecMsg97;
}
}
break;
case Firebird::IUser::OP_USER_ADD:
// this checks the "entered" flags for each parameter (except the name)
// and makes all non-entered parameters null valued
STORE (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS USING
STR_STORE(U.PLG$USER_NAME, user->userName()->get());
U.PLG$UID.NULL = ISC_TRUE;
U.PLG$GID.NULL = ISC_TRUE;
U.PLG$GROUP_NAME.NULL = ISC_TRUE;
if (user->attributes()->entered())
{
ConfigFile attr(ConfigFile::USE_TEXT, user->attributes()->get());
const ConfigFile::Parameter* p;
if ((p = attr.findParameter("uid")) && p->value.hasData())
{
U.PLG$UID = p->asInteger();
U.PLG$UID.NULL = ISC_FALSE;
}
if ((p = attr.findParameter("gid")) && p->value.hasData())
{
U.PLG$GID = p->asInteger();
U.PLG$GID.NULL = ISC_FALSE;
}
if ((p = attr.findParameter("groupName")) && p->value.hasData())
{
STR_STORE(U.PLG$GROUP_NAME, p->value.c_str());
U.PLG$GROUP_NAME.NULL = ISC_FALSE;
}
}
if (user->password()->entered())
{
ENC_crypt(encrypted1, sizeof encrypted1, user->password()->get(), LEGACY_PASSWORD_SALT);
LegacyHash::hash(encrypted2, user->userName()->get(), &encrypted1[2]);
STR_STORE(U.PLG$PASSWD, encrypted2.c_str());
U.PLG$PASSWD.NULL = ISC_FALSE;
}
else
U.PLG$PASSWD.NULL = ISC_TRUE;
if (user->firstName()->entered())
{
STR_STORE(U.PLG$FIRST_NAME, user->firstName()->get());
U.PLG$FIRST_NAME.NULL = ISC_FALSE;
}
else
U.PLG$FIRST_NAME.NULL = ISC_TRUE;
if (user->middleName()->entered())
{
STR_STORE(U.PLG$MIDDLE_NAME, user->middleName()->get());
U.PLG$MIDDLE_NAME.NULL = ISC_FALSE;
}
else
U.PLG$MIDDLE_NAME.NULL = ISC_TRUE;
if (user->lastName()->entered())
{
STR_STORE(U.PLG$LAST_NAME, user->lastName()->get());
U.PLG$LAST_NAME.NULL = ISC_FALSE;
}
else
U.PLG$LAST_NAME.NULL = ISC_TRUE;
END_STORE
ON_ERROR
ret = GsecMsg19; // gsec - add record error
END_ERROR;
if (ret == 0 && !grantRevokeAdmin(isc_status, database, transaction, user))
{
ret = GsecMsg19; // gsec - add record error
}
break;
case Firebird::IUser::OP_USER_MODIFY:
// this updates an existing record, replacing all fields that are
// entered, and for those that were specified but not entered, it
// changes the current value to the null value
found = false;
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS
WITH U.PLG$USER_NAME EQ user->userName()->get()
{
found = true;
MODIFY U USING
if (user->attributes()->entered())
{
U.PLG$UID.NULL = ISC_TRUE;
U.PLG$GID.NULL = ISC_TRUE;
U.PLG$GROUP_NAME.NULL = ISC_TRUE;
ConfigFile attr(ConfigFile::USE_TEXT, user->attributes()->get());
const ConfigFile::Parameter* p;
if ((p = attr.findParameter("uid")) && p->value.hasData())
{
U.PLG$UID = p->asInteger();
U.PLG$UID.NULL = ISC_FALSE;
}
if ((p = attr.findParameter("gid")) && p->value.hasData())
{
U.PLG$GID = p->asInteger();
U.PLG$GID.NULL = ISC_FALSE;
}
if ((p = attr.findParameter("groupName")) && p->value.hasData())
{
STR_STORE(U.PLG$GROUP_NAME, p->value.c_str());
U.PLG$GROUP_NAME.NULL = ISC_FALSE;
}
}
else if (user->attributes()->specified())
{
U.PLG$UID.NULL = ISC_TRUE;
U.PLG$GID.NULL = ISC_TRUE;
U.PLG$GROUP_NAME.NULL = ISC_TRUE;
}
if (user->password()->entered())
{
ENC_crypt(encrypted1, sizeof encrypted1, user->password()->get(), LEGACY_PASSWORD_SALT);
LegacyHash::hash(encrypted2, user->userName()->get(), &encrypted1[2]);
STR_STORE(U.PLG$PASSWD, encrypted2.c_str());
U.PLG$PASSWD.NULL = ISC_FALSE;
}
else if (user->password()->specified())
U.PLG$PASSWD.NULL = ISC_TRUE;
if (user->firstName()->entered())
{
STR_STORE(U.PLG$FIRST_NAME, user->firstName()->get());
U.PLG$FIRST_NAME.NULL = ISC_FALSE;
}
else if (user->firstName()->specified())
U.PLG$FIRST_NAME.NULL = ISC_TRUE;
if (user->middleName()->entered())
{
STR_STORE(U.PLG$MIDDLE_NAME, user->middleName()->get());
U.PLG$MIDDLE_NAME.NULL = ISC_FALSE;
}
else if (user->middleName()->specified())
U.PLG$MIDDLE_NAME.NULL = ISC_TRUE;
if (user->lastName()->entered())
{
STR_STORE(U.PLG$LAST_NAME, user->lastName()->get());
U.PLG$LAST_NAME.NULL = ISC_FALSE;
}
else if (user->lastName()->specified())
U.PLG$LAST_NAME.NULL = ISC_TRUE;
END_MODIFY
ON_ERROR
ret = GsecMsg20;
END_ERROR;
}
END_FOR
ON_ERROR
ret = GsecMsg21;
END_ERROR;
if (!ret && !found)
ret = GsecMsg22;
if (ret == 0 && !grantRevokeAdmin(isc_status, database, transaction, user))
{
ret = GsecMsg21;
}
break;
case Firebird::IUser::OP_USER_DELETE:
// looks up the specified user record and deletes it
found = false;
// Do not allow SYSDBA user to be deleted
if (!fb_utils::stricmp(user->userName()->get(), DBA_USER_NAME))
ret = GsecMsg23;
else
{
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS
WITH U.PLG$USER_NAME EQ user->userName()->get()
{
found = true;
ERASE U
ON_ERROR
ret = GsecMsg23; // gsec - delete record error
END_ERROR;
}
END_FOR
ON_ERROR
ret = GsecMsg24; // gsec - find/delete record error
END_ERROR;
}
if (!ret && !found)
ret = GsecMsg22; // gsec - record not found for user:
user->admin()->set(st, 0);
check(st);
user->admin()->setEntered(st, 1);
check(st);
if (ret == 0 && !grantRevokeAdmin(isc_status, database, transaction, user))
{
ret = GsecMsg24;
}
break;
case Firebird::IUser::OP_USER_DISPLAY:
// gets either the desired record, or all records, and displays them
found = false;
if (!user->userName()->entered())
{
Firebird::LocalStatus s2;
Firebird::CheckStatusWrapper statusWrapper2(&s2);
Firebird::CheckStatusWrapper* s = st;
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS
try
{
{
Firebird::string attr, a1, a2, a3;
if (!U.PLG$UID.NULL)
a1.printf("Uid=%d\n", U.PLG$UID);
if (!U.PLG$GID.NULL)
a2.printf("Gid=%d\n", U.PLG$GID);
if (!U.PLG$GROUP_NAME.NULL)
a3.printf("GroupName=%s\n", U.PLG$GROUP_NAME);
attr = a1 + a2 + a3;
user->attributes()->set(s, attr.c_str());
check(s);
user->attributes()->setEntered(s, attr.hasData() ? 1 : 0);
check(s);
}
user->userName()->set(s, U.PLG$USER_NAME);
check(s);
user->userName()->setEntered(s, U.PLG$USER_NAME.NULL ? 0 : 1);
check(s);
user->password()->set(s, "");
check(s);
user->password()->setEntered(s, 0);
check(s);
user->firstName()->set(s, U.PLG$FIRST_NAME);
check(s);
user->firstName()->setEntered(s, U.PLG$FIRST_NAME.NULL ? 0 : 1);
check(s);
user->middleName()->set(s, U.PLG$MIDDLE_NAME);
check(s);
user->middleName()->setEntered(s, U.PLG$MIDDLE_NAME.NULL ? 0 : 1);
check(s);
user->lastName()->set(s, U.PLG$LAST_NAME);
check(s);
user->lastName()->setEntered(s, U.PLG$LAST_NAME.NULL ? 0 : 1);
check(s);
user->admin()->set(s, 0);
check(s);
user->admin()->setEntered(s, 1);
check(s);
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request2)
P IN RDB$USER_PRIVILEGES
WITH P.RDB$USER EQ U.PLG$USER_NAME AND
P.RDB$RELATION_NAME EQ 'RDB$ADMIN' AND
P.RDB$PRIVILEGE EQ 'M'
{
user->admin()->set(s, 1);
}
END_FOR
check(s);
callback->list(s, user);
check(s);
found = true;
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(s);
s = &statusWrapper2;
}
END_FOR
ON_ERROR
ret = GsecMsg28; // gsec - find/display record error
END_ERROR;
// real error raise - out of gpre's FOR loop
check(st);
}
else
{
Firebird::string attr, a1, a2, a3;
Firebird::LocalStatus s2;
Firebird::CheckStatusWrapper statusWrapper2(&s2);
Firebird::CheckStatusWrapper* s = st;
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS
WITH U.PLG$USER_NAME EQ user->userName()->get()
try
{
if (!U.PLG$UID.NULL)
a1.printf("Uid=%d\n", U.PLG$UID);
if (!U.PLG$GID.NULL)
a2.printf("Gid=%d\n", U.PLG$GID);
if (!U.PLG$GROUP_NAME.NULL)
a3.printf("GroupName=%s\n", U.PLG$GROUP_NAME);
attr = a1 + a2 + a3;
user->attributes()->set(s, attr.c_str());
check(s);
user->attributes()->setEntered(s, attr.hasData() ? 1 : 0);
check(s);
user->userName()->set(s, U.PLG$USER_NAME);
check(s);
user->userName()->setEntered(s, U.PLG$USER_NAME.NULL ? 0 : 1);
check(s);
user->password()->set(s, "");
check(s);
user->password()->setEntered(s, 0);
check(s);
user->firstName()->set(s, U.PLG$FIRST_NAME);
check(s);
user->firstName()->setEntered(s, U.PLG$FIRST_NAME.NULL ? 0 : 1);
check(s);
user->middleName()->set(s, U.PLG$MIDDLE_NAME);
check(s);
user->middleName()->setEntered(s, U.PLG$MIDDLE_NAME.NULL ? 0 : 1);
check(s);
user->lastName()->set(s, U.PLG$LAST_NAME);
check(s);
user->lastName()->setEntered(s, U.PLG$LAST_NAME.NULL ? 0 : 1);
check(s);
user->admin()->set(s, 0);
check(s);
user->admin()->setEntered(s, 1);
check(s);
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request2)
P IN RDB$USER_PRIVILEGES
WITH P.RDB$USER EQ U.PLG$USER_NAME AND
P.RDB$RELATION_NAME EQ 'RDB$ADMIN' AND
P.RDB$PRIVILEGE EQ 'M'
{
user->admin()->set(s, 1);
}
END_FOR
check(s);
callback->list(s, user);
check(s);
found = true;
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(s);
s = &statusWrapper2;
}
END_FOR
ON_ERROR
ret = GsecMsg28; // gsec - find/display record error
END_ERROR;
// real error raise - out of gpre's FOR loop
check(st);
}
break;
default:
ret = GsecMsg16; // gsec - error in switch specifications
break;
}
if (request)
{
ISC_STATUS_ARRAY s;
if (isc_release_request(s, &request) != FB_SUCCESS)
{
if (! ret)
{
ret = GsecMsg94; // error releasing request in security database
}
}
}
if (request2)
{
ISC_STATUS_ARRAY s;
if (isc_release_request(s, &request2) != FB_SUCCESS)
{
if (! ret)
{
ret = GsecMsg94; // error releasing request in security database
}
}
}
fb_utils::setIStatus(st, isc_status);
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(st);
}
return ret;
}
} // namespace Auth
// register plugin
static Firebird::SimpleFactory<Auth::SecurityDatabaseManagement> factory;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(
Firebird::IPluginManager::TYPE_AUTH_USER_MANAGEMENT, "Legacy_UserManager", &factory);
Firebird::getUnloadDetector()->registerMe();
}