summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Ahern <william@ubuntu.(none)>2012-10-01 08:55:38 -0700
committerWilliam Ahern <william@ubuntu.(none)>2012-10-01 08:55:38 -0700
commit251101cbed9096deff25dd5bf043b5f3c2fdebd9 (patch)
treea81caa44a0dcec605bf7cc7fb518f306e0ce4306
parent24e8ba9d5b608f3a6a66021ef08b2cf7088e8212 (diff)
downloadluaossl-251101cbed9096deff25dd5bf043b5f3c2fdebd9.tar.gz
luaossl-251101cbed9096deff25dd5bf043b5f3c2fdebd9.tar.bz2
luaossl-251101cbed9096deff25dd5bf043b5f3c2fdebd9.zip
-n
fix GENERAL_NAMES bug and fix build on Linux
-rw-r--r--openssl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/openssl.c b/openssl.c
index fb4f719..afae12b 100644
--- a/openssl.c
+++ b/openssl.c
@@ -1304,7 +1304,7 @@ int luaopen__openssl_x509_name(lua_State *L) {
1304static GENERAL_NAMES *gn_dup(lua_State *L, GENERAL_NAMES *gens) { 1304static GENERAL_NAMES *gn_dup(lua_State *L, GENERAL_NAMES *gens) {
1305 GENERAL_NAMES **ud = prepsimple(L, X509_GENS_CLASS); 1305 GENERAL_NAMES **ud = prepsimple(L, X509_GENS_CLASS);
1306 1306
1307 if (!(*ud = sk_GENERAL_NAMES_dup(gens))) 1307 if (!(*ud = sk_GENERAL_NAME_dup(gens)))
1308 throwssl(L, "x509.altname.dup"); 1308 throwssl(L, "x509.altname.dup");
1309 1309
1310 return *ud; 1310 return *ud;
@@ -2931,16 +2931,19 @@ static int sx_new(lua_State *L) {
2931 "SSLv2", "SSLv3", "SSLv23", "SSL", "TLSv1", "TLS", NULL 2931 "SSLv2", "SSLv3", "SSLv23", "SSL", "TLSv1", "TLS", NULL
2932 }; 2932 };
2933 SSL_CTX **ud = prepsimple(L, SSL_CTX_CLASS); 2933 SSL_CTX **ud = prepsimple(L, SSL_CTX_CLASS);
2934 SSL_METHOD *(*method)() = &TLSv1_client_method; 2934 /* later versions of SSL declare a const qualifier on the return type */
2935 __typeof__(&TLSv1_client_method) method = &TLSv1_client_method;
2935 _Bool srv; 2936 _Bool srv;
2936 2937
2937 lua_settop(L, 2); 2938 lua_settop(L, 2);
2938 srv = lua_toboolean(L, 2); 2939 srv = lua_toboolean(L, 2);
2939 2940
2940 switch (checkoption(L, 1, "TLS", opts)) { 2941 switch (checkoption(L, 1, "TLS", opts)) {
2942#ifndef OPENSSL_NO_SSL2
2941 case 0: /* SSLv2 */ 2943 case 0: /* SSLv2 */
2942 method = (srv)? &SSLv2_server_method : &SSLv2_client_method; 2944 method = (srv)? &SSLv2_server_method : &SSLv2_client_method;
2943 break; 2945 break;
2946#endif
2944 case 1: /* SSLv3 */ 2947 case 1: /* SSLv3 */
2945 method = (srv)? &SSLv3_server_method : &SSLv3_client_method; 2948 method = (srv)? &SSLv3_server_method : &SSLv3_client_method;
2946 break; 2949 break;