mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 21:23:04 +01:00
Diagnostics
This commit is contained in:
parent
e093442122
commit
c31aea58ed
@ -456,8 +456,6 @@ public:
|
||||
disp += " WHERE PLG$USER_NAME = ?";
|
||||
}
|
||||
|
||||
printf("disp=%s\n", disp.c_str());
|
||||
|
||||
Login login(di);
|
||||
Name first(di), middle(di), last(di);
|
||||
Field<SLONG> admin(di);
|
||||
@ -527,31 +525,6 @@ public:
|
||||
{
|
||||
ex.stuffException(status);
|
||||
return -1;
|
||||
|
||||
/* To be moved to plugin invoking code. !!!!
|
||||
switch(user->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;
|
||||
|
||||
default:
|
||||
return GsecMsg17;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "firebird.h"
|
||||
#include "../common/security.h"
|
||||
#include "../common/StatusArg.h"
|
||||
#include "../utilities/gsec/gsec.h" // gsec error codes
|
||||
|
||||
using namespace Firebird;
|
||||
|
||||
@ -72,4 +73,35 @@ void FB_CARG UserData::clear()
|
||||
// never clear this permanent block! authenticationBlock.clear();
|
||||
}
|
||||
|
||||
// This function sets typical gsec return code based on requested operation if it was not set by plugin
|
||||
int setGsecCode(int code, IUser* user)
|
||||
{
|
||||
if (code >= 0)
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
switch(user->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
|
||||
|
@ -221,6 +221,8 @@ public:
|
||||
Get(Config* firebirdConf);
|
||||
};
|
||||
|
||||
int setGsecCode(int code, IUser* iUser);
|
||||
|
||||
} // namespace Auth
|
||||
|
||||
#endif // UTILITIES_SECUR_PROTO_H
|
||||
|
@ -179,12 +179,13 @@ USHORT UserManagement::put(Auth::UserData* userData)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void UserManagement::checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName)
|
||||
void UserManagement::checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName, Auth::IUser* user)
|
||||
{
|
||||
if (!errcode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
errcode = Auth::setGsecCode(errcode, user);
|
||||
|
||||
Arg::StatusVector tmp;
|
||||
tmp << Arg::Gds(ENCODE_ISC_MSG(errcode, GSEC_MSG_FAC));
|
||||
@ -212,7 +213,7 @@ void UserManagement::execute(USHORT id)
|
||||
|
||||
LocalStatus status;
|
||||
int errcode = manager->execute(&status, commands[id], NULL);
|
||||
checkSecurityResult(errcode, &status, commands[id]->userName()->get());
|
||||
checkSecurityResult(errcode, &status, commands[id]->userName()->get(), commands[id]);
|
||||
|
||||
delete commands[id];
|
||||
commands[id] = NULL;
|
||||
@ -310,7 +311,7 @@ RecordBuffer* UserManagement::getList(thread_db* tdbb, jrd_rel* relation)
|
||||
Auth::StackUserData u;
|
||||
u.op = DIS_OPER;
|
||||
int errcode = manager->execute(&status, &u, &display);
|
||||
checkSecurityResult(errcode, &status, "Unknown");
|
||||
checkSecurityResult(errcode, &status, "Unknown", &u);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ private:
|
||||
Display display;
|
||||
Auth::IManagement* manager;
|
||||
|
||||
static void checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName);
|
||||
static void checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName, Auth::IUser* user);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -3775,16 +3775,16 @@ static bool process_packet(rem_port* port, PACKET* sendL, PACKET* receive, rem_p
|
||||
if (!accept_connection(port, &receive->p_cnct, sendL))
|
||||
{
|
||||
const string& s = port->port_user_name;
|
||||
if (s.hasData())
|
||||
{
|
||||
/* if (s.hasData())
|
||||
{ looks like logging rejects is not good idea any more?
|
||||
gds__log("SERVER/process_packet: connection rejected for %s", s.c_str());
|
||||
}
|
||||
} */
|
||||
if (port->port_server->srvr_flags & SRVR_multi_client) {
|
||||
port->port_state = rem_port::BROKEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
gds__log("SERVER/process_packet: connect reject, server exiting");
|
||||
// gds__log("SERVER/process_packet: connect reject, server exiting");
|
||||
port->disconnect(sendL, receive);
|
||||
return false;
|
||||
}
|
||||
@ -5430,7 +5430,6 @@ static THREAD_ENTRY_DECLARE loopThread(THREAD_ENTRY_PARAM)
|
||||
|
||||
if (new_request->req_receive.p_operation == op_partial)
|
||||
{
|
||||
// gds__log("Partial");
|
||||
free_request(new_request);
|
||||
port->setRecvState(recvState);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
//if (!uSvc->isService() && argv.getCount() == 1)
|
||||
// GSEC_error(GsecMsg101); // use gsec -? to get help
|
||||
|
||||
SSHORT ret = parse_cmd_line(argv, tdsec);
|
||||
int ret = parse_cmd_line(argv, tdsec);
|
||||
if (!uSvc->isService() && ret == -2) // user asked for help
|
||||
GSEC_exit();
|
||||
|
||||
@ -426,6 +426,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = setGsecCode(ret, user_data);
|
||||
fb_utils::copyStatus(status, FB_NELEM(status),
|
||||
st.get(), fb_utils::statusLength(st.get()));
|
||||
GSEC_print(ret, user_data->userName()->get());
|
||||
|
Loading…
Reference in New Issue
Block a user