|
From: <hv...@us...> - 2010-07-23 14:31:11
|
Revision: 51362
http://firebird.svn.sourceforge.net/firebird/?rev=51362&view=rev
Author: hvlad
Date: 2010-07-23 14:31:04 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Make trusted auth works
Modified Paths:
--------------
firebird/trunk/src/remote/interface.cpp
firebird/trunk/src/remote/os/win32/srvr_w32.cpp
Modified: firebird/trunk/src/remote/interface.cpp
===================================================================
--- firebird/trunk/src/remote/interface.cpp 2010-07-23 14:06:29 UTC (rev 51361)
+++ firebird/trunk/src/remote/interface.cpp 2010-07-23 14:31:04 UTC (rev 51362)
@@ -68,6 +68,15 @@
//#include "../auth/trusted/AuthSspi.h"
#include "../common/classes/ImplementHelper.h"
+#ifdef WIN_NT
+#include "../auth/trusted/AuthSspi.h"
+
+namespace {
+ char name[] = "WIN_SSPI";
+ Firebird::PluginHelper<Auth::WinSspiClient, Firebird::Plugin::AuthClient, name> client;
+}
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
Modified: firebird/trunk/src/remote/os/win32/srvr_w32.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/srvr_w32.cpp 2010-07-23 14:06:29 UTC (rev 51361)
+++ firebird/trunk/src/remote/os/win32/srvr_w32.cpp 2010-07-23 14:31:04 UTC (rev 51362)
@@ -123,7 +123,7 @@
// from AuthSspi
char name1[] = "WIN_SSPI";
Firebird::PluginHelper<Auth::WinSspiServer, Firebird::Plugin::AuthServer, name1> server1;
- Firebird::PluginHelper<Auth::WinSspiClient, Firebird::Plugin::AuthClient, name1> client1;
+// Firebird::PluginHelper<Auth::WinSspiClient, Firebird::Plugin::AuthClient, name1> client1;
// from LegacyClient
char name2[] = "LEGACY_AUTH";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2010-10-12 08:15:58
|
Revision: 51654
http://firebird.svn.sourceforge.net/firebird/?rev=51654&view=rev
Author: alexpeshkoff
Date: 2010-10-12 08:15:48 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
Missed in previous commit files
Added Paths:
-----------
firebird/trunk/src/remote/os/
firebird/trunk/src/remote/os/win32/
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/wnet_proto.h
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/os/win32/xnet.h
firebird/trunk/src/remote/os/win32/xnet_proto.h
firebird/trunk/src/remote/server/os/win32/
firebird/trunk/src/remote/server/os/win32/caution.ico
firebird/trunk/src/remote/server/os/win32/chop.cpp
firebird/trunk/src/remote/server/os/win32/chop_proto.h
firebird/trunk/src/remote/server/os/win32/cntl.cpp
firebird/trunk/src/remote/server/os/win32/cntl_proto.h
firebird/trunk/src/remote/server/os/win32/property.cpp
firebird/trunk/src/remote/server/os/win32/property.rc
firebird/trunk/src/remote/server/os/win32/property.rh
firebird/trunk/src/remote/server/os/win32/propty_proto.h
firebird/trunk/src/remote/server/os/win32/server.ico
firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp
firebird/trunk/src/remote/server/os/win32/window.cpp
firebird/trunk/src/remote/server/os/win32/window.h
firebird/trunk/src/remote/server/os/win32/window.rc
firebird/trunk/src/remote/server/os/win32/window.rh
firebird/trunk/src/remote/server/os/win32/window_proto.h
Added: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp (rev 0)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2010-10-12 08:15:48 UTC (rev 51654)
@@ -0,0 +1,1609 @@
+/*
+ * PROGRAM: JRD Remote Interface/Server
+ * MODULE: wnet.cpp
+ * DESCRIPTION: Windows Net Communications module.
+ *
+ * The contents of this file are subject to the Interbase Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy
+ * of the License at http://www.Inprise.com/IPL.html
+ *
+ * Software distributed under the License is distributed on an
+ * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code was created by Inprise Corporation
+ * and its predecessors. Portions created by Inprise Corporation are
+ * Copyright (C) Inprise Corporation.
+ *
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ */
+
+#ifdef DEBUG
+// define WNET_trace to 0 (zero) for no packet debugging
+#define WNET_trace
+#endif
+
+#include "firebird.h"
+#include <stdio.h>
+#include <string.h>
+#include "../remote/remote.h"
+#include "../jrd/ibase.h"
+#include "../common/thd.h"
+
+#include "../utilities/install/install_nt.h"
+
+#include "../remote/proto_proto.h"
+#include "../remote/remot_proto.h"
+#include "../remote/os/win32/wnet_proto.h"
+#include "../yvalve/gds_proto.h"
+#include "../common/isc_proto.h"
+#include "../common/isc_f_proto.h"
+#include "../common/config/config.h"
+#include "../common/utils_proto.h"
+#include "../common/classes/ClumpletWriter.h"
+#include "../common/classes/init.h"
+
+#include <stdarg.h>
+
+using namespace Firebird;
+
+const int MAX_DATA = 2048;
+const int BUFFER_SIZE = MAX_DATA;
+
+const char* PIPE_PREFIX = "pipe"; // win32-specific
+const char* SERVER_PIPE_SUFFIX = "server";
+const char* EVENT_PIPE_SUFFIX = "event";
+Firebird::AtomicCounter event_counter;
+
+static Firebird::GlobalPtr<PortsCleanup> wnet_ports;
+static Firebird::GlobalPtr<Firebird::Mutex> init_mutex;
+static volatile bool wnet_initialized = false;
+static volatile bool wnet_shutdown = false;
+
+static bool accept_connection(rem_port*, const P_CNCT*);
+static rem_port* alloc_port(rem_port*);
+static rem_port* aux_connect(rem_port*, PACKET*);
+static rem_port* aux_request(rem_port*, PACKET*);
+static bool connect_client(rem_port*);
+static void disconnect(rem_port*);
+#ifdef NOT_USED_OR_REPLACED
+static void exit_handler(void*);
+#endif
+static void force_close(rem_port*);
+static rem_str* make_pipe_name(const TEXT*, const TEXT*, const TEXT*);
+static rem_port* receive(rem_port*, PACKET*);
+static int send_full(rem_port*, PACKET*);
+static int send_partial(rem_port*, PACKET*);
+static int xdrwnet_create(XDR*, rem_port*, UCHAR*, USHORT, xdr_op);
+static bool_t xdrwnet_endofrecord(XDR*);//, int);
+static int wnet_destroy(XDR*);
+static bool wnet_error(rem_port*, const TEXT*, ISC_STATUS, int);
+static void wnet_gen_error(rem_port*, const Firebird::Arg::StatusVector& v);
+static bool_t wnet_getbytes(XDR*, SCHAR*, u_int);
+static bool_t wnet_getlong(XDR*, SLONG*);
+static u_int wnet_getpostn(XDR*);
+static caddr_t wnet_inline(XDR*, u_int);
+static bool_t wnet_putlong(XDR*, const SLONG*);
+static bool_t wnet_putbytes(XDR*, const SCHAR*, u_int);
+static bool_t wnet_read(XDR*);
+static bool_t wnet_setpostn(XDR*, u_int);
+static bool_t wnet_write(XDR*); //, int);
+#ifdef DEBUG
+static void packet_print(const TEXT*, const UCHAR*, const int);
+#endif
+static bool packet_receive(rem_port*, UCHAR*, SSHORT, SSHORT*);
+static bool packet_send(rem_port*, const SCHAR*, SSHORT);
+static void wnet_make_file_name(TEXT*, DWORD);
+
+static int cleanup_ports(const int, const int, void*);
+
+static xdr_t::xdr_ops wnet_ops =
+{
+ wnet_getlong,
+ wnet_putlong,
+ wnet_getbytes,
+ wnet_putbytes,
+ wnet_getpostn,
+ wnet_setpostn,
+ wnet_inline,
+ wnet_destroy
+};
+
+
+rem_port* WNET_analyze(const Firebird::PathName& file_name,
+ ISC_STATUS* status_vector,
+ const TEXT* node_name,
+ bool uv_flag)
+{
+/**************************************
+ *
+ * W N E T _ a n a l y z e
+ *
+ **************************************
+ *
+ * Functional description
+ * Determine whether the file name has a "\\nodename".
+ * If so, establish an external connection to the node.
+ *
+ * If a connection is established, return a port block, otherwise
+ * return NULL.
+ *
+ **************************************/
+
+ // We need to establish a connection to a remote server. Allocate the necessary
+ // blocks and get ready to go.
+
+ Rdb* rdb = new Rdb;
+ PACKET* packet = &rdb->rdb_packet;
+
+ // Pick up some user identification information
+ Firebird::string buffer;
+ Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
+
+ ISC_get_user(&buffer, 0, 0);
+ buffer.lower();
+ user_id.insertString(CNCT_user, buffer);
+
+ ISC_get_host(buffer);
+ buffer.lower();
+ user_id.insertString(CNCT_host, buffer);
+
+ if (uv_flag) {
+ user_id.insertTag(CNCT_user_verification);
+ }
+
+ // Establish connection to server
+
+ P_CNCT* const cnct = &packet->p_cnct;
+ packet->p_operation = op_connect;
+ cnct->p_cnct_operation = op_attach;
+ cnct->p_cnct_cversion = CONNECT_VERSION2;
+ cnct->p_cnct_client = ARCHITECTURE;
+ cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
+ cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
+
+ // If we want user verification, we can't speak anything less than version 7
+
+ cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
+ cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
+
+ static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ {
+ REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_batch_send, 4),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_batch_send, 5),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_batch_send, 6)
+ };
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+
+ for (size_t i = 0; i < cnct->p_cnct_count; i++) {
+ cnct->p_cnct_versions[i] = protocols_to_try1[i];
+ }
+
+ // If we can't talk to a server, punt. Let somebody else generate an error.
+
+ rem_port* port = WNET_connect(node_name, packet, status_vector, 0);
+ if (!port)
+ {
+ delete rdb;
+ return NULL;
+ }
+
+ // Get response packet from server.
+
+ rdb->rdb_port = port;
+ port->port_context = rdb;
+ port->receive(packet);
+
+ if (packet->p_operation == op_reject && !uv_flag)
+ {
+ disconnect(port);
+ packet->p_operation = op_connect;
+ cnct->p_cnct_operation = op_attach;
+ cnct->p_cnct_cversion = CONNECT_VERSION2;
+ cnct->p_cnct_client = ARCHITECTURE;
+ cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
+ cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
+
+ // try again with next set of known protocols
+
+ cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
+ cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
+
+ static const p_cnct::p_cnct_repeat protocols_to_try2[] =
+ {
+ REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_rpc, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 2),
+ };
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
+
+ for (size_t i = 0; i < cnct->p_cnct_count; i++) {
+ cnct->p_cnct_versions[i] = protocols_to_try2[i];
+ }
+
+ port = WNET_connect(node_name, packet, status_vector, 0);
+ if (!port)
+ {
+ delete rdb;
+ return NULL;
+ }
+
+ // Get response packet from server.
+
+ rdb->rdb_port = port;
+ port->port_context = rdb;
+ port->receive(packet);
+ }
+
+ if (packet->p_operation == op_reject && !uv_flag)
+ {
+ disconnect(port);
+ packet->p_operation = op_connect;
+ cnct->p_cnct_operation = op_attach;
+ cnct->p_cnct_cversion = CONNECT_VERSION2;
+ cnct->p_cnct_client = ARCHITECTURE;
+ cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
+ cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
+
+ // try again with next set of known protocols
+
+ cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
+ cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
+
+ static const p_cnct::p_cnct_repeat protocols_to_try3[] =
+ {
+ REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_rpc, ptype_batch_send, 1)
+ };
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
+
+ for (size_t i = 0; i < cnct->p_cnct_count; i++) {
+ cnct->p_cnct_versions[i] = protocols_to_try3[i];
+ }
+
+ port = WNET_connect(node_name, packet, status_vector, 0);
+ if (!port)
+ {
+ delete rdb;
+ return NULL;
+ }
+
+ // Get response packet from server.
+
+ rdb->rdb_port = port;
+ port->port_context = rdb;
+ port->receive(packet);
+ }
+
+ if (packet->p_operation != op_accept)
+ {
+ *status_vector++ = isc_arg_gds;
+ *status_vector++ = isc_connect_reject;
+ *status_vector++ = 0;
+ delete rdb;
+ disconnect(port);
+ return NULL;
+ }
+
+ port->port_protocol = packet->p_acpt.p_acpt_version;
+
+ // once we've decided on a protocol, concatenate the version
+ // string to reflect it...
+
+ Firebird::string temp;
+ temp.printf("%s/P%d", port->port_version->str_data,
+ port->port_protocol & FB_PROTOCOL_MASK);
+ delete port->port_version;
+ port->port_version = REMOTE_make_string(temp.c_str());
+
+ if (packet->p_acpt.p_acpt_architecture == ARCHITECTURE)
+ port->port_flags |= PORT_symmetric;
+
+ if (packet->p_acpt.p_acpt_type == ptype_rpc)
+ port->port_flags |= PORT_rpc;
+
+ if (packet->p_acpt.p_acpt_type != ptype_out_of_band)
+ port->port_flags |= PORT_no_oob;
+
+ return port;
+}
+
+
+rem_port* WNET_connect(const TEXT* name,
+ PACKET* packet,
+ ISC_STATUS* status_vector,
+ USHORT flag)
+{
+/**************************************
+ *
+ * W N E T _ c o n n e c t
+ *
+ **************************************
+ *
+ * Functional description
+ * Establish half of a communication link. If a connect packet is given,
+ * the connection is on behalf of a remote interface. Otherwise the
+ * connect is for a server process.
+ *
+ **************************************/
+ rem_port* const port = alloc_port(0);
+ port->port_status_vector = status_vector;
+ status_vector[0] = isc_arg_gds;
+ status_vector[1] = 0;
+ status_vector[2] = isc_arg_end;
+
+ delete port->port_connection;
+ port->port_connection = make_pipe_name(name, SERVER_PIPE_SUFFIX, 0);
+
+ // If we're a host, just make the connection
+
+ if (packet)
+ {
+ while (true)
+ {
+ port->port_pipe = CreateFile(port->port_connection->str_data,
+ GENERIC_WRITE | GENERIC_READ,
+ 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+ if (port->port_pipe != INVALID_HANDLE_VALUE) {
+ break;
+ }
+ const ISC_STATUS status = GetLastError();
+ if (status != ERROR_PIPE_BUSY)
+ {
+ wnet_error(port, "CreateFile", isc_net_connect_err, status);
+ disconnect(port);
+ return NULL;
+ }
+ WaitNamedPipe(port->port_connection->str_data, 3000L);
+ }
+ send_full(port, packet);
+ return port;
+ }
+
+ // We're a server, so wait for a host to show up
+
+ wnet_ports->registerPort(port);
+ while (!wnet_shutdown)
+ {
+ port->port_pipe =
+ CreateNamedPipe(port->port_connection->str_data,
+ PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
+ PIPE_WAIT | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
+ PIPE_UNLIMITED_INSTANCES,
+ MAX_DATA,
+ MAX_DATA,
+ 0,
+ ISC_get_security_desc());
+ if (port->port_pipe == INVALID_HANDLE_VALUE)
+ {
+ const DWORD dwError = GetLastError();
+ if (dwError == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ disconnect(port);
+ wnet_shutdown = true;
+ break;
+ }
+
+ wnet_error(port, "CreateNamedPipe", isc_net_connect_listen_err, dwError);
+ disconnect(port);
+ return NULL;
+ }
+
+ if (!connect_client(port))
+ break;
+
+ if (flag & (SRVR_debug | SRVR_multi_client))
+ {
+ port->port_server_flags |= SRVR_server;
+ if (flag & SRVR_multi_client)
+ {
+ port->port_server_flags |= SRVR_multi_client;
+ }
+
+ return port;
+ }
+
+ TEXT name[MAXPATHLEN];
+ GetModuleFileName(NULL, name, sizeof(name));
+
+ Firebird::string cmdLine;
+ cmdLine.printf("%s -w -h %"HANDLEFORMAT"@%"ULONGFORMAT, name, port->port_pipe, GetCurrentProcessId());
+
+ STARTUPINFO start_crud;
+ PROCESS_INFORMATION pi;
+ start_crud.cb = sizeof(STARTUPINFO);
+ start_crud.lpReserved = NULL;
+ start_crud.lpReserved2 = NULL;
+ start_crud.cbReserved2 = 0;
+ start_crud.lpDesktop = NULL;
+ start_crud.lpTitle = NULL;
+ start_crud.dwFlags = STARTF_FORCEOFFFEEDBACK;
+
+ if (CreateProcess(NULL, cmdLine.begin(), NULL, NULL, FALSE,
+ (flag & SRVR_high_priority ?
+ HIGH_PRIORITY_CLASS | DETACHED_PROCESS :
+ NORMAL_PRIORITY_CLASS | DETACHED_PROCESS),
+ NULL, NULL, &start_crud, &pi))
+ {
+ // hvlad: child process will close our handle of client pipe
+ CloseHandle(pi.hThread);
+ CloseHandle(pi.hProcess);
+ }
+ else
+ {
+ gds__log("WNET/inet_error: fork/CreateProcess errno = %d", GetLastError());
+ CloseHandle(port->port_pipe);
+ }
+
+ if (wnet_shutdown) {
+ disconnect(port);
+ }
+ }
+
+ if (wnet_shutdown)
+ {
+ Arg::Gds temp(isc_net_server_shutdown);
+ temp << Arg::Str("WNET");
+ temp.copyTo(status_vector);
+ }
+ return NULL;
+}
+
+
+rem_port* WNET_reconnect(HANDLE handle, ISC_STATUS* status_vector)
+{
+/**************************************
+ *
+ * W N E T _ r e c o n n e c t
+ *
+ **************************************
+ *
+ * Functional description
+ * A communications link has been established by another
+ * process. We have inheritted the handle. Set up
+ * a port block.
+ *
+ **************************************/
+ rem_port* const port = alloc_port(0);
+ port->port_status_vector = status_vector;
+ status_vector[0] = isc_arg_gds;
+ status_vector[1] = 0;
+ status_vector[2] = isc_arg_end;
+
+ delete port->port_connection;
+ port->port_connection = make_pipe_name(NULL, SERVER_PIPE_SUFFIX, 0);
+
+ port->port_pipe = handle;
+ port->port_server_flags |= SRVR_server;
+
+ return port;
+}
+
+
+static bool accept_connection( rem_port* port, const P_CNCT* cnct)
+{
+/**************************************
+ *
+ * a c c e p t _ c o n n e c t i o n
+ *
+ **************************************
+ *
+ * Functional description
+ * Accept an incoming request for connection. This is purely a lower
+ * level handshaking function, and does not constitute the server
+ * response for protocol selection.
+ *
+ **************************************/
+ // Default account to "guest" (in theory all packets contain a name)
+
+ Firebird::string name("guest"), password;
+
+ // Pick up account and password, if given. The password is ignored
+
+ Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged,
+ cnct->p_cnct_user_id.cstr_address, cnct->p_cnct_user_id.cstr_length);
+
+ for (id.rewind(); !id.isEof(); id.moveNext())
+ {
+ switch (id.getClumpTag())
+ {
+ case CNCT_user:
+ id.getString(name);
+ port->port_user_name = REMOTE_make_string(name.c_str());
+ break;
+
+ case CNCT_passwd:
+ id.getString(password);
+ break;
+ }
+ }
+
+ // NS: Put in connection address. I have no good idea where to get an
+ // address of the remote end of named pipe so let's live without it for now
+ port->port_protocol_str = REMOTE_make_string("WNET");
+
+ return true;
+}
+
+
+static rem_port* alloc_port( rem_port* parent)
+{
+/**************************************
+ *
+ * a l l o c _ p o r t
+ *
+ **************************************
+ *
+ * Functional description
+ * Allocate a port block, link it in to parent (if there is a parent),
+ * and initialize input and output XDR streams.
+ *
+ **************************************/
+
+ if (!wnet_initialized)
+ {
+ Firebird::MutexLockGuard guard(init_mutex);
+ if (!wnet_initialized)
+ {
+ wnet_initialized = true;
+ fb_shutdown_callback(0, cleanup_ports, fb_shut_postproviders, 0);
+ }
+ }
+
+ rem_port* port = new rem_port(rem_port::PIPE, BUFFER_SIZE * 2);
+
+ TEXT buffer[BUFFER_TINY];
+ ISC_get_host(buffer, sizeof(buffer));
+ port->port_host = REMOTE_make_string(buffer);
+ port->port_connection = REMOTE_make_string(buffer);
+ sprintf(buffer, "WNet (%s)", port->port_host->str_data);
+ port->port_version = REMOTE_make_string(buffer);
+
+ port->port_accept = accept_connection;
+ port->port_disconnect = disconnect;
+ port->port_force_close = force_close;
+ port->port_receive_packet = receive;
+ port->port_send_packet = send_full;
+ port->port_send_partial = send_partial;
+ port->port_connect = aux_connect;
+ port->port_request = aux_request;
+ port->port_buff_size = BUFFER_SIZE;
+
+ port->port_event = CreateEvent(NULL, TRUE, TRUE, NULL);
+
+ xdrwnet_create(&port->port_send, port, &port->port_buffer[BUFFER_SIZE], BUFFER_SIZE, XDR_ENCODE);
+
+ xdrwnet_create(&port->port_receive, port, port->port_buffer, 0, XDR_DECODE);
+
+ if (parent)
+ {
+ delete port->port_connection;
+ port->port_connection = REMOTE_make_string(parent->port_connection->str_data);
+
+ port->linkParent(parent);
+ }
+
+ return port;
+}
+
+
+static rem_port* aux_connect( rem_port* port, PACKET* packet)
+{
+/**************************************
+ *
+ * a u x _ c o n n e c t
+ *
+ **************************************
+ *
+ * Functional description
+ * Try to establish an alternative connection. Somebody has already
+ * done a successfull connect request ("packet" contains the response).
+ *
+ **************************************/
+ // If this is a server, we're got an auxiliary connection. Accept it
+
+ if (port->port_server_flags)
+ {
+ if (!connect_client(port))
+ return NULL;
+
+ port->port_flags |= PORT_async;
+ return port;
+ }
+
+ // The server will be sending its process id in the packet to
+ // create a unique pipe name.
+
+ P_RESP* response = &packet->p_resp;
+
+ TEXT str_pid[32];
+ const TEXT* p = 0;
+ if (response->p_resp_data.cstr_length)
+ {
+ // Avoid B.O.
+ size_t len = MIN(response->p_resp_data.cstr_length, sizeof(str_pid) - 1);
+ memcpy(str_pid, response->p_resp_data.cstr_address, len);
+ str_pid[len] = 0;
+ p = str_pid;
+ }
+
+ rem_port* const new_port = alloc_port(port->port_parent);
+ port->port_async = new_port;
+ new_port->port_flags = port->port_flags & PORT_no_oob;
+ new_port->port_flags |= PORT_async;
+ new_port->port_connection = make_pipe_name(port->port_connection->str_data, EVENT_PIPE_SUFFIX, p);
+
+ while (true)
+ {
+ new_port->port_pipe =
+ CreateFile(new_port->port_connection->str_data, GENERIC_READ, 0,
+ NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+ if (new_port->port_pipe != INVALID_HANDLE_VALUE)
+ break;
+ const ISC_STATUS status = GetLastError();
+ if (status != ERROR_PIPE_BUSY)
+ {
+ wnet_error(new_port, "CreateFile", isc_net_event_connect_err, status);
+ return NULL;
+ }
+ WaitNamedPipe(new_port->port_connection->str_data, 3000L);
+ }
+
+ return new_port;
+}
+
+
+static rem_port* aux_request( rem_port* vport, PACKET* packet)
+{
+/**************************************
+ *
+ * a u x _ r e q u e s t
+ *
+ **************************************
+ *
+ * Functional description
+ * A remote interface has requested the server prepare an auxiliary
+ * connection; the server calls aux_request to set up the connection.
+ * Send the servers process id on the packet. If at a later time
+ * a multi client server is used, there may be a need to
+ * generate a unique id based on connection.
+ *
+ **************************************/
+
+ const DWORD server_pid = (vport->port_server_flags & SRVR_multi_client) ?
+ ++event_counter : GetCurrentProcessId();
+ rem_port* const new_port = alloc_port(vport->port_parent);
+ vport->port_async = new_port;
+ new_port->port_server_flags = vport->port_server_flags;
+ new_port->port_flags = vport->port_flags & PORT_no_oob;
+
+ TEXT str_pid[32];
+ wnet_make_file_name(str_pid, server_pid);
+ new_port->port_connection =
+ make_pipe_name(vport->port_connection->str_data, EVENT_PIPE_SUFFIX, str_pid);
+
+ new_port->port_pipe =
+ CreateNamedPipe(new_port->port_connection->str_data,
+ PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
+ PIPE_WAIT | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
+ PIPE_UNLIMITED_INSTANCES,
+ MAX_DATA,
+ MAX_DATA,
+ 0,
+ ISC_get_security_desc());
+
+ if (new_port->port_pipe == INVALID_HANDLE_VALUE)
+ {
+ wnet_error(new_port, "CreateNamedPipe", isc_net_event_listen_err, ERRNO);
+ disconnect(new_port);
+ return NULL;
+ }
+
+ P_RESP* response = &packet->p_resp;
+ response->p_resp_data.cstr_length = (USHORT) strlen(str_pid);
+ memcpy(response->p_resp_data.cstr_address, str_pid, response->p_resp_data.cstr_length);
+
+ return new_port;
+}
+
+
+static bool connect_client(rem_port *port)
+{
+/**************************************
+ *
+ * c o n n e c t _ c l i e n t
+ *
+ **************************************
+ *
+ * Functional description
+ * Wait for new client connected.
+ *
+ **************************************/
+
+ OVERLAPPED ovrl = {0};
+ ovrl.hEvent = port->port_event;
+ if (!ConnectNamedPipe(port->port_pipe, &ovrl))
+ {
+ DWORD err = GetLastError();
+ switch (err)
+ {
+ case ERROR_PIPE_CONNECTED:
+ break;
+
+ case ERROR_IO_PENDING:
+ if (WaitForSingleObject(port->port_event, INFINITE) == WAIT_OBJECT_0)
+ {
+ if (!wnet_shutdown)
+ break;
+ }
+ else
+ err = GetLastError(); // fall thru
+
+ default:
+ if (!wnet_shutdown) {
+ wnet_error(port, "ConnectNamedPipe", isc_net_connect_err, err);
+ }
+ disconnect(port);
+ return false;
+ }
+ }
+ return true;
+}
+
+
+static void disconnect(rem_port* port)
+{
+/**************************************
+ *
+ * d i s c o n n e c t
+ *
+ **************************************
+ *
+ * Functional description
+ * Break a remote connection.
+ *
+ **************************************/
+
+ if (port->port_async)
+ {
+ disconnect(port->port_async);
+ port->port_async = NULL;
+ }
+
+ // If this is a sub-port, unlink it from its parent
+ port->unlinkParent();
+
+ if (port->port_server_flags & SRVR_server)
+ {
+ FlushFileBuffers(port->port_pipe);
+ DisconnectNamedPipe(port->port_pipe);
+ }
+ if (port->port_event != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(port->port_event);
+ port->port_event = INVALID_HANDLE_VALUE;
+ }
+ if (port->port_pipe != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(port->port_pipe);
+ port->port_pipe = INVALID_HANDLE_VALUE;
+ }
+
+ wnet_ports->unRegisterPort(port);
+ port->release();
+}
+
+
+static void force_close(rem_port* port)
+{
+/**************************************
+ *
+ * f o r c e _ c l o s e
+ *
+ **************************************
+ *
+ * Functional description
+ * Forcibly close remote connection.
+ *
+ **************************************/
+
+ if (port->port_event != INVALID_HANDLE_VALUE)
+ {
+ port->port_state = rem_port::BROKEN;
+
+ const HANDLE handle = port->port_pipe;
+ port->port_pipe = INVALID_HANDLE_VALUE;
+ SetEvent(port->port_event);
+ CloseHandle(handle);
+ }
+}
+
+
+#ifdef NOT_USED_OR_REPLACED
+static void exit_handler(void* main_port)
+{
+/**************************************
+ *
+ * e x i t _ h a n d l e r
+ *
+ **************************************
+ *
+ * Functional description
+ * Shutdown all active connections
+ * to allow restart.
+ *
+ **************************************/
+ for (rem_port* vport = static_cast<rem_port*>(main_port); vport; vport = vport->port_next)
+ CloseHandle(vport->port_pipe);
+}
+#endif
+
+
+static rem_str* make_pipe_name(const TEXT* connect_name, const TEXT* suffix_name, const TEXT* str_pid)
+{
+/**************************************
+ *
+ * m a k e _ p i p e _ n a m e
+ *
+ **************************************
+ *
+ * Functional description
+ * Construct a name for the pipe connection.
+ * Figure out whether we need a remote node name,
+ * and construct the pipe name accordingly.
+ * If a server pid != 0, append it to pipe name as <>/<pid>
+ *
+ **************************************/
+ Firebird::string buffer("\\\\");
+
+ const TEXT* p = connect_name;
+
+ if (!p || *p++ != '\\' || *p++ != '\\')
+ p = ".";
+
+ while (*p && *p != '\\' && *p != '@')
+ buffer += *p++;
+
+ const TEXT* protocol = NULL;
+ switch (*p)
+ {
+ case 0:
+ protocol = Config::getRemoteServiceName();
+ break;
+ case '@':
+ protocol = p + 1;
+ break;
+ default:
+ while (*p)
+ {
+ if (*p++ == '\\')
+ protocol = p;
+ }
+ }
+
+ buffer += '\\';
+ buffer += PIPE_PREFIX;
+ buffer += '\\';
+ const char *pipe_name = Config::getRemotePipeName();
+ buffer += pipe_name;
+ buffer += '\\';
+ buffer += suffix_name;
+ buffer += '\\';
+ buffer += protocol;
+
+ if (str_pid)
+ {
+ buffer += '\\';
+ buffer += str_pid;
+ }
+
+ return REMOTE_make_string(buffer.c_str());
+}
+
+
+static rem_port* receive( rem_port* main_port, PACKET* packet)
+{
+/**************************************
+ *
+ * r e c e i v e
+ *
+ **************************************
+ *
+ * Functional description
+ * Receive a message from a port or clients of a port. If the process
+ * is a server and a connection request comes in, generate a new port
+ * block for the client.
+ *
+ **************************************/
+
+#ifdef DEV_BUILD
+ main_port->port_receive.x_client = !(main_port->port_flags & PORT_server);
+#endif
+
+ if (!xdr_protocol(&main_port->port_receive, packet))
+ packet->p_operation = op_exit;
+
+ return main_port;
+}
+
+
+static int send_full( rem_port* port, PACKET* packet)
+{
+/**************************************
+ *
+ * s e n d _ f u l l
+ *
+ **************************************
+ *
+ * Functional description
+ * Send a packet across a port to another process.
+ *
+ **************************************/
+
+#ifdef DEV_BUILD
+ port->port_send.x_client = !(port->port_flags & PORT_server);
+#endif
+
+ if (!xdr_protocol(&port->port_send, packet))
+ return FALSE;
+
+ return xdrwnet_endofrecord(&port->port_send); //, TRUE);
+}
+
+
+static int send_partial( rem_port* port, PACKET* packet)
+{
+/**************************************
+ *
+ * s e n d _ p a r t i a l
+ *
+ **************************************
+ *
+ * Functional description
+ * Send a packet across a port to another process.
+ *
+ **************************************/
+
+#ifdef DEV_BUILD
+ port->port_send.x_client = !(port->port_flags & PORT_server);
+#endif
+
+ return xdr_protocol(&port->port_send, packet);
+}
+
+
+static int xdrwnet_create(XDR* xdrs,
+ rem_port* port,
+ UCHAR* buffer, USHORT length, xdr_op x_op)
+{
+/**************************************
+ *
+ * x d r w n e t _ c r e a t e
+ *
+ **************************************
+ *
+ * Functional description
+ * Initialize an XDR stream for Apollo mailboxes.
+ *
+ **************************************/
+
+ xdrs->x_public = (caddr_t) port;
+ xdrs->x_base = xdrs->x_private = reinterpret_cast<SCHAR*>(buffer);
+ xdrs->x_handy = length;
+ xdrs->x_ops = &wnet_ops;
+ xdrs->x_op = x_op;
+
+ return TRUE;
+}
+
+
+static bool_t xdrwnet_endofrecord( XDR* xdrs) //, bool_t flushnow)
+{
+/**************************************
+ *
+ * x d r w n e t _ e n d o f r e c o r d
+ *
+ **************************************
+ *
+ * Functional description
+ * Write out the rest of a record.
+ *
+ **************************************/
+
+ return wnet_write(xdrs); //, flushnow);
+}
+
+
+static int wnet_destroy( XDR*)
+{
+/**************************************
+ *
+ * w n e t _ d e s t r o y
+ *
+ **************************************
+ *
+ * Functional description
+ * Destroy a stream. A no-op.
+ *
+ **************************************/
+
+ return 0;
+}
+
+
+static bool wnet_error(rem_port* port,
+ const TEXT* function, ISC_STATUS operation, int status)
+{
+/**************************************
+ *
+ * w n e t _ e r r o r
+ *
+ **************************************
+ *
+ * Functional description
+ * An I/O error has occurred. If a status vector is present,
+ * generate an error return. In any case, return NULL, which
+ * is used to indicate and error.
+ *
+ **************************************/
+ if (status)
+ {
+ if (port->port_state != rem_port::BROKEN) {
+ gds__log("WNET/wnet_error: %s errno = %d", function, status);
+ }
+
+ wnet_gen_error(port, Arg::Gds(operation) << SYS_ERR(status));
+ }
+ else
+ {
+ wnet_gen_error(port, Arg::Gds(operation));
+ }...
[truncated message content] |
|
From: <di...@us...> - 2010-10-31 13:47:00
|
Revision: 51812
http://firebird.svn.sourceforge.net/firebird/?rev=51812&view=rev
Author: dimitr
Date: 2010-10-31 13:46:54 +0000 (Sun, 31 Oct 2010)
Log Message:
-----------
Basic network support for the fb_ping() API call. Untested yet.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/protocol.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/client/interface.cpp 2010-10-31 13:46:54 UTC (rev 51812)
@@ -4347,8 +4347,28 @@
* Check the attachment handle for persistent errors.
*
**************************************/
+ try
+ {
+ reset(status);
- reset(status);
+ CHECK_HANDLE(rdb, isc_bad_db_handle);
+ rem_port* port = rdb->rdb_port;
+ RefMutexGuard portGuard(*port->port_sync);
+
+ // Make sure protocol support action
+
+ if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION13)
+ unsupported();
+
+ PACKET* packet = &rdb->rdb_packet;
+ packet->p_operation = op_ping;
+
+ send_and_receive(status, rdb, packet);
+ }
+ catch (const Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
static Rvnt* add_event( rem_port* port)
@@ -6628,7 +6648,7 @@
if (port->port_protocol < PROTOCOL_VERSION12 || port->port_type != rem_port::INET)
{
- Arg::Gds(isc_wish_list).raise();
+ unsupported();
}
MutexEnsureUnlock guard(rdb->rdb_async_lock); // This is async operation
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/protocol.cpp 2010-10-31 13:46:54 UTC (rev 51812)
@@ -277,6 +277,7 @@
case op_reject:
case op_disconnect:
case op_dummy:
+ case op_ping:
return P_TRUE(xdrs, p);
case op_connect:
Modified: firebird/trunk/src/remote/protocol.h
===================================================================
--- firebird/trunk/src/remote/protocol.h 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/protocol.h 2010-10-31 13:46:54 UTC (rev 51812)
@@ -298,6 +298,8 @@
op_cont_auth = 92,
+ op_ping = 93,
+
op_max
};
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/server/server.cpp 2010-10-31 13:46:54 UTC (rev 51812)
@@ -553,6 +553,7 @@
static bool get_next_msg_no(Rrq*, USHORT, USHORT*);
static Rtr* make_transaction(Rdb*, FB_API_HANDLE);
+static void ping_connection(rem_port*, PACKET*);
static bool process_packet(rem_port* port, PACKET* sendL, PACKET* receive, rem_port** result);
static void release_blob(Rbl*);
static void release_event(Rvnt*);
@@ -3222,6 +3223,30 @@
}
+static void ping_connection(rem_port* port, PACKET* send)
+{
+/**************************************
+ *
+ * p i n g _ c o n n e c t i o n
+ *
+ **************************************
+ *
+ * Functional description
+ * Check the connection for persistent errors.
+ *
+ **************************************/
+ ISC_STATUS_ARRAY status_vector;
+
+ Rdb* rdb = port->port_context;
+ if (!bad_db(status_vector, rdb))
+ {
+ fb_ping(status_vector, &rdb->rdb_handle);
+ }
+
+ port->send_response(send, 0, 0, status_vector, false);
+}
+
+
ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL)
{
/**************************************
@@ -3705,6 +3730,10 @@
cancel_operation(port, receive->p_cancel_op.p_co_kind);
break;
+ case op_ping:
+ ping_connection(port, sendL);
+ break;
+
default:
gds__log("SERVER/process_packet: don't understand packet type %d", receive->p_operation);
port->port_state = rem_port::BROKEN;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hv...@us...> - 2010-12-12 20:19:53
|
Revision: 52038
http://firebird.svn.sourceforge.net/firebird/?rev=52038&view=rev
Author: hvlad
Date: 2010-12-12 20:19:47 +0000 (Sun, 12 Dec 2010)
Log Message:
-----------
Port forward fix for bug CORE-3119 : 100% CPU USAGE with Unilimited Loop & Index corrupted
Modified Paths:
--------------
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2010-12-12 19:53:27 UTC (rev 52037)
+++ firebird/trunk/src/remote/inet.cpp 2010-12-12 20:19:47 UTC (rev 52038)
@@ -125,7 +125,7 @@
#include <process.h>
#include <signal.h>
#include "../utilities/install/install_nt.h"
-#define SOCLOSE closesocket
+
#define INET_RETRY_ERRNO WSAEINPROGRESS
#define INET_ADDR_IN_USE WSAEADDRINUSE
#define sleep(seconds) Sleep ((seconds) * 1000)
@@ -133,9 +133,6 @@
#else // WIN_NT
-#ifndef SOCLOSE
-#define SOCLOSE close
-#endif
#ifndef INET_ADDR_IN_USE
#define INET_ADDR_IN_USE EADDRINUSE
#endif
@@ -146,9 +143,18 @@
#endif // WIN_NT
-#ifndef INVALID_SOCKET
-#define INVALID_SOCKET -1
+static void SOCLOSE(SOCKET& socket)
+{
+ if (socket != INVALID_SOCKET)
+ {
+#ifdef WIN_NT
+ closesocket(socket);
+#else
+ close(socket);
#endif
+ socket = INVALID_SOCKET;
+ }
+};
// Can't find were it's used.
//#ifndef SIGURG
@@ -235,7 +241,7 @@
#ifdef HAVE_SETITIMER
static void alarm_handler(int);
#endif
-static rem_port* alloc_port(rem_port*);
+static rem_port* alloc_port(rem_port*, const USHORT = 0);
static rem_port* aux_connect(rem_port*, PACKET*);
static rem_port* aux_request(rem_port*, PACKET*);
@@ -1050,7 +1056,7 @@
}
-static rem_port* alloc_port(rem_port* const parent)
+static rem_port* alloc_port(rem_port* const parent, const USHORT flags)
{
/**************************************
*
@@ -1120,6 +1126,7 @@
port->port_request = aux_request;
port->port_buff_size = (USHORT) INET_remote_buffer;
port->port_async_receive = inet_async_receive;
+ port->port_flags = flags;
xdrinet_create( &port->port_send, port,
&port->port_buffer[INET_remote_buffer],
@@ -1323,14 +1330,14 @@
inet_error(false, port, "listen", isc_net_event_listen_err, INET_ERRNO);
}
- rem_port* const new_port = alloc_port(port->port_parent);
+ rem_port* const new_port = alloc_port(port->port_parent, PORT_async);
port->port_async = new_port;
new_port->port_dummy_packet_interval = port->port_dummy_packet_interval;
new_port->port_dummy_timeout = new_port->port_dummy_packet_interval;
new_port->port_server_flags = port->port_server_flags;
new_port->port_channel = (int) n;
- new_port->port_flags = port->port_flags & PORT_no_oob;
+ new_port->port_flags |= port->port_flags & PORT_no_oob;
P_RESP* response = &packet->p_resp;
@@ -1427,11 +1434,7 @@
(SCHAR*) &port->port_linger, sizeof(port->port_linger));
}
-#if defined WIN_NT
- if (port->port_handle && port->port_handle != INVALID_SOCKET)
-#else
- if (port->port_handle)
-#endif
+ if (port->port_handle != INVALID_SOCKET)
{
shutdown(port->port_handle, 2);
}
@@ -1450,9 +1453,8 @@
inet_ports->unRegisterPort(port);
- if (port->port_handle) {
- SOCLOSE(port->port_handle);
- }
+ SOCLOSE(port->port_handle);
+ SOCLOSE(port->port_channel);
port->release();
@@ -1489,17 +1491,10 @@
port->port_state = rem_port::BROKEN;
- const SOCKET handle = port->port_handle;
- port->port_handle = 0;
-
-#ifdef WIN_NT
- if (handle && handle != INVALID_SOCKET)
-#else
- if (handle)
-#endif
+ if (port->port_handle != INVALID_SOCKET)
{
- shutdown(handle, 2);
- SOCLOSE(handle);
+ shutdown(port->port_handle, 2);
+ SOCLOSE(port->port_handle);
}
}
@@ -1870,9 +1865,9 @@
if (main_port->port_state != rem_port::BROKEN)
{
main_port->port_state = rem_port::BROKEN;
- const SOCKET s = main_port->port_handle;
- shutdown(s, 2);
- SOCLOSE(s);
+
+ shutdown(main_port->port_handle, 2);
+ SOCLOSE(main_port->port_handle);
}
}
else if (port = select_accept(main_port))
@@ -1980,8 +1975,12 @@
#ifdef WIN_NT
const int ok = FD_ISSET(n, &selct->slct_fdset);
#else
- if (n < 0 || n >= FD_SETSIZE) {
- return;
+ if (n < 0 || n >= FD_SETSIZE)
+ {
+ if (port->port_flags & PORT_disconnect)
+ continue;
+ else
+ return;
}
const int ok = n < selct->slct_width && FD_ISSET(n, &selct->slct_fdset);
#endif
@@ -2040,8 +2039,10 @@
Firebird::MutexLockGuard guard(port_mutex);
for (rem_port* port = main_port; port; port = port->port_next)
{
- if (port->port_state == rem_port::PENDING)
- {
+ if (port->port_state == rem_port::PENDING &&
+ // don't wait on still listening (not connected) async port
+ !(port->port_handle == INVALID_SOCKET && port->port_flags & PORT_async) )
+ {
// Adjust down the port's keepalive timer.
if (port->port_dummy_packet_interval)
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2010-12-12 19:53:27 UTC (rev 52037)
+++ firebird/trunk/src/remote/remote.cpp 2010-12-12 20:19:47 UTC (rev 52038)
@@ -590,7 +590,6 @@
this->port_parent = parent;
this->port_next = parent->port_clients;
- this->port_handle = parent->port_handle;
this->port_server = parent->port_server;
this->port_server_flags = parent->port_server_flags;
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2010-12-12 19:53:27 UTC (rev 52037)
+++ firebird/trunk/src/remote/remote.h 2010-12-12 20:19:47 UTC (rev 52038)
@@ -46,6 +46,10 @@
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+
+#ifndef INVALID_SOCKET
+#define INVALID_SOCKET -1
+#endif
#endif // !WIN_NT
@@ -566,6 +570,7 @@
const USHORT PORT_lazy = 0x0100; // Deferred operations are allowed
const USHORT PORT_server = 0x0200; // Server (not client) port
const USHORT PORT_detached = 0x0400; // op_detach, op_drop_database or op_service_detach was processed
+const USHORT PORT_rdb_shutdown = 0x0800; // Database is shutted down
// Port itself
@@ -622,7 +627,7 @@
SLONG port_dummy_timeout; // time remaining until keepalive packet
//ISC_STATUS* port_status_vector;
SOCKET port_handle; // handle for INET socket
- int port_channel; // handle for connection (from by OS)
+ SOCKET port_channel; // handle for connection (from by OS)
struct linger port_linger; // linger value as defined by SO_LINGER
Rdb* port_context;
Thread::Handle port_events_thread; // handle of thread, handling incoming events
@@ -667,7 +672,7 @@
port_clients(0), port_next(0), port_parent(0), port_async(0), port_async_receive(0),
port_server(0), port_server_flags(0), port_protocol(0), port_buff_size(0),
port_flags(0), port_connect_timeout(0), port_dummy_packet_interval(0),
- port_dummy_timeout(0), /*port_status_vector(0),*/ port_handle(0), port_channel(0),
+ port_dummy_timeout(0), /*port_status_vector(0),*/ port_handle(INVALID_SOCKET), port_channel(INVALID_SOCKET),
port_context(0), port_events_thread(0), port_events_shutdown(0),
#ifdef WIN_NT
port_pipe(INVALID_HANDLE_VALUE), port_event(INVALID_HANDLE_VALUE),
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2010-12-12 19:53:27 UTC (rev 52037)
+++ firebird/trunk/src/remote/server/server.cpp 2010-12-12 20:19:47 UTC (rev 52038)
@@ -1541,15 +1541,23 @@
}
if (aux_port)
+ try
+ {
+ if (aux_port->connect(send))
+ aux_port->port_context = rdb;
+ }
+ catch (const Exception& ex)
+ {
+ iscLogException("", ex);
+ fb_assert(port->port_async == aux_port);
+ port->port_async = NULL;
+ aux_port->disconnect();
+ }
+ }
+ catch (const Exception& ex)
{
- aux_port->connect(send);
- aux_port->port_context = rdb;
+ iscLogException("Unhandled exception in server's aux_request():", ex);
}
- }
- catch (const Exception& ex)
- {
- iscLogException("Unhandled exception in server's aux_request():", ex);
- }
}
@@ -3744,7 +3752,7 @@
{
if (!port->port_parent)
{
- if (!Worker::isShuttingDown())
+ if (!Worker::isShuttingDown() && !(port->port_flags & PORT_rdb_shutdown))
gds__log("SERVER/process_packet: broken port, server exiting");
port->disconnect(sendL, receive);
return false;
@@ -4569,6 +4577,7 @@
if (exit_code == isc_shutdown || exit_code == isc_att_shutdown)
{
this->port_state = rem_port::BROKEN;
+ this->port_flags |= PORT_rdb_shutdown;
}
return exit_code;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ro...@us...> - 2011-04-02 04:53:41
|
Revision: 52650
http://firebird.svn.sourceforge.net/firebird/?rev=52650&view=rev
Author: robocop
Date: 2011-04-02 04:53:35 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
Misc, style, etc.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/remot_proto.h
firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2011-04-02 04:51:27 UTC (rev 52649)
+++ firebird/trunk/src/remote/client/interface.cpp 2011-04-02 04:53:35 UTC (rev 52650)
@@ -1513,7 +1513,8 @@
RefMutexGuard portGuard(*port->port_sync);
Rtr* transaction = 0;
- if (apiTra) {
+ if (apiTra)
+ {
transaction = ((Transaction*)apiTra)->getTransaction();
CHECK_HANDLE(transaction, isc_bad_trans_handle);
}
@@ -1703,7 +1704,8 @@
unsigned char* out_msg = outMsgBuffer ? outMsgBuffer->buffer : NULL;
Rtr* transaction = 0;
- if (apiTra) {
+ if (apiTra)
+ {
transaction = ((Transaction*)apiTra)->getTransaction();
CHECK_HANDLE(transaction, isc_bad_trans_handle);
}
@@ -2347,7 +2349,8 @@
RefMutexGuard portGuard(*port->port_sync);
Rtr* transaction = 0;
- if (apiTra) {
+ if (apiTra)
+ {
transaction = reinterpret_cast<Transaction*>(apiTra)->getTransaction();
CHECK_HANDLE(transaction, isc_bad_trans_handle);
}
@@ -3620,7 +3623,7 @@
* Abort a transaction but keep its environment valid
*
**************************************/
- reset(status);
+ reset(status);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
@@ -4390,7 +4393,7 @@
{
/**************************************
*
- * f b _ p i n g
+ * p i n g
*
**************************************
*
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2011-04-02 04:51:27 UTC (rev 52649)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2011-04-02 04:53:35 UTC (rev 52650)
@@ -462,7 +462,7 @@
*
* Functional description
* A communications link has been established by another
- * process. We have inheritted the handle. Set up
+ * process. We have inherited the handle. Set up
* a port block.
*
**************************************/
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2011-04-02 04:51:27 UTC (rev 52649)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2011-04-02 04:53:35 UTC (rev 52650)
@@ -143,7 +143,7 @@
class ExitHandler
{
public:
- ExitHandler(MemoryPool&) {};
+ explicit ExitHandler(MemoryPool&) {};
~ExitHandler()
{
@@ -1406,8 +1406,7 @@
presponse->slot_num = slot_num;
presponse->timestamp = timestamp;
- rem_port* port = get_server_port(client_pid, xpm, map_num, slot_num,
- timestamp);
+ rem_port* port = get_server_port(client_pid, xpm, map_num, slot_num, timestamp);
SetEvent(xnet_response_event);
Modified: firebird/trunk/src/remote/remot_proto.h
===================================================================
--- firebird/trunk/src/remote/remot_proto.h 2011-04-02 04:51:27 UTC (rev 52649)
+++ firebird/trunk/src/remote/remot_proto.h 2011-04-02 04:53:35 UTC (rev 52650)
@@ -46,5 +46,6 @@
void REMOTE_reset_statement (struct Rsr *);
void REMOTE_save_status_strings (ISC_STATUS *);
bool_t REMOTE_getbytes (XDR*, SCHAR*, u_int);
+
#endif // REMOTE_REMOT_PROTO_H
Modified: firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp
===================================================================
--- firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp 2011-04-02 04:51:27 UTC (rev 52649)
+++ firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp 2011-04-02 04:53:35 UTC (rev 52650)
@@ -540,7 +540,8 @@
**************************************/
ThreadCounter counter;
- if (server_flag & SRVR_inet) {
+ if (server_flag & SRVR_inet)
+ {
try {
Thread::start(inet_connect_wait_thread, 0, THREAD_medium);
}
@@ -548,7 +549,8 @@
iscLogException("INET: can't start listener thread", ex);
}
}
- if (server_flag & SRVR_wnet) {
+ if (server_flag & SRVR_wnet)
+ {
try {
Thread::start(wnet_connect_wait_thread, 0, THREAD_medium);
}
@@ -556,7 +558,8 @@
iscLogException("WNET: can't start listener thread", ex);
}
}
- if (server_flag & SRVR_xnet) {
+ if (server_flag & SRVR_xnet)
+ {
try {
Thread::start(xnet_connect_wait_thread, 0, THREAD_medium);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-12-23 18:33:29
|
Revision: 53748
http://firebird.svn.sourceforge.net/firebird/?rev=53748&view=rev
Author: dimitr
Date: 2011-12-23 18:33:23 +0000 (Fri, 23 Dec 2011)
Log Message:
-----------
Fixed some compilation errors.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/wnet_proto.h
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/os/win32/xnet_proto.h
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2011-12-23 18:13:55 UTC (rev 53747)
+++ firebird/trunk/src/remote/client/interface.cpp 2011-12-23 18:33:23 UTC (rev 53748)
@@ -4988,7 +4988,7 @@
#if defined(WIN_NT)
if (ISC_analyze_protocol(PROTOCOL_XNET, service_name, node_name))
{
- return XNET_analyze(cBlock, service_name, uv_flag);
+ return XNET_analyze(NULL, service_name, uv_flag);
}
if (ISC_analyze_protocol(PROTOCOL_WNET, service_name, node_name) ||
@@ -4998,7 +4998,7 @@
{
node_name = WNET_LOCALHOST;
}
- return WNET_analyze(cBlock, service_name, node_name.c_str(), uv_flag);
+ return WNET_analyze(NULL, service_name, node_name.c_str(), uv_flag);
}
#endif
@@ -5025,12 +5025,12 @@
#if defined(WIN_NT)
if (!port)
{
- port = XNET_analyze(cBlock, service_name, uv_flag);
+ port = XNET_analyze(NULL, service_name, uv_flag);
}
if (!port)
{
- port = WNET_analyze(cBlock, service_name, WNET_LOCALHOST, uv_flag);
+ port = WNET_analyze(NULL, service_name, WNET_LOCALHOST, uv_flag);
}
#endif
if (!port)
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2011-12-23 18:13:55 UTC (rev 53747)
+++ firebird/trunk/src/remote/inet.cpp 2011-12-23 18:33:23 UTC (rev 53748)
@@ -532,10 +532,10 @@
rem_port* INET_analyze(ClntAuthBlock* cBlock,
- const Firebird::PathName& file_name,
- const TEXT* node_name,
- bool uv_flag,
- ClumpletReader &dpb)
+ const Firebird::PathName& file_name,
+ const TEXT* node_name,
+ bool uv_flag,
+ ClumpletReader &dpb)
{
/**************************************
*
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2011-12-23 18:13:55 UTC (rev 53747)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2011-12-23 18:33:23 UTC (rev 53748)
@@ -56,10 +56,10 @@
const char* PIPE_PREFIX = "pipe"; // win32-specific
const char* SERVER_PIPE_SUFFIX = "server";
const char* EVENT_PIPE_SUFFIX = "event";
-Firebird::AtomicCounter event_counter;
+AtomicCounter event_counter;
-static Firebird::GlobalPtr<PortsCleanup> wnet_ports;
-static Firebird::GlobalPtr<Firebird::Mutex> init_mutex;
+static GlobalPtr<PortsCleanup> wnet_ports;
+static GlobalPtr<Mutex> init_mutex;
static volatile bool wnet_initialized = false;
static volatile bool wnet_shutdown = false;
@@ -81,7 +81,7 @@
static bool_t xdrwnet_endofrecord(XDR*);//, int);
static int wnet_destroy(XDR*);
static bool wnet_error(rem_port*, const TEXT*, ISC_STATUS, int);
-static void wnet_gen_error(rem_port*, const Firebird::Arg::StatusVector& v);
+static void wnet_gen_error(rem_port*, const Arg::StatusVector& v);
static bool_t wnet_getbytes(XDR*, SCHAR*, u_int);
static bool_t wnet_getlong(XDR*, SLONG*);
static u_int wnet_getpostn(XDR*);
@@ -113,7 +113,10 @@
};
-rem_port* WNET_analyze(const Firebird::PathName& file_name, const TEXT* node_name, bool uv_flag)
+rem_port* WNET_analyze(ClntAuthBlock* cBlock,
+ const PathName& file_name,
+ const TEXT* node_name,
+ bool uv_flag)
{
/**************************************
*
@@ -137,8 +140,12 @@
PACKET* packet = &rdb->rdb_packet;
// Pick up some user identification information
- Firebird::string buffer;
- Firebird::ClumpletWriter user_id(Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE);
+ string buffer;
+ ClumpletWriter user_id(ClumpletReader::UnTagged, 64000);
+ if (cBlock)
+ {
+ cBlock->extractDataFromPluginTo(user_id);
+ }
ISC_get_user(&buffer, 0, 0);
buffer.lower();
@@ -286,32 +293,68 @@
port->receive(packet);
}
- if (packet->p_operation != op_accept)
+ P_ACPT* accept = NULL;
+ switch (packet->p_operation)
{
+ case op_accept_data:
+ accept = &packet->p_acpd;
+ if (cBlock)
+ {
+ cBlock->storeDataForPlugin(packet->p_acpd.p_acpt_data.cstr_length,
+ packet->p_acpd.p_acpt_data.cstr_address);
+ cBlock->authComplete = packet->p_acpd.p_acpt_authenticated;
+ }
+ break;
+
+ case op_accept:
+ if (cBlock)
+ {
+ cBlock->reset(&file_name);
+ }
+ accept = &packet->p_acpt;
+ break;
+
+ case op_response:
+ try
+ {
+ Firebird::LocalStatus warning; // Ignore connect warnings for a while
+ REMOTE_check_response(&warning, rdb, packet);
+ }
+ catch(const Firebird::Exception&)
+ {
+ disconnect(port);
+ delete rdb;
+ throw;
+ }
+ // fall through - response is not a required accept
+
+ default:
disconnect(port);
delete rdb;
-
Arg::Gds(isc_connect_reject).raise();
+ break;
}
- port->port_protocol = packet->p_acpt.p_acpt_version;
+ fb_assert(accept);
+ fb_assert(port);
+ port->port_protocol = accept->p_acpt_version;
// once we've decided on a protocol, concatenate the version
// string to reflect it...
- Firebird::string temp;
+ string temp;
temp.printf("%s/P%d", port->port_version->str_data,
port->port_protocol & FB_PROTOCOL_MASK);
delete port->port_version;
port->port_version = REMOTE_make_string(temp.c_str());
- if (packet->p_acpt.p_acpt_architecture == ARCHITECTURE)
+ if (accept->p_acpt_architecture == ARCHITECTURE)
port->port_flags |= PORT_symmetric;
- if (packet->p_acpt.p_acpt_type == ptype_rpc)
+ if (accept->p_acpt_type == ptype_rpc)
port->port_flags |= PORT_rpc;
- if (packet->p_acpt.p_acpt_type != ptype_out_of_band)
+ if (accept->p_acpt_type != ptype_out_of_band)
port->port_flags |= PORT_no_oob;
return port;
@@ -408,7 +451,7 @@
TEXT name[MAXPATHLEN];
GetModuleFileName(NULL, name, sizeof(name));
- Firebird::string cmdLine;
+ string cmdLine;
cmdLine.printf("%s -w -h %"HANDLEFORMAT"@%"ULONGFORMAT, name, port->port_pipe, GetCurrentProcessId());
STARTUPINFO start_crud;
@@ -494,11 +537,11 @@
**************************************/
// Default account to "guest" (in theory all packets contain a name)
- Firebird::string name("guest"), password;
+ string name("guest"), password;
// Pick up account and password, if given. The password is ignored
- Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged,
+ ClumpletReader id(ClumpletReader::UnTagged,
cnct->p_cnct_user_id.cstr_address, cnct->p_cnct_user_id.cstr_length);
for (id.rewind(); !id.isEof(); id.moveNext())
@@ -540,7 +583,7 @@
if (!wnet_initialized)
{
- Firebird::MutexLockGuard guard(init_mutex);
+ MutexLockGuard guard(init_mutex);
if (!wnet_initialized)
{
wnet_initialized = true;
@@ -852,7 +895,7 @@
* If a server pid != 0, append it to pipe name as <>/<pid>
*
**************************************/
- Firebird::string buffer("\\\\");
+ string buffer("\\\\");
const TEXT* p = connect_name;
@@ -1061,7 +1104,7 @@
}
-static void wnet_gen_error (rem_port* port, const Firebird::Arg::StatusVector& v)
+static void wnet_gen_error (rem_port* port, const Arg::StatusVector& v)
{
/**************************************
*
Modified: firebird/trunk/src/remote/os/win32/wnet_proto.h
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet_proto.h 2011-12-23 18:13:55 UTC (rev 53747)
+++ firebird/trunk/src/remote/os/win32/wnet_proto.h 2011-12-23 18:33:23 UTC (rev 53748)
@@ -31,7 +31,7 @@
#endif
-rem_port* WNET_analyze(const Firebird::PathName&, const TEXT*, bool);
+rem_port* WNET_analyze(ClntAuthBlock*, const Firebird::PathName&, const TEXT*, bool);
rem_port* WNET_connect(const TEXT*, struct packet*, USHORT);
rem_port* WNET_reconnect(HANDLE);
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2011-12-23 18:13:55 UTC (rev 53747)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2011-12-23 18:33:23 UTC (rev 53748)
@@ -200,7 +200,7 @@
#define ERR_STR(str) (str)
#endif
-rem_port* XNET_analyze(const PathName& file_name, bool uv_flag)
+rem_port* XNET_analyze(ClntAuthBlock* cBlock, const PathName& file_name, bool uv_flag)
{
/**************************************
*
@@ -225,7 +225,11 @@
// Pick up some user identification information
string buffer;
- ClumpletWriter user_id(ClumpletReader::UnTagged, MAX_DPB_SIZE);
+ ClumpletWriter user_id(ClumpletReader::UnTagged, 64000);
+ if (cBlock)
+ {
+ cBlock->extractDataFromPluginTo(user_id);
+ }
ISC_get_user(&buffer, 0, 0);
buffer.lower();
@@ -371,15 +375,51 @@
port->receive(packet);
}
- if (packet->p_operation != op_accept)
+ P_ACPT* accept = NULL;
+ switch (packet->p_operation)
{
+ case op_accept_data:
+ accept = &packet->p_acpd;
+ if (cBlock)
+ {
+ cBlock->storeDataForPlugin(packet->p_acpd.p_acpt_data.cstr_length,
+ packet->p_acpd.p_acpt_data.cstr_address);
+ cBlock->authComplete = packet->p_acpd.p_acpt_authenticated;
+ }
+ break;
+
+ case op_accept:
+ if (cBlock)
+ {
+ cBlock->reset(&file_name);
+ }
+ accept = &packet->p_acpt;
+ break;
+
+ case op_response:
+ try
+ {
+ Firebird::LocalStatus warning; // Ignore connect warnings for a while
+ REMOTE_check_response(&warning, rdb, packet);
+ }
+ catch(const Firebird::Exception&)
+ {
+ disconnect(port);
+ delete rdb;
+ throw;
+ }
+ // fall through - response is not a required accept
+
+ default:
disconnect(port);
delete rdb;
-
Arg::Gds(isc_connect_reject).raise();
+ break;
}
- port->port_protocol = packet->p_acpt.p_acpt_version;
+ fb_assert(accept);
+ fb_assert(port);
+ port->port_protocol = accept->p_acpt_version;
// Once we've decided on a protocol, concatenate the version
// string to reflect it...
@@ -391,13 +431,13 @@
delete port->port_version;
port->port_version = REMOTE_make_string(temp.c_str());
- if (packet->p_acpt.p_acpt_architecture == ARCHITECTURE)
+ if (accept->p_acpt_architecture == ARCHITECTURE)
port->port_flags |= PORT_symmetric;
- if (packet->p_acpt.p_acpt_type == ptype_rpc)
+ if (accept->p_acpt_type == ptype_rpc)
port->port_flags |= PORT_rpc;
- if (packet->p_acpt.p_acpt_type != ptype_out_of_band)
+ if (accept->p_acpt_type != ptype_out_of_band)
port->port_flags |= PORT_no_oob;
return port;
Modified: firebird/trunk/src/remote/os/win32/xnet_proto.h
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet_proto.h 2011-12-23 18:13:55 UTC (rev 53747)
+++ firebird/trunk/src/remote/os/win32/xnet_proto.h 2011-12-23 18:33:23 UTC (rev 53748)
@@ -32,7 +32,7 @@
#define rem_port void
#endif
-rem_port* XNET_analyze(const Firebird::PathName&, bool);
+rem_port* XNET_analyze(ClntAuthBlock*, const Firebird::PathName&, bool);
rem_port* XNET_connect(struct packet*, USHORT);
rem_port* XNET_reconnect(ULONG);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-12-26 13:51:52
|
Revision: 53763
http://firebird.svn.sourceforge.net/firebird/?rev=53763&view=rev
Author: dimitr
Date: 2011-12-26 13:51:45 +0000 (Mon, 26 Dec 2011)
Log Message:
-----------
A patch resolving client-side crashes with a new fbclient. Thanks to Alex.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/remote.h
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2011-12-26 13:35:26 UTC (rev 53762)
+++ firebird/trunk/src/remote/client/interface.cpp 2011-12-26 13:51:45 UTC (rev 53763)
@@ -5850,8 +5850,16 @@
}
// send answer (may be empty) to server
- packet->p_operation = op_cont_auth;
- cBlock.extractDataFromPluginTo(&packet->p_auth_cont);
+ if (port->port_protocol >= PROTOCOL_VERSION13)
+ {
+ packet->p_operation = op_cont_auth;
+ cBlock.extractDataFromPluginTo(&packet->p_auth_cont);
+ }
+ else
+ {
+ packet->p_operation = op_trusted_auth;
+ cBlock.extractDataFromPluginTo(&packet->p_trau.p_trau_data);
+ }
send_packet(port, packet);
memset(&packet->p_auth_cont, 0, sizeof packet->p_auth_cont);
}
@@ -7054,11 +7062,16 @@
}
}
+void ClntAuthBlock::extractDataFromPluginTo(CSTRING* to)
+{
+ to->cstr_length = dataFromPlugin.getCount();
+ to->cstr_address = dataFromPlugin.begin();
+ to->cstr_allocated = 0;
+}
+
void ClntAuthBlock::extractDataFromPluginTo(P_AUTH_CONT* to)
{
- to->p_data.cstr_length = dataFromPlugin.getCount();
- to->p_data.cstr_address = dataFromPlugin.begin();
- to->p_data.cstr_allocated = 0;
+ extractDataFromPluginTo(&to->p_data);
PathName pluginName = getPluginName();
to->p_name.cstr_length = pluginName.length();
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2011-12-26 13:35:26 UTC (rev 53762)
+++ firebird/trunk/src/remote/remote.h 2011-12-26 13:51:45 UTC (rev 53763)
@@ -621,6 +621,7 @@
void storeDataForPlugin(unsigned int length, const unsigned char* data);
void resetDataFromPlugin();
void extractDataFromPluginTo(Firebird::ClumpletWriter& dpb, const ParametersSet* tags, int protocol);
+ void extractDataFromPluginTo(CSTRING* to);
void extractDataFromPluginTo(P_AUTH_CONT* to);
void load(Firebird::ClumpletReader& dpb, const ParametersSet*);
void extractDataFromPluginTo(Firebird::ClumpletWriter& user_id);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <asf...@us...> - 2011-12-28 01:07:55
|
Revision: 53778
http://firebird.svn.sourceforge.net/firebird/?rev=53778&view=rev
Author: asfernandes
Date: 2011-12-28 01:07:49 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
Misc.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2011-12-27 12:45:55 UTC (rev 53777)
+++ firebird/trunk/src/remote/client/interface.cpp 2011-12-28 01:07:49 UTC (rev 53778)
@@ -7075,7 +7075,7 @@
PathName pluginName = getPluginName();
to->p_name.cstr_length = pluginName.length();
- to->p_name.cstr_address = (UCHAR*)(pluginName.c_str());
+ to->p_name.cstr_address = (UCHAR*) pluginName.c_str();
to->p_name.cstr_allocated = 0;
HANDSHAKE_DEBUG(fprintf(stderr, "extractDataFromPluginTo added plugin name (%d) and data (%d)\n",
@@ -7084,7 +7084,7 @@
if (firstTime)
{
to->p_list.cstr_length = pluginList.length();
- to->p_list.cstr_address = (UCHAR*)(pluginList.c_str());
+ to->p_list.cstr_address = (UCHAR*) pluginList.c_str();
to->p_list.cstr_allocated = 0;
HANDSHAKE_DEBUG(fprintf(stderr, "extractDataFromPluginTo added plugin list (%d len) to packet\n",
to->p_list.cstr_length));
@@ -7109,7 +7109,7 @@
const unsigned char* ClntAuthBlock::getData(unsigned int* length)
{
*length = dataForPlugin.getCount();
- return (*length) ? dataForPlugin.begin() : NULL;
+ return *length ? dataForPlugin.begin() : NULL;
}
void ClntAuthBlock::putData(unsigned int length, const void* data)
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2011-12-27 12:45:55 UTC (rev 53777)
+++ firebird/trunk/src/remote/protocol.cpp 2011-12-28 01:07:49 UTC (rev 53778)
@@ -338,7 +338,7 @@
MAP(xdr_cstring, accept_with_data->p_acpt_data);
MAP(xdr_cstring, accept_with_data->p_acpt_plugin);
MAP(xdr_u_short, accept_with_data->p_acpt_authenticated);
-//??? fprintf(stderr, "data length %d\n", accept_with_data->p_acpt_data.cstr_length);
+ //??? fprintf(stderr, "data length %d\n", accept_with_data->p_acpt_data.cstr_length);
DEBUG_PRINTSIZE(xdrs, p->p_operation);
return P_TRUE(xdrs, p);
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2011-12-27 12:45:55 UTC (rev 53777)
+++ firebird/trunk/src/remote/remote.h 2011-12-28 01:07:49 UTC (rev 53778)
@@ -600,7 +600,7 @@
typedef Firebird::GetPlugins<Auth::IClient> AuthClientPlugins;
// Representation of authentication data, visible for plugin
-// Transfered in format, depending upon type of the packet (phaze of handshake)
+// Transfered in format, depending upon type of the packet (phase of handshake)
class ClntAuthBlock : public Firebird::StdPlugin<Auth::IClientBlock, FB_AUTH_CLIENT_BLOCK_VERSION>
{
private:
@@ -631,7 +631,7 @@
void loadServiceDataFrom(rem_port*);
Firebird::PathName getPluginName();
-// Auth::IClientBlock implementation
+ // Auth::IClientBlock implementation
int FB_CARG release();
const char* FB_CARG getLogin();
const char* FB_CARG getPassword();
@@ -690,7 +690,7 @@
void setDataForPlugin(const p_auth_continue* data);
void reset();
-// Auth::IServerBlock implementation
+ // Auth::IServerBlock implementation
int FB_CARG release();
const char* FB_CARG getLogin();
const unsigned char* FB_CARG getData(unsigned int* length);
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2011-12-27 12:45:55 UTC (rev 53777)
+++ firebird/trunk/src/remote/server/server.cpp 2011-12-28 01:07:49 UTC (rev 53778)
@@ -257,7 +257,7 @@
if (aDbName)
{
dbName = *aDbName;
- if (oldPath && (dbName != oldPath))
+ if (oldPath && dbName != oldPath)
{
HANDSHAKE_DEBUG(fprintf(stderr, "old='%s' new='%s'\n", oldPath, dbName.c_str()));
(Arg::Gds(isc_login) << Arg::Gds(isc_random) << "Client error - database name does not match").raise();
@@ -1389,9 +1389,9 @@
for (; plugins->hasData(); plugins->next())
{
port->port_srv_auth_block->authBlockWriter.setMethod(plugins->name());
- switch (port->port_srv_auth_block->plugins->plugin()->
- authenticate(&status, port->port_srv_auth_block,
- &port->port_srv_auth_block->authBlockWriter))
+ switch (port->port_srv_auth_block->plugins->plugin()->authenticate(
+ &status, port->port_srv_auth_block,
+ &port->port_srv_auth_block->authBlockWriter))
{
case Auth::AUTH_SUCCESS:
port->port_srv_auth_block->authCompleted(true);
@@ -6040,7 +6040,7 @@
const unsigned char* SrvAuthBlock::getData(unsigned int* length)
{
*length = dataForPlugin.getCount();
- return (*length) ? dataForPlugin.begin() : NULL;
+ return *length ? dataForPlugin.begin() : NULL;
}
void SrvAuthBlock::putData(unsigned int length, const void* data)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-12-28 18:16:17
|
Revision: 53787
http://firebird.svn.sourceforge.net/firebird/?rev=53787&view=rev
Author: dimitr
Date: 2011-12-28 18:16:11 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
Misc.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/inet.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2011-12-28 18:12:23 UTC (rev 53786)
+++ firebird/trunk/src/remote/client/interface.cpp 2011-12-28 18:16:11 UTC (rev 53787)
@@ -2114,7 +2114,7 @@
sqldata->p_sqldata_message_number = 0; // msg_type
if (sqldata->p_sqldata_messages = statement->rsr_select_format ? 1 : 0)
{
- if (!(port->port_flags &PORT_rpc))
+ if (!(port->port_flags & PORT_rpc))
{
sqldata->p_sqldata_messages =
static_cast<USHORT>(REMOTE_compute_batch_size(port,
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2011-12-28 18:12:23 UTC (rev 53786)
+++ firebird/trunk/src/remote/inet.cpp 2011-12-28 18:16:11 UTC (rev 53787)
@@ -120,9 +120,7 @@
using namespace Firebird;
-const USHORT MAX_PTYPE = ptype_lazy_send;
-
#ifdef WIN_NT
#include <fcntl.h>
@@ -599,11 +597,11 @@
static const p_cnct::p_cnct_repeat protocols_to_try1[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, MAX_PTYPE, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, MAX_PTYPE, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, MAX_PTYPE, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, MAX_PTYPE, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, MAX_PTYPE, 5)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_lazy_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_lazy_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_lazy_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_lazy_send, 4),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_lazy_send, 5)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
@@ -626,7 +624,7 @@
static const p_cnct::p_cnct_repeat protocols_to_try2[] =
{
REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, MAX_PTYPE, 2)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_lazy_send, 2)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2012-01-03 18:06:49
|
Revision: 53808
http://firebird.svn.sourceforge.net/firebird/?rev=53808&view=rev
Author: dimitr
Date: 2012-01-03 18:06:42 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
Removed the outdated RPC support + some misc cleanup.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/protocol.h
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/client/interface.cpp 2012-01-03 18:06:42 UTC (rev 53808)
@@ -868,8 +868,7 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- if (!(port->port_flags & PORT_rpc) &&
- (blob->rbl_flags & Rbl::CREATE) && blob->rbl_ptr != blob->rbl_buffer)
+ if ((blob->rbl_flags & Rbl::CREATE) && blob->rbl_ptr != blob->rbl_buffer)
{
send_blob(status, blob, 0, NULL);
}
@@ -2088,8 +2087,6 @@
( // Low in inventory
(statement->rsr_rows_pending <= statement->rsr_reorder_level) &&
(statement->rsr_msgs_waiting <= statement->rsr_reorder_level) &&
- // doing Batch, not RPC
- !(port->port_flags & PORT_rpc) &&
// not using named pipe on NT
// Pipelining causes both server & client to
// write at the same time. In named pipes, writes
@@ -2112,23 +2109,21 @@
sqldata->p_sqldata_blr.cstr_length = blr_length;
sqldata->p_sqldata_blr.cstr_address = const_cast<unsigned char*>(blr);
sqldata->p_sqldata_message_number = 0; // msg_type
- if (sqldata->p_sqldata_messages = statement->rsr_select_format ? 1 : 0)
+ sqldata->p_sqldata_messages = 0;
+ if (statement->rsr_select_format)
{
- if (!(port->port_flags & PORT_rpc))
- {
- sqldata->p_sqldata_messages =
- static_cast<USHORT>(REMOTE_compute_batch_size(port,
- 0, op_fetch_response, statement->rsr_select_format));
- sqldata->p_sqldata_messages *= 4;
+ sqldata->p_sqldata_messages =
+ static_cast<USHORT>(REMOTE_compute_batch_size(port,
+ 0, op_fetch_response, statement->rsr_select_format));
+ sqldata->p_sqldata_messages *= 4;
- // Reorder data when the local buffer is half empty
+ // Reorder data when the local buffer is half empty
- statement->rsr_reorder_level = sqldata->p_sqldata_messages / 2;
+ statement->rsr_reorder_level = sqldata->p_sqldata_messages / 2;
#ifdef DEBUG
- fprintf(stdout, "Recalculating Rows Pending in REM_fetch=%lu\n",
- statement->rsr_rows_pending);
+ fprintf(stdout, "Recalculating Rows Pending in REM_fetch=%lu\n",
+ statement->rsr_rows_pending);
#endif
- }
}
statement->rsr_rows_pending += sqldata->p_sqldata_messages;
@@ -2884,10 +2879,9 @@
P_RESP* response = &packet->p_resp;
CSTRING temp = response->p_resp_data;
- // Handle old protocol. Also handle new protocol on a blob that has
- // been created rather than opened. (This should yield an error.)
+ // Handle a blob that has been created rather than opened (this should yield an error)
- if ((port->port_flags & PORT_rpc) || (blob->rbl_flags & Rbl::CREATE))
+ if (blob->rbl_flags & Rbl::CREATE)
{
packet->p_operation = op_get_segment;
segment->p_sgmt_length = buffer_length;
@@ -3309,11 +3303,9 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // If this is an ancient protocol, just send the segment.
- // Also handle the new protocol on a blob that has been
- // opened rather than created. (This should yield an error.)
+ // Handle a blob that has been opened rather than created (this should yield an error)
- if ((port->port_flags & PORT_rpc) || !(blob->rbl_flags & Rbl::CREATE))
+ if (!(blob->rbl_flags & Rbl::CREATE))
{
send_blob(status, blob, segment_length, segmentPtr);
fb_assert(false);
@@ -3578,7 +3570,6 @@
((!message->msg_address && tail->rrq_rows_pending == 0) || // No message waiting
(tail->rrq_rows_pending <= tail->rrq_reorder_level && // Low in inventory
tail->rrq_msgs_waiting <= tail->rrq_reorder_level &&
- !(port->port_flags & PORT_rpc) && // doing Batch, not RPC
// Pipelining causes both server & client to
// write at the same time. In named pipes, writes
// block for the other end to read - and so when both
@@ -3611,26 +3602,16 @@
// is the same for each batch (June 1996), perhaps in the future it
// could dynamically adjust batching sizes based on fetch patterns
- if (port->port_flags & PORT_rpc)
- {
- // This is an RPC (remote procedure call) port - we just do
- // one at a time processing as that's how RPC works.
+ data->p_data_messages =
+ static_cast<USHORT>(REMOTE_compute_batch_size(port, 0, op_send, tail->rrq_format));
+ tail->rrq_reorder_level = 2 * data->p_data_messages;
+ data->p_data_messages *= 4;
+ tail->rrq_rows_pending += data->p_data_messages;
- data->p_data_messages = 1;
- }
- else
- {
- data->p_data_messages =
- static_cast<USHORT>(REMOTE_compute_batch_size(port, 0, op_send, tail->rrq_format));
- tail->rrq_reorder_level = 2 * data->p_data_messages;
- data->p_data_messages *= 4;
- tail->rrq_rows_pending += data->p_data_messages;
-
#ifdef DEBUG
- fprintf(stdout, "Recalculating Rows Pending in REM_receive=%d\n",
- tail->rrq_rows_pending);
+ fprintf(stdout, "Recalculating Rows Pending in REM_receive=%d\n",
+ tail->rrq_rows_pending);
#endif
- }
#ifdef DEBUG
fprintf(stderr, "port_flags %d max_msg %d\n", port->port_flags, request->rrq_max_msg);
@@ -5191,8 +5172,7 @@
// See if we're at end of the batch
- if (packet->p_sqldata.p_sqldata_status || !packet->p_sqldata.p_sqldata_messages ||
- (port->port_flags & PORT_rpc))
+ if (packet->p_sqldata.p_sqldata_status || !packet->p_sqldata.p_sqldata_messages)
{
if (packet->p_sqldata.p_sqldata_status == 100)
{
@@ -5358,7 +5338,7 @@
// See if we're at end of the batch
- if (!packet->p_data.p_data_messages || (port->port_flags & PORT_rpc))
+ if (!packet->p_data.p_data_messages)
{
if (!(--tail->rrq_batch_count))
tail->rrq_rows_pending = 0;
@@ -6115,9 +6095,8 @@
// Reached end of batch
- if (!packet->p_data.p_data_messages || (port->port_flags & PORT_rpc)) {
+ if (!packet->p_data.p_data_messages)
break;
- }
}
}
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/inet.cpp 2012-01-03 18:06:42 UTC (rev 53808)
@@ -597,11 +597,11 @@
static const p_cnct::p_cnct_repeat protocols_to_try1[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_lazy_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_lazy_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_lazy_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_lazy_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_lazy_send, 5)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_lazy_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_lazy_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_lazy_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_lazy_send, 4),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_lazy_send, 5)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
@@ -623,8 +623,8 @@
static const p_cnct::p_cnct_repeat protocols_to_try2[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_lazy_send, 2)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_lazy_send, 2)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
@@ -691,10 +691,6 @@
port->port_flags |= PORT_symmetric;
}
- if (accept->p_acpt_type == ptype_rpc) {
- port->port_flags |= PORT_rpc;
- }
-
if (accept->p_acpt_type != ptype_out_of_band) {
port->port_flags |= PORT_no_oob;
}
@@ -1199,7 +1195,6 @@
if (user_verification)
{
eff_gid = eff_uid = -1;
- // port->port_flags |= PORT_not_trusted; // never tested
}
#ifndef WIN_NT
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-03 18:06:42 UTC (rev 53808)
@@ -176,12 +176,12 @@
static const p_cnct::p_cnct_repeat protocols_to_try1[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_batch_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_batch_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_batch_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_batch_send, 5),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_batch_send, 6)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
@@ -225,8 +225,8 @@
static const p_cnct::p_cnct_repeat protocols_to_try2[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_rpc, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2),
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
@@ -268,7 +268,7 @@
static const p_cnct::p_cnct_repeat protocols_to_try3[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_rpc, ptype_batch_send, 1)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
@@ -351,9 +351,6 @@
if (accept->p_acpt_architecture == ARCHITECTURE)
port->port_flags |= PORT_symmetric;
- if (accept->p_acpt_type == ptype_rpc)
- port->port_flags |= PORT_rpc;
-
if (accept->p_acpt_type != ptype_out_of_band)
port->port_flags |= PORT_no_oob;
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-03 18:06:42 UTC (rev 53808)
@@ -258,12 +258,12 @@
static const p_cnct::p_cnct_repeat protocols_to_try1[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_rpc, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_rpc, ptype_batch_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_rpc, ptype_batch_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_rpc, ptype_batch_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_rpc, ptype_batch_send, 5),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_rpc, ptype_batch_send, 6)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
@@ -307,8 +307,8 @@
static const p_cnct::p_cnct_repeat protocols_to_try2[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_rpc, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_rpc, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2),
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
@@ -350,7 +350,7 @@
static const p_cnct::p_cnct_repeat protocols_to_try3[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_rpc, ptype_batch_send, 1)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1)
};
cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
@@ -434,9 +434,6 @@
if (accept->p_acpt_architecture == ARCHITECTURE)
port->port_flags |= PORT_symmetric;
- if (accept->p_acpt_type == ptype_rpc)
- port->port_flags |= PORT_rpc;
-
if (accept->p_acpt_type != ptype_out_of_band)
port->port_flags |= PORT_no_oob;
Modified: firebird/trunk/src/remote/protocol.h
===================================================================
--- firebird/trunk/src/remote/protocol.h 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/protocol.h 2012-01-03 18:06:42 UTC (rev 53808)
@@ -159,7 +159,7 @@
// Protocol Types
// p_acpt_type
//const USHORT ptype_page = 1; // Page server protocol
-const USHORT ptype_rpc = 2; // Simple remote procedure call
+//const USHORT ptype_rpc = 2; // Simple remote procedure call
const USHORT ptype_batch_send = 3; // Batch sends, no asynchrony
const USHORT ptype_out_of_band = 4; // Batch sends w/ out of band notification
const USHORT ptype_lazy_send = 5; // Deferred packets delivery
@@ -371,12 +371,12 @@
} P_CNCT;
#ifdef ASYMMETRIC_PROTOCOLS_ONLY
-#define REMOTE_PROTOCOL(version, min_type, max_type, weight) \
- {version, arch_generic, min_type, max_type, weight * 2}
+#define REMOTE_PROTOCOL(version, max_type, weight) \
+ {version, arch_generic, ptype_batch_send, max_type, weight * 2}
#else
-#define REMOTE_PROTOCOL(version, min_type, max_type, weight) \
- {version, arch_generic, min_type, max_type, weight * 2}, \
- {version, ARCHITECTURE, min_type, max_type, weight * 2 + 1}
+#define REMOTE_PROTOCOL(version, max_type, weight) \
+ {version, arch_generic, ptype_batch_send, max_type, weight * 2}, \
+ {version, ARCHITECTURE, ptype_batch_send, max_type, weight * 2 + 1}
#endif
/* User identification data, if any, is of form:
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/remote.h 2012-01-03 18:06:42 UTC (rev 53808)
@@ -700,18 +700,15 @@
// port_flags
const USHORT PORT_symmetric = 0x0001; // Server/client architectures are symmetic
-const USHORT PORT_rpc = 0x0002; // Protocol is remote procedure call
-const USHORT PORT_async = 0x0004; // Port is asynchronous channel for events
-const USHORT PORT_no_oob = 0x0008; // Don't send out of band data
-const USHORT PORT_disconnect = 0x0010; // Disconnect is in progress
-// This is set only in inet.cpp but never tested
-//const USHORT PORT_not_trusted = 0x0020; // Connection is from an untrusted node
-const USHORT PORT_dummy_pckt_set= 0x0040; // A dummy packet interval is set
-const USHORT PORT_partial_data = 0x0080; // Physical packet doesn't contain all API packet
-const USHORT PORT_lazy = 0x0100; // Deferred operations are allowed
-const USHORT PORT_server = 0x0200; // Server (not client) port
-const USHORT PORT_detached = 0x0400; // op_detach, op_drop_database or op_service_detach was processed
-const USHORT PORT_rdb_shutdown = 0x0800; // Database is shut down
+const USHORT PORT_async = 0x0002; // Port is asynchronous channel for events
+const USHORT PORT_no_oob = 0x0004; // Don't send out of band data
+const USHORT PORT_disconnect = 0x0008; // Disconnect is in progress
+const USHORT PORT_dummy_pckt_set= 0x0010; // A dummy packet interval is set
+const USHORT PORT_partial_data = 0x0020; // Physical packet doesn't contain all API packet
+const USHORT PORT_lazy = 0x0040; // Deferred operations are allowed
+const USHORT PORT_server = 0x0080; // Server (not client) port
+const USHORT PORT_detached = 0x0100; // op_detach, op_drop_database or op_service_detach was processed
+const USHORT PORT_rdb_shutdown = 0x0200; // Database is shut down
// Port itself
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2012-01-03 16:14:41 UTC (rev 53807)
+++ firebird/trunk/src/remote/server/server.cpp 2012-01-03 18:06:42 UTC (rev 53808)
@@ -645,9 +645,6 @@
static void trusted_auth(rem_port*, const P_TRAU*, PACKET*);
static void continue_authentication(rem_port*, const p_auth_continue*, PACKET*);
-#ifdef NOT_USED_OR_REPLACED
-static void aux_connect(rem_port*, P_REQ*, PACKET*);
-#endif
static void aux_request(rem_port*, /*P_REQ*,*/ PACKET*);
static bool bad_port_context(IStatus*, IRefCounted*, const ISC_STATUS);
static ISC_STATUS cancel_events(rem_port*, P_EVENT*, PACKET*);
@@ -1457,9 +1454,6 @@
if (architecture == ARCHITECTURE)
port->port_flags |= PORT_symmetric;
- if (type == ptype_rpc)
- port->port_flags |= PORT_rpc;
-
if (type != ptype_out_of_band)
port->port_flags |= PORT_no_oob;
@@ -1722,30 +1716,6 @@
}
-#ifdef NOT_USED_OR_REPLACED
-static void aux_connect( rem_port* port, P_REQ * request, PACKET* send)
-{
-/**************************************
- *
- * a u x _ c o n n e c t
- *
- **************************************
- *
- * Functional description
- * We're receive a auxiliary connection on the main communications
- * channel. Accept connection and reply politely.
- *
- * 13-Mar-2004, Nickolay Samofatov
- * This code is 64-bit unsafe, unused and also has a security hole, thus I disable it for now
- *
- **************************************/
- port->connect(0);
- rem_port* partner = (rem_port*) request->p_req_partner;
- partner->port_async = port;
-}
-#endif
-
-
static void aux_request( rem_port* port, /*P_REQ* request,*/ PACKET* send)
{
/**************************************
@@ -2747,8 +2717,7 @@
else {
msg_length = 0;
}
- USHORT count = ((this->port_flags & PORT_rpc) || statement->rsr_flags.test(Rsr::NO_BATCH)) ?
- 1 : sqldata->p_sqldata_messages;
+ USHORT count = statement->rsr_flags.test(Rsr::NO_BATCH) ? 1 : sqldata->p_sqldata_messages;
USHORT count2 = statement->rsr_flags.test(Rsr::NO_BATCH) ? 0 : count;
// On first fetch, clear the end-of-stream flag & reset the message buffers
@@ -3075,25 +3044,10 @@
#endif
sendL->p_resp.p_resp_data.cstr_address = buffer;
- // Be backwards compatible
+ // Gobble up a buffer's worth of segments
LocalStatus status_vector;
- if (this->port_flags & PORT_rpc)
- {
- USHORT length = blob->rbl_iface->getSegment(&status_vector, segment->p_sgmt_length, buffer);
-
- const ISC_STATUS status =
- this->send_response(sendL, blob->rbl_id, length, &status_vector, false);
-#ifdef DEBUG_REMOTE_MEMORY
- printf("get_segment(server) free buffer %x\n", buffer);
-#endif
-
- return status;
- }
-
- // Gobble up a buffer's worth of segments
-
UCHAR* p = buffer;
ISC_STATUS state = 0;
@@ -3945,12 +3899,6 @@
aux_request(port, /*&receive->p_req,*/ sendL);
break;
-#ifdef NOT_USED_OR_REPLACED
- case op_aux_connect:
- aux_connect(port, &receive->p_req, sendL);
- break;
-#endif
-
case op_ddl:
port->ddl(&receive->p_ddl, sendL);
break;
@@ -4302,15 +4250,8 @@
const rem_fmt* format = tail->rrq_format;
data->p_data_message_number = msg_number;
- if (this->port_flags & PORT_rpc)
- {
- data->p_data_messages = 1;
- }
- else
- {
- data->p_data_messages = (USHORT) REMOTE_compute_batch_size(this,
- (USHORT) xdr_protocol_overhead(op_response_piggyback), op_send, format);
- }
+ data->p_data_messages = (USHORT) REMOTE_compute_batch_size(this,
+ (USHORT) xdr_protocol_overhead(op_response_piggyback), op_send, format);
return this->receive_msg(data, sendL);
}
@@ -4340,7 +4281,7 @@
requestL = REMOTE_find_request(requestL, level);
const USHORT msg_number = data->p_data_message_number;
USHORT count, count2;
- count2 = count = (this->port_flags & PORT_rpc) ? 1 : data->p_data_messages;
+ count2 = count = data->p_data_messages;
LocalStatus status_vector;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2012-01-06 11:24:45
|
Revision: 53813
http://firebird.svn.sourceforge.net/firebird/?rev=53813&view=rev
Author: dimitr
Date: 2012-01-06 11:24:37 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
Removed support for the remote protocol versions prior to v10.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/parse_proto.h
firebird/trunk/src/remote/parser.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/protocol.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/client/interface.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -46,7 +46,6 @@
#include "../jrd/ibase.h"
#include "../common/ThreadStart.h"
#include "../jrd/license.h"
-#include "../common/sdl.h"
#include "../remote/inet_proto.h"
#include "../remote/merge_proto.h"
#include "../remote/parse_proto.h"
@@ -55,7 +54,6 @@
#include "../common/cvt.h"
#include "../yvalve/gds_proto.h"
#include "../common/isc_f_proto.h"
-#include "../common/sdl_proto.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/config/config.h"
#include "../common/utils_proto.h"
@@ -70,11 +68,6 @@
#include "../auth/trusted/AuthSspi.h"
-// hvlad: following code registering plugins is temporary and should be
-// moved at appropriate places
-
-#include "../auth/trusted/AuthSspi.h"
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -828,13 +821,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol supports action
-
- if (port->port_protocol < PROTOCOL_VERSION6)
- {
- unsupported();
- }
-
// Tell the remote server to cancel it and delete it from the list
send_cancel_event(rvnt);
}
@@ -942,12 +928,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol support action
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
release_object(status, rdb, op_commit_retaining, transaction->rtr_id);
}
catch (const Exception& ex)
@@ -1037,10 +1017,6 @@
// Parse the request in case blr_d_float must be converted to blr_double
const UCHAR* new_blr = blr;
- AutoPtr<const UCHAR> delete_blr;
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION5) {
- delete_blr = new_blr = PARSE_prepare_messages(blr, blr_length);
- }
// Make up a packet for the remote guy
@@ -1128,23 +1104,18 @@
CHECK_HANDLE(transaction, isc_bad_trans_handle);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = op_create_blob;
+ packet->p_operation = op_create_blob2;
P_BLOB* p_blob = &packet->p_blob;
p_blob->p_blob_transaction = transaction->rtr_id;
+ p_blob->p_blob_bpb.cstr_length = bpb_length;
+ fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
+ p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
+ // CVC: Should we ensure here that cstr_allocated < bpb_length???
+ // Otherwise, xdr_cstring() calling alloc_string() to decode would
+ // cause memory problems on the client side for SS, as the client
+ // would try to write to the application's provided R/O buffer.
+ p_blob->p_blob_bpb.cstr_address = bpb;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION4)
- {
- packet->p_operation = op_create_blob2;
- p_blob->p_blob_bpb.cstr_length = bpb_length;
- fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
- p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
- // CVC: Should we ensure here that cstr_allocated < bpb_length???
- // Otherwise, xdr_cstring() calling alloc_string() to decode would
- // cause memory problems on the client side for SS, as the client
- // would try to write to the application's provided R/O buffer.
- p_blob->p_blob_bpb.cstr_address = bpb;
- }
-
try
{
send_and_receive(status, rdb, packet);
@@ -1343,10 +1314,6 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
// Make up a packet for the remote guy
PACKET* packet = &rdb->rdb_packet;
@@ -1466,11 +1433,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol supports the action
-
- if (port->port_protocol < PROTOCOL_VERSION8)
- unsupported();
-
try
{
release_object(status, rdb, op_drop_database, rdb->rdb_id);
@@ -1530,11 +1492,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol support action
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7)
- unsupported();
-
Rsr* statement = NULL;
if (rdb->rdb_port->port_flags & PORT_lazy)
{
@@ -1624,14 +1581,6 @@
CHECK_HANDLE(transaction, isc_bad_trans_handle);
}
- // bag it if the protocol doesn't support it...
-
- if (port->port_protocol < PROTOCOL_VERSION7 ||
- (out_msg_length && port->port_protocol < PROTOCOL_VERSION8))
- {
- unsupported();
- }
-
// 24-Mar-2004 Nickolay Samofatov
// Unconditionally deallocate existing formats that are left from
// previous executions (possibly with different statement if
@@ -1832,22 +1781,6 @@
reset(status);
- // bag it if the protocol doesn't support it...
-
- if (port->port_protocol < PROTOCOL_VERSION7 ||
- ((in_msg_length || out_msg_length) && port->port_protocol < PROTOCOL_VERSION8))
- {
- unsupported();
- }
-
- // If the server is pre-6.0, do not send anything if the client dialect is 3 and
- // there is a SQLDA. This will cause the older server to crash
- if (port->port_protocol < PROTOCOL_VERSION10 &&
- (in_msg_length || out_msg_length) && dialect > SQL_DIALECT_V5)
- {
- unsupported();
- }
-
Rsr* statement = port->port_statement;
if (!statement) {
statement = port->port_statement = new Rsr;
@@ -2000,12 +1933,6 @@
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
// On first fetch, clear the end-of-stream flag & reset the message buffers
if (!statement->rsr_flags.test(Rsr::FETCHED))
@@ -2244,12 +2171,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
fb_assert(statement->haveException() == 0);
statement->clearException();
@@ -2343,12 +2264,6 @@
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
// Free existing format unconditionally.
// This is also related to SF#919246
delete statement->rsr_bind_format;
@@ -2481,13 +2396,6 @@
REMOTE_reset_statement(statement);
- // if we're less than protocol 7, the remote server doesn't support
- // DSQL, so we're done...
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
// set up the packet for the other guy...
PACKET* packet = &rdb->rdb_packet;
@@ -2608,12 +2516,6 @@
statement->raiseException();
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
if (!cursor)
{
// Return CURSOR unknown error
@@ -2691,11 +2593,6 @@
statement->raiseException();
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7)
- unsupported();
-
if (!metadata.fillFromCache(itemsLength, items, bufferLength, buffer))
{
info(status, rdb, op_info_sql, statement->rsr_id, 0,
@@ -3093,17 +2990,9 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
// Parse the sdl in case blr_d_float must be converted to blr_double
const UCHAR* new_sdl = sdl;
- AutoPtr<const UCHAR> delete_sdl; // To release memory if allocated by SDL_prepare_slice
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION6)
- {
- delete_sdl = new_sdl = SDL_prepare_slice(sdl, sdl_length);
- }
// CVC: Modified this horrible idea: don't touch input parameters!
// The modified (perhaps) sdl is send to the remote connection. The
@@ -3176,24 +3065,19 @@
CHECK_HANDLE(transaction, isc_bad_trans_handle);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = op_open_blob;
+ packet->p_operation = op_open_blob2;
P_BLOB* p_blob = &packet->p_blob;
p_blob->p_blob_transaction = transaction->rtr_id;
p_blob->p_blob_id = *id;
+ p_blob->p_blob_bpb.cstr_length = bpb_length;
+ fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
+ p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
+ // CVC: Should we ensure here that cstr_allocated < bpb_length???
+ // Otherwise, xdr_cstring() calling alloc_string() to decode would
+ // cause memory problems on the client side for SS, as the client
+ // would try to write to the application's provided R/O buffer.
+ p_blob->p_blob_bpb.cstr_address = bpb;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION4)
- {
- packet->p_operation = op_open_blob2;
- p_blob->p_blob_bpb.cstr_length = bpb_length;
- fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
- p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
- // CVC: Should we ensure here that cstr_allocated < bpb_length???
- // Otherwise, xdr_cstring() calling alloc_string() to decode would
- // cause memory problems on the client side for SS, as the client
- // would try to write to the application's provided R/O buffer.
- p_blob->p_blob_bpb.cstr_address = bpb;
- }
-
send_and_receive(status, rdb, packet);
// CVC: It's not evident to me why these two lines that I've copied
@@ -3246,17 +3130,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Handle historical version
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4)
- {
- if (msg_length)
- {
- unsupported();
- }
- release_object(status, rdb, op_prepare, transaction->rtr_id);
- }
-
PACKET* packet = &rdb->rdb_packet;
packet->p_operation = op_prepare2;
packet->p_prep.p_prep_transaction = transaction->rtr_id;
@@ -3376,18 +3249,9 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
// Parse the sdl in case blr_d_float must be converted to blr_double
const UCHAR* new_sdl = sdl;
- AutoPtr<const UCHAR> delete_sdl; // To release memory if allocated by SDL_prepare_slice
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION6)
- {
- delete_sdl = new_sdl = SDL_prepare_slice(sdl, sdl_length);
- }
// CVC: Modified this horrible idea: don't touch input parameters!
// The modified (perhaps) sdl is send to the remote connection. The
@@ -3459,12 +3323,6 @@
PACKET* packet = &rdb->rdb_packet;
- // Make sure protocol support action
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
// If there isn't a auxiliary asynchronous port, make one now
if (!port->port_async)
@@ -3969,10 +3827,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION6) {
- unsupported();
- }
-
PACKET* packet = &rdb->rdb_packet;
packet->p_operation = op_seek_blob;
P_SEEK* seek = &packet->p_seek;
@@ -4088,13 +3942,6 @@
RefMutexGuard portGuard(*port->port_sync);
Rdb* rdb = port->port_context;
- // make sure the protocol supports it
- if (port->port_protocol < PROTOCOL_VERSION8)
- {
- disconnect(port);
- unsupported();
- }
-
// The client may have set a parameter for dummy_packet_interval. Add that to the
// the SPB so the server can pay attention to it. Note: allocation code must
// ensure sufficient space has been added.
@@ -4177,12 +4024,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
release_object(status, rdb, op_service_detach, rdb->rdb_id);
disconnect(port);
rdb = NULL;
@@ -4220,12 +4061,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
ClntAuthBlock cBlock(NULL);
cBlock.loadServiceDataFrom(port);
@@ -4264,13 +4099,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8)
- {
- unsupported();
- }
-
svcstart(status, rdb, op_service_start, rdb->rdb_id, 0, spbLength, spb);
}
catch (const Exception& ex)
@@ -4326,8 +4154,7 @@
message->msg_address = const_cast<unsigned char*>(msg);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) ?
- op_start_and_send : op_start_send_and_receive;
+ packet->p_operation = op_start_send_and_receive;
P_DATA* data = &packet->p_data;
data->p_data_request = request->rrq_id;
data->p_data_transaction = transaction->rtr_id;
@@ -4348,8 +4175,7 @@
request->rrq_rtr = transaction;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION8 &&
- packet->p_operation == op_response_piggyback)
+ if (packet->p_operation == op_response_piggyback)
{
receive_after_start(request, packet->p_resp.p_resp_object);
}
@@ -4398,8 +4224,7 @@
REMOTE_reset_request(request, 0);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) ?
- op_start : op_start_and_receive;
+ packet->p_operation = op_start_and_receive;
P_DATA* data = &packet->p_data;
data->p_data_request = request->rrq_id;
data->p_data_transaction = transaction->rtr_id;
@@ -4412,8 +4237,7 @@
request->rrq_rtr = transaction;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION8 &&
- packet->p_operation == op_response_piggyback)
+ if (packet->p_operation == op_response_piggyback)
{
receive_after_start(request, packet->p_resp.p_resp_object);
}
@@ -4498,12 +4322,6 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- // bag it if the protocol doesn't support it...
-
- if (port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
Rpr* procedure = port->port_rpr;
if (!procedure) {
procedure = port->port_rpr = new Rpr;
@@ -5112,10 +4930,7 @@
// so we have to clear the wire before the response can be received
// In addtion to the above we grab all the records in case of XNET as
// we need to clear the queue
- bool clear_queue = false;
- if (id != statement->rsr_id || port->port_type == rem_port::XNET) {
- clear_queue = true;
- }
+ const bool clear_queue = (id != statement->rsr_id || port->port_type == rem_port::XNET);
statement->rsr_flags.set(Rsr::FETCHED);
while (true)
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/inet.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -434,10 +434,6 @@
static in_addr get_bind_address();
static int get_host_address(const char* name, in_addr* const host_addr_arr, const int arr_size);
-static void copy_p_cnct_repeat_array( p_cnct::p_cnct_repeat* pDest,
- const p_cnct::p_cnct_repeat* pSource,
- size_t nEntries);
-
static int inet_destroy(XDR*);
static void inet_gen_error(bool, rem_port*, const Firebird::Arg::StatusVector& v);
static bool_t inet_getbytes(XDR*, SCHAR *, u_int);
@@ -595,45 +591,24 @@
cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
- static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ static const p_cnct::p_cnct_repeat protocols_to_try[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_lazy_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_lazy_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_lazy_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_lazy_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_lazy_send, 5)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_lazy_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_lazy_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_lazy_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_lazy_send, 4)
};
+ fb_assert(FB_NELEM(protocols_to_try) <= FB_NELEM(cnct->p_cnct_versions));
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try);
- cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+ for (size_t i = 0; i < cnct->p_cnct_count; i++) {
+ cnct->p_cnct_versions[i] = protocols_to_try[i];
+ }
- copy_p_cnct_repeat_array(cnct->p_cnct_versions, protocols_to_try1, cnct->p_cnct_count);
-
// Try connection using first set of protocols
rem_port* port = inet_try_connect(packet, rdb, file_name, node_name, dpb);
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try2[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_lazy_send, 2)
- };
-
- cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
-
- copy_p_cnct_repeat_array(cnct->p_cnct_versions, protocols_to_try2, cnct->p_cnct_count);
-
- port = inet_try_connect(packet, rdb, file_name, node_name, dpb);
- }
-
P_ACPT* accept = NULL;
switch (packet->p_operation)
{
@@ -1964,20 +1939,7 @@
return 0;
}
-//____________________________________________________________
-//
-// Copy an array of p_cnct::p_cnct_repeat.
-//
-static void copy_p_cnct_repeat_array( p_cnct::p_cnct_repeat* pDest,
- const p_cnct::p_cnct_repeat* pSource,
- size_t nEntries)
-{
- for (size_t i = 0; i < nEntries; ++i) {
- pDest[i] = pSource[i];
- }
-}
-
static rem_port* receive( rem_port* main_port, PACKET * packet)
{
/**************************************
@@ -2079,10 +2041,8 @@
if (port->port_dummy_timeout < 0)
{
port->port_dummy_timeout = port->port_dummy_packet_interval;
- if (port->port_flags & PORT_async || port->port_protocol < PROTOCOL_VERSION8)
- {
+ if (port->port_flags & PORT_async)
continue;
- }
*length = 0;
return true;
}
@@ -3016,7 +2976,7 @@
timeout.tv_sec = port->port_connect_timeout;
time_ptr = &timeout;
}
- else if (port->port_protocol >= PROTOCOL_VERSION8 && port->port_dummy_packet_interval > 0)
+ else if (port->port_dummy_packet_interval > 0)
{
// Set the time interval for sending dummy packets to the client
timeout.tv_sec = port->port_dummy_packet_interval;
@@ -3084,7 +3044,7 @@
return false;
}
- if (!slct_count && port->port_protocol >= PROTOCOL_VERSION8)
+ if (!slct_count)
{
#ifdef DEBUG
if (INET_trace & TRACE_operations)
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -174,19 +174,18 @@
cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
- static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ static const p_cnct::p_cnct_repeat protocols_to_try[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 4)
};
- cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+ fb_assert(FB_NELEM(protocols_to_try) <= FB_NELEM(cnct->p_cnct_versions));
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try);
for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try1[i];
+ cnct->p_cnct_versions[i] = protocols_to_try[i];
}
// If we can't talk to a server, punt. Let somebody else generate an error.
@@ -208,91 +207,6 @@
port->port_context = rdb;
port->receive(packet);
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try2[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2),
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try2[i];
- }
-
- try
- {
- port = WNET_connect(node_name, packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server.
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try3[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1)
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try3[i];
- }
-
- try
- {
- port = WNET_connect(node_name, packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server.
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
P_ACPT* accept = NULL;
switch (packet->p_operation)
{
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -256,19 +256,18 @@
cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
- static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ static const p_cnct::p_cnct_repeat protocols_to_try[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 4)
};
- cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+ fb_assert(FB_NELEM(protocols_to_try) <= FB_NELEM(cnct->p_cnct_versions));
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try);
for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try1[i];
+ cnct->p_cnct_versions[i] = protocols_to_try[i];
}
// If we can't talk to a server, punt. Let somebody else generate an error.
@@ -290,91 +289,6 @@
port->port_context = rdb;
port->receive(packet);
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try2[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2),
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try2[i];
- }
-
- try
- {
- port = XNET_connect(packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try3[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1)
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try3[i];
- }
-
- try
- {
- port = XNET_connect(packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
P_ACPT* accept = NULL;
switch (packet->p_operation)
{
Modified: firebird/trunk/src/remote/parse_proto.h
===================================================================
--- firebird/trunk/src/remote/parse_proto.h 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/parse_proto.h 2012-01-06 11:24:37 UTC (rev 53813)
@@ -25,6 +25,5 @@
#define REMOTE_PARSE_PROTO_H
struct RMessage* PARSE_messages(const UCHAR*, USHORT);
-const UCHAR* PARSE_prepare_messages(const UCHAR*, USHORT);
#endif // REMOTE_PARSE_PROTO_H
Modified: firebird/trunk/src/remote/parser.cpp
===================================================================
--- firebird/trunk/src/remote/parser.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/parser.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -65,7 +65,6 @@
if (*blr++ != blr_begin)
return 0;
-
RMessage* message = NULL;
USHORT net_length = 0;
@@ -300,90 +299,3 @@
}
return (RMessage*) -1;
}
-
-
-const UCHAR* PARSE_prepare_messages(const UCHAR* blr, USHORT blr_length)
-{
-/**************************************
- *
- * P A R S E _ p r e p a r e _ m e s s a g e s
- *
- **************************************
- *
- * Functional description
- * Parse the messages of a blr request and convert
- * each occurrence of blr_d_float to blr_double.
- *
- * This function is only called for protocol version 5 and below
- *
- **************************************/
- const UCHAR* old_blr = blr;
- const UCHAR* new_blr = blr;
-
- const SSHORT version = *blr++;
- if ((version != blr_version4 && version != blr_version5) || *blr++ != blr_begin)
- {
- return old_blr;
- }
-
- while (*blr++ == blr_message)
- {
- blr++;
- USHORT count = *blr++;
- count += (*blr++) << 8;
- for (; count; --count)
- switch (*blr++)
- {
- case blr_text2:
- case blr_varying2:
- case blr_cstring2:
- blr += 4; // SUBTYPE word & LENGTH word
- break;
- case blr_text:
- case blr_varying:
- case blr_cstring:
- blr += 2; // LENGTH word
- break;
- case blr_short:
- case blr_long:
- case blr_int64:
- case blr_quad:
- blr++; // SCALE byte
- break;
- case blr_float:
- case blr_double:
- case blr_timestamp:
- case blr_sql_date:
- case blr_sql_time:
- case blr_bool:
- break;
-
- case blr_d_float:
- if (new_blr == old_blr)
- {
- new_blr = FB_...
[truncated message content] |
|
From: <ale...@us...> - 2012-01-12 13:53:20
|
Revision: 53851
http://firebird.svn.sourceforge.net/firebird/?rev=53851&view=rev
Author: alexpeshkoff
Date: 2012-01-12 13:53:11 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
Fixed multifactor auth-plugin use on server - thanks to Claudio
Modified Paths:
--------------
firebird/trunk/src/remote/remot_proto.h
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/remot_proto.h
===================================================================
--- firebird/trunk/src/remote/remot_proto.h 2012-01-12 03:34:49 UTC (rev 53850)
+++ firebird/trunk/src/remote/remot_proto.h 2012-01-12 13:53:11 UTC (rev 53851)
@@ -60,7 +60,7 @@
bool REMOTE_legacy_auth(const char* nm, int protocol);
Firebird::RefPtr<Config> REMOTE_get_config(const Firebird::PathName* dbName);
void REMOTE_parseList(Remote::ParsedList&, Firebird::PathName);
-void REMOTE_mergeList(Firebird::PathName& list, const Remote::ParsedList& parsed);
+void REMOTE_makeList(Firebird::PathName& list, const Remote::ParsedList& parsed);
void REMOTE_check_response(Firebird::IStatus* warning, Rdb* rdb, PACKET* packet);
#define HANDSHAKE_DEBUG(A)
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2012-01-12 03:34:49 UTC (rev 53850)
+++ firebird/trunk/src/remote/remote.cpp 2012-01-12 13:53:11 UTC (rev 53851)
@@ -994,7 +994,7 @@
}
}
-void REMOTE_mergeList(Firebird::PathName& list, const Remote::ParsedList& parsed)
+void REMOTE_makeList(Firebird::PathName& list, const Remote::ParsedList& parsed)
{
list.erase();
for (unsigned i = 0; i < parsed.getCount(); ++i)
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2012-01-12 03:34:49 UTC (rev 53850)
+++ firebird/trunk/src/remote/server/server.cpp 2012-01-12 13:53:11 UTC (rev 53851)
@@ -6026,13 +6026,22 @@
}
// special case - last plugin from the list on the server may be used to check
- // correctness of what previous one added to auth parameters block
- if (final[final.getCount() - 1] != onServer[onServer.getCount() - 1])
+ // correctness of what previous plugins added to auth parameters block
+ bool multiFactor = true;
+ for (unsigned sp = 0; sp < final.getCount(); ++sp)
{
+ if (final[sp] == onServer[onServer.getCount() - 1])
+ {
+ multiFactor = false;
+ break;
+ }
+ }
+ if (multiFactor)
+ {
final.push(onServer[onServer.getCount() - 1]);
}
- REMOTE_mergeList(pluginList, final);
+ REMOTE_makeList(pluginList, final);
plugins = new AuthServerPlugins(PluginType::AuthServer, FB_AUTH_SERVER_VERSION, upInfo,
myConfig, pluginList.c_str());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2012-01-16 15:01:28
|
Revision: 53864
http://firebird.svn.sourceforge.net/firebird/?rev=53864&view=rev
Author: alexpeshkoff
Date: 2012-01-16 15:01:17 +0000 (Mon, 16 Jan 2012)
Log Message:
-----------
Fixed CORE-3718: Client Library Hangs after unsuccessful connection to remote auxiliary (events) port
Modified Paths:
--------------
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/protocol.h
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2012-01-16 14:30:47 UTC (rev 53863)
+++ firebird/trunk/src/remote/inet.cpp 2012-01-16 15:01:17 UTC (rev 53864)
@@ -399,6 +399,7 @@
#endif
static rem_port* alloc_port(rem_port*, const USHORT = 0);
static rem_port* aux_connect(rem_port*, PACKET*);
+static void abort_aux_connection(rem_port*);
static rem_port* aux_request(rem_port*, PACKET*);
#if !defined(WIN_NT)
@@ -1296,6 +1297,7 @@
port->port_send_packet = send_full;
port->port_send_partial = send_partial;
port->port_connect = aux_connect;
+ port->port_abort_aux_connection = abort_aux_connection;
port->port_request = aux_request;
port->port_buff_size = (USHORT) INET_remote_buffer;
port->port_async_receive = inet_async_receive;
@@ -1317,6 +1319,15 @@
return port;
}
+static void abort_aux_connection(rem_port* port)
+{
+ if (port->port_flags & PORT_connecting)
+ {
+ shutdown(port->port_channel, 2);
+ SOCLOSE(port->port_channel);
+ }
+}
+
static rem_port* aux_connect(rem_port* port, PACKET* packet)
{
/**************************************
@@ -1396,8 +1407,9 @@
SOCKET n = socket(AF_INET, SOCK_STREAM, 0);
if (n == INVALID_SOCKET)
{
- inet_error(false, port, "socket", isc_net_event_connect_err, INET_ERRNO);
- return NULL;
+ int savedError = INET_ERRNO;
+ port->auxAcceptError(packet);
+ inet_error(false, port, "socket", isc_net_event_connect_err, savedError);
}
// NJK - Determine address and port to use.
@@ -1414,6 +1426,7 @@
if (status != 0)
{
int savedError = INET_ERRNO;
+ port->auxAcceptError(packet);
SOCLOSE(n);
inet_error(false, port, "socket", isc_net_event_connect_err, savedError);
}
@@ -1430,6 +1443,7 @@
{
int savedError = INET_ERRNO;
SOCLOSE(n);
+ port->auxAcceptError(packet);
inet_error(false, port, "connect", isc_net_event_connect_err, savedError);
}
@@ -1651,6 +1665,9 @@
*
**************************************/
+ if (port->port_async)
+ abort_aux_connection(port->port_async);
+
if (port->port_state != rem_port::PENDING)
return;
@@ -2127,7 +2144,7 @@
switch (result)
{
case Select::SEL_BAD:
- if (port->port_state == rem_port::BROKEN)
+ if (port->port_state == rem_port::BROKEN || port->port_flags & PORT_connecting)
continue;
return;
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2012-01-16 14:30:47 UTC (rev 53863)
+++ firebird/trunk/src/remote/protocol.cpp 2012-01-16 15:01:17 UTC (rev 53864)
@@ -280,6 +280,7 @@
case op_disconnect:
case op_dummy:
case op_ping:
+ case op_abort_aux_connection:
return P_TRUE(xdrs, p);
case op_connect:
Modified: firebird/trunk/src/remote/protocol.h
===================================================================
--- firebird/trunk/src/remote/protocol.h 2012-01-16 14:30:47 UTC (rev 53863)
+++ firebird/trunk/src/remote/protocol.h 2012-01-16 15:01:17 UTC (rev 53864)
@@ -275,6 +275,8 @@
op_accept_data = 94, // Server accepts connection and returns some data to client
+ op_abort_aux_connection = 95, // Async operation - stop waiting for async connection to arrive
+
op_max
};
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2012-01-16 14:30:47 UTC (rev 53863)
+++ firebird/trunk/src/remote/remote.cpp 2012-01-16 15:01:17 UTC (rev 53864)
@@ -656,6 +656,14 @@
return (*this->port_select_multi)(this, buffer, bufsize, length, port);
}
+void rem_port::abort_aux_connection()
+{
+ if (this->port_abort_aux_connection)
+ {
+ (*this->port_abort_aux_connection)(this);
+ }
+}
+
XDR_INT rem_port::send(PACKET* pckt)
{
return (*this->port_send_packet)(this, pckt);
@@ -676,6 +684,16 @@
return (*this->port_request)(this, pckt);
}
+void rem_port::auxAcceptError(PACKET* packet)
+{
+ if (port_protocol >= PROTOCOL_VERSION13)
+ {
+ packet->p_operation = op_abort_aux_connection;
+ // Ignore error return - we are already processing auxiliary connection error from the wire
+ send(packet);
+ }
+}
+
bool_t REMOTE_getbytes (XDR* xdrs, SCHAR* buff, u_int count)
{
/**************************************
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2012-01-16 14:30:47 UTC (rev 53863)
+++ firebird/trunk/src/remote/remote.h 2012-01-16 15:01:17 UTC (rev 53864)
@@ -709,6 +709,7 @@
const USHORT PORT_server = 0x0080; // Server (not client) port
const USHORT PORT_detached = 0x0100; // op_detach, op_drop_database or op_service_detach was processed
const USHORT PORT_rdb_shutdown = 0x0200; // Database is shut down
+const USHORT PORT_connecting = 0x0400; // Aux connection waits for a channel to be activated by client
// Port itself
@@ -737,6 +738,7 @@
t_port_connect port_connect; // Establish secondary connection
rem_port* (*port_request)(rem_port*, PACKET*); // Request to establish secondary connection
bool (*port_select_multi)(rem_port*, UCHAR*, SSHORT, SSHORT*, RemPortPtr&); // get packet from active port
+ void (*port_abort_aux_connection)(rem_port*); // stop waiting for secondary connection
enum rem_port_t {
INET, // Internet (TCP/IP)
@@ -927,6 +929,7 @@
rem_port* connect(PACKET* pckt);
rem_port* request(PACKET* pckt);
bool select_multi(UCHAR* buffer, SSHORT bufsize, SSHORT* length, RemPortPtr& port);
+ void abort_aux_connection();
bool haveRecvData()
{
@@ -1022,6 +1025,7 @@
SSHORT asyncReceive(PACKET* asyncPacket, const UCHAR* buffer, SSHORT dataSize);
Firebird::string getRemoteId() const;
+ void auxAcceptError(PACKET* packet);
};
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2012-01-16 14:30:47 UTC (rev 53863)
+++ firebird/trunk/src/remote/server/server.cpp 2012-01-16 15:01:17 UTC (rev 53864)
@@ -1754,6 +1754,7 @@
if (aux_port)
{
+ aux_port->port_flags |= PORT_connecting;
try
{
if (aux_port->connect(send))
@@ -1761,11 +1762,13 @@
}
catch (const Exception& ex)
{
+ aux_port->port_flags &= ~PORT_connecting;
iscLogException("", ex);
fb_assert(port->port_async == aux_port);
port->port_async = NULL;
aux_port->disconnect();
}
+ aux_port->port_flags &= ~PORT_connecting;
}
}
catch (const Exception& ex)
@@ -5504,6 +5507,7 @@
switch (getOperation(buffer, dataSize))
{
case op_cancel:
+ case op_abort_aux_connection:
break;
default:
return 0;
@@ -5530,6 +5534,12 @@
case op_cancel:
cancel_operation(this, asyncPacket->p_cancel_op.p_co_kind);
break;
+ case op_abort_aux_connection:
+ if (port_async && (port_async->port_flags & PORT_connecting))
+ {
+ port_async->abort_aux_connection();
+ }
+ break;
default:
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2012-01-25 07:32:42
|
Revision: 53923
http://firebird.svn.sourceforge.net/firebird/?rev=53923&view=rev
Author: dimitr
Date: 2012-01-25 07:32:35 +0000 (Wed, 25 Jan 2012)
Log Message:
-----------
Simplification.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/parser.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/remote.h
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2012-01-25 07:13:53 UTC (rev 53922)
+++ firebird/trunk/src/remote/client/interface.cpp 2012-01-25 07:32:35 UTC (rev 53923)
@@ -5777,7 +5777,7 @@
*
**************************************/
- if (!from_fmt || !to_fmt || from_fmt->fmt_count != to_fmt->fmt_count)
+ if (!from_fmt || !to_fmt || from_fmt->fmt_desc.getCount() != to_fmt->fmt_desc.getCount())
{
move_error(Arg::Gds(isc_dsql_sqlda_err));
// Msg 263 SQLDA missing or wrong number of variables
@@ -5785,8 +5785,8 @@
const dsc* from_desc = from_fmt->fmt_desc.begin();
const dsc* to_desc = to_fmt->fmt_desc.begin();
- const dsc* const end_desc = to_desc + to_fmt->fmt_count;
- for (; to_desc < end_desc; from_desc++, to_desc++)
+ for (const dsc* const end_desc = to_fmt->fmt_desc.end();
+ to_desc < end_desc; from_desc++, to_desc++)
{
dsc from = *from_desc;
dsc to = *to_desc;
Modified: firebird/trunk/src/remote/parser.cpp
===================================================================
--- firebird/trunk/src/remote/parser.cpp 2012-01-25 07:13:53 UTC (rev 53922)
+++ firebird/trunk/src/remote/parser.cpp 2012-01-25 07:32:35 UTC (rev 53923)
@@ -81,7 +81,6 @@
#ifdef DEBUG_REMOTE_MEMORY
printf("PARSE_messages allocate format %x\n", format);
#endif
- format->fmt_count = count;
USHORT offset = 0;
for (dsc* desc = format->fmt_desc.begin(); count; --count, ++desc)
{
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2012-01-25 07:13:53 UTC (rev 53922)
+++ firebird/trunk/src/remote/protocol.cpp 2012-01-25 07:32:35 UTC (rev 53923)
@@ -1149,7 +1149,7 @@
}
const dsc* desc = format->fmt_desc.begin();
- for (const dsc* const end = desc + format->fmt_count; desc < end; ++desc)
+ for (const dsc* const end = format->fmt_desc.end(); desc < end; ++desc)
{
if (!xdr_datum(xdrs, desc, message->msg_address))
return FALSE;
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2012-01-25 07:13:53 UTC (rev 53922)
+++ firebird/trunk/src/remote/remote.h 2012-01-25 07:32:35 UTC (rev 53923)
@@ -289,14 +289,12 @@
{
USHORT fmt_length;
USHORT fmt_net_length;
- USHORT fmt_count;
- USHORT fmt_version;
Firebird::Array<dsc> fmt_desc;
public:
explicit rem_fmt(size_t rpt) :
- fmt_length(0), fmt_net_length(0), fmt_count(0),
- fmt_version(0), fmt_desc(getPool(), rpt)
+ fmt_length(0), fmt_net_length(0),
+ fmt_desc(getPool(), rpt)
{
fmt_desc.grow(rpt);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2012-11-01 14:38:21
|
Revision: 57285
http://firebird.svn.sourceforge.net/firebird/?rev=57285&view=rev
Author: alexpeshkoff
Date: 2012-11-01 14:38:14 +0000 (Thu, 01 Nov 2012)
Log Message:
-----------
Begin wire crypt only after successfull authentication - this helps avoid meaningless message when password is wrong, thanks to Vlad
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/remot_proto.h
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2012-11-01 12:03:18 UTC (rev 57284)
+++ firebird/trunk/src/remote/client/interface.cpp 2012-11-01 14:38:14 UTC (rev 57285)
@@ -4638,13 +4638,6 @@
// We have a local connection string. If it's a file on a network share,
// try to connect to the corresponding host remotely.
-
- if (port)
- {
- cBlock.tryNewKeys(port);
- return port;
- }
-
#ifdef WIN_NT
PathName expanded_name = file_name;
ISC_expand_share(expanded_name);
@@ -4697,10 +4690,6 @@
}
}
- if (port)
- {
- cBlock.tryNewKeys(port);
- }
return port;
}
@@ -5504,7 +5493,6 @@
// OK to use plugin
cBlock.resetDataFromPlugin();
int authRc = cBlock.plugins.plugin()->authenticate(&s, &cBlock);
- cBlock.tryNewKeys(port);
switch (authRc)
{
@@ -5589,13 +5577,16 @@
CSTRING* tmpKeys = REMOTE_dup_string(&packet->p_crypt.p_key);
// it was start crypt packet, receive next one
receive_response(status, rdb, packet);
- // now try to start crypt
+ // add received keys to the list of known
if (tmpKeys)
{
port->addServerKeys(tmpKeys);
REMOTE_free_string(tmpKeys);
}
}
+
+ // try to start crypt
+ cBlock.tryNewKeys(port);
return;
default:
@@ -5604,6 +5595,9 @@
// successfully attached
HANDSHAKE_DEBUG(fprintf(stderr, "RR: OK!\n"));
rdb->rdb_id = packet->p_resp.p_resp_object;
+
+ // try to start crypt
+ cBlock.tryNewKeys(port);
return;
}
@@ -5638,7 +5632,6 @@
{
break;
}
- cBlock.tryNewKeys(port);
// send answer (may be empty) to server
if (port->port_protocol >= PROTOCOL_VERSION13)
Modified: firebird/trunk/src/remote/remot_proto.h
===================================================================
--- firebird/trunk/src/remote/remot_proto.h 2012-11-01 12:03:18 UTC (rev 57284)
+++ firebird/trunk/src/remote/remot_proto.h 2012-11-01 14:38:14 UTC (rev 57285)
@@ -64,5 +64,6 @@
void REMOTE_check_response(Firebird::IStatus* warning, Rdb* rdb, PACKET* packet, bool checkKeys = false);
#define HANDSHAKE_DEBUG(A)
+#define WIRECRYPT_DEBUG(A)
#endif // REMOTE_REMOT_PROTO_H
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2012-11-01 12:03:18 UTC (rev 57284)
+++ firebird/trunk/src/remote/remote.cpp 2012-11-01 14:38:14 UTC (rev 57285)
@@ -1219,6 +1219,13 @@
Firebird::status_exception::raise(vector);
}
+static void setCStr(CSTRING& to, const char* from)
+{
+ to.cstr_address = reinterpret_cast<UCHAR*>(const_cast<char*>(from));
+ to.cstr_length = strlen(from);
+ to.cstr_allocated = 0;
+}
+
void rem_port::addServerKeys(CSTRING* passedStr)
{
Firebird::ClumpletReader newKeys(Firebird::ClumpletReader::UnTagged,
@@ -1239,14 +1246,6 @@
key.plugins += ' ';
key.plugins.insert(0, " ");
- for (unsigned k = 0; k < port_crypt_keys.getCount(); ++k)
- {
- if (tryKeyType(key, port_crypt_keys[k]))
- {
- return;
- }
- }
-
port_known_server_keys.add(key);
}
}
@@ -1265,13 +1264,6 @@
return false;
}
-static void setCStr(CSTRING& to, const char* from)
-{
- to.cstr_address = reinterpret_cast<UCHAR*>(const_cast<char*>(from));
- to.cstr_length = strlen(from);
- to.cstr_allocated = 0;
-}
-
bool rem_port::tryKeyType(const KnownServerKey& srvKey, InternalCryptKey* cryptKey)
{
if (port_crypt_complete)
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2012-11-01 12:03:18 UTC (rev 57284)
+++ firebird/trunk/src/remote/server/server.cpp 2012-11-01 14:38:14 UTC (rev 57285)
@@ -5358,7 +5358,7 @@
port_crypt_complete = true;
send_response(sendL, 0, 0, &st, false);
- // fprintf(stderr, "Installed cipher %s key %s\n", cp.name(), key->type);
+ WIRECRYPT_DEBUG(fprintf(stderr, "Installed cipher %s key %s\n", cp.name(), key->type));
}
catch(const Exception& ex)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hv...@us...> - 2013-04-05 07:48:08
|
Revision: 57900
http://sourceforge.net/p/firebird/code/57900
Author: hvlad
Date: 2013-04-05 07:48:05 +0000 (Fri, 05 Apr 2013)
Log Message:
-----------
Fixed Windows build
Modified Paths:
--------------
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2013-04-05 07:43:37 UTC (rev 57899)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2013-04-05 07:48:05 UTC (rev 57900)
@@ -212,7 +212,7 @@
case op_accept:
if (cBlock)
{
- cBlock->reset(&file_name);
+ cBlock->resetClnt(&file_name);
}
accept = &packet->p_acpt;
break;
@@ -796,7 +796,7 @@
#endif
-static rem_str* make_pipe_name(RefPtr<Config>& config, const TEXT* connect_name, const TEXT* suffix_name, const TEXT* str_pid)
+static rem_str* make_pipe_name(const RefPtr<Config>& config, const TEXT* connect_name, const TEXT* suffix_name, const TEXT* str_pid)
{
/**************************************
*
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2013-04-05 07:43:37 UTC (rev 57899)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2013-04-05 07:48:05 UTC (rev 57900)
@@ -297,7 +297,7 @@
case op_accept:
if (cBlock)
{
- cBlock->reset(&file_name);
+ cBlock->resetClnt(&file_name);
}
accept = &packet->p_acpt;
break;
@@ -1024,7 +1024,7 @@
}
-static rem_port* connect_client(PACKET* packet, Firebird::RefPtr<Config>* config)
+static rem_port* connect_client(PACKET* packet, const Firebird::RefPtr<Config>* config)
{
/**************************************
*
@@ -1037,7 +1037,7 @@
*
**************************************/
- Firebird::RefPtr<Config>& conf(config ? *config : Config::getDefaultConfig());
+ const Firebird::RefPtr<Config>& conf(config ? *config : Config::getDefaultConfig());
if (!xnet_initialized)
{
Modified: firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp
===================================================================
--- firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp 2013-04-05 07:43:37 UTC (rev 57899)
+++ firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp 2013-04-05 07:48:05 UTC (rev 57900)
@@ -245,6 +245,11 @@
SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
}
+ {
+ Firebird::MasterInterfacePtr master;
+ master->serverMode(server_flag & SRVR_multi_client ? 1 : 0);
+ }
+
TEXT mutex_name[MAXPATHLEN];
fb_utils::snprintf(mutex_name, sizeof(mutex_name), SERVER_MUTEX, instance);
fb_utils::prefix_kernel_object_name(mutex_name, sizeof(mutex_name));
@@ -390,7 +395,7 @@
rem_port* port = NULL;
try
{
- port = INET_connect(protocol_inet, NULL, server_flag, 0);
+ port = INET_connect(protocol_inet, NULL, server_flag, 0, NULL);
}
catch (const Exception& ex)
{
@@ -439,7 +444,7 @@
try
{
- port = WNET_connect(protocol_wnet, NULL, server_flag);
+ port = WNET_connect(protocol_wnet, NULL, server_flag, NULL);
}
catch (const Exception& ex)
{
@@ -490,7 +495,7 @@
try
{
- port = XNET_connect(NULL, server_flag);
+ port = XNET_connect(NULL, server_flag, NULL);
}
catch (const Exception& ex)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2013-04-11 13:35:46
|
Revision: 57931
http://sourceforge.net/p/firebird/code/57931
Author: alexpeshkoff
Date: 2013-04-11 13:35:37 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
Fixed security issue - plain password remained in DPB
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/remote.h
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2013-04-11 11:40:23 UTC (rev 57930)
+++ firebird/trunk/src/remote/client/interface.cpp 2013-04-11 13:35:37 UTC (rev 57931)
@@ -655,7 +655,7 @@
static Rvnt* add_event(rem_port*);
static void add_other_params(rem_port*, ClumpletWriter&, const ParametersSet&);
static void add_working_directory(ClumpletWriter&, const PathName&);
-static rem_port* analyze(ClntAuthBlock&, PathName&, bool, ClumpletReader&, PathName&, bool);
+static rem_port* analyze(ClntAuthBlock&, PathName&, bool, ClumpletWriter&, PathName&, bool);
static rem_port* analyze_service(ClntAuthBlock&, PathName&, bool, ClumpletReader&, bool);
static void batch_gds_receive(rem_port*, struct rmtque *, USHORT);
static void batch_dsql_fetch(rem_port*, struct rmtque *, USHORT);
@@ -5202,7 +5202,7 @@
static rem_port* analyze(ClntAuthBlock& cBlock,
PathName& file_name,
bool uv_flag,
- ClumpletReader& dpb,
+ ClumpletWriter& dpb,
PathName& node_name,
bool loopback)
{
@@ -7404,7 +7404,7 @@
ISC_unescape(s);
}
-void ClntAuthBlock::loadClnt(Firebird::ClumpletReader& dpb, const ParametersSet* tags)
+void ClntAuthBlock::loadClnt(Firebird::ClumpletWriter& dpb, const ParametersSet* tags)
{
bool uft8Convert = !dpb.find(isc_dpb_utf8_filename);
@@ -7422,6 +7422,7 @@
{
makeUtfString(uft8Convert, password);
dpb.getString(password);
+ dpb.deleteClumplet();
HANDSHAKE_DEBUG(fprintf(stderr, "Loaded from PB password = %s\n", password.c_str()));
}
else if (t == tags->encrypt_key)
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2013-04-11 11:40:23 UTC (rev 57930)
+++ firebird/trunk/src/remote/remote.cpp 2013-04-11 13:35:37 UTC (rev 57931)
@@ -1003,7 +1003,7 @@
}
const char* legacyAuth = "LEGACY_AUTH";
- if (fb_utils::stricmp(legacyAuth, nm) == 0 && p < PROTOCOL_VERSION11)
+ if (fb_utils::stricmp(legacyAuth, nm) == 0 && p < PROTOCOL_VERSION13)
{
return true;
}
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2013-04-11 11:40:23 UTC (rev 57930)
+++ firebird/trunk/src/remote/remote.h 2013-04-11 13:35:37 UTC (rev 57931)
@@ -663,7 +663,7 @@
void extractDataFromPluginTo(Firebird::ClumpletWriter& dpb, const ParametersSet* tags, int protocol);
void extractDataFromPluginTo(CSTRING* to);
void extractDataFromPluginTo(P_AUTH_CONT* to);
- void loadClnt(Firebird::ClumpletReader& dpb, const ParametersSet*);
+ void loadClnt(Firebird::ClumpletWriter& dpb, const ParametersSet*);
void extractDataFromPluginTo(Firebird::ClumpletWriter& user_id);
void resetClnt(const Firebird::PathName* fileName);
bool checkPluginName(Firebird::PathName& nameToCheck);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2013-11-05 06:52:53
|
Revision: 58747
http://sourceforge.net/p/firebird/code/58747
Author: alexpeshkoff
Date: 2013-11-05 06:52:50 +0000 (Tue, 05 Nov 2013)
Log Message:
-----------
Fixed "Enabled" state of wire encyption
Modified Paths:
--------------
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2013-11-02 16:32:07 UTC (rev 58746)
+++ firebird/trunk/src/remote/remote.cpp 2013-11-05 06:52:50 UTC (rev 58747)
@@ -1398,6 +1398,6 @@
signed char wcCompatible[3][3] = {
/* DISABLED ENABLED REQUIRED */
/* DISABLED */ {0, 0, -1},
-/* ENABLED */ {0, 1, 1},
-/* REQUIRED */ {-1, 1, 1}
+/* ENABLED */ {0, 1, 2},
+/* REQUIRED */ {-1, 2, 2}
};
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2013-11-02 16:32:07 UTC (rev 58746)
+++ firebird/trunk/src/remote/server/server.cpp 2013-11-05 06:52:50 UTC (rev 58747)
@@ -1538,7 +1538,7 @@
}
-bool requiredEncryption(rem_port* port, ClumpletReader& id)
+bool wireEncryption(rem_port* port, ClumpletReader& id)
{
int clientCrypt = id.find(CNCT_client_crypt) ? id.getInt() : WIRE_CRYPT_ENABLED;
int serverCrypt = port->getPortConfig()->getWireCrypt(WC_SERVER);
@@ -1547,8 +1547,8 @@
Arg::Gds(isc_wirecrypt_incompatible).raise();
}
- port->port_required_encryption = wcCompatible[clientCrypt][serverCrypt] > 0;
- return port->port_required_encryption;
+ port->port_required_encryption = wcCompatible[clientCrypt][serverCrypt] == 2;
+ return wcCompatible[clientCrypt][serverCrypt] > 0;
}
@@ -1682,7 +1682,7 @@
send->p_acpd.p_acpt_authenticated = 0;
}
- if (accepted && requiredEncryption(port, id))
+ if (accepted && wireEncryption(port, id))
{
if (version >= PROTOCOL_VERSION13)
{
@@ -1698,7 +1698,10 @@
return true;
}
- accepted = false;
+ if (port->port_required_encryption)
+ {
+ accepted = false;
+ }
}
// We are going to try authentication handshake
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <asf...@us...> - 2013-11-24 23:44:55
|
Revision: 58833
http://sourceforge.net/p/firebird/code/58833
Author: asfernandes
Date: 2013-11-24 23:44:51 +0000 (Sun, 24 Nov 2013)
Log Message:
-----------
Fixed clang build, broken since r58800 with linker undefined references.
Revision Links:
--------------
http://sourceforge.net/p/firebird/code/58800
Modified Paths:
--------------
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2013-11-24 14:21:06 UTC (rev 58832)
+++ firebird/trunk/src/remote/remote.h 2013-11-24 23:44:51 UTC (rev 58833)
@@ -689,7 +689,16 @@
AuthServerPlugins* plugins;
Auth::WriterImplementation authBlockWriter;
- explicit SrvAuthBlock(rem_port* p_port);
+ explicit SrvAuthBlock(rem_port* p_port)
+ : port(p_port),
+ userName(getPool()), pluginName(getPool()), pluginList(getPool()),
+ dataForPlugin(getPool()), dataFromPlugin(getPool()),
+ lastExtractedKeys(getPool(), Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE),
+ newKeys(getPool()),
+ flComplete(false), firstTime(true),
+ plugins(NULL)
+ {
+ }
~SrvAuthBlock()
{
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2013-11-24 14:21:06 UTC (rev 58832)
+++ firebird/trunk/src/remote/server/server.cpp 2013-11-24 23:44:51 UTC (rev 58833)
@@ -6147,16 +6147,6 @@
return 0;
}
-SrvAuthBlock::SrvAuthBlock(rem_port* p_port)
- : port(p_port),
- userName(getPool()), pluginName(getPool()), pluginList(getPool()),
- dataForPlugin(getPool()), dataFromPlugin(getPool()),
- lastExtractedKeys(getPool(), Firebird::ClumpletReader::UnTagged, MAX_DPB_SIZE),
- newKeys(getPool()),
- flComplete(false), firstTime(true),
- plugins(NULL)
-{ }
-
void SrvAuthBlock::extractDataFromPluginTo(cstring* to)
{
to->cstr_allocated = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2014-09-10 11:55:52
|
Revision: 60040
http://sourceforge.net/p/firebird/code/60040
Author: dimitr
Date: 2014-09-10 11:55:43 +0000 (Wed, 10 Sep 2014)
Log Message:
-----------
Resolved CORE-2897: Don't send full length of field over the wire when field is null.
Modified Paths:
--------------
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/protocol.h
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2014-09-09 07:43:46 UTC (rev 60039)
+++ firebird/trunk/src/remote/protocol.cpp 2014-09-10 11:55:43 UTC (rev 60040)
@@ -42,6 +42,8 @@
#include "../common/StatusHolder.h"
#include "../common/classes/stack.h"
+using namespace Firebird;
+
#ifdef DEBUG_XDR_MEMORY
inline bool_t P_TRUE(XDR* xdrs, PACKET* p)
{
@@ -102,9 +104,10 @@
#endif
static bool_t xdr_longs(XDR*, CSTRING*);
static bool_t xdr_message(XDR*, RMessage*, const rem_fmt*);
+static bool_t xdr_packed_message(XDR*, RMessage*, const rem_fmt*);
static bool_t xdr_request(XDR*, USHORT, USHORT, USHORT);
static bool_t xdr_slice(XDR*, lstring*, /*USHORT,*/ const UCHAR*);
-static bool_t xdr_status_vector(XDR*, Firebird::DynamicStatusVector*&);
+static bool_t xdr_status_vector(XDR*, DynamicStatusVector*&);
static bool_t xdr_sql_blr(XDR*, SLONG, CSTRING*, bool, SQL_STMT_TYPE);
static bool_t xdr_sql_message(XDR*, SLONG);
static bool_t xdr_trrq_blr(XDR*, CSTRING*);
@@ -903,7 +906,7 @@
try {
cstring->cstr_address = FB_NEW(*getDefaultMemoryPool()) UCHAR[cstring->cstr_length];
}
- catch (const Firebird::BadAlloc&) {
+ catch (const BadAlloc&) {
return false;
}
@@ -1158,21 +1161,16 @@
if (xdrs->x_op == XDR_FREE)
return TRUE;
- const rem_port* port = (rem_port*) xdrs->x_public;
+ rem_port* port = (rem_port*) xdrs->x_public;
-
if (!message || !format)
- {
return FALSE;
- }
// If we are running a symmetric version of the protocol, just slop
// the bits and don't sweat the translations
if (port->port_flags & PORT_symmetric)
- {
return xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(message->msg_address), format->fmt_length);
- }
const dsc* desc = format->fmt_desc.begin();
for (const dsc* const end = format->fmt_desc.end(); desc < end; ++desc)
@@ -1186,6 +1184,136 @@
}
+static bool_t xdr_packed_message( XDR* xdrs, RMessage* message, const rem_fmt* format)
+{
+/**************************************
+ *
+ * x d r _ p a c k e d _ m e s s a g e
+ *
+ **************************************
+ *
+ * Functional description
+ * Map a formatted message.
+ *
+ **************************************/
+
+ if (xdrs->x_op == XDR_FREE)
+ return TRUE;
+
+ const rem_port* const port = (rem_port*) xdrs->x_public;
+
+ if (!message || !format)
+ return FALSE;
+
+ // If we are running a symmetric version of the protocol, just slop
+ // the bits and don't sweat the translations
+
+ if (port->port_flags & PORT_symmetric)
+ return xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(message->msg_address), format->fmt_length);
+
+ // Optimize the message by transforming NULL indicators into a bitmap
+ // and then skipping the NULL items
+
+ class NullBitmap : private HalfStaticArray<UCHAR, 4>
+ {
+ public:
+ explicit NullBitmap(USHORT size)
+ {
+ resize(size);
+ }
+
+ void setNull(USHORT id)
+ {
+ data[id >> 3] |= (1 << (id & 7));
+ }
+
+ bool isNull(USHORT id) const
+ {
+ return data[id >> 3] & (1 << (id & 7));
+ }
+
+ UCHAR* getData()
+ {
+ return data;
+ }
+ };
+
+ fb_assert(format->fmt_desc.getCount() % 2 == 0);
+ const USHORT flagBytes = (format->fmt_desc.getCount() / 2 + 7) / 8;
+ NullBitmap nulls(flagBytes);
+
+ if (xdrs->x_op == XDR_ENCODE)
+ {
+ // First pass (odd elements): track NULL indicators
+
+ const dsc* desc = format->fmt_desc.begin() + 1;
+ for (const dsc* const end = format->fmt_desc.end(); desc < end; desc += 2)
+ {
+ fb_assert(desc->dsc_dtype == dtype_short);
+ const USHORT index = (USHORT) (desc - format->fmt_desc.begin()) / 2;
+ const SSHORT* const flag = (SSHORT*) (message->msg_address + (IPTR) desc->dsc_address);
+
+ if (*flag)
+ nulls.setNull(index);
+ }
+
+ // Send the NULL bitmap
+
+ if (!xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(nulls.getData()), flagBytes))
+ return FALSE;
+
+ // Second pass (even elements): process non-NULL items
+
+ desc = format->fmt_desc.begin();
+ for (const dsc* const end = format->fmt_desc.end(); desc < end; desc += 2)
+ {
+ const USHORT index = (USHORT) (desc - format->fmt_desc.begin()) / 2;
+
+ if (!nulls.isNull(index))
+ {
+ if (!xdr_datum(xdrs, desc, message->msg_address))
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ // Receive the NULL bitmap
+
+ if (!xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(nulls.getData()), flagBytes))
+ return FALSE;
+
+ // First pass (odd elements): initialize NULL indicators
+
+ const dsc* desc = format->fmt_desc.begin() + 1;
+ for (const dsc* const end = format->fmt_desc.end(); desc < end; desc += 2)
+ {
+ fb_assert(desc->dsc_dtype == dtype_short);
+ const USHORT index = (USHORT) (desc - format->fmt_desc.begin()) / 2;
+ SSHORT* const flag = (SSHORT*) (message->msg_address + (IPTR) desc->dsc_address);
+ *flag = nulls.isNull(index) ? -1 : 0;
+ }
+
+ // Second pass (even elements): process non-NULL items
+
+ desc = format->fmt_desc.begin();
+ for (const dsc* const end = format->fmt_desc.end(); desc < end; desc += 2)
+ {
+ const USHORT index = (USHORT) (desc - format->fmt_desc.begin()) / 2;
+
+ if (!nulls.isNull(index))
+ {
+ if (!xdr_datum(xdrs, desc, message->msg_address))
+ return FALSE;
+ }
+ }
+ }
+
+ DEBUG_PRINTSIZE(xdrs, op_void);
+ return TRUE;
+}
+
+
static bool_t xdr_request(XDR* xdrs,
USHORT request_id,
USHORT message_number, USHORT incarnation)
@@ -1214,7 +1342,7 @@
{
request = port->port_objects[request_id];
}
- catch (const Firebird::status_exception&)
+ catch (const status_exception&)
{
return FALSE;
}
@@ -1280,7 +1408,7 @@
try {
slice->lstr_address = FB_NEW(*getDefaultMemoryPool()) UCHAR[slice->lstr_length];
}
- catch (const Firebird::BadAlloc&) {
+ catch (const BadAlloc&) {
return false;
}
@@ -1373,7 +1501,7 @@
{
statement = port->port_objects[statement_id];
}
- catch (const Firebird::status_exception&)
+ catch (const status_exception&)
{
return FALSE;
}
@@ -1479,7 +1607,7 @@
{
statement = port->port_objects[statement_id];
}
- catch (const Firebird::status_exception&)
+ catch (const status_exception&)
{
return FALSE;
}
@@ -1494,20 +1622,19 @@
RMessage* message = statement->rsr_buffer;
if (!message)
- {
- // We should not call xdr_message() with NULL
return FALSE;
- }
statement->rsr_buffer = message->msg_next;
if (!message->msg_address)
message->msg_address = message->msg_buffer;
- return xdr_message(xdrs, message, statement->rsr_format);
+ return (port->port_protocol >= PROTOCOL_VERSION13) ?
+ xdr_packed_message(xdrs, message, statement->rsr_format) :
+ xdr_message(xdrs, message, statement->rsr_format);
}
-static bool_t xdr_status_vector(XDR* xdrs, Firebird::DynamicStatusVector*& vector)
+static bool_t xdr_status_vector(XDR* xdrs, DynamicStatusVector*& vector)
{
/**************************************
*
@@ -1531,12 +1658,12 @@
}
if (!vector)
- vector = FB_NEW(*getDefaultMemoryPool()) Firebird::DynamicStatusVector();
+ vector = FB_NEW(*getDefaultMemoryPool()) DynamicStatusVector();
- Firebird::SimpleStatusVector vectorDecode;
+ SimpleStatusVector vectorDecode;
const ISC_STATUS* vectorEncode = vector->value();
- Firebird::Stack<SCHAR*> space;
+ Stack<SCHAR*> space;
bool rc = false;
SLONG vec;
@@ -1745,7 +1872,7 @@
statement = port->port_objects[statement_id];
REMOTE_reset_statement(statement);
}
- catch (const Firebird::status_exception&)
+ catch (const status_exception&)
{} // no-op
}
}
Modified: firebird/trunk/src/remote/protocol.h
===================================================================
--- firebird/trunk/src/remote/protocol.h 2014-09-09 07:43:46 UTC (rev 60039)
+++ firebird/trunk/src/remote/protocol.h 2014-09-10 11:55:43 UTC (rev 60040)
@@ -73,6 +73,7 @@
const USHORT PROTOCOL_VERSION12 = (FB_PROTOCOL_FLAG | 12);
// Protocol 13 has support for authentication plugins (op_cont_auth).
+// It also transfers SQL messages in the packed (null aware) format.
const USHORT PROTOCOL_VERSION13 = (FB_PROTOCOL_FLAG | 13);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2014-09-29 10:51:45
|
Revision: 60058
http://sourceforge.net/p/firebird/code/60058
Author: alexpeshkoff
Date: 2014-09-29 10:51:40 +0000 (Mon, 29 Sep 2014)
Log Message:
-----------
Fixed access to freed memory in remote redirector. This should fix CORE-4557.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/remote.h
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2014-09-29 01:18:08 UTC (rev 60057)
+++ firebird/trunk/src/remote/client/interface.cpp 2014-09-29 10:51:40 UTC (rev 60058)
@@ -153,7 +153,9 @@
public:
explicit Blob(Rbl* handle)
: blob(handle)
- { }
+ {
+ blob->rbl_self = &blob;
+ }
private:
void freeClientData(IStatus* status, bool force = false);
@@ -201,7 +203,9 @@
Transaction(Rtr* handle, Attachment* a)
: remAtt(a),
transaction(handle)
- { }
+ {
+ transaction->rtr_self = &transaction;
+ }
Rtr* getTransaction()
{
@@ -319,6 +323,7 @@
statement(handle),
dialect(aDialect)
{
+ statement->rsr_self = &statement;
}
Rsr* getStatement()
@@ -382,7 +387,9 @@
public:
Request(Rrq* handle, Attachment* a)
: remAtt(a), rq(handle)
- { }
+ {
+ rq->rrq_self = &rq;
+ }
private:
void freeClientData(IStatus* status, bool force = false);
@@ -414,7 +421,11 @@
virtual void FB_CARG cancel(IStatus* status);
public:
- Events(Rvnt* handle) : rvnt(handle) { }
+ Events(Rvnt* handle)
+ : rvnt(handle)
+ {
+ rvnt->rvnt_self = &rvnt;
+ }
private:
void freeClientData(IStatus* status, bool force = false);
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2014-09-29 01:18:08 UTC (rev 60057)
+++ firebird/trunk/src/remote/remote.cpp 2014-09-29 10:51:40 UTC (rev 60058)
@@ -924,10 +924,6 @@
}
*/
-Rrq::~Rrq()
-{
-}
-
void Rrq::saveStatus(const Firebird::Exception& ex) throw()
{
if (rrqStatus.isSuccess())
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2014-09-29 01:18:08 UTC (rev 60057)
+++ firebird/trunk/src/remote/remote.h 2014-09-29 10:51:40 UTC (rev 60058)
@@ -168,14 +168,21 @@
bool rtr_limbo;
Firebird::Array<Rsr*> rtr_cursors;
+ Rtr** rtr_self;
public:
Rtr() :
rtr_rdb(0), rtr_next(0), rtr_blobs(0),
rtr_iface(NULL), rtr_id(0), rtr_limbo(0),
- rtr_cursors(getPool())
+ rtr_cursors(getPool()), rtr_self(NULL)
{ }
+ ~Rtr()
+ {
+ if (rtr_self && *rtr_self == this)
+ *rtr_self = NULL;
+ }
+
static ISC_STATUS badHandle() { return isc_bad_trans_handle; }
};
@@ -197,6 +204,7 @@
USHORT rbl_fragment_length;
USHORT rbl_source_interp; // source interp (for writing)
USHORT rbl_target_interp; // destination interp (for reading)
+ Rbl** rbl_self;
public:
// Values for rbl_flags
@@ -213,9 +221,15 @@
rbl_buffer(rbl_data.getBuffer(BLOB_LENGTH)), rbl_ptr(rbl_buffer), rbl_iface(NULL),
rbl_offset(0), rbl_id(0), rbl_flags(0),
rbl_buffer_length(BLOB_LENGTH), rbl_length(0), rbl_fragment_length(0),
- rbl_source_interp(0), rbl_target_interp(0)
+ rbl_source_interp(0), rbl_target_interp(0), rbl_self(NULL)
{ }
+ ~Rbl()
+ {
+ if (rbl_self && *rbl_self == this)
+ *rbl_self = NULL;
+ }
+
static ISC_STATUS badHandle() { return isc_bad_segstr_handle; }
};
@@ -229,12 +243,19 @@
rem_port* rvnt_port; // used to id server from whence async came
SLONG rvnt_id; // used to store client-side id
USHORT rvnt_length;
+ Rvnt** rvnt_self;
public:
Rvnt() :
rvnt_next(NULL), rvnt_rdb(NULL), rvnt_callback(NULL), rvnt_iface(NULL),
- rvnt_port(NULL), rvnt_id(0), rvnt_length(0)
+ rvnt_port(NULL), rvnt_id(0), rvnt_length(0), rvnt_self(NULL)
{ }
+
+ ~Rvnt()
+ {
+ if (rvnt_self && *rvnt_self == this)
+ *rvnt_self = NULL;
+ }
};
@@ -325,23 +346,29 @@
};
Firebird::Array<rrq_repeat> rrq_rpt;
+ Rrq** rrq_self;
public:
explicit Rrq(FB_SIZE_T rpt) :
rrq_rdb(0), rrq_rtr(0), rrq_next(0), rrq_levels(0),
rrq_iface(NULL), rrq_id(0), rrq_max_msg(0), rrq_level(0),
- rrq_rpt(getPool(), rpt)
+ rrq_rpt(getPool(), rpt), rrq_self(NULL)
{
//memset(rrq_status_vector, 0, sizeof rrq_status_vector);
rrq_rpt.grow(rpt);
}
- ~Rrq();
+ ~Rrq()
+ {
+ if (rrq_self && *rrq_self == this)
+ *rrq_self = NULL;
+ }
Rrq* clone() const
{
Rrq* rc = new Rrq(rrq_rpt.getCount());
*rc = *this;
+ rc->rrq_self = NULL;
return rc;
}
@@ -419,6 +446,7 @@
Firebird::string rsr_cursor_name; // Name for cursor to be set on open
bool rsr_delayed_format; // Out format was delayed on execute, set it on fetch
+ Rsr** rsr_self;
public:
// Values for rsr_flags.
@@ -440,9 +468,15 @@
rsr_format(0), rsr_message(0), rsr_buffer(0), rsr_status(0),
rsr_id(0), rsr_fmt_length(0),
rsr_rows_pending(0), rsr_msgs_waiting(0), rsr_reorder_level(0), rsr_batch_count(0),
- rsr_cursor_name(getPool()), rsr_delayed_format(false)
- { }
+ rsr_cursor_name(getPool()), rsr_delayed_format(false), rsr_self(NULL)
+ { }
+ ~Rsr()
+ {
+ if (rsr_self && *rsr_self == this)
+ *rsr_self = NULL;
+ }
+
void saveException(Firebird::IStatus* status, bool overwrite);
void saveException(const Firebird::Exception& ex, bool overwrite);
void clearException();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2014-10-11 09:02:18
|
Revision: 60100
http://sourceforge.net/p/firebird/code/60100
Author: dimitr
Date: 2014-10-11 09:02:09 +0000 (Sat, 11 Oct 2014)
Log Message:
-----------
Improved the batching (prefetch) logic. This is the second part of CORE-2530.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/remote.cpp
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/client/interface.cpp 2014-10-11 09:02:09 UTC (rev 60100)
@@ -2897,7 +2897,6 @@
{
sqldata->p_sqldata_messages =
REMOTE_compute_batch_size(port, 0, op_fetch_response, statement->rsr_select_format);
- sqldata->p_sqldata_messages *= 4;
// Reorder data when the local buffer is half empty
@@ -4076,8 +4075,7 @@
// could dynamically adjust batching sizes based on fetch patterns
data->p_data_messages = REMOTE_compute_batch_size(port, 0, op_send, tail->rrq_format);
- tail->rrq_reorder_level = 2 * data->p_data_messages;
- data->p_data_messages *= 4;
+ tail->rrq_reorder_level = data->p_data_messages / 2;
tail->rrq_rows_pending += data->p_data_messages;
#ifdef DEBUG
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/inet.cpp 2014-10-11 09:02:09 UTC (rev 60100)
@@ -2977,6 +2977,9 @@
} // end scope
#endif
+ port->port_rcv_packets++;
+ port->port_rcv_bytes += n;
+
*length = n;
return true;
@@ -3146,6 +3149,9 @@
} // end scope
#endif
+ port->port_snd_packets++;
+ port->port_snd_bytes += buffer_length;
+
return true;
}
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2014-10-11 09:02:09 UTC (rev 60100)
@@ -1342,6 +1342,9 @@
packet_print("receive", buffer, n);
#endif
+ port->port_rcv_packets++;
+ port->port_rcv_bytes += n;
+
*length = (SSHORT) n;
return true;
@@ -1400,6 +1403,9 @@
packet_print("send", reinterpret_cast<const UCHAR*>(buffer), buffer_length);
#endif
+ port->port_snd_packets++;
+ port->port_snd_bytes += buffer_length;
+
return true;
}
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2014-10-11 09:02:09 UTC (rev 60100)
@@ -1902,7 +1902,7 @@
* Read a buffer full of data.
*
**************************************/
- rem_port* port = (rem_port*)xdrs->x_public;
+ rem_port* port = (rem_port*) xdrs->x_public;
const bool portServer = (port->port_flags & PORT_server);
XCC xcc = port->port_xcc;
XCH xch = xcc->xcc_recv_channel;
@@ -1936,8 +1936,13 @@
if (wait_result == WAIT_OBJECT_0)
{
// Client has written some data for us (server) to read
+
+ port->port_rcv_packets++;
+ port->port_rcv_bytes += xch->xch_length;
+
xdrs->x_handy = xch->xch_length;
xdrs->x_private = xdrs->x_base;
+
return TRUE;
}
if (wait_result == WAIT_TIMEOUT)
@@ -1981,15 +1986,19 @@
* filled and ready for reading.
*
**************************************/
- rem_port* port = (rem_port*)xdrs->x_public;
+ rem_port* port = (rem_port*) xdrs->x_public;
XCC xcc = port->port_xcc;
XCH xch = xcc->xcc_send_channel;
xch->xch_length = xdrs->x_private - xdrs->x_base;
if (SetEvent(xcc->xcc_event_send_channel_filled))
{
+ port->port_snd_packets++;
+ port->port_snd_bytes += xch->xch_length;
+
xdrs->x_private = xdrs->x_base;
xdrs->x_handy = xch->xch_size;
+
return TRUE;
}
Modified: firebird/trunk/src/remote/remote.cpp
===================================================================
--- firebird/trunk/src/remote/remote.cpp 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/remote.cpp 2014-10-11 09:02:09 UTC (rev 60100)
@@ -204,34 +204,12 @@
* The client calculates this number (n from the list above)
* and sends it to the server.
*
- * I asked why it is that the client doesn't just ask for a packet
- * full of records and let the server return however many fits in
- * a packet. According to Sudesh, this is because of a bug in
- * Superserver which showed up in the WIN_NT 4.2.x kits. So I
- * imagine once we up the protocol so that we can be sure we're not
- * talking to a 4.2 kit, then we can make this optimization.
- * - Deej 2/28/97
- *
- * Note: A future optimization can look at setting the packet
- * size to optimize the transfer.
- *
- * Note: This calculation must use worst-case to determine the
- * packing. Should the data record have VARCHAR data, it is
- * often possible to fit more than the packing specification
- * into each packet. This is also a candidate for future
- * optimization.
- *
* The data size is either the XDR data representation, or the
* actual message size (rounded up) if this is a symmetric
* architecture connection.
*
**************************************/
- const USHORT MAX_PACKETS_PER_BATCH = 4; // packets - picked by SWAG
- const USHORT MIN_PACKETS_PER_BATCH = 2; // packets - picked by SWAG
- const USHORT DESIRED_ROWS_PER_BATCH = 20; // data rows - picked by SWAG
- const USHORT MIN_ROWS_PER_BATCH = 10; // data rows - picked by SWAG
-
const USHORT op_overhead = (USHORT) xdr_protocol_overhead(op_code);
#ifdef DEBUG
@@ -241,52 +219,22 @@
format->fmt_length, op_overhead);
#endif
- ULONG row_size;
- if (port->port_flags & PORT_symmetric)
- {
- // Same architecture connection
- row_size = (ROUNDUP(format->fmt_length, 4) + op_overhead);
- }
- else
- {
- // Using XDR for data transfer
- row_size = (ROUNDUP(format->fmt_net_length, 4) + op_overhead);
- }
+ const ULONG row_size = op_overhead +
+ (port->port_flags & PORT_symmetric) ?
+ ROUNDUP(format->fmt_length, 4) : // Same architecture connection
+ ROUNDUP(format->fmt_net_length, 4); // Using XDR for data transfer
- USHORT num_packets = (USHORT) (((DESIRED_ROWS_PER_BATCH * row_size) // data set
- + buffer_used // used in 1st pkt
- + (port->port_buff_size - 1)) // to round up
- / port->port_buff_size);
- if (num_packets > MAX_PACKETS_PER_BATCH)
- {
- num_packets = (USHORT) (((MIN_ROWS_PER_BATCH * row_size) // data set
- + buffer_used // used in 1st pkt
- + (port->port_buff_size - 1)) // to round up
- / port->port_buff_size);
- }
- num_packets = MAX(num_packets, MIN_PACKETS_PER_BATCH);
+ ULONG result = (port->port_protocol >= PROTOCOL_VERSION13) ?
+ MAX_ROWS_PER_BATCH : (MAX_PACKETS_PER_BATCH * port->port_buff_size - buffer_used) / row_size;
- // Now that we've picked the number of packets in a batch,
- // pack as many rows as we can into the set of packets
+ // Don't ask for more records than we can cache
- ULONG result = (num_packets * port->port_buff_size - buffer_used) / row_size;
+ result = MIN(result, MAX_BATCH_CACHE_SIZE / format->fmt_length);
- // Must always send some messages, even if message size is more
- // than packet size.
+ // Must always send some messages, even if message is larger than packet
result = MAX(result, MIN_ROWS_PER_BATCH);
-#ifdef DEBUG
- {
- // CVC: I don't see the point in replacing this with fb_utils::readenv().
- const char* p = getenv("DEBUG_BATCH_SIZE");
- if (p)
- result = atoi(p);
- fprintf(stderr, "row_size = %lu num_packets = %d\n", row_size, num_packets);
- fprintf(stderr, "result = %lu\n", result);
- }
-#endif
-
fb_assert(result <= MAX_USHORT);
return static_cast<USHORT>(result);
}
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/remote.h 2014-10-11 09:02:09 UTC (rev 60100)
@@ -80,7 +80,15 @@
#include "fb_blk.h"
#include "firebird/Interface.h"
+// Prefetch constants
+const ULONG MAX_PACKETS_PER_BATCH = 8;
+
+const ULONG MIN_ROWS_PER_BATCH = 10;
+const ULONG MAX_ROWS_PER_BATCH = 1000;
+
+const ULONG MAX_BATCH_CACHE_SIZE = 1024 * 1024; // 1 MB
+
// fwd. decl.
namespace Firebird {
class Exception;
@@ -910,6 +918,11 @@
UCharArrayAutoPtr port_buffer;
+ FB_UINT64 port_snd_packets;
+ FB_UINT64 port_rcv_packets;
+ FB_UINT64 port_snd_bytes;
+ FB_UINT64 port_rcv_bytes;
+
public:
rem_port(rem_port_t t, size_t rpt) :
port_sync(FB_NEW(getPool()) Firebird::RefMutex()),
@@ -941,7 +954,8 @@
port_required_encryption(true), // safe default
port_known_server_keys(getPool()), port_crypt_plugin(NULL),
port_client_crypt_callback(NULL), port_server_crypt_callback(NULL),
- port_buffer(FB_NEW(getPool()) UCHAR[rpt])
+ port_buffer(FB_NEW(getPool()) UCHAR[rpt]),
+ port_snd_packets(0), port_rcv_packets(0), port_snd_bytes(0), port_rcv_bytes(0)
{
addRef();
memset(&port_linger, 0, sizeof port_linger);
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2014-10-11 01:20:07 UTC (rev 60099)
+++ firebird/trunk/src/remote/server/server.cpp 2014-10-11 09:02:09 UTC (rev 60100)
@@ -3282,11 +3282,6 @@
Rsr* statement;
getHandle(statement, sqldata->p_sqldata_statement);
- const ULONG msg_length = statement->rsr_format ? statement->rsr_format->fmt_length : 0;
-
- USHORT count = statement->rsr_flags.test(Rsr::NO_BATCH) ? 1 : sqldata->p_sqldata_messages;
- USHORT count2 = statement->rsr_flags.test(Rsr::NO_BATCH) ? 0 : count;
-
// On first fetch, clear the end-of-stream flag & reset the message buffers
if (!statement->rsr_flags.test(Rsr::FETCHED))
@@ -3311,6 +3306,7 @@
}
}
+ const ULONG msg_length = statement->rsr_format ? statement->rsr_format->fmt_length : 0;
// If required, call setDelayedOutputFormat()
@@ -3329,9 +3325,10 @@
statement->rsr_delayed_format = false;
}
-
// Get ready to ship the data out
+ const USHORT max_records = statement->rsr_flags.test(Rsr::NO_BATCH) ? 1 : sqldata->p_sqldata_messages;
+
P_SQLDATA* response = &sendL->p_sqldata;
sendL->p_operation = op_fetch_response;
response->p_sqldata_statement = sqldata->p_sqldata_statement;
@@ -3341,17 +3338,18 @@
// Check to see if any messages are already sitting around
+ const FB_UINT64 org_packets = this->port_snd_packets;
+
+ USHORT count = 0;
bool rc = true;
- while (true)
+ for (; count < max_records; count++)
{
-
// Have we exhausted the cache & reached cursor EOF?
if (statement->rsr_flags.test(Rsr::EOF_SET) && !statement->rsr_msgs_waiting)
{
statement->rsr_flags.clear(Rsr::EOF_SET);
rc = false;
- count2 = 0;
break;
}
@@ -3378,15 +3376,12 @@
rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer) == IStatus::FB_OK;
statement->rsr_flags.set(Rsr::FETCHED);
+
if (status_vector.getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
- {
return this->send_response(sendL, 0, 0, &status_vector, false);
- }
+
if (!rc)
- {
- count2 = 0;
break;
- }
message->msg_address = message->msg_buffer;
}
@@ -3397,8 +3392,6 @@
statement->rsr_msgs_waiting--;
}
- count--;
-
// There's a buffer waiting -- send it
if (!this->send_partial(sendL))
@@ -3406,9 +3399,11 @@
message->msg_address = NULL;
- // If we've sent the requested amount, break out of loop
+ // If we've hit maximum prefetch size, break out of loop
- if (count <= 0)
+ const USHORT packets = this->port_snd_packets - org_packets;
+
+ if (packets >= MAX_PACKETS_PER_BATCH && count >= MIN_ROWS_PER_BATCH)
break;
}
@@ -3438,7 +3433,9 @@
while (message->msg_address && message->msg_next != statement->rsr_buffer)
message = message->msg_next;
- for (; count2; --count2)
+ USHORT prefetch_count = (rc && !statement->rsr_flags.test(Rsr::NO_BATCH)) ? count : 0;
+
+ for (; prefetch_count; --prefetch_count)
{
if (message->msg_address)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2014-10-28 13:41:50
|
Revision: 60140
http://sourceforge.net/p/firebird/code/60140
Author: alexpeshkoff
Date: 2014-10-28 13:41:40 +0000 (Tue, 28 Oct 2014)
Log Message:
-----------
Fixed a bug in unofficial release of beta1 reported by Martijn in devel - missing security context error when using separate SecurityDatabase
Modified Paths:
--------------
firebird/trunk/src/remote/remote.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/remote.h
===================================================================
--- firebird/trunk/src/remote/remote.h 2014-10-27 19:20:30 UTC (rev 60139)
+++ firebird/trunk/src/remote/remote.h 2014-10-28 13:41:40 UTC (rev 60140)
@@ -885,7 +885,6 @@
rem_str* port_host; // Our name
rem_str* port_connection; // Name of connection
Firebird::string port_login;
- Firebird::PathName port_security_db;
Firebird::string port_user_name;
Firebird::string port_peer_name;
Firebird::string port_protocol_id; // String containing protocol name for this port
@@ -943,7 +942,7 @@
port_packet_vector(0),
#endif
port_objects(getPool()), port_version(0), port_host(0),
- port_connection(0), port_login(getPool()), port_security_db(getPool()),
+ port_connection(0), port_login(getPool()),
port_user_name(getPool()), port_peer_name(getPool()),
port_protocol_id(getPool()), port_address(getPool()),
port_rpr(0), port_statement(0), port_receive_rmtque(0),
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2014-10-27 19:20:30 UTC (rev 60139)
+++ firebird/trunk/src/remote/server/server.cpp 2014-10-28 13:41:40 UTC (rev 60140)
@@ -1720,10 +1720,7 @@
{
// Setup correct configuration for port
PathName dbName(connect->p_cnct_file.cstr_address, connect->p_cnct_file.cstr_length);
- RefPtr<Config> dbConfig = REMOTE_get_config(&dbName);
- port->port_security_db = dbConfig->getSecurityDatabase();
- port->port_config = REMOTE_get_config(port->port_security_db.hasData() ?
- &port->port_security_db : NULL);
+ port->port_config = REMOTE_get_config(&dbName);
// Clear accept data
send->p_acpd.p_acpt_plugin.cstr_length = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hv...@us...> - 2014-11-14 14:54:13
|
Revision: 60239
http://sourceforge.net/p/firebird/code/60239
Author: hvlad
Date: 2014-11-14 14:54:09 +0000 (Fri, 14 Nov 2014)
Log Message:
-----------
Fixed compilation errors on Windows after IPv6 patches
Modified Paths:
--------------
firebird/trunk/src/remote/SockAddr.h
firebird/trunk/src/remote/inet.cpp
Modified: firebird/trunk/src/remote/SockAddr.h
===================================================================
--- firebird/trunk/src/remote/SockAddr.h 2014-11-14 13:05:53 UTC (rev 60238)
+++ firebird/trunk/src/remote/SockAddr.h 2014-11-14 14:54:09 UTC (rev 60239)
@@ -33,6 +33,17 @@
#include <netinet/in.h>
#endif
+#ifdef WIN_NT
+#include <winsock2.h>
+#include <Ws2tcpip.h>
+#include <Wspiapi.h>
+
+#ifndef IN_LOOPBACKNET
+#define IN_LOOPBACKNET 127
+#endif
+
+#endif
+
#include "../remote/remote.h"
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2014-11-14 13:05:53 UTC (rev 60238)
+++ firebird/trunk/src/remote/inet.cpp 2014-11-14 14:54:09 UTC (rev 60239)
@@ -775,7 +775,11 @@
memset(&gai_hints, 0, sizeof(gai_hints));
gai_hints.ai_family = (packet ? AF_UNSPEC : AF_INET6);
gai_hints.ai_socktype = SOCK_STREAM;
+#ifndef WIN_NT
gai_hints.ai_protocol = SOL_TCP;
+#else
+ gai_hints.ai_protocol = IPPROTO_TCP;
+#endif
gai_hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | (packet ? 0 : AI_PASSIVE);
const char* host_str = (host.hasData() ? host.c_str() : NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ale...@us...> - 2014-11-26 10:20:53
|
Revision: 60296
http://sourceforge.net/p/firebird/code/60296
Author: alexpeshkoff
Date: 2014-11-26 10:20:45 +0000 (Wed, 26 Nov 2014)
Log Message:
-----------
Remove unneeded any more assert, causing problems for a build w/o compression
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2014-11-26 10:01:51 UTC (rev 60295)
+++ firebird/trunk/src/remote/client/interface.cpp 2014-11-26 10:20:45 UTC (rev 60296)
@@ -5952,7 +5952,6 @@
P_OP operation = op_void;
{ // scope
RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
- fb_assert(!port->port_compressed);
stuff = port->receive(&packet);
operation = packet.p_operation;
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2014-11-26 10:01:51 UTC (rev 60295)
+++ firebird/trunk/src/remote/server/server.cpp 2014-11-26 10:20:45 UTC (rev 60296)
@@ -721,7 +721,6 @@
}
RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
- fb_assert(!port->port_compressed);
PACKET packet;
packet.p_operation = op_event;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|