Skip to content
Permalink
Browse files

fix(check-password): correctly validate parameters, fix test

  • Loading branch information
mbroadst committed Jul 5, 2018
1 parent 0cb8b90 commit b772dded06234aca89a9554ecb1c7967725da109
Showing with 6 additions and 6 deletions.
  1. +5 −5 lib/kerberos.js
  2. +1 −1 test/kerberos_tests.js
@@ -61,10 +61,10 @@ function validateParameter(parameter, spec) {
*/
function checkPassword(username, password, service, defaultRealm, callback) {
if (typeof defaultRealm === 'function') (callback = defaultRealm), (defaultRealm = null);
validateParameter(username, { name: 'service', type: 'string' });
validateParameter(password, { name: 'options', type: 'string' });
validateParameter(service, { name: 'options', type: 'string' });
validateParameter(defaultRealm, { name: 'options', type: 'string' });
validateParameter(username, { name: 'username', type: 'string' });
validateParameter(password, { name: 'password', type: 'string' });
validateParameter(service, { name: 'service', type: 'string' });
validateParameter(defaultRealm, { name: 'defaultRealm', type: 'string' });
validateParameter(callback, { name: 'callback', type: 'function' });

kerberos.checkPassword(username, password, service, defaultRealm, callback);
@@ -82,7 +82,7 @@ function checkPassword(username, password, service, defaultRealm, callback) {
*/
function principalDetails(service, hostname, callback) {
validateParameter(service, { name: 'service', type: 'string' });
validateParameter(hostname, { name: 'options', type: 'string' });
validateParameter(hostname, { name: 'hostname', type: 'string' });
validateParameter(callback, { name: 'callback', type: 'function' });

kerberos.principalDetails(service, hostname, callback);
@@ -29,7 +29,7 @@ describe('Kerberos', function() {
kerberos.checkPassword(username, password, service, realm.toUpperCase(), err => {
expect(err).to.not.exist;

kerberos.checkPassword(username, 'incorrect-password', service, realm.toUpperCase, err => {
kerberos.checkPassword(username, 'incorrect-password', service, realm.toUpperCase(), err => {
expect(err).to.exist;
done();
});

0 comments on commit b772dde

Please sign in to comment.
You can’t perform that action at this time.