Browse Source

Bug 1586: Log more information about loading a custom GSSAPI library

https://winscp.net/tracker/1586

Source commit: 3dbd4d01ba701692462215939ca952fd6406db98
Martin Prikryl 8 years ago
parent
commit
14bbd88847

+ 1 - 1
source/core/PuttyIntf.cpp

@@ -677,7 +677,7 @@ bool __fastcall HasGSSAPI(UnicodeString CustomPath)
       Filename * filename = filename_from_str(UTF8String(CustomPath).c_str());
       conf_set_filename(conf, CONF_ssh_gss_custom, filename);
       filename_free(filename);
-      List = ssh_gss_setup(conf);
+      List = ssh_gss_setup(conf, NULL);
       for (int Index = 0; (has <= 0) && (Index < List->nlibraries); Index++)
       {
         ssh_gss_library * library = &List->libraries[Index];

+ 2 - 2
source/core/SessionInfo.cpp

@@ -1177,8 +1177,8 @@ void __fastcall TSessionLog::DoAddStartupInfo(TSessionData * Data)
          BooleanToEngStr(Data->AuthKI), BooleanToEngStr(Data->AuthGSSAPI)));
       if (Data->AuthGSSAPI)
       {
-        ADF(L"GSSAPI: Forwarding: %s",
-          (BooleanToEngStr(Data->GSSAPIFwdTGT)));
+        ADF(L"GSSAPI: Forwarding: %s; Libs: %s; Custom: %s",
+          (BooleanToEngStr(Data->GSSAPIFwdTGT), Data->GssLibList, Data->GssLibCustom));
       }
       ADF(L"Ciphers: %s; Ssh2DES: %s",
         (Data->CipherList, BooleanToEngStr(Data->Ssh2DES)));

+ 1 - 1
source/putty/ssh.c

@@ -9781,7 +9781,7 @@ static void do_ssh2_authconn(Ssh ssh, const unsigned char *in, int inlen,
                     /* Try loading the GSS libraries and see if we
                      * have any. */
                     if (!ssh->gsslibs)
-                        ssh->gsslibs = ssh_gss_setup(ssh->conf);
+                        ssh->gsslibs = ssh_gss_setup(ssh->conf, ssh->frontend); // MPEXT
                     s->can_gssapi = (ssh->gsslibs->nlibraries > 0);
                 } else {
                     /* No point in even bothering to try to load the

+ 1 - 1
source/putty/sshgss.h

@@ -47,7 +47,7 @@ struct ssh_gss_liblist {
     struct ssh_gss_library *libraries;
     int nlibraries;
 };
-struct ssh_gss_liblist *ssh_gss_setup(Conf *conf);
+struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, void *frontend);
 void ssh_gss_cleanup(struct ssh_gss_liblist *list);
 
 /*

+ 7 - 1
source/putty/windows/wingss.c

@@ -72,7 +72,7 @@ const char *gsslogmsg = NULL;
 
 static void ssh_sspi_bind_fns(struct ssh_gss_library *lib);
 
-struct ssh_gss_liblist *ssh_gss_setup(Conf *conf)
+struct ssh_gss_liblist *ssh_gss_setup(Conf *conf, void *frontend) // MPEXT
 {
     HMODULE module;
     HKEY regkey;
@@ -208,6 +208,12 @@ struct ssh_gss_liblist *ssh_gss_setup(Conf *conf)
                                LOAD_LIBRARY_SEARCH_SYSTEM32 |
                                LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
                                LOAD_LIBRARY_SEARCH_USER_DIRS);
+        // MPEXT
+        if (!module && frontend) {
+            char *buf = dupprintf("Cannot load GSSAPI from user-specified library '%s': %s", path, win_strerror(GetLastError()));
+            logevent(frontend, buf);
+            sfree(buf);
+        }
     }
     if (module) {
 	struct ssh_gss_library *lib =