From 46413d27be023d21d2dfe94c411bce4b26721dfb Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 10 Aug 2009 09:31:18 +0000 Subject: [PATCH] 2009-08-10 11:30 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbtip/sendmail.prg * contrib/hbtip/client.prg ! HAS_OPENSSL -> HB_HAS_OPENSSL. --- harbour/ChangeLog | 5 +++++ harbour/contrib/hbtip/client.prg | 32 +++++++++++++++--------------- harbour/contrib/hbtip/sendmail.prg | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 270fbf8279..495dea4bf7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-10 11:30 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbtip/sendmail.prg + * contrib/hbtip/client.prg + ! HAS_OPENSSL -> HB_HAS_OPENSSL. + 2009-08-10 11:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) - bin/hbmk.bat - Deleted. Probably no one uses it. diff --git a/harbour/contrib/hbtip/client.prg b/harbour/contrib/hbtip/client.prg index 0bff3e705d..6bc289e6a6 100644 --- a/harbour/contrib/hbtip/client.prg +++ b/harbour/contrib/hbtip/client.prg @@ -78,7 +78,7 @@ #include "simpleio.ch" #endif -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) #include "hbssl.ch" #endif @@ -121,7 +121,7 @@ CREATE CLASS tIPClient VAR exGauge /* Gauge control; it can be a codeblock or a function pointer. */ VAR lTLS INIT .F. -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) VAR ssl_ctx VAR ssl VAR nSSLError INIT 0 @@ -185,7 +185,7 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClient LOCAL oErr LOCAL aProtoAccepted := { "ftp", "http", "pop", "smtp" } -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) LOCAL aProtoAcceptedSSL := { "ftps", "https", "pop3s", "pop3", "smtps" } #else LOCAL aProtoAcceptedSSL := {} @@ -214,14 +214,14 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClient IF ! ::bInitSocks hb_inetInit() -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) SSL_init() RAND_seed( Time() + hb_username() + DToS( Date() ) + hb_DirBase() + NetName() ) #endif ::bInitSocks := .T. ENDIF -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) IF oURL:cProto == "ftps" .OR. ; oURL:cProto == "https" .OR. ; oURL:cProto == "pop3s" .OR. oURL:cProto == "pops" .OR. ; @@ -276,7 +276,7 @@ METHOD EnableTLS( lEnable ) CLASS tIPClient RETURN .T. ENDIF -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) IF lEnable ::ssl_ctx := SSL_CTX_new() ::ssl := SSL_new( ::ssl_ctx ) @@ -360,7 +360,7 @@ METHOD Close() CLASS tIPClient nRet := hb_inetClose( ::SocketCon ) -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) IF ::lTLS SSL_shutdown( ::ssl ) ::ssl := NIL @@ -415,7 +415,7 @@ METHOD Read( nLen ) CLASS tIPClient cStr0 := Space( nLen ) IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) /* Getting around implementing the hack used in non-SSL branch for now. IMO the proper fix would have been done to hb_inetRecvAll(). [vszakats] */ ::nLastRead := ::InetRecvAll( ::SocketCon, @cStr0, nLen ) @@ -579,7 +579,7 @@ METHOD InetSendAll( SocketCon, cData, nLen ) CLASS tIPClient ENDIF IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) #if defined( _SSL_DEBUG_TEMP ) ? "SSL_WRITE()", cData #endif @@ -611,7 +611,7 @@ METHOD InetRecv( SocketCon, cStr1, len ) CLASS tIPClient LOCAL nRet IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) #if defined( _SSL_DEBUG_TEMP ) ? "SSL_READ()" #endif @@ -634,7 +634,7 @@ METHOD InetRecvLine( SocketCon, nRet, size ) CLASS tIPClient LOCAL cRet IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) nRet := hb_SSL_read_line( ::ssl, @cRet, size, ::nConnTimeout ) #if defined( _SSL_DEBUG_TEMP ) ? "HB_SSL_READ_LINE()", cRet @@ -661,7 +661,7 @@ METHOD InetRecvAll( SocketCon, cRet, size ) CLASS tIPClient LOCAL nRet IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) nRet := hb_SSL_read_all( ::ssl, @cRet, size, ::nConnTimeout ) #if defined( _SSL_DEBUG_TEMP ) ? "HB_SSL_READ_ALL()", cRet @@ -688,7 +688,7 @@ METHOD InetErrorCode( SocketCon ) CLASS tIPClient LOCAL nRet IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) nRet := iif( ::nSSLError == 0, 0, SSL_get_error( ::ssl, ::nSSLError ) ) #else nRet := 0 @@ -712,7 +712,7 @@ METHOD InetErrorDesc( SocketCon ) CLASS tIPClient IF ! Empty( SocketCon ) IF ::lTLS -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) IF ::nSSLError != 0 cMsg := ERR_error_string( SSL_get_error( ::ssl, ::nSSLError ) ) ENDIF @@ -737,7 +737,7 @@ METHOD InetConnect( cServer, nPort, SocketCon ) CLASS tIPClient ::InetRcvBufSize( SocketCon, ::nDefaultRcvBuffSize ) ENDIF -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) IF ::lTLS SSL_set_mode( ::ssl, HB_SSL_MODE_AUTO_RETRY ) SSL_set_fd( ::ssl, hb_inetFD( SocketCon ) ) @@ -823,7 +823,7 @@ METHOD SetProxy( cProxyHost, nProxyPort, cProxyUser, cProxyPassword ) CLASS tIPC RETURN Self FUNCTION tip_SSL() -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) RETURN .T. #else RETURN .F. diff --git a/harbour/contrib/hbtip/sendmail.prg b/harbour/contrib/hbtip/sendmail.prg index a474ea709d..2c36e2f08b 100644 --- a/harbour/contrib/hbtip/sendmail.prg +++ b/harbour/contrib/hbtip/sendmail.prg @@ -280,7 +280,7 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF lAuthLogin := .T. ELSEIF "PLAIN" $ oInMail:cReply lAuthPlain := .T. -#if defined( HAS_OPENSSL ) +#if defined( HB_HAS_OPENSSL ) ELSEIF "STARTTLS" $ oInMail:cReply lAuthTLS := .T. #endif