From 5e37ef0b36d5c60514b2c2164ce41ea452e3ee75 Mon Sep 17 00:00:00 2001 From: hyc Date: Thu, 29 Apr 2010 23:47:30 +0000 Subject: [PATCH] Add -DNO_SSL option for omitting SSL support (just use rtmpe, no rtmps) git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@456 400ebc74-4327-4243-bc38-086b20814532 --- Makefile | 3 +-- librtmp/Makefile | 2 +- librtmp/hashswf.c | 6 ++++++ librtmp/rtmp.c | 14 +++++++------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ad490b8..6216f86 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,7 @@ CRYPTO_LIB=$(LIB_$(CRYPTO)) DEF_=-DNO_CRYPTO CRYPTO_DEF=$(DEF_$(CRYPTO)) - -DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) +DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) $(XDEF) OPT=-O2 CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT) LDFLAGS=-Wall $(XLDFLAGS) diff --git a/librtmp/Makefile b/librtmp/Makefile index bcf8a3e..08e43aa 100644 --- a/librtmp/Makefile +++ b/librtmp/Makefile @@ -17,7 +17,7 @@ REQ_OPENSSL=libssl,libcrypto CRYPTO_REQ=$(REQ_$(CRYPTO)) CRYPTO_DEF=$(DEF_$(CRYPTO)) -DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) +DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) $(XDEF) OPT=-O2 CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT) diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c index 23921b2..f72b687 100644 --- a/librtmp/hashswf.c +++ b/librtmp/hashswf.c @@ -155,6 +155,11 @@ HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb) #ifdef CRYPTO if (ssl) { +#ifdef NO_SSL + RTMP_Log(RTMP_LOGERROR, "%s, No SSL/TLS support", __FUNCTION__); + ret = HTTPRES_BAD_REQUEST; + goto leave; +#else TLS_client(RTMP_TLS_ctx, sb.sb_ssl); TLS_setfd(sb.sb_ssl, sb.sb_socket); if ((i = TLS_connect(sb.sb_ssl)) < 0) @@ -163,6 +168,7 @@ HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb) ret = HTTPRES_LOST_CONNECTION; goto leave; } +#endif } #endif RTMPSockBuf_Send(&sb, sb.sb_buf, i); diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index 958aabf..28098c1 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -201,14 +201,14 @@ RTMP_TLS_Init() #ifdef USE_POLARSSL RTMP_TLS_ctx = calloc(1,sizeof(struct tls_ctx)); havege_init(&RTMP_TLS_ctx->hs); -#elif defined(USE_GNUTLS) +#elif defined(USE_GNUTLS) && !defined(NO_SSL) gnutls_global_init(); RTMP_TLS_ctx = malloc(sizeof(struct tls_ctx)); gnutls_certificate_allocate_credentials(&RTMP_TLS_ctx->cred); gnutls_priority_init(&RTMP_TLS_ctx->prios, "NORMAL", NULL); gnutls_certificate_set_x509_trust_file(RTMP_TLS_ctx->cred, "ca.pem", GNUTLS_X509_FMT_PEM); -#else /* USE_OPENSSL */ +#elif !defined(NO_SSL) /* USE_OPENSSL */ SSL_load_error_strings(); SSL_library_init(); OpenSSL_add_all_digests(); @@ -811,7 +811,7 @@ RTMP_Connect1(RTMP *r, RTMPPacket *cp) { if (r->Link.protocol & RTMP_FEATURE_SSL) { -#ifdef CRYPTO +#if defined(CRYPTO) && !defined(NO_SSL) TLS_client(RTMP_TLS_ctx, r->m_sb.sb_ssl); TLS_setfd(r->m_sb.sb_ssl, r->m_sb.sb_socket); if (TLS_connect(r->m_sb.sb_ssl) < 0) @@ -821,7 +821,7 @@ RTMP_Connect1(RTMP *r, RTMPPacket *cp) return false; } #else - RTMP_Log(RTMP_LOGERROR, "%s, no CRYPTO support", __FUNCTION__); + RTMP_Log(RTMP_LOGERROR, "%s, no SSL/TLS support", __FUNCTION__); RTMP_Close(r); return false; @@ -3303,7 +3303,7 @@ RTMPSockBuf_Fill(RTMPSockBuf *sb) while (1) { nBytes = sizeof(sb->sb_buf) - sb->sb_size - (sb->sb_start - sb->sb_buf); -#ifdef CRYPTO +#if defined(CRYPTO) && !defined(NO_SSL) if (sb->sb_ssl) { nBytes = TLS_read(sb->sb_ssl, sb->sb_start + sb->sb_size, nBytes); @@ -3346,7 +3346,7 @@ RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len) fwrite(buf, 1, len, netstackdump); #endif -#ifdef CRYPTO +#if defined(CRYPTO) && !defined(NO_SSL) if (sb->sb_ssl) { rc = TLS_write(sb->sb_ssl, buf, len); @@ -3362,7 +3362,7 @@ RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len) int RTMPSockBuf_Close(RTMPSockBuf *sb) { -#ifdef CRYPTO +#if defined(CRYPTO) && !defined(NO_SSL) if (sb->sb_ssl) { TLS_shutdown(sb->sb_ssl); -- 2.40.0