diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/impure/ssl.nim | 8 | ||||
-rw-r--r-- | lib/pure/smtp.nim | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/impure/ssl.nim b/lib/impure/ssl.nim index 5a39f6f31..c1b8276f5 100644 --- a/lib/impure/ssl.nim +++ b/lib/impure/ssl.nim @@ -17,12 +17,10 @@ type ssl: PSSL bio: PBIO - - proc connect*(sock: var TSecureSocket, address: string, - port: int, certResult: var Int) = + port: int): Int = ## Connects to the specified `address` on the specified `port`. - ## `certResult` will become the result of the certificate validation. + ## Returns the result of the certificate validation. SslLoadErrorStrings() ERR_load_BIO_strings() @@ -50,7 +48,7 @@ proc connect*(sock: var TSecureSocket, address: string, ERR_print_errors_fp(stderr) OSError() - certResult = SSL_get_verify_result(sock.ssl) + result = SSL_get_verify_result(sock.ssl) proc recvLine*(sock: TSecureSocket, line: var String): bool = ## Acts in a similar fashion to the `recvLine` in the sockets module. diff --git a/lib/pure/smtp.nim b/lib/pure/smtp.nim index 00e636ebc..dcec012eb 100644 --- a/lib/pure/smtp.nim +++ b/lib/pure/smtp.nim @@ -24,7 +24,7 @@ ## smtp.sendmail("username@gmail.com", @["foo@gmail.com"], $msg) ## -import sockets, strutils, strtabs, ssl, base64 +import sockets, strutils, strtabs, ssl, base64, os type TSMTP* = object {.final.} @@ -62,7 +62,7 @@ proc debugRecv(smtp: TSMTP): String = echo("S:" & line) return line else: - echo("S-Warning: recvLine failed.") + OSError() return "" proc quitExcpt(smtp: TSMTP, msg: String) = @@ -84,8 +84,7 @@ proc connect*(address: String, port: int = 25, result.sock.connect(address, TPort(port)) else: result.ssl = True - var certResult: int - result.sslSock.connect(address, port, certResult) + discard result.sslSock.connect(address, port) result.debug = debug |