Giter Site home page Giter Site logo

node-krb5's People

Contributors

alexcfyung avatar gboutry avatar pierrotws avatar rreivax avatar wdavidw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-krb5's Issues

Cannot build on Mac or Linux

Building from npm or the source repo fails on Mac and Linux.

Attempting to npm install on Mac OS 10.12.6 (node 6 and 8 tried):

../src/krb5.cc:141:17: error: no matching function for call to 'krb5_get_init_creds_password'
    this->err = krb5_get_init_creds_password(this->context,this->cred,this->client_principal,password, NULL, NULL, 0, NULL, NULL);

Attempting to npm install on OEL/RHEL 6.4 (node 6 tried):

../src/krb5.cc: In member function ‘krb5_error_code Krb5::get_credentials_by_password(const char*)’:
../src/krb5.cc:141:129: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     this->err = krb5_get_init_creds_password(this->context,this->cred,this->client_principal,password, NULL, NULL, 0, NULL, NULL);
                                                                                                                                 ^
In file included from /usr/include/krb5.h:8:0,
                 from ../src/krb5.h:4,
                 from ../src/krb5.cc:4:
/usr/include/krb5/krb5.h:6686:1: error:   initializing argument 4 of ‘krb5_error_code krb5_get_init_creds_password(krb5_context, krb5_creds*, krb5_principal, char*, krb5_prompter_fct, void*, krb5_deltat, char*, krb5_get_init_creds_opt*)’ [-fpermissive]
 krb5_get_init_creds_password(krb5_context context, krb5_creds *creds,

Installed krb5 on Mac using instructions in README.
Installed krb5 on Linux by yum install krb5-libs krb5-workstation krb5-devel.

Validate the 'token/ticket' header for SSO Authentication

From what I can see in the code examples, this library can produce the token or tickets:

      service_fqdn: 'm01.krb.local'
    }, function (err, token) {
      if (err) {
        console.log(err)
      } else {
        console.log('SPNEGO token :', token)
      } }) 

I would like to validate the 'token/ticket'. Not sure if this library supports that. Is it the case?

*** stack smashing detect *** for spnego tokens bigger than 2048

When I tried to get a spnego token from my company's kerberos, I received the *** stack smashing detect *** error.

After run some validations into src/gss_bind.cc file, I could realize that the token sent by the server is bigger than the 2048 set into the token_buffer variable, thus the N-API code cannot return this value to Node and it gave me an overflow error.

To solve the problem for now, I raised the value to 4056 and published into our package manager. I really don't know if this is the best solution, but if true, I can open a pull request here with the change.

Anyway, I will wait the fix suggestion or the module's update to come back to use this.

Thank you!

Npm audit error. (node-addon-api)

High │ Node.js js_native_api_v8.cc napi_get_value_string_*() │
│ │ Functions Integer Underflow Buffer Overflow │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ node-addon-api │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ 1.7.2||2.0.1

I get the above error, Could u please update the version of node-addon-api?

Port to node 0.12

Hello, I think this module is only compatible with node 0.10 cause v8. Are you thinking to port node-krb5 to version 0.12? Thanks!

Error installing krb5 on node 10 and 12

I have a error trying to installing krb5 on nodejs 10 and 12 versions.

this is the log in nodejs 10 :

> [email protected] install /mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5
> node-gyp rebuild

make: Entering directory '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5/build'
  CXX(target) Release/obj.target/krb5/src/base64.o
../src/base64.cc: In function ‘int decode64(char*)’:
../src/base64.cc:89:44: warning: ‘valcar[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         buffer[posdest++]=(valcar[2] << 6) | (valcar[3]);
                           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../src/base64.cc:87:53: warning: ‘valcar[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       buffer[posdest++]=(valcar[1] << 4) | (valcar[2] >> 2);
                                             ~~~~~~~~^
../src/base64.cc:63:8: warning: ‘valcar[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   char valcar [4]; // valeur après conversion des caractères
        ^~~~~~
../src/base64.cc:63:8: warning: ‘valcar[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  CXX(target) Release/obj.target/krb5/src/krb5.o
../src/krb5.cc: In member function ‘krb5_error_code Krb5::cleanup(int)’:
../src/krb5.cc:80:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     krb5_cc_close(this->context, this->cache);
     ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/krb5.cc:81:3: note: here
   case 3:
   ^~~~
../src/krb5.cc:82:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
     krb5_free_principal(this->context,this->client_principal);
     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/krb5.cc:83:3: note: here
   case 2:
   ^~~~
  CXX(target) Release/obj.target/krb5/src/bind.o
../src/bind.cc: In static member function ‘static void Krb5Wrap::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:69:59: error: no matching function for call to ‘v8::Function::NewInstance(const int&, v8::Local<v8::Value> [0])’
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:3993:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:3993:44: note:   candidate expects 3 arguments, 2 provided
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:3996:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:3996:44: note:   candidate expects 1 argument, 2 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::InitSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:145:41: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
     v8::String::Utf8Value v8user(info[0]);
                                         ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/toryas/.node-gyp/10.16.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bind.cc:146:42: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
     v8::String::Utf8Value v8realm(info[1]);
                                          ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/toryas/.node-gyp/10.16.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bind.cc: In static member function ‘static void Krb5Wrap::ByPasswordSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:155:41: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
     v8::String::Utf8Value v8pass(info[0]);
                                         ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/toryas/.node-gyp/10.16.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bind.cc: In static member function ‘static void Krb5Wrap::ByKeyTabSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:171:39: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
     v8::String::Utf8Value v8kt(info[0]);
                                       ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/toryas/.node-gyp/10.16.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bind.cc: In static member function ‘static void Krb5Wrap::GenTokenSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:186:48: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
     v8::String::Utf8Value v8server_name(info[0]);
                                                ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/toryas/.node-gyp/10.16.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bind.cc: In static member function ‘static void Krb5Wrap::DestroySync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:205:47: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
     v8::String::Utf8Value v8cache_name(info[0]);
                                               ^
In file included from /home/toryas/.node-gyp/10.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/10.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/10.16.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/toryas/.node-gyp/10.16.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
krb5.target.mk:105: recipe for target 'Release/obj.target/krb5/src/bind.o' failed
make: *** [Release/obj.target/krb5/src/bind.o] Error 1
make: Leaving directory '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-18362-Microsoft
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN The package sinon is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/toryas/.npm/_logs/2019-06-28T14_50_17_738Z-debug.log

and this is in nodejs 12:

> [email protected] install /mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5
> node-gyp rebuild

make: Entering directory '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5/build'
  CXX(target) Release/obj.target/krb5/src/base64.o
../src/base64.cc: In function ‘int decode64(char*)’:
../src/base64.cc:89:44: warning: ‘valcar[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         buffer[posdest++]=(valcar[2] << 6) | (valcar[3]);
                           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../src/base64.cc:87:53: warning: ‘valcar[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       buffer[posdest++]=(valcar[1] << 4) | (valcar[2] >> 2);
                                             ~~~~~~~~^
../src/base64.cc:63:8: warning: ‘valcar[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   char valcar [4]; // valeur après conversion des caractères
        ^~~~~~
../src/base64.cc:63:8: warning: ‘valcar[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  CXX(target) Release/obj.target/krb5/src/krb5.o
../src/krb5.cc: In member function ‘krb5_error_code Krb5::cleanup(int)’:
../src/krb5.cc:80:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     krb5_cc_close(this->context, this->cache);
     ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/krb5.cc:81:3: note: here
   case 3:
   ^~~~
../src/krb5.cc:82:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
     krb5_free_principal(this->context,this->client_principal);
     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/krb5.cc:83:3: note: here
   case 2:
   ^~~~
  CXX(target) Release/obj.target/krb5/src/bind.o
../src/bind.cc: In static member function ‘static void Krb5Wrap::Initialize(v8::Local<v8::Object>)’:
../src/bind.cc:52:38: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
   constructor.Reset(tpl->GetFunction());
                                      ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
                                              ^~~~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:5947:46: note:   candidate expects 1 argument, 0 provided
../src/bind.cc:53:68: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
   exports->Set(Nan::New("Krb5").ToLocalChecked(), tpl->GetFunction());
                                                                    ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
                                              ^~~~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:5947:46: note:   candidate expects 1 argument, 0 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:69:59: error: no matching function for call to ‘v8::Function::NewInstance(const int&, v8::Local<v8::Value> [0])’
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:4131:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:4131:44: note:   candidate expects 3 arguments, 2 provided
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:4134:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:4134:44: note:   candidate expects 1 argument, 2 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::InitSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:145:41: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     v8::String::Utf8Value v8user(info[0]);
                                         ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
../src/bind.cc:146:42: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     v8::String::Utf8Value v8realm(info[1]);
                                          ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::ByPasswordSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:155:41: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     v8::String::Utf8Value v8pass(info[0]);
                                         ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::ByKeyTabSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:171:39: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     v8::String::Utf8Value v8kt(info[0]);
                                       ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::GenTokenSync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:186:48: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     v8::String::Utf8Value v8server_name(info[0]);
                                                ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
../src/bind.cc: In static member function ‘static void Krb5Wrap::DestroySync(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:205:47: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’
     v8::String::Utf8Value v8cache_name(info[0]);
                                               ^
In file included from /home/toryas/.node-gyp/12.4.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
     Utf8Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~~~~~
/home/toryas/.node-gyp/12.4.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
krb5.target.mk:111: recipe for target 'Release/obj.target/krb5/src/bind.o' failed
make: *** [Release/obj.target/krb5/src/bind.o] Error 1
make: Leaving directory '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.4.0-18362-Microsoft
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EINVAL: invalid argument, lstat '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules'
npm WARN The package sinon is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/toryas/.npm/_logs/2019-06-28T14_54_42_766Z-debug.log

but when install in nodejs 8 works fine:

> [email protected] install /mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5
> node-gyp rebuild

make: Entering directory '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5/build'
  CXX(target) Release/obj.target/krb5/src/base64.o
../src/base64.cc: In function ‘int decode64(char*)’:
../src/base64.cc:89:44: warning: ‘valcar[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         buffer[posdest++]=(valcar[2] << 6) | (valcar[3]);
                           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../src/base64.cc:87:53: warning: ‘valcar[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       buffer[posdest++]=(valcar[1] << 4) | (valcar[2] >> 2);
                                             ~~~~~~~~^
../src/base64.cc:63:8: warning: ‘valcar[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   char valcar [4]; // valeur après conversion des caractères
        ^~~~~~
../src/base64.cc:63:8: warning: ‘valcar[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  CXX(target) Release/obj.target/krb5/src/krb5.o
../src/krb5.cc: In member function ‘krb5_error_code Krb5::cleanup(int)’:
../src/krb5.cc:80:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     krb5_cc_close(this->context, this->cache);
     ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/krb5.cc:81:3: note: here
   case 3:
   ^~~~
../src/krb5.cc:82:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
     krb5_free_principal(this->context,this->client_principal);
     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/krb5.cc:83:3: note: here
   case 2:
   ^~~~
  CXX(target) Release/obj.target/krb5/src/bind.o
../src/bind.cc: In static member function ‘static void Krb5Wrap::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/bind.cc:69:59: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance(int, v8::Local<v8::Value>*) const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /home/toryas/.node-gyp/8.16.0/include/node/v8.h:26:0,
                 from /home/toryas/.node-gyp/8.16.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bind.h:4,
                 from ../src/bind.cc:1:
/home/toryas/.node-gyp/8.16.0/include/node/v8.h:3897:31: note: declared here
                 Local<Object> NewInstance(int argc, Local<Value> argv[]) const);
                               ^
/home/toryas/.node-gyp/8.16.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
  CXX(target) Release/obj.target/krb5/src/worker.o
../src/worker.cc: In member function ‘virtual void Worker::HandleOKCallback()’:
../src/worker.cc:42:34: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
       this->callback->Call(2,argv);
                                  ^
In file included from ../src/worker.h:4:0,
                 from ../src/worker.cc:1:
../../nan/nan.h:1740:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
../src/worker.cc:46:34: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
       this->callback->Call(2,argv);
                                  ^
In file included from ../src/worker.h:4:0,
                 from ../src/worker.cc:1:
../../nan/nan.h:1740:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
../src/worker.cc:52:34: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
       this->callback->Call(1,argv);
                                  ^
In file included from ../src/worker.h:4:0,
                 from ../src/worker.cc:1:
../../nan/nan.h:1740:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
../src/worker.cc:56:34: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
       this->callback->Call(1,argv);
                                  ^
In file included from ../src/worker.h:4:0,
                 from ../src/worker.cc:1:
../../nan/nan.h:1740:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
  CXX(target) Release/obj.target/krb5/src/addon.o
  SOLINK_MODULE(target) Release/obj.target/krb5.node
  COPY Release/krb5.node
make: Leaving directory '/mnt/c/workspace/bff/ahorrobff/node_modules/arquitecturaDigital/node_modules/krb5/build'

> [email protected] install /mnt/c/workspace/bff/ahorrobff/node_modules/krb5
> node-gyp rebuild

make: Entering directory '/mnt/c/workspace/bff/ahorrobff/node_modules/krb5/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/krb5/src/module.o
  CXX(target) Release/obj.target/krb5/src/krb5_bind.o
  CXX(target) Release/obj.target/krb5/src/gss_bind.o
../src/gss_bind.cc: In member function ‘virtual void Worker_generate_spnego_token::Execute()’:
../src/gss_bind.cc:77:16: warning: variable ‘token_buffer’ set but not used [-Wunused-but-set-variable]
           char token_buffer[2048];
                ^~~~~~~~~~~~
  CXX(target) Release/obj.target/krb5/src/base64.o
../src/base64.cc: In function ‘int decode64(char*)’:
../src/base64.cc:89:44: warning: ‘valcar[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         buffer[posdest++]=(valcar[2] << 6) | (valcar[3]);
                           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../src/base64.cc:87:53: warning: ‘valcar[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       buffer[posdest++]=(valcar[1] << 4) | (valcar[2] >> 2);
                                             ~~~~~~~~^
../src/base64.cc:63:8: warning: ‘valcar[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   char valcar [4]; // valeur après conversion des caractères
        ^~~~~~
../src/base64.cc:63:8: warning: ‘valcar[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  SOLINK_MODULE(target) Release/obj.target/krb5.node
  COPY Release/krb5.node
make: Leaving directory '/mnt/c/workspace/bff/ahorrobff/node_modules/krb5/build'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EINVAL: invalid argument, scandir '/mnt/c/workspace/bff/ahorrobff/node_modules/fsevents/node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EINVAL: invalid argument, lstat '/mnt/c/workspace/bff/ahorrobff/node_modules/fsevents/node_modules'
npm WARN The package sinon is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
added 39 packages from 37 contributors, updated 1 package and audited 12028 packages in 29.475s
found 61 vulnerabilities (20 low, 28 moderate, 13 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Request for kvno support

Hi,

This node module is very useful.
I have scenario to do Kerberos Constrained Delegation.
I see that this is available through kvno tool and source is in latest "krb5" repo.

Looks like you are exposing kinit and other useful tools already through node in this module.
Is there any plan OR can you please share few pointers on how I can add support for kvno, so that I can do constrained delegation from my NodeJS REST API?

Thanks

Error when running npm install

vkagdi$ node --version
v8.16.1
vkagdi$ npm --version
6.4.1

Getting below error when trying to install this module on Mac. We are using hbase module and it has kerberos authentication. So we need this module to enable authentication to HBase from NodeJS.

LM-SJN-40004088:server vkagdi$ npm install krb5 --save

> [email protected] install /Users/.../server/node_modules/krb5
> node-gyp rebuild

  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  LIBTOOL-STATIC Release/nothing.a
  CXX(target) Release/obj.target/krb5/src/module.o
In file included from ../src/module.cc:1:
In file included from ../src/krb5_bind.h:1:
/Users/.../server/node_modules/node-addon-api/napi.h:31:6: error: Exception support not detected. Define either NAPI_CPP_EXCEPTIONS or
      NAPI_DISABLE_CPP_EXCEPTIONS.
    #error Exception support not detected. \
     ^
1 error generated.
make: *** [Release/obj.target/krb5/src/module.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node@8/8.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node@8/8.16.1/bin/node" "/usr/local/Cellar/node@8/8.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/...server/node_modules/krb5
gyp ERR! node -v v8.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vkagdi/.npm/_logs/2019-08-26T17_40_07_693Z-debug.log

Error: Symbol krb5_module not found

I'm following the sample provided in the spnego_async.js file in samples directory - https://github.com/adaltas/node-krb5/blob/master/samples/spnego_async.js

When I include the krb5 module in my node app, I get the following error.

/home/cloud-user/test_node/node_modules/krb5/node_modules/bindings/bindings.js:83
        throw e
              ^
Error: Symbol krb5_module not found.
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at bindings (/home/cloud-user/test_node/node_modules/krb5/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/home/cloud-user/test_node/node_modules/krb5/lib/index.js:6:27)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

I have installed libkrb5-dev but still not able to get past this error. Did I miss something?

Usage

Hi

I'm trying to find out how to retrieve the Kerberos token using node-krb5 in case of successful authentication. My use case is as following

1. Client app provides username/password to node server app
2. Node authenticates the user with the provided credentials against Kerberos
3. Kerberos provides a spnego token that node app will send back to client
4. Client sends the token for every request to node to enable authentication 

Thanks
Simon

Receiving Error in `node': free(): invalid pointer: 0x00000000039d5760

I'm creating a noddy nodejs app in node v8 using the below code:-

var util = require('util');
var krb5 = require('krb5');
var exec = require('child_process').exec;

var config = {
    principal: '*******@*******',
    password: '*******',
    fqdn: '*******'
}

var k = krb5({
  principal: config.principal,
  password: config.password,
  service_fqdn: config.fqdn
});

var do_klist = function(err){
  if(err){
    return process.stderr.write('ERROR: ' + err.message + '\n');
  }
  process.stderr.write('----------------------- klist:\n\n');
  exec('klist', function(err, stdout, stderr){
    if(err){
      return process.stderr.write('ERROR: ' + err.message + '\n');
    }
    process.stderr.write(stdout + '\n');
    do_spnego();
  });
};

var do_kinit = function(){
  process.stderr.write('----------------------- kinit:\n\n');
  k.kinit(do_klist);
};
var do_kdestroy = function(){
  process.stderr.write('-------------------- kdestroy:\n\n');
  k.kdestroy(function(err){
    if(err){
      return process.stderr.write('ERROR: ' + err.message + '\n');
    }
  });
};

var do_spnego = function(){
  if(config.fqdn){
    process.stderr.write('---------------------- spnego:\n\n');
    k.token(function(err,token){
      if(err){
        return process.stderr.write('ERROR: ' + err.message + '\n');
      }
      process.stderr.write('TOKEN:' + token + '\n\n');
      do_kdestroy();
    });
  }
};

do_kinit();

And i'm getting this crash dump, any suggestions?

----------------------- kinit:
*** Error in `node': free(): invalid pointer: 0x00000000039d5760 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fef517527e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fef5175b37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fef5175f53c]
/data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node(_ZN6WorkerD1Ev+0x57)[0x7fef4f4d3257]
/data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node(_ZN3Nan11AsyncWorker7DestroyEv+0x29)[0x7fef4f4d3bc9]
/data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node(_ZN3Nan20AsyncExecuteCompleteEP9uv_work_s+0x1c4)[0x7fef4f4d2d24]
node[0x14104e5]
node[0x14125fb]
node[0x14246b8]
node(uv_run+0x156)[0x1412f86]
node(_ZN4node5StartEP9uv_loop_siPKPKciS5_+0x4ad)[0x8d443d]
node(_ZN4node5StartEiPPc+0x16d)[0x8cc8fd]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fef516fb830]
node[0x89b1b1]
======= Memory map: ========
00400000-01f4b000 r-xp 00000000 fc:00 46296                              /usr/bin/node
0214a000-02165000 rw-p 01b4a000 fc:00 46296                              /usr/bin/node
02165000-0217c000 rw-p 00000000 00:00 0
03916000-03a65000 rw-p 00000000 00:00 0                                  [heap]
27889c00000-27889c80000 rw-p 00000000 00:00 0
174f79b00000-174f79b80000 rw-p 00000000 00:00 0
1cbb4ae00000-1cbb4ae80000 rw-p 00000000 00:00 0
1d4a40800000-1d4a40880000 rw-p 00000000 00:00 0
2035df780000-2035df800000 rw-p 00000000 00:00 0
2493dbf00000-2493dbf80000 rw-p 00000000 00:00 0
253f8f000000-253f8f080000 rw-p 00000000 00:00 0
290c11c80000-290c11d00000 rw-p 00000000 00:00 0
2c4d07400000-2c4d0744f000 rw-p 00000000 00:00 0
30d03e200000-30d03e205000 rw-p 00000000 00:00 0
30dbe931f000-30dbe9320000 ---p 00000000 00:00 0
30dbe9320000-30dbe9328000 rw-p 00000000 00:00 0
30dbe9328000-30dbe932b000 ---p 00000000 00:00 0
3927d0980000-3927d0a00000 rw-p 00000000 00:00 0
39fb1334c000-39fb13380000 ---p 00000000 00:00 0
39fb13380000-39fb13383000 rw-p 00000000 00:00 0
39fb13383000-39fb13384000 ---p 00000000 00:00 0
39fb13384000-39fb13385000 rwxp 00000000 00:00 0
39fb13385000-39fb13400000 ---p 00000000 00:00 0
39fb13400000-39fb13403000 rw-p 00000000 00:00 0
39fb13403000-39fb13404000 ---p 00000000 00:00 0
39fb13404000-39fb13405000 rwxp 00000000 00:00 0
39fb13405000-39fb13480000 ---p 00000000 00:00 0
39fb13480000-39fb13483000 rw-p 00000000 00:00 0
39fb13483000-39fb13484000 ---p 00000000 00:00 0
39fb13484000-39fb13485000 rwxp 00000000 00:00 0
39fb13485000-39fb13500000 ---p 00000000 00:00 0
39fb13500000-39fb13503000 rw-p 00000000 00:00 0
39fb13503000-39fb13504000 ---p 00000000 00:00 0
39fb13504000-39fb1357f000 rwxp 00000000 00:00 0
39fb1357f000-39fb13580000 ---p 00000000 00:00 0
39fb13580000-39fb13583000 rw-p 00000000 00:00 0
39fb13583000-39fb13584000 ---p 00000000 00:00 0
39fb13584000-39fb135ff000 rwxp 00000000 00:00 0
39fb135ff000-39fb13600000 ---p 00000000 00:00 0
39fb13600000-39fb13603000 rw-p 00000000 00:00 0
39fb13603000-39fb13604000 ---p 00000000 00:00 0
39fb13604000-39fb1367f000 rwxp 00000000 00:00 0
39fb1367f000-39fb13680000 ---p 00000000 00:00 0
39fb13680000-39fb13683000 rw-p 00000000 00:00 0
39fb13683000-39fb13684000 ---p 00000000 00:00 0
39fb13684000-39fb136ff000 rwxp 00000000 00:00 0
39fb136ff000-39fb3334c000 ---p 00000000 00:00 0
3d1895c00000-3d1895c80000 rw-p 00000000 00:00 0
7fef30000000-7fef30021000 rw-p 00000000 00:00 0
7fef30021000-7fef34000000 ---p 00000000 00:00 0
7fef34000000-7fef34021000 rw-p 00000000 00:00 0
7fef34021000-7fef38000000 ---p 00000000 00:00 0
7fef38000000-7fef38021000 rw-p 00000000 00:00 0
7fef38021000-7fef3c000000 ---p 00000000 00:00 0
7fef3c000000-7fef3c021000 rw-p 00000000 00:00 0
7fef3c021000-7fef40000000 ---p 00000000 00:00 0
7fef40000000-7fef40021000 rw-p 00000000 00:00 0
7fef40021000-7fef44000000 ---p 00000000 00:00 0
7fef44000000-7fef44021000 rw-p 00000000 00:00 0
7fef44021000-7fef48000000 ---p 00000000 00:00 0
7fef48000000-7fef48021000 rw-p 00000000 00:00 0
7fef48021000-7fef4c000000 ---p 00000000 00:00 0
7fef4c34a000-7fef4c34d000 r-xp 00000000 fc:00 130629                     /usr/lib/x86_64-linux-gnu/krb5/plugins/libkrb5/sssd_krb5_locator_plugin.so
7fef4c34d000-7fef4c54c000 ---p 00003000 fc:00 130629                     /usr/lib/x86_64-linux-gnu/krb5/plugins/libkrb5/sssd_krb5_locator_plugin.so
7fef4c54c000-7fef4c54d000 r--p 00002000 fc:00 130629                     /usr/lib/x86_64-linux-gnu/krb5/plugins/libkrb5/sssd_krb5_locator_plugin.so
7fef4c54d000-7fef4c54e000 rw-p 00003000 fc:00 130629                     /usr/lib/x86_64-linux-gnu/krb5/plugins/libkrb5/sssd_krb5_locator_plugin.so
7fef4c54e000-7fef4c54f000 ---p 00000000 00:00 0
7fef4c54f000-7fef4cd4f000 rw-p 00000000 00:00 0
7fef4cd4f000-7fef4cd50000 ---p 00000000 00:00 0
7fef4cd50000-7fef4d550000 rw-p 00000000 00:00 0
7fef4d550000-7fef4d551000 ---p 00000000 00:00 0
7fef4d551000-7fef4dd51000 rw-p 00000000 00:00 0
7fef4dd51000-7fef4dd52000 ---p 00000000 00:00 0
7fef4dd52000-7fef4e552000 rw-p 00000000 00:00 0
7fef4e552000-7fef4e569000 r-xp 00000000 fc:00 1383                       /lib/x86_64-linux-gnu/libresolv-2.23.so
7fef4e569000-7fef4e769000 ---p 00017000 fc:00 1383                       /lib/x86_64-linux-gnu/libresolv-2.23.so
7fef4e769000-7fef4e76a000 r--p 00017000 fc:00 1383                       /lib/x86_64-linux-gnu/libresolv-2.23.so
7fef4e76a000-7fef4e76b000 rw-p 00018000 fc:00 1383                       /lib/x86_64-linux-gnu/libresolv-2.23.so
7fef4e76b000-7fef4e76d000 rw-p 00000000 00:00 0
7fef4e76d000-7fef4e770000 r-xp 00000000 fc:00 52533                      /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7fef4e770000-7fef4e96f000 ---p 00003000 fc:00 52533                      /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7fef4e96f000-7fef4e970000 r--p 00002000 fc:00 52533                      /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7fef4e970000-7fef4e971000 rw-p 00003000 fc:00 52533                      /lib/x86_64-linux-gnu/libkeyutils.so.1.5
7fef4e971000-7fef4e97b000 r-xp 00000000 fc:00 52508                      /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7fef4e97b000-7fef4eb7a000 ---p 0000a000 fc:00 52508                      /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7fef4eb7a000-7fef4eb7b000 r--p 00009000 fc:00 52508                      /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7fef4eb7b000-7fef4eb7c000 rw-p 0000a000 fc:00 52508                      /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7fef4eb7c000-7fef4eb7f000 r-xp 00000000 fc:00 1068                       /lib/x86_64-linux-gnu/libcom_err.so.2.1
7fef4eb7f000-7fef4ed7e000 ---p 00003000 fc:00 1068                       /lib/x86_64-linux-gnu/libcom_err.so.2.1
7fef4ed7e000-7fef4ed7f000 r--p 00002000 fc:00 1068                       /lib/x86_64-linux-gnu/libcom_err.so.2.1
7fef4ed7f000-7fef4ed80000 rw-p 00003000 fc:00 1068                       /lib/x86_64-linux-gnu/libcom_err.so.2.1
7fef4ed80000-7fef4edac000 r-xp 00000000 fc:00 52519                      /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7fef4edac000-7fef4efab000 ---p 0002c000 fc:00 52519                      /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7fef4efab000-7fef4efad000 r--p 0002b000 fc:00 52519                      /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7fef4efad000-7fef4efae000 rw-p 0002d000 fc:00 52519                      /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7fef4efae000-7fef4efaf000 rw-p 00000000 00:00 0
7fef4efaf000-7fef4eff6000 r-xp 00000000 fc:00 52563                      /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7fef4eff6000-7fef4f1f5000 ---p 00047000 fc:00 52563                      /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7fef4f1f5000-7fef4f1f7000 r--p 00046000 fc:00 52563                      /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7fef4f1f7000-7fef4f1f9000 rw-p 00048000 fc:00 52563                      /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
7fef4f1f9000-7fef4f2bc000 r-xp 00000000 fc:00 52547                      /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7fef4f2bc000-7fef4f4bc000 ---p 000c3000 fc:00 52547                      /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7fef4f4bc000-7fef4f4c9000 r--p 000c3000 fc:00 52547                      /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7fef4f4c9000-7fef4f4cb000 rw-p 000d0000 fc:00 52547                      /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
7fef4f4cb000-7fef4f4d6000 r-xp 00000000 fc:01 391596                     /data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node
7fef4f4d6000-7fef4f6d5000 ---p 0000b000 fc:01 391596                     /data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node
7fef4f6d5000-7fef4f6d6000 r--p 0000a000 fc:01 391596                     /data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node
7fef4f6d6000-7fef4f6d7000 rw-p 0000b000 fc:01 391596                     /data/spike/Node-Docker/jdbcspike/node_modules/krb5/build/Release/krb5.node
7fef4f6d7000-7fef4f6d8000 ---p 00000000 00:00 0
7fef4f6d8000-7fef4fed8000 rw-p 00000000 00:00 0
7fef4fed8000-7fef4fed9000 ---p 00000000 00:00 0
7fef4fed9000-7fef506d9000 rw-p 00000000 00:00 0
7fef506d9000-7fef506da000 ---p 00000000 00:00 0
7fef506da000-7fef50eda000 rw-p 00000000 00:00 0
7fef50eda000-7fef50edb000 ---p 00000000 00:00 0
7fef50edb000-7fef516db000 rw-p 00000000 00:00 0
7fef516db000-7fef5189b000 r-xp 00000000 fc:00 1367                       /lib/x86_64-linux-gnu/libc-2.23.so
7fef5189b000-7fef51a9b000 ---p 001c0000 fc:00 1367                       /lib/x86_64-linux-gnu/libc-2.23.so
7fef51a9b000-7fef51a9f000 r--p 001c0000 fc:00 1367                       /lib/x86_64-linux-gnu/libc-2.23.so
7fef51a9f000-7fef51aa1000 rw-p 001c4000 fc:00 1367                       /lib/x86_64-linux-gnu/libc-2.23.so
7fef51aa1000-7fef51aa5000 rw-p 00000000 00:00 0
7fef51aa5000-7fef51abd000 r-xp 00000000 fc:00 1363                       /lib/x86_64-linux-gnu/libpthread-2.23.so
7fef51abd000-7fef51cbc000 ---p 00018000 fc:00 1363                       /lib/x86_64-linux-gnu/libpthread-2.23.so
7fef51cbc000-7fef51cbd000 r--p 00017000 fc:00 1363                       /lib/x86_64-linux-gnu/libpthread-2.23.so
7fef51cbd000-7fef51cbe000 rw-p 00018000 fc:00 1363                       /lib/x86_64-linux-gnu/libpthread-2.23.so
7fef51cbe000-7fef51cc2000 rw-p 00000000 00:00 0
7fef51cc2000-7fef51cd8000 r-xp 00000000 fc:00 1227                       /lib/x86_64-linux-gnu/libgcc_s.so.1
7fef51cd8000-7fef51ed7000 ---p 00016000 fc:00 1227                       /lib/x86_64-linux-gnu/libgcc_s.so.1
7fef51ed7000-7fef51ed8000 rw-p 00015000 fc:00 1227                       /lib/x86_64-linux-gnu/libgcc_s.so.1
7fef51ed8000-7fef51fe0000 r-xp 00000000 fc:00 1305                       /lib/x86_64-linux-gnu/libm-2.23.so
7fef51fe0000-7fef521df000 ---p 00108000 fc:00 1305                       /lib/x86_64-linux-gnu/libm-2.23.so
7fef521df000-7fef521e0000 r--p 00107000 fc:00 1305                       /lib/x86_64-linux-gnu/libm-2.23.so
7fef521e0000-7fef521e1000 rw-p 00108000 fc:00 1305                       /lib/x86_64-linux-gnu/libm-2.23.so
7fef521e1000-7fef52353000 r-xp 00000000 fc:00 2591                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fef52353000-7fef52553000 ---p 00172000 fc:00 2591                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fef52553000-7fef5255d000 r--p 00172000 fc:00 2591                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fef5255d000-7fef5255f000 rw-p 0017c000 fc:00 2591                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fef5255f000-7fef52563000 rw-p 00000000 00:00 0
7fef52563000-7fef5256a000 r-xp 00000000 fc:00 1529                       /lib/x86_64-linux-gnu/librt-2.23.so
7fef5256a000-7fef52769000 ---p 00007000 fc:00 1529                       /lib/x86_64-linux-gnu/librt-2.23.so
7fef52769000-7fef5276a000 r--p 00006000 fc:00 1529                       /lib/x86_64-linux-gnu/librt-2.23.so
7fef5276a000-7fef5276b000 rw-p 00007000 fc:00 1529                       /lib/x86_64-linux-gnu/librt-2.23.so
7fef5276b000-7fef5276e000 r-xp 00000000 fc:00 1378                       /lib/x86_64-linux-gnu/libdl-2.23.so
7fef5276e000-7fef5296d000 ---p 00003000 fc:00 1378                       /lib/x86_64-linux-gnu/libdl-2.23.so
7fef5296d000-7fef5296e000 r--p 00002000 fc:00 1378                       /lib/x86_64-linux-gnu/libdl-2.23.so
7fef5296e000-7fef5296f000 rw-p 00003000 fc:00 1378                       /lib/x86_64-linux-gnu/libdl-2.23.so
7fef5296f000-7fef52995000 r-xp 00000000 fc:00 1354                       /lib/x86_64-linux-gnu/ld-2.23.so
7fef52b83000-7fef52b8a000 rw-p 00000000 00:00 0
7fef52b8f000-7fef52b90000 rw-p 00000000 00:00 0
7fef52b90000-7fef52b91000 ---p 00000000 00:00 0
7fef52b91000-7fef52b94000 rw-p 00000000 00:00 0
7fef52b94000-7fef52b95000 r--p 00025000 fc:00 1354                       /lib/x86_64-linux-gnu/ld-2.23.so
7fef52b95000-7fef52b96000 rw-p 00026000 fc:00 1354                       /lib/x86_64-linux-gnu/ld-2.23.so
7fef52b96000-7fef52b97000 rw-p 00000000 00:00 0
7ffc65d4d000-7ffc65d6e000 rw-p 00000000 00:00 0                          [stack]
7ffc65dcc000-7ffc65dcf000 r--p 00000000 00:00 0                          [vvar]
7ffc65dcf000-7ffc65dd1000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

Getting Access Denied

i need quick access to get tokens, when i accessing multiple times from this code:

var krb5 = require('krb5');
var debug = require('debug')('dbg');

var config = {
  target:'http://localhost:3003',
  principal: '[email protected]',
  keytab: '/etc/krb5.keytab',
  service_principal: 'HTTP@localhost',
}

var k = krb5({
  principal: config.principal,
  keytab: config.keytab,
  service_principal: config.service_principal,
  renew: true
});

k.kinit(function(err) {
  if(err)
    return debug("ERR KiNIT",err);

  k.token(function(err, token) {
    if(err)
      return debug("ERR token",err);
    //proxyEmitter.emit('proxy.spengo.token',token);
    return console.log("WWWW",token);
  });
});

So i getting randomly "Permission denied" (even i run this code in root, also installed with sudo npm -g etc...):

[user@host folder]$ DEBUG=* node index.js 
WWWW YIICZA.........etc.....deyGPUA==
[user@host folder]$ DEBUG=* node index.js 
  RestProxy:proxy ERR KiNIT Error: Permission denied
    at Error (native) +0ms
[user@host folder]$ DEBUG=* node index.js 
  RestProxy:proxy ERR KiNIT Error: Permission denied
    at Error (native) +0ms
[user@host folder]$ DEBUG=* node index.js 
WWWW YIICZQYGKwYBBQUCoII........etc...... JylPg=
[user@host folder]$ DEBUG=* node index.js 
WWWW YIICewYGKwYBBQUCoIICbzCCAmugDT.........etc.........2TpjP7QWEAybd
[user@host folder]$ DEBUG=* node index.js 
WWWW YIICZQYGKwYBBQUCo............etc.......KBvX2kXRMDQFQ=
[user@host folder]$ DEBUG=* node index.js 
  RestProxy:proxy ERR KiNIT Error: Permission denied
    at Error (native) +0ms

Have idea?

[Memory leak] Spnego tokens aren't properly freed in gss_bind.cc

Spnego tokens aren't properly freed. They are buffer attributes, therefore they're not deleted when class destructor is called.

We could use this opportunity to return an ArrayBuffer to node (with proper lifetime) and let the node side encode to b64, therefore removing the need for the files base64.h and base64.cc

General Protection Fault / Segmentation Fault in a CentOS environment

Calling krb5.spnego can result in node process termination from general protection, or segmentation fault on certain CentOS configuration(s).

On the target machine, using kinit from the shell and using curl --negotiate works, but using krb5.spnego from node will result in the following error, with default ccname or FILE/DIR/MEMORY cache types.

kernel: traps: node[14822] general protection ip:7febec5f31e2 sp:7febecff8e78 error:0 in krb5.node[7febec5df000+18000]

Target environment information:
CentOS version: CentOS Linux release 7.9.2009 (Core)
krb5-libs package version: (unsure of version at this time, will update)

Example test case:

const krb5 = require('krb5');
krb5.kinit({
    principal: '<[email protected]>',
    password: '<password>'
}).then(() => {
    krb5.spnego({
        hostbased_service: `HTTP@HOSTNAME`
    })
    .then((ticket) => {
        console.log(ticket); // does not reach on target system
    });
});

Edits: Edited original issue to indicate it was spnego, not kinit causing the fault.

Note: Having difficulty reproducing on our own test infrastructure, but I will update this issue with more information next time we can schedule access to the remote machine such as krb5-libs version and double check the CentOS/kernel versions and VM information.

*** stack smashing detected ***: node terminated

I'm receiving:

"*** stack smashing detected ***: node terminated"

When executing the sync sample code, only modification is changing the yargs object for a config object instead.

I am getting this:-

Default principal: [email protected]

Valid starting     Expires            Service principal
26/07/18 11:04:06  26/07/18 21:04:06  krbtgt/[email protected]
        renew until 02/08/18 11:04:06
26/07/18 11:04:06  26/07/18 21:04:06  HTTP/[email protected]
        renew until 02/08/18 11:04:06
26/07/18 11:23:08  26/07/18 21:23:08  krbtgt/[email protected]
        renew until 02/08/18 11:23:08

------------------ spnegoSync:

*** stack smashing detected ***: node terminated
Aborted

This is the sample code:-

var util = require('util');
var krb5 = require('krb5');
var exec = require('child_process').exec;

var config = {
    principal: '[email protected]',
    password: 'AGoodPassword',
    fqdn: 'abc.defg.com'
}

var k = krb5({
  principal: config.principal,
  password: config.password,
  service_fqdn: config.fqdn
});

var do_klist = function(callback){
  process.stderr.write('----------------------- klist:\n\n');
  exec('klist', function(err, stdout, stderr){
    if(err){
      return process.stderr.write('ERROR: ' + err.message + '\n');
    }
    process.stderr.write(stdout + '\n');
    if(typeof(callback)=='function') return callback();
  });
};

var do_kinit = function(){
  process.stderr.write('------------------- kinitSync:\n\n');
  k.kinitSync();
};

var do_kdestroy = function(){
  process.stderr.write('---------------- kdestroySync:\n\n');
  k.kdestroySync();
};

var do_spnego = function(){
  if(config.fqdn){
    process.stderr.write('------------------ spnegoSync:\n\n');
    token = k.tokenSync();
    process.stderr.write('TOKEN: ' + token + '\n\n');
  }
  do_kdestroy();
};

do_kinit();
do_klist(do_spnego);

Any suggestions

Missing krb5.h header file when compiling on Windows

After following the instructions provided to compile the library in Windows, I keep getting a build error indicating the the krb5.h file cannot be found:

Build FAILED.

"C:\Users\rprigat\Desktop\node-krb5-master\build\binding.sln" (default target) (1) ->
"C:\Users\rprigat\Desktop\node-krb5-master\build\krb5.vcxproj.metaproj" (default target) (2) ->
"C:\Users\rprigat\Desktop\node-krb5-master\build\krb5.vcxproj" (default target) (4) ->
(ClCompile target) ->
  c:\users\rprigat\desktop\node-krb5-master\src\krb5_bind.h(2): fatal error C1083: Cannot open include file: 'krb5.h':
No such file or directory (compiling source file ..\src\krb5_bind.cc) [C:\Users\rprigat\Desktop\node-krb5-master\build\
krb5.vcxproj]
  c:\users\rprigat\desktop\node-krb5-master\src\krb5_bind.h(2): fatal error C1083: Cannot open include file: 'krb5.h':
No such file or directory (compiling source file ..\src\module.cc) [C:\Users\rprigat\Desktop\node-krb5-master\build\krb
5.vcxproj]
  c:\users\rprigat\desktop\node-krb5-master\src\gss_bind.h(2): fatal error C1083: Cannot open include file: 'krb5.h': N
o such file or directory (compiling source file ..\src\gss_bind.cc) [C:\Users\rprigat\Desktop\node-krb5-master\build\kr
b5.vcxproj]

    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:02.05
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\rprigat\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rprigat\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--verbose"
gyp ERR! cwd C:\Users\rprigat\Desktop\node-krb5-master
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok

I am using node 10, python 2.7 and installed the VS 2017 Community with the relevant C++ workload.

Any idea why this might happen?

SPNEGO: be more generic for service name

Current behavior

krb5.spnego
  service_fqdn: 'fully.qualified.domain'
, (err, token) ->

service_fqdn is replaced by [email protected]

OR

krb5.spnego
  service_fqdn: '[email protected]'
, (err, token) ->

Issue
Current implementation assumes that the service principal for SPNEGO is always HTTP/fqdn.

New implementation
Option 1:
gss_import_name requires service@host when input_name_type is GSS_C_NT_HOSTBASED_SERVICE (current value).
Make HTTP the default service and allow other services name.
We could have something like:

krb5.spnego
  hostbased_service: '[email protected]'
, (err, token) ->

Option 2:
Use GSS_C_NT_USER_NAME for gss_import_name.
We then need to provide the Kerberos principal associated with the service.
We could have something like:

krb5.spnego
  service_principal: 'http/fully.qualified.domain'
, (err, token) ->

OR

krb5.spnego
  service_principal: 'http/fully.qualified.domain@REALM'
, (err, token) ->

Option 3:
Combine both options depending on rather service_principal or hostbased_service is given.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.