View | Details | Raw Unified
Collapse All | Expand All

(-) Firebird-2.0.3.12981-0_orig/src/jrd/constants.h (-1 / +1 lines)
 Lines 56-62    Link Here 
/* Misc constant values */
/* Misc constant values */
const int USERNAME_LENGTH	= 31;	/* Characters */
const unsigned int USERNAME_LENGTH	= 31;	/* Characters */
const size_t MAX_SQL_IDENTIFIER_SIZE = 32;
const size_t MAX_SQL_IDENTIFIER_SIZE = 32;
const size_t MAX_SQL_IDENTIFIER_LEN = MAX_SQL_IDENTIFIER_SIZE - 1;
const size_t MAX_SQL_IDENTIFIER_LEN = MAX_SQL_IDENTIFIER_SIZE - 1;
(-) Firebird-2.0.3.12981-0_orig/src/jrd/isc.cpp (-172 / +37 lines)
 Lines 87-100    Link Here 
#include <windows.h>
#include <windows.h>
#include <aclapi.h>
#include <aclapi.h>
#include <lmcons.h>
static USHORT os_type;
static USHORT os_type;
static SECURITY_ATTRIBUTES security_attr;
static SECURITY_ATTRIBUTES security_attr;
//static TEXT interbase_directory[MAXPATHLEN];
//static TEXT interbase_directory[MAXPATHLEN];
static bool check_user_privilege();
#endif // WIN_NT
#endif // WIN_NT
static TEXT user_name[256];
static TEXT user_name[256];
 Lines 393-406    Link Here 
}
}
#endif
#endif
const TEXT* ISC_get_host(Firebird::string& host)
{
/**************************************
 *
 *      I S C _ g e t _ h o s t
 *
 **************************************
 *
 * Functional description
 *      Get host name in non-plain buffer.
 *
 **************************************/
	TEXT buffer[BUFFER_SMALL];
	ISC_get_host(buffer, sizeof(buffer));
	host = buffer;
	return host.c_str();
}
#ifdef UNIX
#ifdef UNIX
int ISC_get_user(TEXT*	name,
bool ISC_get_user(Firebird::string*	name, 
									  int*	id,
				  int*	id,
									  int*	group,
				  int*	group,
									  TEXT*	project,
				  const TEXT*	user_string)
									  TEXT*	organization,
									  int*	node,
									  const TEXT*	user_string)
{
{
/**************************************
/**************************************
 *
 *
 Lines 448-454    Link Here 
	}
	}
	if (name)
	if (name)
		strcpy(name, p);
		*name = p;
	if (id)
	if (id)
		*id = euid;
		*id = euid;
 Lines 456-470    Link Here 
	if (group)
	if (group)
		*group = egid;
		*group = egid;
	if (project)
		*project = 0;
	if (organization)
		*organization = 0;
	if (node)
		*node = 0;
	return (euid == 0);
	return (euid == 0);
}
}
#endif
#endif
 Lines 573-585    Link Here 
#endif
#endif
#ifdef WIN_NT
#ifdef WIN_NT
int ISC_get_user(TEXT*	name,
bool ISC_get_user(Firebird::string*	name, 
									  int*	id,
				  int*	id,
									  int*	group,
				  int*	group,
									  TEXT*	project,
				  const TEXT*	user_string)
									  TEXT*	organization,
									  int*	node,
									  const TEXT*	user_string)
{
{
/**************************************
/**************************************
 *
 *
 Lines 597-758    Link Here 
	if (group)
	if (group)
		*group = -1;
		*group = -1;
	if (project)
		*project = 0;
	if (organization)
		*organization = 0;
	if (node)
		*node = 0;
	if (name)
	if (name)
	{
	{
		name[0] = 0;
		DWORD name_len = UNLEN;
		DWORD  name_len = 128;
		TEXT* nm = name->getBuffer(name_len + 1);
		if (GetUserName(name, &name_len))
		if (GetUserName(nm, &name_len))
		{
			name[name_len] = 0;
			/* NT user name is case insensitive */
			for (DWORD i = 0; i < name_len; i++)
			{
				name[i] = UPPER7(name[i]);
			}
/* This check is not internationalized, the security model needs to be
 * reengineered, especially on SUPERSERVER where none of these local
 * user (in process) assumptions are valid.
			if (!strcmp(name, "ADMINISTRATOR"))
			{
				if (id)
					*id = 0;
				if (group)
					*group = 0;
			}
 */
		}
	}
	return check_user_privilege();
}
//____________________________________________________________
//
// Check to see if the user belongs to the administrator group.
//
// This routine was adapted from code in routine RunningAsAdminstrator
// in \mstools\samples\regmpad\regdb.c.
//
static bool check_user_privilege()
{
	HANDLE tkhandle;
	SID_IDENTIFIER_AUTHORITY system_sid_authority = {SECURITY_NT_AUTHORITY};
	// First we must open a handle to the access token for this thread.
	if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &tkhandle))
	{
		if (GetLastError() == ERROR_NO_TOKEN)
		{
		{
			// If the thread does not have an access token, we'll examine the
			nm[name_len] = 0;
			// access token associated with the process.
			if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &tkhandle))
			// NT user name is case insensitive
			{
			CharUpperBuff(nm, name_len);
				CloseHandle(tkhandle);
			name->recalculate_length();
				return false;
			}
		}
		}
		else
		else
		{
		{
			return false;
			*name = "";
		}
		}
	}
	}
	TOKEN_GROUPS*	ptg       = NULL;
	return false;
	DWORD			token_len = 0;
	while (true)
	{
		/* Then we must query the size of the group information associated with
		   the token.  This is guarenteed to fail the first time through
		   because there is no buffer. */
		if (GetTokenInformation(tkhandle,
								TokenGroups,
								ptg,
								token_len,
								&token_len))
		{
			break;
		}
		/* If there had been a buffer, it's either too small or something
		   else is wrong.  Either way, we can dispose of it. */
		if (ptg)
		{
			gds__free(ptg);
		}
		/* Here we verify that GetTokenInformation failed for lack of a large
		   enough buffer. */
		if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
		{
			CloseHandle(tkhandle);
			return false;
		}
		// Allocate a buffer for the group information.
		ptg = (TOKEN_GROUPS *) gds__alloc((SLONG) token_len);
		if (!ptg)
		{
			CloseHandle(tkhandle);
			return false;		/* NOMEM: */
		}
		// FREE: earlier in this loop, and at procedure return
	}
	// Create a System Identifier for the Admin group.
	PSID admin_sid;
	if (!AllocateAndInitializeSid(&system_sid_authority, 2,
								  SECURITY_BUILTIN_DOMAIN_RID,
								  DOMAIN_ALIAS_RID_ADMINS,
								  0, 0, 0, 0, 0, 0, &admin_sid))
	{
		gds__free(ptg);
		CloseHandle(tkhandle);
		return false;
	}
	// Finally we'll iterate through the list of groups for this access
	// token looking for a match against the SID we created above.
	bool admin_priv = false;
	for (DWORD i = 0; i < ptg->GroupCount; i++)
	{
		if (EqualSid(ptg->Groups[i].Sid, admin_sid))
		{
			admin_priv = true;
			break;
		}
	}
	// Deallocate the SID we created.
	FreeSid(admin_sid);
	gds__free(ptg);
	CloseHandle(tkhandle);
	return admin_priv;
}
}
#endif
#endif
(-) Firebird-2.0.3.12981-0_orig/src/jrd/isc_proto.h (-2 / +3 lines)
 Lines 25-30    Link Here 
#define JRD_ISC_PROTO_H
#define JRD_ISC_PROTO_H
#include "../jrd/isc.h"
#include "../jrd/isc.h"
#include "../common/classes/fb_string.h"
void	ISC_ast_enter(void);
void	ISC_ast_enter(void);
void	ISC_ast_exit(void);
void	ISC_ast_exit(void);
 Lines 33-40    Link Here 
//void	ISC_get_config(TEXT *, struct ipccfg *);
//void	ISC_get_config(TEXT *, struct ipccfg *);
//int		ISC_set_config(TEXT *, struct ipccfg *);
//int		ISC_set_config(TEXT *, struct ipccfg *);
TEXT*	ISC_get_host(TEXT *, USHORT);
TEXT*	ISC_get_host(TEXT *, USHORT);
int		ISC_get_user(TEXT*, int*, int*, TEXT*,
const TEXT*   ISC_get_host(Firebird::string&);
											 TEXT*, int*, const TEXT*);
bool  ISC_get_user(Firebird::string*, int*, int*, const TEXT*);
SLONG	ISC_get_user_group_id(const TEXT*);
SLONG	ISC_get_user_group_id(const TEXT*);
void	ISC_set_user(const TEXT*);
void	ISC_set_user(const TEXT*);
SLONG	ISC_get_prefix(const TEXT*);
SLONG	ISC_get_prefix(const TEXT*);
(-) Firebird-2.0.3.12981-0_orig/src/jrd/jrd.cpp (-15 / +9 lines)
 Lines 6699-6710    Link Here 
 **/
 **/
static void getUserInfo(UserId& user, const DatabaseOptions& options)
static void getUserInfo(UserId& user, const DatabaseOptions& options)
{
{
	TEXT name[129] = "";
	TEXT project[33] = "";
	TEXT organization[33] = "";
	int node_id = 0;
	int id = -1, group = -1;	// CVC: This var contained trash
	int id = -1, group = -1;	// CVC: This var contained trash
	int node_id = 0;
	Firebird::string name;
#ifdef BOOT_BUILD
#ifdef BOOT_BUILD
	bool wheel = true;
	bool wheel = true;
 Lines 6712-6723    Link Here 
	bool wheel = false;
	bool wheel = false;
	if (options.dpb_user_name.isEmpty()) 
	if (options.dpb_user_name.isEmpty()) 
	{
	{
       wheel = ISC_get_user(name,
       wheel = ISC_get_user(&name,
                            &id,
                            &id,
                            &group,
                            &group,
                            project,
                            organization,
                            &node_id,
                            options.dpb_sys_user_name.nullStr());
                            options.dpb_sys_user_name.nullStr());
	}
	}
 Lines 6738-6755    Link Here 
		{
		{
			if (options.dpb_user_name.hasData())
			if (options.dpb_user_name.hasData())
			{
			{
				options.dpb_user_name.copyTo(name, sizeof name);
				name = options.dpb_user_name;
			}
			}
			else
			else
			{
			{
				strcpy(name, "<Unknown>");
				name = "<Unknown>";
			}
			}
		}
		}
		// if the name from the user database is defined as SYSDBA,
		// if the name from the user database is defined as SYSDBA,
		// we define that user id as having system privileges
		// we define that user id as having system privileges
		if (!strcmp(name, SYSDBA_USER_NAME))
		if (name == SYSDBA_USER_NAME)
		{
		{
			wheel = true;
			wheel = true;
		}
		}
 Lines 6761-6772    Link Here 
	if (wheel)
	if (wheel)
	{
	{
		strcpy(name, SYSDBA_USER_NAME);
		name = SYSDBA_USER_NAME;
	}
	}
	user.usr_user_name = name;
	user.usr_user_name = name;
	user.usr_project_name = project;
	user.usr_project_name = "";
	user.usr_org_name = organization;
	user.usr_org_name = "";
	user.usr_sql_role_name = options.dpb_role_name;
	user.usr_sql_role_name = options.dpb_role_name;
	user.usr_user_id = id;
	user.usr_user_id = id;
	user.usr_group_id = group;
	user.usr_group_id = group;
(-) Firebird-2.0.3.12981-0_orig/src/jrd/jrd_pwd.h (-4 / +4 lines)
 Lines 66-76    Link Here 
	static void initialize();
	static void initialize();
	static void shutdown();
	static void shutdown();
	static void verifyUser(TEXT*, const TEXT*, const TEXT*, const TEXT*,
	static void verifyUser(Firebird::string&, const TEXT*, const TEXT*, const TEXT*,
		int*, int*, int*, const Firebird::string&);
		int*, int*, int*, const Firebird::string&);
	static void hash(Firebird::string& h, 
	static void hash(Firebird::string& h, 
					 const TEXT* userName, 
					 const Firebird::string& userName, 
					 const TEXT* passwd)
					 const TEXT* passwd)
	{
	{
		Firebird::string salt;
		Firebird::string salt;
 Lines 79-85    Link Here 
	}
	}
	static void hash(Firebird::string& h, 
	static void hash(Firebird::string& h, 
					 const TEXT* userName, 
					 const Firebird::string& userName, 
					 const TEXT* passwd,
					 const TEXT* passwd,
					 const Firebird::string& oldHash)
					 const Firebird::string& oldHash)
	{
	{
 Lines 110-116    Link Here 
	void fini();
	void fini();
	void init();
	void init();
	bool lookup_user(TEXT*, int*, int*, TEXT*);
	bool lookup_user(const TEXT*, int*, int*, TEXT*);
	bool prepare();
	bool prepare();
	static SecurityDatabase instance;
	static SecurityDatabase instance;
(-) Firebird-2.0.3.12981-0_orig/src/jrd/pwd.cpp (-7 / +6 lines)
 Lines 263-269    Link Here 
	counter += (is_cached) ? 1 : 0;
	counter += (is_cached) ? 1 : 0;
}
}
bool SecurityDatabase::lookup_user(TEXT * user_name, int *uid, int *gid, TEXT * pwd)
bool SecurityDatabase::lookup_user(const TEXT* user_name, int* uid, int* gid, TEXT* pwd)
{
{
	bool found = false;		// user found flag
	bool found = false;		// user found flag
	TEXT uname[129];		// user name buffer
	TEXT uname[129];		// user name buffer
 Lines 433-439    Link Here 
	instance.fini();
	instance.fini();
}
}
void SecurityDatabase::verifyUser(TEXT* name,
void SecurityDatabase::verifyUser(Firebird::string& name,
								  const TEXT* user_name,
								  const TEXT* user_name,
								  const TEXT* password,
								  const TEXT* password,
								  const TEXT* password_enc,
								  const TEXT* password_enc,
 Lines 444-455    Link Here 
{
{
	if (user_name)
	if (user_name)
	{
	{
		TEXT* p = name;
		name = user_name;
		for (const TEXT* q = user_name; *q; ++q, ++p)
		for (unsigned int n = 0; n < name.length(); ++n)
		{
		{
			*p = UPPER7(*q);
			name[n] = UPPER7(name[n]);
		}
		}
		*p = 0;
	}
	}
#ifndef EMBEDDED
#ifndef EMBEDDED
 Lines 459-465    Link Here 
	// that means the current context must be saved and restored.
	// that means the current context must be saved and restored.
	TEXT pw1[MAX_PASSWORD_LENGTH + 1];
	TEXT pw1[MAX_PASSWORD_LENGTH + 1];
	const bool found = instance.lookup_user(name, uid, gid, pw1);
	const bool found = instance.lookup_user(name.c_str(), uid, gid, pw1);
	pw1[MAX_PASSWORD_LENGTH] = 0;
	pw1[MAX_PASSWORD_LENGTH] = 0;
	Firebird::string storedHash(pw1, MAX_PASSWORD_LENGTH);
	Firebird::string storedHash(pw1, MAX_PASSWORD_LENGTH);
	storedHash.rtrim();
	storedHash.rtrim();
(-) Firebird-2.0.3.12981-0_orig/src/jrd/svc.cpp (-1 / +1 lines)
 Lines 516-522    Link Here 
		}
		}
		else 
		else 
		{
		{
			TEXT name[129]; // unused after retrieved
			Firebird::string name; // unused after retrieved
			int id, group, node_id;
			int id, group, node_id;
			
			
			Firebird::string remote = options.spb_network_protocol +
			Firebird::string remote = options.spb_network_protocol +
(-) Firebird-2.0.3.12981-0_orig/src/remote/inet.cpp (-13 / +9 lines)
 Lines 94-100    Link Here 
#endif
#endif
#endif // !(defined VMS || defined WIN_NT)
#endif // !(defined VMS || defined WIN_NT)
#ifdef DARWIN
#if (defined DARWIN || defined HPUX)
extern "C" int innetgr(const char*, const char*, const char*, const char*);
extern "C" int innetgr(const char*, const char*, const char*, const char*);
#endif
#endif
 Lines 119-125    Link Here 
#include "../common/utils_proto.h"
#include "../common/utils_proto.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/classes/ClumpletWriter.h"
#if (defined hpux || defined SCO_UNIX)
#if (defined HPUX || defined SCO_UNIX)
extern int h_errno;
extern int h_errno;
#endif
#endif
 Lines 461-480    Link Here 
/* Pick up some user identification information */
/* Pick up some user identification information */
	Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
	Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
	char buffer[BUFFER_SMALL];
	Firebird::string buffer;
	int eff_gid;
	int eff_gid;
	int eff_uid;
	int eff_uid;
	ISC_get_user(buffer, &eff_uid, &eff_gid, 0, 0, 0, user_string);
	user_id.insertString(CNCT_user, buffer, strlen(buffer));
	ISC_get_host(buffer, sizeof(buffer));
	ISC_get_user(&buffer, &eff_uid, &eff_gid, user_string);
	for (char* p = buffer; *p; p++) {
	user_id.insertString(CNCT_user, buffer);
		if (*p >= 'A' && *p <= 'Z') {
			*p = *p - 'A' + 'a';
	ISC_get_host(buffer);
		}
	buffer.lower();
	}
	user_id.insertString(CNCT_host, buffer);
	user_id.insertString(CNCT_host, buffer, strlen(buffer));
	if ((eff_uid == -1) || uv_flag) {
	if ((eff_uid == -1) || uv_flag) {
		user_id.insertTag(CNCT_user_verification);
		user_id.insertTag(CNCT_user_verification);
(-) Firebird-2.0.3.12981-0_orig/src/remote/inet_server.cpp (-11 / +28 lines)
 Lines 96-101    Link Here 
#include "../jrd/sch_proto.h"
#include "../jrd/sch_proto.h"
#include "../jrd/thread_proto.h"
#include "../jrd/thread_proto.h"
#include "../common/utils_proto.h"
#include "../common/utils_proto.h"
#include "../common/classes/fb_string.h"
#ifdef UNIX
#ifdef UNIX
#ifdef NETBSD
#ifdef NETBSD
 Lines 105-120    Link Here 
#endif
#endif
#endif
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#if (defined SUPERSERVER && defined UNIX && defined SERVER_SHUTDOWN)
#if (defined SUPERSERVER && defined UNIX && defined SERVER_SHUTDOWN)
#include "../common/classes/semaphore.h"
#include "../common/classes/semaphore.h"
#define SHUTDOWN_THREAD
#define SHUTDOWN_THREAD
#endif
#endif
#ifdef SUPERSERVER
#ifdef UNIX
#ifndef WIN_NT
const char* TEMP_DIR = "/tmp";
const char* TEMP_DIR = "/tmp";
#define CHANGE_DIR chdir
#define CHANGE_DIR chdir
#endif
#endif
#ifdef SUPERSERVER
const char* INTERBASE_USER_NAME		= "interbase";
const char* INTERBASE_USER_NAME		= "interbase";
const char* INTERBASE_USER_SHORT	= "interbas";
const char* INTERBASE_USER_SHORT	= "interbas";
const char* FIREBIRD_USER_NAME		= "firebird";
const char* FIREBIRD_USER_NAME		= "firebird";
 Lines 280-288    Link Here 
	set_signal(SIGUSR2, signal_handler);
	set_signal(SIGUSR2, signal_handler);
#endif
#endif
#if defined(UNIX) && defined(DEV_BUILD)
#if defined(UNIX) && defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT)
#if !(defined(DEV_BUILD))
	if (Config::getBugcheckAbort())
#endif
	{
	{
		// try to force core files creation for DEV_BUILD
		// try to force core files creation
		struct rlimit core;
		struct rlimit core;
		if (getrlimit(RLIMIT_CORE, &core) == 0)
		if (getrlimit(RLIMIT_CORE, &core) == 0)
		{
		{
 Lines 296-301    Link Here 
		{
		{
			gds__log("getrlimit() failed, errno=%d", errno);
			gds__log("getrlimit() failed, errno=%d", errno);
		}
		}
		// we need some writable directory for core file
		// on any unix /tmp seems to be the best place
		if (CHANGE_DIR(TEMP_DIR)) {
			/* error on changing the directory */
			gds__log("Could not change directory to %s due to errno %d",
					TEMP_DIR, errno);
		}
	}
	}
#endif
#endif
 Lines 328-341    Link Here 
            // Remove restriction on username, for DEV builds
            // Remove restriction on username, for DEV builds
            // restrict only for production builds.  MOD 21-July-2002
            // restrict only for production builds.  MOD 21-July-2002
#ifndef DEV_BUILD
#ifndef DEV_BUILD
			TEXT user_name[256];	/* holds the user name */
			Firebird::string user_name;	/* holds the user name */
			/* check user id */
			/* check user id */
			ISC_get_user(user_name, NULL, NULL, NULL, NULL, NULL, NULL);
			ISC_get_user(&user_name, NULL, NULL, NULL);
			if (strcmp(user_name, "root") &&
			if (user_name != "root" &&
				strcmp(user_name, FIREBIRD_USER_NAME) &&
				user_name != FIREBIRD_USER_NAME &&
				strcmp(user_name, INTERBASE_USER_NAME) &&
				user_name != INTERBASE_USER_NAME &&
				strcmp(user_name, INTERBASE_USER_SHORT))
				user_name != INTERBASE_USER_SHORT)
			{
			{
				/* invalid user -- bail out */
				/* invalid user -- bail out */
				fprintf(stderr,
				fprintf(stderr,
 Lines 546-552    Link Here 
#endif
#endif
#ifdef SHUTDOWN_THREAD
#ifdef SHUTDOWN_THREAD
static Firebird::Semaphore shutSem;
static Firebird::SignalSafeSemaphore shutSem;
static bool alreadyClosing = false;
static bool alreadyClosing = false;
static THREAD_ENTRY_DECLARE shutdown_thread(THREAD_ENTRY_PARAM arg) 
static THREAD_ENTRY_DECLARE shutdown_thread(THREAD_ENTRY_PARAM arg) 
(-) Firebird-2.0.3.12981-0_orig/src/remote/os/win32/wnet.cpp (-16 / +8 lines)
 Lines 135-159    Link Here 
	PACKET* packet = &rdb->rdb_packet;
	PACKET* packet = &rdb->rdb_packet;
/* Pick up some user identification information */
/* Pick up some user identification information */
	TEXT buffer[128];
	Firebird::string buffer;
	TEXT *p;
	TEXT *p;
	Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
	Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
	ISC_get_user(buffer, 0, 0, 0, 0, 0, 0);
	ISC_get_user(&buffer, 0, 0, 0);
	for (p = buffer; *p; p++) {
	buffer.lower();
		if (*p >= 'A' && *p <= 'Z') {
	user_id.insertString(CNCT_user, buffer);
			*p = *p - 'A' + 'a';
		}
	ISC_get_host(buffer);
	}
	buffer.lower();
	user_id.insertString(CNCT_user, buffer, strlen(buffer));
	user_id.insertString(CNCT_host, buffer);
	ISC_get_host(buffer, sizeof(buffer));
	for (p = buffer; *p; p++) {
		if (*p >= 'A' && *p <= 'Z') {
			*p = *p - 'A' + 'a';
		}
	}
	user_id.insertString(CNCT_host, buffer, strlen(buffer));
	if (uv_flag) {
	if (uv_flag) {
		user_id.insertTag(CNCT_user_verification);
		user_id.insertTag(CNCT_user_verification);
(-) Firebird-2.0.3.12981-0_orig/src/remote/xnet.cpp (-21 / +12 lines)
 Lines 214-238    Link Here 
	// Pick up some user identification information
	// Pick up some user identification information
	TEXT buffer[BUFFER_TINY];
	Firebird::string buffer;
	TEXT *p;
	Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
	Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
	ISC_get_user(buffer, 0, 0, 0, 0, 0, 0);
	ISC_get_user(&buffer, 0, 0, 0);
	for (p = buffer; *p; p++) {
	buffer.lower();
		if (*p >= 'A' && *p <= 'Z') {
	user_id.insertString(CNCT_user, buffer);
			*p = *p - 'A' + 'a';
		}
	ISC_get_host(buffer);
	}
	buffer.lower();
	user_id.insertString(CNCT_user, buffer, strlen(buffer));
	user_id.insertString(CNCT_host, buffer);
	ISC_get_host(buffer, sizeof(buffer));
	for (p = buffer; *p; p++) {
		if (*p >= 'A' && *p <= 'Z') {
			*p = *p - 'A' + 'a';
		}
	}
	user_id.insertString(CNCT_host, buffer, strlen(buffer));
	if (uv_flag) {
	if (uv_flag) {
		user_id.insertTag(CNCT_user_verification);
		user_id.insertTag(CNCT_user_verification);
 Lines 760-770    Link Here 
		// send events channel
		// send events channel
		xps->xps_channels[XPS_CHANNEL_C2S_EVENTS].xch_client_ptr =
		xps->xps_channels[XPS_CHANNEL_C2S_EVENTS].xch_client_ptr =
			((UCHAR *) xpm->xpm_address + sizeof(struct xps));
			((UCHAR *) xcc->xcc_mapped_addr + sizeof(struct xps));
		// receive events channel
		// receive events channel
		xps->xps_channels[XPS_CHANNEL_S2C_EVENTS].xch_client_ptr =
		xps->xps_channels[XPS_CHANNEL_S2C_EVENTS].xch_client_ptr =
			((UCHAR *) xpm->xpm_address + sizeof(struct xps) + (XNET_EVENT_SPACE));
			((UCHAR *) xcc->xcc_mapped_addr + sizeof(struct xps) + (XNET_EVENT_SPACE));
		xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS];		
		xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS];		
		xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS];
		xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS];
 Lines 894-904    Link Here 
		// send events channel
		// send events channel
		xps->xps_channels[XPS_CHANNEL_S2C_EVENTS].xch_client_ptr =
		xps->xps_channels[XPS_CHANNEL_S2C_EVENTS].xch_client_ptr =
			((UCHAR *) xpm->xpm_address + sizeof(struct xps) + (XNET_EVENT_SPACE));
			((UCHAR *) xcc->xcc_mapped_addr + sizeof(struct xps) + (XNET_EVENT_SPACE));
		// receive events channel
		// receive events channel
		xps->xps_channels[XPS_CHANNEL_C2S_EVENTS].xch_client_ptr =
		xps->xps_channels[XPS_CHANNEL_C2S_EVENTS].xch_client_ptr =
			((UCHAR *) xpm->xpm_address + sizeof(struct xps));
			((UCHAR *) xcc->xcc_mapped_addr + sizeof(struct xps));
		xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS];		
		xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS];		
		xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS];
		xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS];
(-) Firebird-2.0.3.12981-0_orig/src/utilities/guard/guard.cpp (-6 / +8 lines)
 Lines 15-21    Link Here 
 *
 *
 * All Rights Reserved.
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 * Contributor(s): ______________________________________.
 * $Id: guard.cpp,v 1.8.12.3 2006/04/18 08:56:34 alexpeshkoff Exp $
 * $Id: guard.cpp,v 1.8.12.4 2007/11/22 12:30:43 alexpeshkoff Exp $
 */
 */
 /* contains the main() and not shared routines for ibguard */
 /* contains the main() and not shared routines for ibguard */
 Lines 45-50    Link Here 
#include "../jrd/gds_proto.h"
#include "../jrd/gds_proto.h"
#include "../jrd/file_params.h"
#include "../jrd/file_params.h"
#include "../utilities/guard/util_proto.h"
#include "../utilities/guard/util_proto.h"
#include "../common/classes/fb_string.h"
const USHORT FOREVER	= 1;
const USHORT FOREVER	= 1;
const USHORT ONETIME	= 2;
const USHORT ONETIME	= 2;
 Lines 107-118    Link Here 
	}							/* while */
	}							/* while */
/* check user id */
/* check user id */
	TEXT user_name[256];		/* holds the user name */
	Firebird::string user_name;		/* holds the user name */
	ISC_get_user(user_name, NULL, NULL, NULL, NULL, NULL, NULL);
	ISC_get_user(&user_name, NULL, NULL, NULL);
	if (strcmp(user_name, INTERBASE_USER) && strcmp(user_name, "root")
	if (user_name != INTERBASE_USER && 
		&& strcmp(user_name, FIREBIRD_USER)
		user_name != "root" &&
		&& strcmp(user_name, INTERBASE_USER_SHORT))
		user_name != FIREBIRD_USER &&
		user_name != INTERBASE_USER_SHORT)
	{
	{
		/* invalid user bail out */
		/* invalid user bail out */
		fprintf(stderr,
		fprintf(stderr,