Skip to content

Commit

Permalink
refactor(check-password): ensure that defaultDomain is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Nov 27, 2018
1 parent b53a3ea commit e9bb698
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
11 changes: 9 additions & 2 deletions src/unix/kerberos_unix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,15 @@ NAN_METHOD(CheckPassword) {
std::string username(*Nan::Utf8String(info[0]));
std::string password(*Nan::Utf8String(info[1]));
std::string service(*Nan::Utf8String(info[2]));
std::string defaultRealm(*Nan::Utf8String(info[3]));
Nan::Callback* callback = new Nan::Callback(Nan::To<v8::Function>(info[4]).ToLocalChecked());

std::string defaultRealm;
Nan::Callback* callback;
if (info[3]->IsFunction()) {
callback = new Nan::Callback(Nan::To<v8::Function>(info[3]).ToLocalChecked());
} else {
defaultRealm = *Nan::Utf8String(info[3]);
callback = new Nan::Callback(Nan::To<v8::Function>(info[4]).ToLocalChecked());
}

KerberosWorker::Run(callback, "kerberos:CheckPassword", [=](KerberosWorker::SetOnFinishedHandler onFinished) {
std::shared_ptr<gss_result> result(authenticate_user_krb5pwd(
Expand Down
10 changes: 0 additions & 10 deletions src/win32/kerberos_win32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,13 @@ NAN_METHOD(InitializeClient) {
}

NAN_METHOD(InitializeServer) {
std::string service(*Nan::Utf8String(info[0]));
Nan::Callback* callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());
Nan::ThrowError("`initializeServer` is not implemented yet for windows");
}

NAN_METHOD(PrincipalDetails) {
std::string service(*Nan::Utf8String(info[0]));
std::string hostname(*Nan::Utf8String(info[1]));
Nan::Callback* callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());
Nan::ThrowError("`principalDetails` is not implemented yet for windows");
}

NAN_METHOD(CheckPassword) {
std::string username(*Nan::Utf8String(info[0]));
std::string password(*Nan::Utf8String(info[1]));
std::string service(*Nan::Utf8String(info[2]));
std::string defaultRealm(*Nan::Utf8String(info[3]));
Nan::Callback* callback = new Nan::Callback(Nan::To<v8::Function>(info[4]).ToLocalChecked());
Nan::ThrowError("`checkPassword` is not implemented yet for windows");
}

0 comments on commit e9bb698

Please sign in to comment.