wingss.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. #ifndef NO_GSSAPI
  2. #include "putty.h"
  3. #define SECURITY_WIN32
  4. #include <security.h>
  5. #include "pgssapi.h"
  6. #include "sshgss.h"
  7. #include "sshgssc.h"
  8. #include "misc.h"
  9. /* Windows code to set up the GSSAPI library list. */
  10. const int ngsslibs = 3;
  11. const char *const gsslibnames[3] = {
  12. "MIT Kerberos GSSAPI32.DLL",
  13. "Microsoft SSPI SECUR32.DLL",
  14. "User-specified GSSAPI DLL",
  15. };
  16. const struct keyvalwhere gsslibkeywords[] = {
  17. { "gssapi32", 0, -1, -1 },
  18. { "sspi", 1, -1, -1 },
  19. { "custom", 2, -1, -1 },
  20. };
  21. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  22. AcquireCredentialsHandleA,
  23. (SEC_CHAR *, SEC_CHAR *, ULONG, PLUID,
  24. PVOID, SEC_GET_KEY_FN, PVOID, PCredHandle, PTimeStamp));
  25. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  26. InitializeSecurityContextA,
  27. (PCredHandle, PCtxtHandle, SEC_CHAR *, ULONG, ULONG,
  28. ULONG, PSecBufferDesc, ULONG, PCtxtHandle,
  29. PSecBufferDesc, PULONG, PTimeStamp));
  30. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  31. FreeContextBuffer,
  32. (PVOID));
  33. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  34. FreeCredentialsHandle,
  35. (PCredHandle));
  36. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  37. DeleteSecurityContext,
  38. (PCtxtHandle));
  39. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  40. QueryContextAttributesA,
  41. (PCtxtHandle, ULONG, PVOID));
  42. DECL_WINDOWS_FUNCTION(static, SECURITY_STATUS,
  43. MakeSignature,
  44. (PCtxtHandle, ULONG, PSecBufferDesc, ULONG));
  45. DECL_WINDOWS_FUNCTION(static, DLL_DIRECTORY_COOKIE,
  46. AddDllDirectory,
  47. (PCWSTR));
  48. typedef struct winSsh_gss_ctx {
  49. unsigned long maj_stat;
  50. unsigned long min_stat;
  51. CredHandle cred_handle;
  52. CtxtHandle context;
  53. PCtxtHandle context_handle;
  54. TimeStamp expiry;
  55. } winSsh_gss_ctx;
  56. #ifdef MPEXT
  57. static
  58. #endif
  59. const Ssh_gss_buf gss_mech_krb5={9,"\x2A\x86\x48\x86\xF7\x12\x01\x02\x02"};
  60. const char *gsslogmsg = NULL;
  61. static void ssh_sspi_bind_fns(struct ssh_gss_library *lib);
  62. struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, void *frontend) // MPEXT
  63. {
  64. HMODULE module;
  65. HKEY regkey;
  66. struct ssh_gss_liblist *list = snew(struct ssh_gss_liblist);
  67. char *path;
  68. static HMODULE kernel32_module;
  69. if (!kernel32_module) {
  70. kernel32_module = load_system32_dll("kernel32.dll");
  71. }
  72. #if (defined _MSC_VER && _MSC_VER < 1900) || defined MPEXT
  73. /* Omit the type-check because older MSVCs don't have this function */
  74. GET_WINDOWS_FUNCTION_NO_TYPECHECK(kernel32_module, AddDllDirectory);
  75. #else
  76. GET_WINDOWS_FUNCTION(kernel32_module, AddDllDirectory);
  77. #endif
  78. list->libraries = snewn(3, struct ssh_gss_library);
  79. list->nlibraries = 0;
  80. /* MIT Kerberos GSSAPI implementation */
  81. /* TODO: For 64-bit builds, check for gssapi64.dll */
  82. module = NULL;
  83. if (RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\MIT\\Kerberos", &regkey)
  84. == ERROR_SUCCESS) {
  85. DWORD type, size;
  86. LONG ret;
  87. char *buffer;
  88. /* Find out the string length */
  89. ret = RegQueryValueEx(regkey, "InstallDir", NULL, &type, NULL, &size);
  90. if (ret == ERROR_SUCCESS && type == REG_SZ) {
  91. buffer = snewn(size + 20, char);
  92. ret = RegQueryValueEx(regkey, "InstallDir", NULL,
  93. &type, (LPBYTE)buffer, &size);
  94. if (ret == ERROR_SUCCESS && type == REG_SZ) {
  95. strcat (buffer, "\\bin");
  96. if(p_AddDllDirectory) {
  97. /* Add MIT Kerberos' path to the DLL search path,
  98. * it loads its own DLLs further down the road */
  99. wchar_t *dllPath =
  100. dup_mb_to_wc(DEFAULT_CODEPAGE, 0, buffer);
  101. p_AddDllDirectory(dllPath);
  102. sfree(dllPath);
  103. }
  104. strcat (buffer, "\\gssapi32.dll");
  105. module = LoadLibraryEx (buffer, NULL,
  106. LOAD_LIBRARY_SEARCH_SYSTEM32 |
  107. LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
  108. LOAD_LIBRARY_SEARCH_USER_DIRS);
  109. }
  110. sfree(buffer);
  111. }
  112. RegCloseKey(regkey);
  113. }
  114. if (module) {
  115. struct ssh_gss_library *lib =
  116. &list->libraries[list->nlibraries++];
  117. lib->id = 0;
  118. lib->gsslogmsg = "Using GSSAPI from GSSAPI32.DLL";
  119. lib->handle = (void *)module;
  120. #define BIND_GSS_FN(name) \
  121. lib->u.gssapi.name = (t_gss_##name) GetProcAddress(module, "gss_" #name)
  122. BIND_GSS_FN(delete_sec_context);
  123. BIND_GSS_FN(display_status);
  124. BIND_GSS_FN(get_mic);
  125. BIND_GSS_FN(import_name);
  126. BIND_GSS_FN(init_sec_context);
  127. BIND_GSS_FN(release_buffer);
  128. BIND_GSS_FN(release_cred);
  129. BIND_GSS_FN(release_name);
  130. #undef BIND_GSS_FN
  131. ssh_gssapi_bind_fns(lib);
  132. }
  133. /* Microsoft SSPI Implementation */
  134. module = load_system32_dll("secur32.dll");
  135. if (module) {
  136. struct ssh_gss_library *lib =
  137. &list->libraries[list->nlibraries++];
  138. lib->id = 1;
  139. lib->gsslogmsg = "Using SSPI from SECUR32.DLL";
  140. lib->handle = (void *)module;
  141. #pragma option push -w-cpt
  142. GET_WINDOWS_FUNCTION(module, AcquireCredentialsHandleA);
  143. #pragma option pop
  144. GET_WINDOWS_FUNCTION(module, InitializeSecurityContextA);
  145. GET_WINDOWS_FUNCTION(module, FreeContextBuffer);
  146. GET_WINDOWS_FUNCTION(module, FreeCredentialsHandle);
  147. GET_WINDOWS_FUNCTION(module, DeleteSecurityContext);
  148. GET_WINDOWS_FUNCTION(module, QueryContextAttributesA);
  149. GET_WINDOWS_FUNCTION(module, MakeSignature);
  150. ssh_sspi_bind_fns(lib);
  151. }
  152. /*
  153. * Custom GSSAPI DLL.
  154. */
  155. module = NULL;
  156. path = conf_get_filename(conf, CONF_ssh_gss_custom)->path;
  157. if (*path) {
  158. if(p_AddDllDirectory) {
  159. /* Add the custom directory as well in case it chainloads
  160. * some other DLLs (e.g a non-installed MIT Kerberos
  161. * instance) */
  162. int pathlen = strlen(path);
  163. while (pathlen > 0 && path[pathlen-1] != ':' &&
  164. path[pathlen-1] != '\\')
  165. pathlen--;
  166. if (pathlen > 0 && path[pathlen-1] != '\\')
  167. pathlen--;
  168. if (pathlen > 0) {
  169. char *dirpath = dupprintf("%.*s", pathlen, path);
  170. wchar_t *dllPath = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, dirpath);
  171. p_AddDllDirectory(dllPath);
  172. sfree(dllPath);
  173. sfree(dirpath);
  174. }
  175. }
  176. module = LoadLibraryEx(path, NULL,
  177. LOAD_LIBRARY_SEARCH_SYSTEM32 |
  178. LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
  179. LOAD_LIBRARY_SEARCH_USER_DIRS);
  180. // MPEXT
  181. if (!module && frontend) {
  182. char *buf = dupprintf("Cannot load GSSAPI from user-specified library '%s': %s", path, win_strerror(GetLastError()));
  183. logevent(frontend, buf);
  184. sfree(buf);
  185. }
  186. }
  187. if (module) {
  188. struct ssh_gss_library *lib =
  189. &list->libraries[list->nlibraries++];
  190. lib->id = 2;
  191. lib->gsslogmsg = dupprintf("Using GSSAPI from user-specified"
  192. " library '%s'", path);
  193. lib->handle = (void *)module;
  194. #define BIND_GSS_FN(name) \
  195. lib->u.gssapi.name = (t_gss_##name) GetProcAddress(module, "gss_" #name)
  196. BIND_GSS_FN(delete_sec_context);
  197. BIND_GSS_FN(display_status);
  198. BIND_GSS_FN(get_mic);
  199. BIND_GSS_FN(import_name);
  200. BIND_GSS_FN(init_sec_context);
  201. BIND_GSS_FN(release_buffer);
  202. BIND_GSS_FN(release_cred);
  203. BIND_GSS_FN(release_name);
  204. #undef BIND_GSS_FN
  205. ssh_gssapi_bind_fns(lib);
  206. }
  207. return list;
  208. }
  209. void ssh_gss_cleanup(struct ssh_gss_liblist *list)
  210. {
  211. int i;
  212. /*
  213. * LoadLibrary and FreeLibrary are defined to employ reference
  214. * counting in the case where the same library is repeatedly
  215. * loaded, so even in a multiple-sessions-per-process context
  216. * (not that we currently expect ever to have such a thing on
  217. * Windows) it's safe to naively FreeLibrary everything here
  218. * without worrying about destroying it under the feet of
  219. * another SSH instance still using it.
  220. */
  221. for (i = 0; i < list->nlibraries; i++) {
  222. FreeLibrary((HMODULE)list->libraries[i].handle);
  223. if (list->libraries[i].id == 2) {
  224. /* The 'custom' id involves a dynamically allocated message.
  225. * Note that we must cast away the 'const' to free it. */
  226. sfree((char *)list->libraries[i].gsslogmsg);
  227. }
  228. }
  229. sfree(list->libraries);
  230. sfree(list);
  231. }
  232. static Ssh_gss_stat ssh_sspi_indicate_mech(struct ssh_gss_library *lib,
  233. Ssh_gss_buf *mech)
  234. {
  235. *mech = gss_mech_krb5;
  236. return SSH_GSS_OK;
  237. }
  238. static Ssh_gss_stat ssh_sspi_import_name(struct ssh_gss_library *lib,
  239. char *host, Ssh_gss_name *srv_name)
  240. {
  241. char *pStr;
  242. /* Check hostname */
  243. if (host == NULL) return SSH_GSS_FAILURE;
  244. /* copy it into form host/FQDN */
  245. pStr = dupcat("host/", host, NULL);
  246. *srv_name = (Ssh_gss_name) pStr;
  247. return SSH_GSS_OK;
  248. }
  249. static Ssh_gss_stat ssh_sspi_acquire_cred(struct ssh_gss_library *lib,
  250. Ssh_gss_ctx *ctx)
  251. {
  252. winSsh_gss_ctx *winctx = snew(winSsh_gss_ctx);
  253. memset(winctx, 0, sizeof(winSsh_gss_ctx));
  254. /* prepare our "wrapper" structure */
  255. winctx->maj_stat = winctx->min_stat = SEC_E_OK;
  256. winctx->context_handle = NULL;
  257. /* Specifying no principal name here means use the credentials of
  258. the current logged-in user */
  259. winctx->maj_stat = p_AcquireCredentialsHandleA(NULL,
  260. "Kerberos",
  261. SECPKG_CRED_OUTBOUND,
  262. NULL,
  263. NULL,
  264. NULL,
  265. NULL,
  266. &winctx->cred_handle,
  267. &winctx->expiry);
  268. if (winctx->maj_stat != SEC_E_OK) return SSH_GSS_FAILURE;
  269. *ctx = (Ssh_gss_ctx) winctx;
  270. return SSH_GSS_OK;
  271. }
  272. #ifdef MPEXT
  273. static SecBuffer ssh_gss_init_sec_buffer(unsigned long buffersize,
  274. unsigned long buffertype, void * buffer)
  275. {
  276. SecBuffer result;
  277. result.cbBuffer = buffersize;
  278. result.BufferType = buffertype;
  279. result.pvBuffer = buffer;
  280. return result;
  281. }
  282. static SecBufferDesc ssh_gss_init_sec_buffer_desc(unsigned long version,
  283. unsigned long bufferscount, PSecBuffer buffers)
  284. {
  285. SecBufferDesc result;
  286. result.ulVersion = version;
  287. result.cBuffers = bufferscount;
  288. result.pBuffers = buffers;
  289. return result;
  290. }
  291. #define MPEXT_INIT_SEC_BUFFER(BUFFERSIZE, BUFFERTYPE, BUFFER) \
  292. ssh_gss_init_sec_buffer(BUFFERSIZE, BUFFERTYPE, BUFFER)
  293. #define MPEXT_INIT_SEC_BUFFERDESC(VERSION, BUFFERSCOUNT, BUFFERS) \
  294. ssh_gss_init_sec_buffer_desc(VERSION, BUFFERSCOUNT, BUFFERS)
  295. #else
  296. #define MPEXT_INIT_SEC_BUFFER(BUFFERSIZE, BUFFERTYPE, BUFFER) \
  297. {BUFFERSIZE, BUFFERTYPE, BUFFER}
  298. #define MPEXT_INIT_SEC_BUFFERDESC(VERSION, BUFFERSCOUNT, BUFFERS) \
  299. {VERSION, BUFFERSCOUNT, BUFFERS}
  300. #endif
  301. static Ssh_gss_stat ssh_sspi_init_sec_context(struct ssh_gss_library *lib,
  302. Ssh_gss_ctx *ctx,
  303. Ssh_gss_name srv_name,
  304. int to_deleg,
  305. Ssh_gss_buf *recv_tok,
  306. Ssh_gss_buf *send_tok)
  307. {
  308. winSsh_gss_ctx *winctx = (winSsh_gss_ctx *) *ctx;
  309. SecBuffer wsend_tok = MPEXT_INIT_SEC_BUFFER(send_tok->length,SECBUFFER_TOKEN,send_tok->value);
  310. SecBuffer wrecv_tok = MPEXT_INIT_SEC_BUFFER(recv_tok->length,SECBUFFER_TOKEN,recv_tok->value);
  311. SecBufferDesc output_desc= MPEXT_INIT_SEC_BUFFERDESC(SECBUFFER_VERSION,1,&wsend_tok);
  312. SecBufferDesc input_desc = MPEXT_INIT_SEC_BUFFERDESC(SECBUFFER_VERSION,1,&wrecv_tok);
  313. unsigned long flags=ISC_REQ_MUTUAL_AUTH|ISC_REQ_REPLAY_DETECT|
  314. ISC_REQ_CONFIDENTIALITY|ISC_REQ_ALLOCATE_MEMORY;
  315. unsigned long ret_flags=0;
  316. /* check if we have to delegate ... */
  317. if (to_deleg) flags |= ISC_REQ_DELEGATE;
  318. winctx->maj_stat = p_InitializeSecurityContextA(&winctx->cred_handle,
  319. winctx->context_handle,
  320. (char*) srv_name,
  321. flags,
  322. 0, /* reserved */
  323. SECURITY_NATIVE_DREP,
  324. &input_desc,
  325. 0, /* reserved */
  326. &winctx->context,
  327. &output_desc,
  328. &ret_flags,
  329. &winctx->expiry);
  330. /* prepare for the next round */
  331. winctx->context_handle = &winctx->context;
  332. send_tok->value = wsend_tok.pvBuffer;
  333. send_tok->length = wsend_tok.cbBuffer;
  334. /* check & return our status */
  335. if (winctx->maj_stat==SEC_E_OK) return SSH_GSS_S_COMPLETE;
  336. if (winctx->maj_stat==SEC_I_CONTINUE_NEEDED) return SSH_GSS_S_CONTINUE_NEEDED;
  337. return SSH_GSS_FAILURE;
  338. }
  339. static Ssh_gss_stat ssh_sspi_free_tok(struct ssh_gss_library *lib,
  340. Ssh_gss_buf *send_tok)
  341. {
  342. /* check input */
  343. if (send_tok == NULL) return SSH_GSS_FAILURE;
  344. /* free Windows buffer */
  345. p_FreeContextBuffer(send_tok->value);
  346. SSH_GSS_CLEAR_BUF(send_tok);
  347. return SSH_GSS_OK;
  348. }
  349. static Ssh_gss_stat ssh_sspi_release_cred(struct ssh_gss_library *lib,
  350. Ssh_gss_ctx *ctx)
  351. {
  352. winSsh_gss_ctx *winctx= (winSsh_gss_ctx *) *ctx;
  353. /* check input */
  354. if (winctx == NULL) return SSH_GSS_FAILURE;
  355. /* free Windows data */
  356. p_FreeCredentialsHandle(&winctx->cred_handle);
  357. #ifdef MPEXT
  358. if (winctx->context_handle != NULL)
  359. #endif
  360. p_DeleteSecurityContext(&winctx->context);
  361. /* delete our "wrapper" structure */
  362. sfree(winctx);
  363. *ctx = (Ssh_gss_ctx) NULL;
  364. return SSH_GSS_OK;
  365. }
  366. static Ssh_gss_stat ssh_sspi_release_name(struct ssh_gss_library *lib,
  367. Ssh_gss_name *srv_name)
  368. {
  369. char *pStr= (char *) *srv_name;
  370. if (pStr == NULL) return SSH_GSS_FAILURE;
  371. sfree(pStr);
  372. *srv_name = (Ssh_gss_name) NULL;
  373. return SSH_GSS_OK;
  374. }
  375. static Ssh_gss_stat ssh_sspi_display_status(struct ssh_gss_library *lib,
  376. Ssh_gss_ctx ctx, Ssh_gss_buf *buf)
  377. {
  378. winSsh_gss_ctx *winctx = (winSsh_gss_ctx *) ctx;
  379. const char *msg;
  380. if (winctx == NULL) return SSH_GSS_FAILURE;
  381. /* decode the error code */
  382. switch (winctx->maj_stat) {
  383. case SEC_E_OK: msg="SSPI status OK"; break;
  384. case SEC_E_INVALID_HANDLE: msg="The handle passed to the function"
  385. " is invalid.";
  386. break;
  387. case SEC_E_TARGET_UNKNOWN: msg="The target was not recognized."; break;
  388. case SEC_E_LOGON_DENIED: msg="The logon failed."; break;
  389. case SEC_E_INTERNAL_ERROR: msg="The Local Security Authority cannot"
  390. " be contacted.";
  391. break;
  392. case SEC_E_NO_CREDENTIALS: msg="No credentials are available in the"
  393. " security package.";
  394. break;
  395. case SEC_E_NO_AUTHENTICATING_AUTHORITY:
  396. msg="No authority could be contacted for authentication."
  397. "The domain name of the authenticating party could be wrong,"
  398. " the domain could be unreachable, or there might have been"
  399. " a trust relationship failure.";
  400. break;
  401. case SEC_E_INSUFFICIENT_MEMORY:
  402. msg="One or more of the SecBufferDesc structures passed as"
  403. " an OUT parameter has a buffer that is too small.";
  404. break;
  405. case SEC_E_INVALID_TOKEN:
  406. msg="The error is due to a malformed input token, such as a"
  407. " token corrupted in transit, a token"
  408. " of incorrect size, or a token passed into the wrong"
  409. " security package. Passing a token to"
  410. " the wrong package can happen if client and server did not"
  411. " negotiate the proper security package.";
  412. break;
  413. default:
  414. msg = "Internal SSPI error";
  415. break;
  416. }
  417. buf->value = dupstr(msg);
  418. buf->length = strlen(buf->value);
  419. return SSH_GSS_OK;
  420. }
  421. static Ssh_gss_stat ssh_sspi_get_mic(struct ssh_gss_library *lib,
  422. Ssh_gss_ctx ctx, Ssh_gss_buf *buf,
  423. Ssh_gss_buf *hash)
  424. {
  425. winSsh_gss_ctx *winctx= (winSsh_gss_ctx *) ctx;
  426. SecPkgContext_Sizes ContextSizes;
  427. SecBufferDesc InputBufferDescriptor;
  428. SecBuffer InputSecurityToken[2];
  429. if (winctx == NULL) return SSH_GSS_FAILURE;
  430. winctx->maj_stat = 0;
  431. memset(&ContextSizes, 0, sizeof(ContextSizes));
  432. winctx->maj_stat = p_QueryContextAttributesA(&winctx->context,
  433. SECPKG_ATTR_SIZES,
  434. &ContextSizes);
  435. if (winctx->maj_stat != SEC_E_OK ||
  436. ContextSizes.cbMaxSignature == 0)
  437. return winctx->maj_stat;
  438. InputBufferDescriptor.cBuffers = 2;
  439. InputBufferDescriptor.pBuffers = InputSecurityToken;
  440. InputBufferDescriptor.ulVersion = SECBUFFER_VERSION;
  441. InputSecurityToken[0].BufferType = SECBUFFER_DATA;
  442. InputSecurityToken[0].cbBuffer = buf->length;
  443. InputSecurityToken[0].pvBuffer = buf->value;
  444. InputSecurityToken[1].BufferType = SECBUFFER_TOKEN;
  445. InputSecurityToken[1].cbBuffer = ContextSizes.cbMaxSignature;
  446. InputSecurityToken[1].pvBuffer = snewn(ContextSizes.cbMaxSignature, char);
  447. winctx->maj_stat = p_MakeSignature(&winctx->context,
  448. 0,
  449. &InputBufferDescriptor,
  450. 0);
  451. if (winctx->maj_stat == SEC_E_OK) {
  452. hash->length = InputSecurityToken[1].cbBuffer;
  453. hash->value = InputSecurityToken[1].pvBuffer;
  454. }
  455. return winctx->maj_stat;
  456. }
  457. static Ssh_gss_stat ssh_sspi_free_mic(struct ssh_gss_library *lib,
  458. Ssh_gss_buf *hash)
  459. {
  460. sfree(hash->value);
  461. return SSH_GSS_OK;
  462. }
  463. static void ssh_sspi_bind_fns(struct ssh_gss_library *lib)
  464. {
  465. lib->indicate_mech = ssh_sspi_indicate_mech;
  466. lib->import_name = ssh_sspi_import_name;
  467. lib->release_name = ssh_sspi_release_name;
  468. lib->init_sec_context = ssh_sspi_init_sec_context;
  469. lib->free_tok = ssh_sspi_free_tok;
  470. lib->acquire_cred = ssh_sspi_acquire_cred;
  471. lib->release_cred = ssh_sspi_release_cred;
  472. lib->get_mic = ssh_sspi_get_mic;
  473. lib->free_mic = ssh_sspi_free_mic;
  474. lib->display_status = ssh_sspi_display_status;
  475. }
  476. #else
  477. /* Dummy function so this source file defines something if NO_GSSAPI
  478. is defined. */
  479. void ssh_gss_init(void)
  480. {
  481. }
  482. #endif