mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 23:23:04 +01:00
Fixed bug CORE-2586 : Make all kernel object names in the same namespace
This commit is contained in:
parent
30c443092b
commit
e393abbbed
@ -326,7 +326,6 @@ char* cleanup_passwd(char* arg)
|
|||||||
#ifdef WIN_NT
|
#ifdef WIN_NT
|
||||||
|
|
||||||
static bool validateProductSuite (LPCSTR lpszSuiteToValidate);
|
static bool validateProductSuite (LPCSTR lpszSuiteToValidate);
|
||||||
static bool isGlobalKernelPrefix();
|
|
||||||
|
|
||||||
// hvlad: begins from Windows 2000 we can safely add 'Global\' prefix for
|
// hvlad: begins from Windows 2000 we can safely add 'Global\' prefix for
|
||||||
// names of all kernel objects we use. For Win9x we must not add this prefix.
|
// names of all kernel objects we use. For Win9x we must not add this prefix.
|
||||||
|
@ -97,6 +97,7 @@ namespace fb_utils
|
|||||||
|
|
||||||
#ifdef WIN_NT
|
#ifdef WIN_NT
|
||||||
bool prefix_kernel_object_name(char* name, size_t bufsize);
|
bool prefix_kernel_object_name(char* name, size_t bufsize);
|
||||||
|
bool isGlobalKernelPrefix();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Firebird::PathName get_process_name();
|
Firebird::PathName get_process_name();
|
||||||
|
@ -2389,7 +2389,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector,
|
|||||||
|
|
||||||
DWORD fdw_create;
|
DWORD fdw_create;
|
||||||
if (init_flag && file_exists && trunc_flag)
|
if (init_flag && file_exists && trunc_flag)
|
||||||
fdw_create = TRUNCATE_EXISTING | OPEN_ALWAYS;
|
fdw_create = TRUNCATE_EXISTING;
|
||||||
else
|
else
|
||||||
fdw_create = OPEN_ALWAYS;
|
fdw_create = OPEN_ALWAYS;
|
||||||
|
|
||||||
@ -2467,13 +2467,23 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector,
|
|||||||
/* Create the real file mapping object. */
|
/* Create the real file mapping object. */
|
||||||
|
|
||||||
TEXT mapping_name[MAXPATHLEN + 15]; // enough for int32 as text
|
TEXT mapping_name[MAXPATHLEN + 15]; // enough for int32 as text
|
||||||
sprintf(mapping_name, "%s_mapping_%"ULONGFORMAT, filename, header_address[1]);
|
sprintf(mapping_name, "_mapping_%"ULONGFORMAT, header_address[1]);
|
||||||
|
|
||||||
|
if (!make_object_name(object_name, sizeof(object_name), filename, mapping_name))
|
||||||
|
{
|
||||||
|
error(status_vector, "make_object_name", GetLastError());
|
||||||
|
UnmapViewOfFile(header_address);
|
||||||
|
CloseHandle(header_obj);
|
||||||
|
CloseHandle(event_handle);
|
||||||
|
CloseHandle(file_handle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE file_obj = CreateFileMapping(file_handle,
|
HANDLE file_obj = CreateFileMapping(file_handle,
|
||||||
ISC_get_security_desc(),
|
ISC_get_security_desc(),
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
0, length,
|
0, length,
|
||||||
mapping_name);
|
object_name);
|
||||||
if (file_obj == NULL)
|
if (file_obj == NULL)
|
||||||
{
|
{
|
||||||
error(status_vector, "CreateFileMapping", GetLastError());
|
error(status_vector, "CreateFileMapping", GetLastError());
|
||||||
@ -3521,24 +3531,28 @@ UCHAR* ISC_remap_file(ISC_STATUS * status_vector,
|
|||||||
* is generated with the mapped file is created.
|
* is generated with the mapped file is created.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HANDLE file_obj;
|
HANDLE file_obj = NULL;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
TEXT mapping_name[MAXPATHLEN + 15]; // enough for int32 as text
|
TEXT mapping_name[64]; // enough for int32 as text
|
||||||
sprintf(mapping_name, "%s_mapping_%"ULONGFORMAT,
|
sprintf(mapping_name, "_mapping_%"ULONGFORMAT, shmem_data->sh_mem_hdr_address[1] + 1);
|
||||||
shmem_data->sh_mem_name, shmem_data->sh_mem_hdr_address[1] + 1);
|
|
||||||
|
TEXT object_name[MAXPATHLEN];
|
||||||
|
if (!make_object_name(object_name, sizeof(object_name), shmem_data->sh_mem_name, mapping_name))
|
||||||
|
break;
|
||||||
|
|
||||||
file_obj = CreateFileMapping(shmem_data->sh_mem_handle,
|
file_obj = CreateFileMapping(shmem_data->sh_mem_handle,
|
||||||
ISC_get_security_desc(),
|
ISC_get_security_desc(),
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
0, new_length,
|
0, new_length,
|
||||||
mapping_name);
|
object_name);
|
||||||
|
|
||||||
if (!((GetLastError() == ERROR_ALREADY_EXISTS) && flag))
|
if (!((GetLastError() == ERROR_ALREADY_EXISTS) && flag))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CloseHandle(file_obj);
|
CloseHandle(file_obj);
|
||||||
|
file_obj = NULL;
|
||||||
shmem_data->sh_mem_hdr_address[1]++;
|
shmem_data->sh_mem_hdr_address[1]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "firebird.h"
|
#include "firebird.h"
|
||||||
#include "../../../common/classes/init.h"
|
#include "../../../common/classes/init.h"
|
||||||
|
#include "../../../common/utils_proto.h"
|
||||||
#include "../jrd/common.h"
|
#include "../jrd/common.h"
|
||||||
#include "gen/iberror.h"
|
#include "gen/iberror.h"
|
||||||
#include "../jrd/isc.h"
|
#include "../jrd/isc.h"
|
||||||
@ -159,7 +160,7 @@ void* ISC_make_signal(bool create_flag, bool manual_reset, int process_idL, int
|
|||||||
**************************************/
|
**************************************/
|
||||||
ISC_signal_init();
|
ISC_signal_init();
|
||||||
|
|
||||||
const BOOLEAN man_rst = manual_reset ? TRUE : FALSE;
|
const BOOL man_rst = manual_reset ? TRUE : FALSE;
|
||||||
|
|
||||||
if (!signal_number)
|
if (!signal_number)
|
||||||
return CreateEvent(NULL, man_rst, FALSE, NULL);
|
return CreateEvent(NULL, man_rst, FALSE, NULL);
|
||||||
@ -167,6 +168,12 @@ void* ISC_make_signal(bool create_flag, bool manual_reset, int process_idL, int
|
|||||||
TEXT event_name[BUFFER_TINY];
|
TEXT event_name[BUFFER_TINY];
|
||||||
sprintf(event_name, "_firebird_process%u_signal%d", process_idL, signal_number);
|
sprintf(event_name, "_firebird_process%u_signal%d", process_idL, signal_number);
|
||||||
|
|
||||||
|
if (!fb_utils::prefix_kernel_object_name(event_name, sizeof(event_name)))
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, TRUE, event_name);
|
HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, TRUE, event_name);
|
||||||
|
|
||||||
if (create_flag) {
|
if (create_flag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user