From 507a5b4d334c1b4bea8fa232fa6b882849608e97 Mon Sep 17 00:00:00 2001 From: Ramon Fernandez Date: Fri, 23 Sep 2016 07:12:33 -0400 Subject: Import tools: cd0ae5ddb41f781376b51a3d2dfdb31e46768fa4 from branch v3.3 ref: af4004cbd1..cd0ae5ddb4 for: 3.3.14 TOOLS-1442 make spacemonkeygo/openssl compile on suse11 TOOLS-1449 Update setParameter logic in servers.js for mongo master changes TOOLS-1453 VerifySystemAuthVersion should only check for authSchema in system.version --- src/mongo/gotools/Godeps | 2 +- src/mongo/gotools/common/auth/auth_info.go | 4 +++- src/mongo/gotools/mongoreplay/raw_op.go | 8 +++++++ .../gotools/test/qa-tests/jstests/libs/servers.js | 25 ++++++++++++++++------ .../src/github.com/spacemonkeygo/openssl/ctx.go | 20 ----------------- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/mongo/gotools/Godeps b/src/mongo/gotools/Godeps index fc98ba62d4c..c5d6318b56c 100644 --- a/src/mongo/gotools/Godeps +++ b/src/mongo/gotools/Godeps @@ -6,7 +6,7 @@ github.com/smartystreets/assertions 287b4346dc4e71a038c346375a9d572453bc469b github.com/smartystreets/goconvey bf58a9a1291224109919756b4dcc469c670cc7e4 github.com/jessevdk/go-flags 97448c91aac742cbca3d020b3e769013a420a06f github.com/3rf/mongo-lint 3550fdcf1f43b89aaeabaa4559eaae6dc4407e42 -github.com/spacemonkeygo/openssl 6b1c8e0d11cbec09b111e263e28a5a089a06fba1 github.com/10gen/openssl +github.com/spacemonkeygo/openssl 5be686e264d836e7a01ca7fc7c53acdb8edbe768 github.com/10gen/openssl github.com/spacemonkeygo/spacelog ae95ccc1eb0c8ce2496c43177430efd61930f7e4 github.com/howeyc/gopass 44476384cd4721b68705e72f19e95d1a3a504370 github.com/nsf/termbox-go 0723e7c3d0a317dea811f0fbe4d6edd81908c971 diff --git a/src/mongo/gotools/common/auth/auth_info.go b/src/mongo/gotools/common/auth/auth_info.go index a420770ebf2..6ceb7f42cea 100644 --- a/src/mongo/gotools/common/auth/auth_info.go +++ b/src/mongo/gotools/common/auth/auth_info.go @@ -53,7 +53,9 @@ func VerifySystemAuthVersion(sessionProvider *db.SessionProvider) error { return fmt.Errorf("error getting session from server: %v", err) } defer session.Close() - versionEntries := session.DB("admin").C("system.version") + + authSchemaQuery := bson.M{"_id": "authSchema"} + versionEntries := session.DB("admin").C("system.version").Find(authSchemaQuery) if count, err := versionEntries.Count(); err != nil { return fmt.Errorf("error checking pressence of auth version: %v", err) } else if count == 0 { diff --git a/src/mongo/gotools/mongoreplay/raw_op.go b/src/mongo/gotools/mongoreplay/raw_op.go index e430bea339d..bbe6871aa9e 100644 --- a/src/mongo/gotools/mongoreplay/raw_op.go +++ b/src/mongo/gotools/mongoreplay/raw_op.go @@ -61,12 +61,20 @@ func (op *RawOp) ShortenReply() error { switch op.Header.OpCode { case OpCodeReply: + if op.Header.MessageLength <= 20+MsgHeaderLen { + //there are no reply docs + return nil + } firstDocSize := getInt32(op.Body, 20+MsgHeaderLen) op.Body = op.Body[0:(20 + MsgHeaderLen + firstDocSize)] case OpCodeCommandReply: commandReplyDocSize := getInt32(op.Body, MsgHeaderLen) metadataDocSize := getInt32(op.Body, int(commandReplyDocSize)+MsgHeaderLen) + if op.Header.MessageLength <= commandReplyDocSize+metadataDocSize+MsgHeaderLen { + //there are no reply docs + return nil + } firstOutputDocSize := getInt32(op.Body, int(commandReplyDocSize+metadataDocSize)+MsgHeaderLen) shortReplySize := commandReplyDocSize + metadataDocSize + firstOutputDocSize + MsgHeaderLen op.Body = op.Body[0:shortReplySize] diff --git a/src/mongo/gotools/test/qa-tests/jstests/libs/servers.js b/src/mongo/gotools/test/qa-tests/jstests/libs/servers.js index e9a7f68fa9f..f72007c0202 100644 --- a/src/mongo/gotools/test/qa-tests/jstests/libs/servers.js +++ b/src/mongo/gotools/test/qa-tests/jstests/libs/servers.js @@ -386,6 +386,17 @@ return true; }; + var addOptionsToFullArgs = function(k, v) { + if (v === undefined || v === null) + return; + + fullArgs.push("--" + k); + + if (v != "") { + fullArgs.push("" + v); + } + }; + for (var k in o) { // Make sure our logical option should be added to the array of options if (!o.hasOwnProperty(k) || @@ -406,14 +417,14 @@ } fullArgs.push(temp); } + } else if (k === "setParameter" && isObject(o[k])) { + // If the value associated with the setParameter option is an object, we want + // to add all key-value pairs in that object as separate --setParameters. + Object.keys(o[k]).forEach(function(paramKey) { + addOptionsToFullArgs(k, "" + paramKey + "=" + o[k][paramKey]); + }); } else { - if (o[k] === undefined || o[k] === null) { - continue; - } - fullArgs.push("--" + k); - if (o[k] !== "") { - fullArgs.push(String(o[k])); - } + addOptionsToFullArgs(k, o[k]); } } } else { diff --git a/src/mongo/gotools/vendor/src/github.com/spacemonkeygo/openssl/ctx.go b/src/mongo/gotools/vendor/src/github.com/spacemonkeygo/openssl/ctx.go index bf2a14125c2..8daa1bbbb1f 100644 --- a/src/mongo/gotools/vendor/src/github.com/spacemonkeygo/openssl/ctx.go +++ b/src/mongo/gotools/vendor/src/github.com/spacemonkeygo/openssl/ctx.go @@ -84,22 +84,6 @@ static long SSL_CTX_set_tlsext_servername_callback_not_a_macro( #define SSL_OP_NO_COMPRESSION 0 #endif -static const SSL_METHOD *OUR_TLSv1_1_method() { -#if defined(TLS1_1_VERSION) && !defined(OPENSSL_SYSNAME_MACOSX) - return TLSv1_1_method(); -#else - return NULL; -#endif -} - -static const SSL_METHOD *OUR_TLSv1_2_method() { -#if defined(TLS1_2_VERSION) && !defined(OPENSSL_SYSNAME_MACOSX) - return TLSv1_2_method(); -#else - return NULL; -#endif -} - #if defined SSL_CTRL_SET_TLSEXT_HOSTNAME extern int sni_cb(SSL *ssl_conn, int *ad, void *arg); #endif @@ -187,10 +171,6 @@ func NewCtxWithVersion(version SSLVersion) (*Ctx, error) { switch version { case TLSv1: method = C.TLSv1_method() - case TLSv1_1: - method = C.OUR_TLSv1_1_method() - case TLSv1_2: - method = C.OUR_TLSv1_2_method() case AnyVersion: method = C.SSLv23_method() } -- cgit v1.2.1