summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2004-02-20 17:43:02 +0200
committerunknown <monty@mashka.mysql.fi>2004-02-20 17:43:02 +0200
commit8b2b219fb5e1374abdd816d9d0911d37087c86a5 (patch)
treee13a23a1c9f28ed5eb2d903ba59a153cda3355ac /sql/mysqld.cc
parent51a6b4f47ad03031105b0f8ac810d522a804695e (diff)
parent9bc5cdba41a0d2bc3c391469b14168f82e636a6b (diff)
downloadmariadb-git-8b2b219fb5e1374abdd816d9d0911d37087c86a5.tar.gz
merge with 4.0 to get security fixes and latest bug fixes
BitKeeper/etc/logging_ok: auto-union configure.in: Auto merged BitKeeper/deleted/.del-mini_client.cc~8677895ec8169183: Auto merged VC++Files/mysql.dsw: Auto merged VC++Files/mysys/mysys.dsp: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/srv0start.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/que/que0que.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/sync/sync0sync.c: Auto merged innobase/trx/trx0trx.c: Auto merged libmysql/manager.c: Auto merged sql/ha_innodb.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/unireg.cc: Auto merged VC++Files/sql/mysqld.dsp: Removed wrong define USE_SYMLINK include/config-win.h: Use original code innobase/srv/srv0srv.c: merge innobase/usr/usr0sess.c: merge libmysql/libmysql.c: merge mysql-test/r/func_test.result: merge mysql-test/t/func_test.test: merge sql/log.cc: merge sql/mysqld.cc: merge
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc44
1 files changed, 23 insertions, 21 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index af61d624464..ee7e2dfadf5 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -188,7 +188,6 @@ inline void reset_floating_point_exceptions()
extern "C" int gethostname(char *name, int namelen);
#endif
-
/* Set prefix for windows binary */
#ifdef __WIN__
#undef MYSQL_SERVER_SUFFIX
@@ -430,7 +429,7 @@ static NTService Service; // Service object for WinNT
#endif /* __WIN__ */
#ifdef __NT__
-static char szPipeName [ 257 ];
+static char pipe_name[512];
static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
@@ -573,7 +572,7 @@ static void close_connections(void)
DBUG_PRINT( "quit", ("Closing named pipes") );
/* Create connection to the handle named pipe handler to break the loop */
- if ((temp = CreateFile(szPipeName,
+ if ((temp = CreateFile(pipe_name,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
@@ -581,7 +580,7 @@ static void close_connections(void)
0,
NULL )) != INVALID_HANDLE_VALUE)
{
- WaitNamedPipe(szPipeName, 1000);
+ WaitNamedPipe(pipe_name, 1000);
DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
SetNamedPipeHandleState(temp, &dwMode, NULL, NULL);
CancelIo(temp);
@@ -1185,11 +1184,14 @@ static void server_init(void)
if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap &&
opt_enable_named_pipe)
{
- sprintf(szPipeName, "\\\\.\\pipe\\%s", mysqld_unix_port );
- ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) );
- ZeroMemory( &sdPipeDescriptor, sizeof(sdPipeDescriptor) );
- if ( !InitializeSecurityDescriptor(&sdPipeDescriptor,
- SECURITY_DESCRIPTOR_REVISION) )
+
+ pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */
+ strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\",
+ unix_socket, NullS);
+ bzero((char*) &saPipeSecurity, sizeof(saPipeSecurity));
+ bzero((char*) &sdPipeDescriptor, sizeof(sdPipeDescriptor));
+ if (!InitializeSecurityDescriptor(&sdPipeDescriptor,
+ SECURITY_DESCRIPTOR_REVISION))
{
sql_perror("Can't start server : Initialize security descriptor");
unireg_abort(1);
@@ -1202,16 +1204,16 @@ static void server_init(void)
saPipeSecurity.nLength = sizeof( SECURITY_ATTRIBUTES );
saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor;
saPipeSecurity.bInheritHandle = FALSE;
- if ((hPipe = CreateNamedPipe(szPipeName,
- PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_BYTE |
- PIPE_READMODE_BYTE |
- PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES,
- (int) global_system_variables.net_buffer_length,
- (int) global_system_variables.net_buffer_length,
- NMPWAIT_USE_DEFAULT_WAIT,
- &saPipeSecurity )) == INVALID_HANDLE_VALUE)
+ if ((hPipe= CreateNamedPipe(pipe_name,
+ PIPE_ACCESS_DUPLEX,
+ PIPE_TYPE_BYTE |
+ PIPE_READMODE_BYTE |
+ PIPE_WAIT,
+ PIPE_UNLIMITED_INSTANCES,
+ (int) global_system_variables.net_buffer_length,
+ (int) global_system_variables.net_buffer_length,
+ NMPWAIT_USE_DEFAULT_WAIT,
+ &saPipeSecurity)) == INVALID_HANDLE_VALUE)
{
LPVOID lpMsgBuf;
int error=GetLastError();
@@ -3270,7 +3272,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
if (!fConnected)
{
CloseHandle( hPipe );
- if ((hPipe = CreateNamedPipe(szPipeName,
+ if ((hPipe = CreateNamedPipe(pipe_name,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |
@@ -3288,7 +3290,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
}
hConnectedPipe = hPipe;
/* create new pipe for new connection */
- if ((hPipe = CreateNamedPipe(szPipeName,
+ if ((hPipe = CreateNamedPipe(pipe_name,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |