File tree 4 files changed +48
-5
lines changed
4 files changed +48
-5
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,11 @@ NAN_METHOD(AuthGSSClientInit) {
66
66
}
67
67
68
68
NAN_METHOD (AuthGSSClientClean) {
69
- v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0 ]);
69
+ KerberosClientContext* context =
70
+ Nan::ObjectWrap::Unwrap<KerberosClientContext>(info[0 ]->ToObject ());
70
71
Nan::Callback *callback = new Nan::Callback (Nan::To<v8::Function>(info[1 ]).ToLocalChecked ());
71
72
72
- AsyncQueueWorker (new DummyWorker ( callback));
73
+ AsyncQueueWorker (new ClientCleanWorker (context, callback));
73
74
}
74
75
75
76
NAN_METHOD (AuthGSSClientStep) {
@@ -104,10 +105,11 @@ NAN_METHOD(AuthGSSServerInit) {
104
105
}
105
106
106
107
NAN_METHOD (AuthGSSServerClean) {
107
- v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0 ]);
108
+ KerberosServerContext* context =
109
+ Nan::ObjectWrap::Unwrap<KerberosServerContext>(info[0 ]->ToObject ());
108
110
Nan::Callback *callback = new Nan::Callback (Nan::To<v8::Function>(info[1 ]).ToLocalChecked ());
109
111
110
- AsyncQueueWorker (new DummyWorker ( callback));
112
+ AsyncQueueWorker (new ServerCleanWorker (context, callback));
111
113
}
112
114
113
115
NAN_METHOD (AuthGSSServerStep) {
Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ KerberosClientContext::KerberosClientContext(gss_client_state* state)
31
31
32
32
KerberosClientContext::~KerberosClientContext ()
33
33
{
34
- // TODO: destroy the state with `authenticate_gss_client_clean` if it hasn't been already
34
+ }
35
+
36
+ void KerberosClientContext::destroy () {
37
+ authenticate_gss_client_clean (_state);
35
38
}
36
39
37
40
NAN_GETTER (KerberosClientContext::UserNameGetter) {
@@ -93,6 +96,10 @@ KerberosServerContext::~KerberosServerContext()
93
96
// TODO: destroy the state with `authenticate_gss_server_clean` if it hasn't been already
94
97
}
95
98
99
+ void KerberosServerContext::destroy () {
100
+ authenticate_gss_server_clean (_state);
101
+ }
102
+
96
103
NAN_GETTER (KerberosServerContext::UserNameGetter) {
97
104
KerberosServerContext* context =
98
105
Nan::ObjectWrap::Unwrap<KerberosServerContext>(info.Holder ());
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ class KerberosClientContext : public Nan::ObjectWrap {
8
8
public:
9
9
static NAN_MODULE_INIT (Init);
10
10
static v8::Local<v8::Object> NewInstance (gss_client_state* state);
11
+ void destroy ();
11
12
12
13
private:
13
14
static Nan::Persistent<v8::Function> constructor;
@@ -27,6 +28,7 @@ class KerberosServerContext : public Nan::ObjectWrap {
27
28
public:
28
29
static NAN_MODULE_INIT (Init);
29
30
static v8::Local<v8::Object> NewInstance (gss_server_state* state);
31
+ void destroy ();
30
32
31
33
private:
32
34
static Nan::Persistent<v8::Function> constructor;
Original file line number Diff line number Diff line change @@ -49,6 +49,22 @@ class ClientInitWorker : public Nan::AsyncWorker {
49
49
50
50
};
51
51
52
+ class ClientCleanWorker : public Nan ::AsyncWorker {
53
+ public:
54
+ ClientCleanWorker (KerberosClientContext* context, Nan::Callback *callback)
55
+ : AsyncWorker(callback, " kerberos:ClientCleanWorker" ),
56
+ _context (context)
57
+ {}
58
+
59
+ virtual void Execute () {
60
+ _context->destroy ();
61
+ }
62
+
63
+ private:
64
+ KerberosClientContext* _context;
65
+
66
+ };
67
+
52
68
class ServerInitWorker : public Nan ::AsyncWorker {
53
69
public:
54
70
ServerInitWorker (std::string service, Nan::Callback *callback)
@@ -84,4 +100,20 @@ class ServerInitWorker : public Nan::AsyncWorker {
84
100
85
101
};
86
102
103
+ class ServerCleanWorker : public Nan ::AsyncWorker {
104
+ public:
105
+ ServerCleanWorker (KerberosServerContext* context, Nan::Callback *callback)
106
+ : AsyncWorker(callback, " kerberos:ServerCleanWorker" ),
107
+ _context (context)
108
+ {}
109
+
110
+ virtual void Execute () {
111
+ _context->destroy ();
112
+ }
113
+
114
+ private:
115
+ KerberosServerContext* _context;
116
+
117
+ };
118
+
87
119
#endif // KERBEROS_WORKER_H
You can’t perform that action at this time.
0 commit comments