diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2017-07-31 13:17:51 -0400 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2017-08-02 10:59:15 -0400 |
commit | 443a8f1af11374d8d8e3a35492415f8464987d54 (patch) | |
tree | 59b5d6f1d2e411012dfc112bd110efabd37502d9 /src/mongo/scripting | |
parent | e101217eabfaa8d10c1c6cce969fa773ead966f2 (diff) | |
download | mongo-443a8f1af11374d8d8e3a35492415f8464987d54.tar.gz |
SERVER-30458 Dead code elimitation in mozjs::auth
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r-- | src/mongo/scripting/mozjs/mongo.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp index 885183eeca6..5bbb3ac4438 100644 --- a/src/mongo/scripting/mozjs/mongo.cpp +++ b/src/mongo/scripting/mozjs/mongo.cpp @@ -477,29 +477,10 @@ void MongoBase::Functions::update::call(JSContext* cx, JS::CallArgs args) { void MongoBase::Functions::auth::call(JSContext* cx, JS::CallArgs args) { auto conn = getConnection(args); - if (!conn) - uasserted(ErrorCodes::BadValue, "no connection"); - - BSONObj params; - switch (args.length()) { - case 1: - params = ValueWriter(cx, args.get(0)).toBSON(); - break; - case 3: - params = - BSON(saslCommandMechanismFieldName << "MONGODB-CR" << saslCommandUserDBFieldName - << ValueWriter(cx, args[0]).toString() - << saslCommandUserFieldName - << ValueWriter(cx, args[1]).toString() - << saslCommandPasswordFieldName - << ValueWriter(cx, args[2]).toString()); - break; - default: - uasserted(ErrorCodes::BadValue, "mongoAuth takes 1 object or 3 string arguments"); - } - - conn->auth(params); + uassert(ErrorCodes::BadValue, "no connection", conn); + uassert(ErrorCodes::BadValue, "mongoAuth takes exactly 1 object argument", args.length() == 1); + conn->auth(ValueWriter(cx, args.get(0)).toBSON()); args.rval().setBoolean(true); } |