"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "windows/wingss.c" between
putty-0.75.tar.gz and putty-0.76.tar.gz

About: PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator.

wingss.c  (putty-0.75):wingss.c  (putty-0.76)
skipping to change at line 97 skipping to change at line 97
PCtxtHandle context_handle; PCtxtHandle context_handle;
TimeStamp expiry; TimeStamp expiry;
} winSsh_gss_ctx; } winSsh_gss_ctx;
const Ssh_gss_buf gss_mech_krb5={9,"\x2A\x86\x48\x86\xF7\x12\x01\x02\x02"}; const Ssh_gss_buf gss_mech_krb5={9,"\x2A\x86\x48\x86\xF7\x12\x01\x02\x02"};
const char *gsslogmsg = NULL; const char *gsslogmsg = NULL;
static void ssh_sspi_bind_fns(struct ssh_gss_library *lib); static void ssh_sspi_bind_fns(struct ssh_gss_library *lib);
static tree234 *libraries_to_never_unload;
static int library_to_never_unload_cmp(void *av, void *bv)
{
uintptr_t a = (uintptr_t)av, b = (uintptr_t)bv;
return a < b ? -1 : a > b ? +1 : 0;
}
static void ensure_library_tree_exists(void)
{
if (!libraries_to_never_unload)
libraries_to_never_unload = newtree234(library_to_never_unload_cmp);
}
static bool library_is_in_never_unload_tree(HMODULE module)
{
ensure_library_tree_exists();
return find234(libraries_to_never_unload, module, NULL);
}
static void add_library_to_never_unload_tree(HMODULE module)
{
ensure_library_tree_exists();
add234(libraries_to_never_unload, module);
}
struct ssh_gss_liblist *ssh_gss_setup(Conf *conf) struct ssh_gss_liblist *ssh_gss_setup(Conf *conf)
{ {
HMODULE module; HMODULE module;
HKEY regkey; HKEY regkey;
struct ssh_gss_liblist *list = snew(struct ssh_gss_liblist); struct ssh_gss_liblist *list = snew(struct ssh_gss_liblist);
char *path; char *path;
static HMODULE kernel32_module; static HMODULE kernel32_module;
if (!kernel32_module) { if (!kernel32_module) {
kernel32_module = load_system32_dll("kernel32.dll"); kernel32_module = load_system32_dll("kernel32.dll");
} }
skipping to change at line 147 skipping to change at line 169
wchar_t *dllPath = wchar_t *dllPath =
dup_mb_to_wc(DEFAULT_CODEPAGE, 0, buffer); dup_mb_to_wc(DEFAULT_CODEPAGE, 0, buffer);
p_AddDllDirectory(dllPath); p_AddDllDirectory(dllPath);
sfree(dllPath); sfree(dllPath);
} }
strcat (buffer, "\\gssapi"MIT_KERB_SUFFIX".dll"); strcat (buffer, "\\gssapi"MIT_KERB_SUFFIX".dll");
module = LoadLibraryEx (buffer, NULL, module = LoadLibraryEx (buffer, NULL,
LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_SYSTEM32 |
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
LOAD_LIBRARY_SEARCH_USER_DIRS); LOAD_LIBRARY_SEARCH_USER_DIRS);
/*
* The MIT Kerberos DLL suffers an internal segfault
* for some reason if you unload and reload one within
* the same process. So, make sure that after we load
* this library, we never free it.
*
* Or rather: after we've loaded it once, if any
* _further_ load returns the same module handle, we
* immediately free it again (to prevent the Windows
* API's internal reference count growing without
* bound). But on the other hand we never free it in
* ssh_gss_cleanup.
*/
if (library_is_in_never_unload_tree(module))
FreeLibrary(module);
add_library_to_never_unload_tree(module);
} }
sfree(buffer); sfree(buffer);
} }
RegCloseKey(regkey); RegCloseKey(regkey);
} }
if (module) { if (module) {
struct ssh_gss_library *lib = struct ssh_gss_library *lib =
&list->libraries[list->nlibraries++]; &list->libraries[list->nlibraries++];
lib->id = 0; lib->id = 0;
skipping to change at line 281 skipping to change at line 320
/* /*
* LoadLibrary and FreeLibrary are defined to employ reference * LoadLibrary and FreeLibrary are defined to employ reference
* counting in the case where the same library is repeatedly * counting in the case where the same library is repeatedly
* loaded, so even in a multiple-sessions-per-process context * loaded, so even in a multiple-sessions-per-process context
* (not that we currently expect ever to have such a thing on * (not that we currently expect ever to have such a thing on
* Windows) it's safe to naively FreeLibrary everything here * Windows) it's safe to naively FreeLibrary everything here
* without worrying about destroying it under the feet of * without worrying about destroying it under the feet of
* another SSH instance still using it. * another SSH instance still using it.
*/ */
for (i = 0; i < list->nlibraries; i++) { for (i = 0; i < list->nlibraries; i++) {
FreeLibrary((HMODULE)list->libraries[i].handle); if (list->libraries[i].id != 0) {
HMODULE module = (HMODULE)list->libraries[i].handle;
if (!library_is_in_never_unload_tree(module))
FreeLibrary(module);
}
if (list->libraries[i].id == 2) { if (list->libraries[i].id == 2) {
/* The 'custom' id involves a dynamically allocated message. /* The 'custom' id involves a dynamically allocated message.
* Note that we must cast away the 'const' to free it. */ * Note that we must cast away the 'const' to free it. */
sfree((char *)list->libraries[i].gsslogmsg); sfree((char *)list->libraries[i].gsslogmsg);
} }
} }
sfree(list->libraries); sfree(list->libraries);
sfree(list); sfree(list);
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)