def connect( self ):
   errorMsg = ""
   for res in socket.getaddrinfo( self.host, self.port, 0,
                                 socket.SOCK_STREAM ):
     af, socktype, proto, canonname, addTuple = res
     result = gSSLSocketFactory.createClientSocket( addTuple, useCertificates = gConfig._useServerCertificate() )
     if not result[ 'OK' ]:
       errorMsg = result[ 'Message' ]
       continue
     self.sock = result[ 'Value' ]
     break
   if not self.sock:
     raise socket.error, errorMsg
 def connect(self):
   errorMsg = ""
   for res in socket.getaddrinfo(self.host, self.port, 0,
                                 socket.SOCK_STREAM):
     af, socktype, proto, canonname, addTuple = res
     result = gSSLSocketFactory.createClientSocket( addTuple, useCertificates = gConfig._useServerCertificate() )
     if not result[ 'OK' ]:
       errorMsg = result[ 'Message' ]
       continue
     self.sock = result[ 'Value' ]
     break
   if not self.sock:
     raise socket.error, errorMsg
Beispiel #3
0
 def __discoverCredentialsToUse( self ):
   #Use certificates?
   if self.KW_USE_CERTIFICATES in self.kwargs:
     self.useCertificates = self.kwargs[ self.KW_USE_CERTIFICATES ]
   else:
     self.useCertificates = gConfig._useServerCertificate()
     self.kwargs[ self.KW_USE_CERTIFICATES ] = self.useCertificates
   if self.KW_SKIP_CA_CHECK not in self.kwargs:
     if self.useCertificates:
       self.kwargs[ self.KW_SKIP_CA_CHECK ] = False
     else:
       self.kwargs[ self.KW_SKIP_CA_CHECK ] = CS.skipCACheck()
   if self.KW_PROXY_CHAIN in self.kwargs:
     try:
       self.kwargs[ self.KW_PROXY_STRING ] = self.kwargs[ self.KW_PROXY_CHAIN ].dumpAllToString()[ 'Value' ]
       del( self.kwargs[ self.KW_PROXY_CHAIN ] )
     except:
       return S_ERROR( "Invalid proxy chain specified on instantiation" )
   return S_OK()