Skip to content

Commit acf6ed1

Browse files
fix(NODE-6372): correctly GSS wrap non-user data
1 parent c35b125 commit acf6ed1

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/unix/kerberos_gss.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ gss_result authenticate_gss_client_wrap(gss_client_state* state,
468468
input_token.length = len;
469469
}
470470

471-
if (user) {
471+
if (user && *user) {
472472
// get bufsize
473473
// server_conf_flags = ((char*) input_token.value)[0];
474474
((char*)input_token.value)[0] = 0;

test/kerberos_tests.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,24 @@ describe('Kerberos', function () {
168168
});
169169
});
170170
});
171+
172+
describe('options.user', function () {
173+
context('valid values for `user`', function () {
174+
test('no options provided', async function () {
175+
const rs = await client.wrap('x'.repeat(100));
176+
expect(rs).length.to.be.greaterThan(100);
177+
});
178+
179+
test('options provided (user omitted)', async function () {
180+
const rs = await client.wrap('x'.repeat(100), {});
181+
expect(rs).length.to.be.greaterThan(100);
182+
});
183+
184+
test('options provided (user set)', async function () {
185+
const rs = await client.wrap('x'.repeat(100), { user: 'foo' });
186+
expect(rs).length.to.be.lessThan(100);
187+
});
188+
});
189+
});
171190
});
172191
});

0 commit comments

Comments
 (0)