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:
RevisionChanges 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.c10 Apr 2016 22:15:32 - 1.1.2.12
+++ rpm/rpmio/mongoc.c8 May 2016 18:47:26 - 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
+
/*=