8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 02:03:04 +01:00

1. Cleanup

2. Rework temporary files management. In particular:
- fix security hole on all POSIX platforms except FREEBSD/OPENBSD related to mktemp usage (possible DoS attacks or privileges elevation) via switching to mkstemp
- fix problem with only 27 unique filenames generated on Win32 (which could cause unpredictable behavior in SS builds)
- pass appropriate flags to CreateFile on Win32 to indicate that files are temporary (this may improve performance a little)
This commit is contained in:
skidder 2003-05-09 16:18:32 +00:00
parent a006cae722
commit ce1dca4ea4
3 changed files with 90 additions and 1313 deletions

File diff suppressed because it is too large Load Diff

View File

@ -121,7 +121,7 @@ void API_ROUTINE gds__qtoq(void*, void*);
void API_ROUTINE gds__register_cleanup(FPTR_VOID_PTR, void*);
SLONG API_ROUTINE gds__sqlcode(ISC_STATUS*);
void API_ROUTINE gds__sqlcode_s(ISC_STATUS*, ULONG*);
void* API_ROUTINE gds__temp_file(BOOLEAN, TEXT*, TEXT*);
void* API_ROUTINE gds__temp_file(BOOLEAN, TEXT*, TEXT*, TEXT* = NULL, BOOLEAN = FALSE);
void API_ROUTINE gds__unregister_cleanup(FPTR_VOID_PTR, void*);
BOOLEAN API_ROUTINE gds__validate_lib_path(TEXT*, TEXT*, TEXT*,
SLONG);
@ -130,7 +130,6 @@ void API_ROUTINE gds__vtof(SCHAR*, SCHAR*, USHORT);
void API_ROUTINE gds__vtov(const SCHAR*, char*, SSHORT);
void API_ROUTINE isc_print_sqlerror(SSHORT, ISC_STATUS*);
void API_ROUTINE isc_sql_interprete(SSHORT, TEXT*, SSHORT);
void* gds__tmp_file2(BOOLEAN, TEXT*, TEXT*, TEXT*);
SINT64 API_ROUTINE isc_portable_integer(UCHAR*, SSHORT);
void gds__cleanup(void);

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: sort.cpp,v 1.34 2003-04-10 06:49:15 aafemt Exp $
* $Id: sort.cpp,v 1.35 2003-05-09 16:18:32 skidder Exp $
*
* 2001-09-24 SJL - Temporary fix for large sort file bug
*
@ -1797,8 +1797,8 @@ static ULONG find_file_space(SCB scb, ULONG size, SFB * ret_sfb)
/* Create a scratch file */
sfb->sfb_file =
(int) gds__tmp_file2(FALSE, SCRATCH, file_name,
sfb->sfb_dls->dls_directory);
(int) gds__temp_file(FALSE, SCRATCH, file_name,
sfb->sfb_dls->dls_directory, TRUE);
/* allocate the file name even if the file is not open,
because the error routine depends on it
@ -2252,7 +2252,6 @@ static BOOLEAN local_fini(SCB scb, ATT att)
close(sfb->sfb_file);
if (sfb->sfb_file_name) {
unlink(sfb->sfb_file_name);
gds__free(sfb->sfb_file_name);
sfb->sfb_file_name = NULL;
}