Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f574039

Browse files
tkelmancarlosmn
authored andcommitted
Fix undefined reference with old versions of openssl
Versions prior to 0.9.8f did not have this function, rhel/centos5 are still on a heavily backported version of 0.9.8e and theoretically supported until March 2017 Without this ifdef, I get the following link failure: ``` CMakeFiles/libgit2_clar.dir/src/openssl_stream.c.o: In function `openssl_connect': openssl_stream.c:(.text+0x45a): undefined reference to `SSL_set_tlsext_host_name' collect2: error: ld returned 1 exit status make[6]: *** [libgit2_clar] Error 1 ```
1 parent 159061a commit f574039

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/openssl_stream.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ int openssl_connect(git_stream *stream)
324324

325325
SSL_set_bio(st->ssl, bio, bio);
326326
/* specify the host in case SNI is needed */
327+
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
327328
SSL_set_tlsext_host_name(st->ssl, st->host);
329+
#endif
328330

329331
if ((ret = SSL_connect(st->ssl)) <= 0)
330332
return ssl_set_error(st->ssl, ret);

0 commit comments

Comments
 (0)