RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 08-May-2016 20:47:27 Branch: rpm-5_4 Handle: 2016050818472601 Modified files: (Branch: rpm-5_4) rpm/rpmio mongoc.c mongoc.h Log: - mongo: permit enabling both openssl and common crypto on OS X. Summary: Revision Changes Path 1.1.2.13 +145 -145 rpm/rpmio/mongoc.c 1.1.2.10 +2 -2 rpm/rpmio/mongoc.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/mongoc.c ============================================================================ $ cvs diff -u -r1.1.2.12 -r1.1.2.13 mongoc.c --- rpm/rpmio/mongoc.c 10 Apr 2016 22:15:32 -0000 1.1.2.12 +++ rpm/rpmio/mongoc.c 8 May 2016 18:47:26 -0000 1.1.2.13 @@ -454,6 +454,150 @@ } +/*==============================================================*/ +/* --- mongoc-stream-tls.c */ + +#ifdef MONGOC_ENABLE_SSL + +#undef MONGOC_LOG_DOMAIN +#define MONGOC_LOG_DOMAIN "stream-tls" + + +/** + * mongoc_stream_tls_do_handshake: + * + * force an ssl handshake + * + * This will happen on the first read or write otherwise + */ +bool +mongoc_stream_tls_do_handshake (mongoc_stream_t *stream, + int32_t timeout_msec) +{ + mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); + + BSON_ASSERT (stream_tls); + BSON_ASSERT (stream_tls->do_handshake); + + return stream_tls->do_handshake(stream, timeout_msec); +} + + +/** + * mongoc_stream_tls_should_retry: + * + * If the stream should be retried + */ +bool +mongoc_stream_tls_should_retry (mongoc_stream_t *stream) +{ + mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); + + BSON_ASSERT (stream_tls); + BSON_ASSERT (stream_tls->should_retry); + + return stream_tls->should_retry(stream); +} + + +/** + * mongoc_stream_tls_should_read: + * + * If the stream should read + */ +bool +mongoc_stream_tls_should_read (mongoc_stream_t *stream) +{ + mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); + + BSON_ASSERT (stream_tls); + BSON_ASSERT (stream_tls->should_read); + + return stream_tls->should_read(stream); +} + + +/** + * mongoc_stream_tls_should_write: + * + * If the stream should write + */ +bool +mongoc_stream_tls_should_write (mongoc_stream_t *stream) +{ + mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); + + BSON_ASSERT (stream_tls); + BSON_ASSERT (stream_tls->should_write); + + return stream_tls->should_write(stream); +} + + +/** + * mongoc_stream_tls_check_cert: + * + * check the cert returned by the other party + */ +bool +mongoc_stream_tls_check_cert (mongoc_stream_t *stream, + const char *host) +{ + mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); + + BSON_ASSERT (stream_tls); + BSON_ASSERT (stream_tls->check_cert); + + return stream_tls->check_cert(stream, host); +} + + +/* + *-------------------------------------------------------------------------- + * + * mongoc_stream_tls_new -- + * + * Creates a new mongoc_stream_tls_t to communicate with a remote + * server using a TLS stream. + * + * @base_stream should be a stream that will become owned by the + * resulting tls stream. It will be used for raw I/O. + * + * @trust_store_dir should be a path to the SSL cert db to use for + * verifying trust of the remote server. + * + * Returns: + * NULL on failure, otherwise a mongoc_stream_t. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +mongoc_stream_t * +mongoc_stream_tls_new (mongoc_stream_t *base_stream, + mongoc_ssl_opt_t *opt, + int client) +{ + BSON_ASSERT (base_stream); + + switch(MONGOC_TLS_TYPE) + { +#ifdef MONGOC_ENABLE_OPENSSL + case MONGOC_TLS_OPENSSL: + return mongoc_stream_tls_openssl_new (base_stream, opt, client); + break; +#endif + + default: + MONGOC_ERROR("Unknown crypto engine"); + return NULL; + } +} + +#endif + /*==============================================================*/ /* --- mongoc-rpc.c */ @@ -20034,150 +20178,6 @@ } /*==============================================================*/ -/* --- mongoc-stream-tls.c */ - -#ifdef MONGOC_ENABLE_SSL - -#undef MONGOC_LOG_DOMAIN -#define MONGOC_LOG_DOMAIN "stream-tls" - - -/** - * mongoc_stream_tls_do_handshake: - * - * force an ssl handshake - * - * This will happen on the first read or write otherwise - */ -bool -mongoc_stream_tls_do_handshake (mongoc_stream_t *stream, - int32_t timeout_msec) -{ - mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); - - BSON_ASSERT (stream_tls); - BSON_ASSERT (stream_tls->do_handshake); - - return stream_tls->do_handshake(stream, timeout_msec); -} - - -/** - * mongoc_stream_tls_should_retry: - * - * If the stream should be retried - */ -bool -mongoc_stream_tls_should_retry (mongoc_stream_t *stream) -{ - mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); - - BSON_ASSERT (stream_tls); - BSON_ASSERT (stream_tls->should_retry); - - return stream_tls->should_retry(stream); -} - - -/** - * mongoc_stream_tls_should_read: - * - * If the stream should read - */ -bool -mongoc_stream_tls_should_read (mongoc_stream_t *stream) -{ - mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); - - BSON_ASSERT (stream_tls); - BSON_ASSERT (stream_tls->should_read); - - return stream_tls->should_read(stream); -} - - -/** - * mongoc_stream_tls_should_write: - * - * If the stream should write - */ -bool -mongoc_stream_tls_should_write (mongoc_stream_t *stream) -{ - mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); - - BSON_ASSERT (stream_tls); - BSON_ASSERT (stream_tls->should_write); - - return stream_tls->should_write(stream); -} - - -/** - * mongoc_stream_tls_check_cert: - * - * check the cert returned by the other party - */ -bool -mongoc_stream_tls_check_cert (mongoc_stream_t *stream, - const char *host) -{ - mongoc_stream_tls_t *stream_tls = (mongoc_stream_tls_t *)mongoc_stream_get_tls_stream (stream); - - BSON_ASSERT (stream_tls); - BSON_ASSERT (stream_tls->check_cert); - - return stream_tls->check_cert(stream, host); -} - - -/* - *-------------------------------------------------------------------------- - * - * mongoc_stream_tls_new -- - * - * Creates a new mongoc_stream_tls_t to communicate with a remote - * server using a TLS stream. - * - * @base_stream should be a stream that will become owned by the - * resulting tls stream. It will be used for raw I/O. - * - * @trust_store_dir should be a path to the SSL cert db to use for - * verifying trust of the remote server. - * - * Returns: - * NULL on failure, otherwise a mongoc_stream_t. - * - * Side effects: - * None. - * - *-------------------------------------------------------------------------- - */ - -mongoc_stream_t * -mongoc_stream_tls_new (mongoc_stream_t *base_stream, - mongoc_ssl_opt_t *opt, - int client) -{ - BSON_ASSERT (base_stream); - - switch(MONGOC_TLS_TYPE) - { -#ifdef MONGOC_ENABLE_OPENSSL - case MONGOC_TLS_OPENSSL: - return mongoc_stream_tls_openssl_new (base_stream, opt, client); - break; -#endif - - default: - MONGOC_ERROR("Unknown crypto engine"); - return NULL; - } -} - -#endif - -/*==============================================================*/ /* --- mongoc-uri.c */ struct _mongoc_uri_t @@ -26612,7 +26612,7 @@ /*==============================================================*/ /* --- mongoc-rand-common-crypto.c */ -#ifdef MONGOC_ENABLE_COMMON_CRYPTO +#if defined(MONGOC_ENABLE_COMMON_CRYPTO) && !defined(MONGOC_ENABLE_OPENSSL) #include <Security/Security.h> /* rumour has it this wasn't in standard Security.h in ~10.8 */ @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/mongoc.h ============================================================================ $ cvs diff -u -r1.1.2.9 -r1.1.2.10 mongoc.h --- rpm/rpmio/mongoc.h 5 May 2016 22:22:03 -0000 1.1.2.9 +++ rpm/rpmio/mongoc.h 8 May 2016 18:47:27 -0000 1.1.2.10 @@ -507,7 +507,7 @@ * MONGOC_ENABLE_SECURE_TRANSPORT is set from configure to determine if we are * compiled with Native SSL support on Darwin */ -#if defined(__APPLE__) && 0 /* not implemented yet */ +#if defined(__APPLE__) #define MONGOC_ENABLE_SECURE_TRANSPORT 1 #else # undef MONGOC_ENABLE_SECURE_TRANSPORT @@ -518,7 +518,7 @@ * MONGOC_ENABLE_COMMON_CRYPTO is set from configure to determine if we are * compiled with Native Crypto support on Darwin */ -#if defined(__APPLE__) && 0 /* not implemented yet */ +#if defined(__APPLE__) #define MONGOC_ENABLE_COMMON_CRYPTO 1 #else # undef MONGOC_ENABLE_COMMON_CRYPTO @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org