~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Accept_Strategy.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "SSLIOP_Accept_Strategy.h"
2
 
 
3
 
 
4
 
ACE_RCSID (SSLIOP,
5
 
           SSLIOP_Accept_Strategy,
6
 
           "SSLIOP_Accept_Strategy.cpp,v 1.1 2002/11/13 22:16:26 ossama Exp")
7
 
 
8
 
 
9
 
TAO_SSLIOP_Accept_Strategy::TAO_SSLIOP_Accept_Strategy (
10
 
  TAO_ORB_Core * orb_core,
11
 
  const ACE_Time_Value & timeout)
12
 
  : TAO_Accept_Strategy<TAO_SSLIOP_Connection_Handler,
13
 
                        ACE_SSL_SOCK_ACCEPTOR> (orb_core),
14
 
    timeout_ (timeout)
15
 
{
16
 
}
17
 
 
18
 
int
19
 
TAO_SSLIOP_Accept_Strategy::accept_svc_handler (handler_type * svc_handler)
20
 
{
21
 
  ACE_TRACE ("TAO_SSLIOP_Accept_Strategy::accept_svc_handler");
22
 
 
23
 
  // The following code is basically the same code found in
24
 
  // ACE_Accept_Strategy::accept_svc_handler().  The only difference
25
 
  // is that a timeout value is passed to the peer acceptor's accept()
26
 
  // method.  A timeout is necessary to prevent malicious or
27
 
  // misbehaved clients from only completing the TCP handshake and not
28
 
  // the SSL handshake.  Without the timeout, a denial-of-service
29
 
  // vulnerability would exist where multiple incomplete SSL passive
30
 
  // connections (i.e. where only the TCP handshake is completed)
31
 
  // could result in the server process running out of file
32
 
  // descriptors.  That would be due to the SSL handshaking process
33
 
  // blocking/waiting for the handshake to complete.
34
 
 
35
 
  // The timeout value will be modified.  Make a copy.
36
 
  ACE_Time_Value timeout (this->timeout_);
37
 
 
38
 
  // Try to find out if the implementation of the reactor that we are
39
 
  // using requires us to reset the event association for the newly
40
 
  // created handle. This is because the newly created handle will
41
 
  // inherit the properties of the listen handle, including its event
42
 
  // associations.
43
 
  int reset_new_handle = this->reactor_->uses_event_associations ();
44
 
 
45
 
  if (this->peer_acceptor_.accept (svc_handler->peer (), // stream
46
 
                                   0,                // remote address
47
 
                                   &timeout,         // timeout
48
 
                                   1,                // restart
49
 
                                   reset_new_handle  // reset new handler
50
 
                                   ) == -1)
51
 
    {
52
 
      // Close down handler to avoid memory leaks.
53
 
      svc_handler->close (0);
54
 
 
55
 
      return -1;
56
 
    }
57
 
  else
58
 
    return 0;
59
 
}
60
 
 
61
 
 
62
 
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
63
 
 
64
 
template class ACE_Accept_Strategy<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>;
65
 
template class TAO_Accept_Strategy<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>;
66
 
 
67
 
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
68
 
 
69
 
# pragma instantiate ACE_Accept_Strategy<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>
70
 
# pragma instantiate TAO_Accept_Strategy<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>
71
 
 
72
 
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */