Line data Source code
1 : /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2 : * Copyright (C) 2007-2011 Frediano Ziglio
3 : *
4 : * This library is free software; you can redistribute it and/or
5 : * modify it under the terms of the GNU Library General Public
6 : * License as published by the Free Software Foundation; either
7 : * version 2 of the License, or (at your option) any later version.
8 : *
9 : * This library is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : * Library General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU Library General Public
15 : * License along with this library; if not, write to the
16 : * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 : * Boston, MA 02111-1307, USA.
18 : */
19 :
20 : #include <config.h>
21 :
22 : #if HAVE_STDLIB_H
23 : #include <stdlib.h>
24 : #endif /* HAVE_STDLIB_H */
25 :
26 : #include <ctype.h>
27 :
28 : #if HAVE_STRING_H
29 : #include <string.h>
30 : #endif /* HAVE_STRING_H */
31 :
32 : #if HAVE_UNISTD_H
33 : #include <unistd.h>
34 : #endif /* HAVE_UNISTD_H */
35 :
36 : #if HAVE_NETDB_H
37 : #include <netdb.h>
38 : #endif /* HAVE_NETDB_H */
39 :
40 : #if HAVE_SYS_SOCKET_H
41 : #include <sys/socket.h>
42 : #endif /* HAVE_SYS_SOCKET_H */
43 :
44 : #if HAVE_SYS_TYPES_H
45 : #include <sys/types.h>
46 : #endif /* HAVE_SYS_TYPES_H */
47 :
48 : #if HAVE_NETINET_IN_H
49 : #include <netinet/in.h>
50 : #endif /* HAVE_NETINET_IN_H */
51 :
52 : #if HAVE_ARPA_INET_H
53 : #include <arpa/inet.h>
54 : #endif /* HAVE_ARPA_INET_H */
55 :
56 : #if HAVE_COM_ERR_H
57 : #include <com_err.h>
58 : #endif /* HAVE_COM_ERR_H */
59 :
60 : #ifdef ENABLE_KRB5
61 :
62 : #ifdef __APPLE__
63 : #define KERBEROS_APPLE_DEPRECATED(x)
64 : #define GSSKRB_APPLE_DEPRECATED(x)
65 : #undef __API_DEPRECATED
66 : #define __API_DEPRECATED(x, y)
67 : #endif
68 : #include <gssapi/gssapi_krb5.h>
69 :
70 : #include <freetds/tds.h>
71 : #include <freetds/utils/string.h>
72 : #include <freetds/replacements.h>
73 : #include <freetds/tds/tls.h>
74 :
75 : /**
76 : * \ingroup libtds
77 : * \defgroup auth Authentication
78 : * Functions for handling authentication.
79 : */
80 :
81 : /**
82 : * \addtogroup auth
83 : * @{
84 : */
85 :
86 : typedef struct tds_gss_auth
87 : {
88 : TDSAUTHENTICATION tds_auth;
89 : gss_ctx_id_t gss_context;
90 : gss_name_t target_name;
91 : char *sname;
92 : OM_uint32 last_stat;
93 : } TDSGSSAUTH;
94 :
95 : static TDSRET
96 0 : tds_gss_free(TDSCONNECTION *conn TDS_UNUSED, TDSAUTHENTICATION *tds_auth)
97 : {
98 0 : TDSGSSAUTH *auth = (TDSGSSAUTH *) tds_auth;
99 : OM_uint32 min_stat;
100 :
101 0 : if (auth->tds_auth.packet) {
102 : gss_buffer_desc send_tok;
103 :
104 0 : send_tok.value = (void *) auth->tds_auth.packet;
105 0 : send_tok.length = auth->tds_auth.packet_len;
106 0 : gss_release_buffer(&min_stat, &send_tok);
107 : }
108 :
109 0 : gss_release_name(&min_stat, &auth->target_name);
110 0 : free(auth->sname);
111 0 : if (auth->gss_context != GSS_C_NO_CONTEXT)
112 0 : gss_delete_sec_context(&min_stat, &auth->gss_context, GSS_C_NO_BUFFER);
113 0 : free(auth);
114 :
115 0 : return TDS_SUCCESS;
116 : }
117 :
118 : static TDSRET tds_gss_continue(TDSSOCKET * tds, TDSGSSAUTH * auth, gss_buffer_desc * token_ptr);
119 :
120 : static TDSRET
121 0 : tds7_gss_handle_next(TDSSOCKET *tds, TDSAUTHENTICATION *auth, size_t len)
122 : {
123 : TDSRET res;
124 : gss_buffer_desc recv_tok;
125 :
126 0 : if (((TDSGSSAUTH *) auth)->last_stat != GSS_S_CONTINUE_NEEDED)
127 : return TDS_FAIL;
128 :
129 0 : if (auth->packet) {
130 : OM_uint32 min_stat;
131 : gss_buffer_desc send_tok;
132 :
133 0 : send_tok.value = (void *) auth->packet;
134 0 : send_tok.length = auth->packet_len;
135 0 : gss_release_buffer(&min_stat, &send_tok);
136 0 : auth->packet = NULL;
137 : }
138 :
139 0 : recv_tok.length = len;
140 0 : recv_tok.value = tds_new(char, len);
141 0 : if (!recv_tok.value)
142 : return TDS_FAIL;
143 0 : tds_get_n(tds, recv_tok.value, len);
144 :
145 0 : res = tds_gss_continue(tds, (TDSGSSAUTH *) auth, &recv_tok);
146 0 : free(recv_tok.value);
147 0 : TDS_PROPAGATE(res);
148 :
149 0 : if (auth->packet_len) {
150 0 : tds->out_flag = TDS7_AUTH;
151 0 : tds_put_n(tds, auth->packet, auth->packet_len);
152 0 : return tds_flush_packet(tds);
153 : }
154 : return TDS_SUCCESS;
155 : }
156 :
157 : static TDSRET
158 0 : tds5_gss_handle_next(TDSSOCKET *tds, TDSAUTHENTICATION *auth, size_t len TDS_UNUSED)
159 : {
160 : gss_buffer_desc recv_tok;
161 : TDSPARAMINFO *info;
162 : TDSCOLUMN *col;
163 :
164 0 : if (((TDSGSSAUTH *) auth)->last_stat != GSS_S_CONTINUE_NEEDED)
165 : return TDS_FAIL;
166 :
167 0 : if (auth->packet) {
168 : OM_uint32 min_stat;
169 : gss_buffer_desc send_tok;
170 :
171 0 : send_tok.value = (void *) auth->packet;
172 0 : send_tok.length = auth->packet_len;
173 0 : gss_release_buffer(&min_stat, &send_tok);
174 0 : auth->packet = NULL;
175 : }
176 :
177 : /* parse from saved message */
178 0 : if (auth->msg_type != TDS5_MSG_SEC_OPAQUE)
179 : goto error;
180 0 : auth->msg_type = 0;
181 :
182 0 : info = tds->param_info;
183 0 : if (!info || info->num_cols < 5)
184 : goto error;
185 :
186 : /* check first column is int and TDS5_SEC_VERSION */
187 0 : col = info->columns[0];
188 0 : if (tds_get_conversion_type(col->on_server.column_type, col->on_server.column_size) != SYBINT4)
189 : goto error;
190 0 : if (*((TDS_INT *) col->column_data) != TDS5_SEC_VERSION)
191 : goto error;
192 :
193 : /* check second column is int and TDS5_SEC_SECSESS */
194 0 : col = info->columns[1];
195 0 : if (tds_get_conversion_type(col->on_server.column_type, col->on_server.column_size) != SYBINT4)
196 : goto error;
197 0 : if (*((TDS_INT *) col->column_data) != TDS5_SEC_SECSESS)
198 : goto error;
199 :
200 0 : col = info->columns[3];
201 0 : if (col->column_type != SYBLONGBINARY)
202 : goto error;
203 0 : recv_tok.value = ((TDSBLOB*) col->column_data)->textvalue;
204 0 : recv_tok.length = col->column_size;
205 :
206 0 : TDS_PROPAGATE(tds_gss_continue(tds, (TDSGSSAUTH *) auth, &recv_tok));
207 :
208 0 : tds->out_flag = TDS_NORMAL;
209 0 : TDS_PROPAGATE(tds5_gss_send(tds));
210 :
211 0 : return tds_flush_packet(tds);
212 :
213 0 : error:
214 : return TDS_FAIL;
215 : }
216 :
217 : /**
218 : * Build a GSSAPI packet to send to server
219 : * @param tds A pointer to the TDSSOCKET structure managing a client/server operation.
220 : * @return size of packet
221 : */
222 : TDSAUTHENTICATION *
223 0 : tds_gss_get_auth(TDSSOCKET * tds)
224 : {
225 : /*
226 : * TODO
227 : * There are some differences between this implementation and MS on
228 : * - MS use SPNEGO with 3 mechnisms (MS KRB5, KRB5, NTLMSSP)
229 : * - MS seems to use MUTUAL flag
230 : * - name type is "Service and Instance (2)" and not "Principal (1)"
231 : * check for memory leaks
232 : * check for errors in many functions
233 : * a bit more verbose
234 : * dinamically load library ??
235 : */
236 : gss_buffer_desc send_tok;
237 : OM_uint32 maj_stat, min_stat;
238 : #ifdef __APPLE__
239 : /* some MacOS header defines gss_OID_desc with a wrong byte alignment, use external
240 : * library definition. */
241 : # define nt_principal (*(gss_OID_desc *) GSS_KRB5_NT_PRINCIPAL_NAME)
242 : #else
243 : /* same as GSS_KRB5_NT_PRINCIPAL_NAME but do not require .so library */
244 : static gss_OID_desc nt_principal = { 10, (void*) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01" };
245 : #endif
246 : TDSGSSAUTH *auth;
247 :
248 0 : if (!tds->login)
249 : return NULL;
250 :
251 0 : auth = tds_new0(TDSGSSAUTH, 1);
252 0 : if (!auth)
253 : return NULL;
254 :
255 0 : auth->tds_auth.free = tds_gss_free;
256 0 : auth->tds_auth.handle_next = IS_TDS50(tds->conn) ? tds5_gss_handle_next : tds7_gss_handle_next;
257 0 : auth->gss_context = GSS_C_NO_CONTEXT;
258 0 : auth->last_stat = GSS_S_COMPLETE;
259 :
260 0 : auth->sname = tds_get_spn(tds);
261 0 : if (auth->sname && tds_dstr_isempty(&tds->login->server_spn)
262 0 : && !tds_dstr_isempty(&tds->login->server_realm_name)) {
263 : /* add Kerberos realm */
264 0 : char *sname = NULL;
265 :
266 0 : if (asprintf(&sname, "%s@%s", auth->sname, tds_dstr_cstr(&tds->login->server_realm_name)) < 0)
267 0 : sname = NULL;
268 0 : free(auth->sname);
269 0 : auth->sname = sname;
270 : }
271 0 : if (auth->sname == NULL) {
272 0 : tds_gss_free(tds->conn, (TDSAUTHENTICATION *) auth);
273 0 : return NULL;
274 : }
275 0 : tdsdump_log(TDS_DBG_NETWORK, "using kerberos name %s\n", auth->sname);
276 :
277 : /*
278 : * Import the name into target_name. Use send_tok to save
279 : * local variable space.
280 : */
281 0 : send_tok.value = auth->sname;
282 0 : send_tok.length = strlen(auth->sname);
283 0 : maj_stat = gss_import_name(&min_stat, &send_tok, &nt_principal, &auth->target_name);
284 :
285 0 : switch (maj_stat) {
286 0 : case GSS_S_COMPLETE:
287 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_COMPLETE: gss_import_name completed successfully.\n");
288 0 : if (TDS_FAILED(tds_gss_continue(tds, auth, GSS_C_NO_BUFFER))) {
289 0 : tds_gss_free(tds->conn, (TDSAUTHENTICATION *) auth);
290 0 : return NULL;
291 : }
292 : break;
293 0 : case GSS_S_BAD_NAMETYPE:
294 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_BAD_NAMETYPE: The input_name_type was unrecognized.\n");
295 : break;
296 0 : case GSS_S_BAD_NAME:
297 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_BAD_NAME: The input_name parameter could not be interpreted as a name of the specified type.\n");
298 : break;
299 0 : case GSS_S_BAD_MECH:
300 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_BAD_MECH: The input name-type was GSS_C_NT_EXPORT_NAME, but the mechanism contained within the input-name is not supported.\n");
301 : break;
302 0 : default:
303 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: unexpected error %d.\n", maj_stat);
304 : break;
305 : }
306 :
307 0 : if (GSS_ERROR(maj_stat)) {
308 0 : tds_gss_free(tds->conn, (TDSAUTHENTICATION *) auth);
309 0 : return NULL;
310 : }
311 :
312 : return (TDSAUTHENTICATION *) auth;
313 : }
314 :
315 : #ifndef HAVE_ERROR_MESSAGE
316 : static const char *
317 : tds_error_message(OM_uint32 e)
318 : {
319 0 : const char *m = strerror(e);
320 0 : if (m == NULL)
321 : return "";
322 : return m;
323 : }
324 : #define error_message tds_error_message
325 : #endif
326 :
327 : static gss_channel_bindings_t
328 0 : tds_gss_get_channel_binding(TDSSOCKET *tds)
329 : {
330 : unsigned char app_data[256];
331 : size_t app_data_len;
332 : gss_channel_bindings_t cb;
333 :
334 0 : app_data_len = tds_ssl_get_cb(tds->conn, app_data, sizeof(app_data));
335 0 : if (app_data_len == 0)
336 : return GSS_C_NO_CHANNEL_BINDINGS;
337 :
338 0 : cb = calloc(sizeof(struct gss_channel_bindings_struct) + app_data_len, sizeof(char));
339 :
340 0 : if (!cb) {
341 0 : tdsdump_log(TDS_DBG_NETWORK, "tds_gss_get_channel_binding: failed to allocate channel bindings\n");
342 : return GSS_C_NO_CHANNEL_BINDINGS;
343 : }
344 :
345 0 : cb->initiator_addrtype = GSS_C_AF_UNSPEC;
346 0 : cb->initiator_address.length = 0;
347 0 : cb->acceptor_addrtype = GSS_C_AF_UNSPEC;
348 0 : cb->acceptor_address.length = 0;
349 0 : cb->application_data.value = (void *) (cb + 1);
350 :
351 0 : cb->application_data.length = app_data_len;
352 :
353 0 : memcpy(cb->application_data.value, app_data, app_data_len);
354 :
355 0 : tdsdump_dump_buf(TDS_DBG_NETWORK, "gss_channel_bindings_struct", cb, sizeof(struct gss_channel_bindings_struct));
356 0 : tdsdump_dump_buf(TDS_DBG_NETWORK,
357 : "gss_channel_bindings_struct.application_data", cb->application_data.value, cb->application_data.length);
358 : return cb;
359 : }
360 :
361 : static TDSRET
362 0 : tds_gss_continue(TDSSOCKET *tds, TDSGSSAUTH *auth, gss_buffer_desc *token_ptr)
363 : {
364 : gss_buffer_desc send_tok;
365 0 : OM_uint32 maj_stat, min_stat = 0;
366 : OM_uint32 ret_flags;
367 : int gssapi_flags;
368 0 : const char *msg = "???";
369 0 : gss_OID pmech = GSS_C_NULL_OID;
370 : gss_channel_bindings_t cb;
371 :
372 0 : auth->last_stat = GSS_S_COMPLETE;
373 :
374 0 : send_tok.value = NULL;
375 0 : send_tok.length = 0;
376 :
377 : /*
378 : * Perform the context-establishement loop.
379 : *
380 : * On each pass through the loop, token_ptr points to the token
381 : * to send to the server (or GSS_C_NO_BUFFER on the first pass).
382 : * Every generated token is stored in send_tok which is then
383 : * transmitted to the server; every received token is stored in
384 : * recv_tok, which token_ptr is then set to, to be processed by
385 : * the next call to gss_init_sec_context.
386 : *
387 : * GSS-API guarantees that send_tok's length will be non-zero
388 : * if and only if the server is expecting another token from us,
389 : * and that gss_init_sec_context returns GSS_S_CONTINUE_NEEDED if
390 : * and only if the server has another token to send us.
391 : */
392 :
393 : /*
394 : * We always want to ask for the replay, and integ flags.
395 : * We may ask for delegation based on config in the tds.conf and other conf files.
396 : */
397 0 : gssapi_flags = GSS_C_REPLAY_FLAG | GSS_C_INTEG_FLAG;
398 :
399 0 : if (tds->login->gssapi_use_delegation)
400 0 : gssapi_flags |= GSS_C_DELEG_FLAG;
401 0 : if (tds->login->mutual_authentication || IS_TDS7_PLUS(tds->conn))
402 0 : gssapi_flags |= GSS_C_MUTUAL_FLAG;
403 :
404 0 : cb = tds_gss_get_channel_binding(tds);
405 :
406 0 : maj_stat =
407 0 : gss_init_sec_context(&min_stat, GSS_C_NO_CREDENTIAL, &auth->gss_context, auth->target_name, GSS_C_NULL_OID,
408 : gssapi_flags, 0, cb, token_ptr, &pmech, &send_tok, &ret_flags, NULL /* ignore time_rec */ );
409 :
410 0 : free(cb);
411 :
412 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_init_sec_context: actual mechanism at %p\n", pmech);
413 0 : if (pmech && pmech->elements) {
414 0 : tdsdump_dump_buf(TDS_DBG_NETWORK, "actual mechanism", pmech->elements, pmech->length);
415 : }
416 :
417 0 : auth->last_stat = maj_stat;
418 :
419 0 : switch (maj_stat) {
420 0 : case GSS_S_COMPLETE:
421 0 : msg = "GSS_S_COMPLETE: gss_init_sec_context completed successfully.";
422 0 : break;
423 0 : case GSS_S_CONTINUE_NEEDED:
424 0 : msg = "GSS_S_CONTINUE_NEEDED: gss_init_sec_context() routine must be called again.";
425 0 : break;
426 0 : case GSS_S_FAILURE:
427 0 : msg = "GSS_S_FAILURE: The routine failed for reasons that are not defined at the GSS level.";
428 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_init_sec_context: min_stat %ld \"%s\"\n",
429 : (long) min_stat, error_message(min_stat));
430 : break;
431 0 : case GSS_S_BAD_BINDINGS:
432 0 : msg = "GSS_S_BAD_BINDINGS: The channel bindings are not valid.";
433 0 : break;
434 0 : case GSS_S_BAD_MECH:
435 0 : msg = "GSS_S_BAD_MECH: The request security mechanism is not supported.";
436 0 : break;
437 0 : case GSS_S_BAD_NAME:
438 0 : msg = "GSS_S_BAD_NAME: The target_name parameter is not valid.";
439 0 : break;
440 0 : case GSS_S_BAD_SIG:
441 0 : msg = "GSS_S_BAD_SIG: The input token contains an incorrect integrity check value.";
442 0 : break;
443 0 : case GSS_S_CREDENTIALS_EXPIRED:
444 0 : msg = "GSS_S_CREDENTIALS_EXPIRED: The supplied credentials are no longer valid.";
445 0 : break;
446 0 : case GSS_S_DEFECTIVE_CREDENTIAL:
447 0 : msg = "GSS_S_DEFECTIVE_CREDENTIAL: Consistency checks performed on the credential failed.";
448 0 : break;
449 0 : case GSS_S_DEFECTIVE_TOKEN:
450 0 : msg = "GSS_S_DEFECTIVE_TOKEN: Consistency checks performed on the input token failed.";
451 0 : break;
452 0 : case GSS_S_DUPLICATE_TOKEN:
453 0 : msg = "GSS_S_DUPLICATE_TOKEN: The token is a duplicate of a token that has already been processed.";
454 0 : break;
455 0 : case GSS_S_NO_CONTEXT:
456 0 : msg = "GSS_S_NO_CONTEXT: The context handle provided by the caller does not refer to a valid security context.";
457 0 : break;
458 0 : case GSS_S_NO_CRED:
459 0 : msg = "GSS_S_NO_CRED: The supplied credential handle does not refer to a valid credential, the supplied credential is not";
460 0 : break;
461 0 : case GSS_S_OLD_TOKEN:
462 0 : msg = "GSS_S_OLD_TOKEN: The token is too old to be checked for duplication against previous tokens which have already been processed.";
463 0 : break;
464 : }
465 :
466 0 : if (GSS_ERROR(maj_stat)) {
467 0 : gss_release_buffer(&min_stat, &send_tok);
468 0 : tdsdump_log(TDS_DBG_NETWORK, "gss_init_sec_context: %s\n", msg);
469 : return TDS_FAIL;
470 : }
471 :
472 0 : auth->tds_auth.packet = (uint8_t *) send_tok.value;
473 0 : auth->tds_auth.packet_len = (int) send_tok.length;
474 :
475 0 : return TDS_SUCCESS;
476 : }
477 :
478 : static void
479 0 : tds5_send_msg(TDSSOCKET *tds, uint16_t msg_type)
480 : {
481 0 : tds_put_tinyint(tds, TDS_MSG_TOKEN);
482 0 : tds_put_tinyint(tds, 3); /* length */
483 0 : tds_put_tinyint(tds, 1); /* status, 1=has params */
484 0 : tds_put_smallint(tds, msg_type);
485 0 : }
486 :
487 : TDSRET
488 0 : tds5_gss_send(TDSSOCKET *tds)
489 : {
490 0 : uint32_t flags = TDS5_SEC_NETWORK_AUTHENTICATION;
491 :
492 0 : if (!tds->conn->authentication)
493 : return TDS_FAIL;
494 :
495 0 : if (tds->login) {
496 0 : if (tds->login->gssapi_use_delegation)
497 0 : flags |= TDS5_SEC_DELEGATION;
498 0 : if (tds->login->mutual_authentication)
499 0 : flags |= TDS5_SEC_MUTUAL_AUTHENTICATION;
500 : }
501 :
502 0 : tds5_send_msg(tds, TDS5_MSG_SEC_OPAQUE);
503 :
504 0 : tds_put_byte(tds, TDS5_PARAMFMT_TOKEN);
505 0 : TDS_START_LEN_USMALLINT(tds) {
506 0 : tds_put_smallint(tds, 5); /* # parameters */
507 :
508 0 : tds_put_n(tds, NULL, 6); /* name len + output + usertype */
509 0 : tds_put_tinyint(tds, SYBINTN);
510 0 : tds_put_tinyint(tds, 4);
511 0 : tds_put_tinyint(tds, 0); /* locale len */
512 :
513 0 : tds_put_n(tds, NULL, 6); /* name len + output + usertype */
514 0 : tds_put_tinyint(tds, SYBINTN);
515 0 : tds_put_tinyint(tds, 4);
516 0 : tds_put_tinyint(tds, 0); /* locale len */
517 :
518 0 : tds_put_n(tds, NULL, 6); /* name len + output + usertype */
519 0 : tds_put_tinyint(tds, SYBVARBINARY);
520 0 : tds_put_tinyint(tds, 255);
521 0 : tds_put_tinyint(tds, 0); /* locale len */
522 :
523 0 : tds_put_n(tds, NULL, 6); /* name len + output + usertype */
524 0 : tds_put_tinyint(tds, SYBLONGBINARY);
525 0 : tds_put_int(tds, 0x7fffffff);
526 0 : tds_put_tinyint(tds, 0); /* locale len */
527 :
528 0 : tds_put_n(tds, NULL, 6); /* name len + output + usertype */
529 0 : tds_put_tinyint(tds, SYBINTN);
530 0 : tds_put_tinyint(tds, 4);
531 0 : tds_put_tinyint(tds, 0); /* locale len */
532 0 : } TDS_END_LEN
533 :
534 0 : tds_put_byte(tds, TDS5_PARAMS_TOKEN);
535 :
536 0 : tds_put_tinyint(tds, 4);
537 0 : tds_put_int(tds, TDS5_SEC_VERSION);
538 :
539 0 : tds_put_tinyint(tds, 4);
540 0 : tds_put_int(tds, TDS5_SEC_SECSESS);
541 :
542 0 : tds_put_tinyint(tds, 12);
543 0 : tds_put_n(tds, "\x06\x0a\x2b\x06\x01\x04\x01\x87\x01\x04\x06\x06", 12); /* KRB5 Sybase OID */
544 :
545 0 : tds_put_int(tds, tds->conn->authentication->packet_len);
546 0 : tds_put_n(tds, tds->conn->authentication->packet, tds->conn->authentication->packet_len);
547 :
548 0 : tds_put_tinyint(tds, 4);
549 0 : tds_put_int(tds, flags);
550 :
551 0 : return TDS_SUCCESS;
552 : }
553 :
554 : /** @} */
555 :
556 : #endif
|