1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Unix Pageant: ability to build without GTK.

Unix Pageant is in a tricky position as a hybrid CLI/GUI application.
It has uses even in a purely CLI environment, but it won't build
without libgtk-3-dev and friends.

The solution, of course - enabled by the migration to cmake - is to
allow it to build without GTK, leaving out just the GTK askpass
functionality. That way you can still use it in any of its CLI modes,
either as a non-graphical SSH agent or as a client for an agent
elsewhere.

(You can still even use it in X lifetime mode, because its connection
to the X server is done using PuTTY's built-in X authentication and
connection setup code. It's only putting up the password prompt window
that you lose in this configuration - so you're still fine as long as
you don't try to add any encrypted keys.)
This commit is contained in:
Simon Tatham 2022-01-26 20:02:15 +00:00
parent 9d687e4177
commit d6a83fe336
2 changed files with 42 additions and 14 deletions

View File

@ -130,20 +130,6 @@ if(GTK_FOUND)
window.c unifont.c dialog.c config-gtk.c gtk-common.c config-unix.c unicode.c printing.c)
add_dependencies(guiterminal generated_licence_h) # dialog.c uses licence.h
add_executable(pageant
pageant.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
askpass.c
x11.c
noise.c
${CMAKE_SOURCE_DIR}/ssh/x11fwd.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c)
be_list(pageant Pageant)
target_link_libraries(pageant
eventloop console agent settings network crypto utils
${GTK_LIBRARIES})
installed_program(pageant)
add_executable(pterm
pterm.c
main-gtk-simple.c
@ -206,3 +192,26 @@ if(GTK_FOUND)
guiterminal eventloop otherbackends settings network charset utils
${GTK_LIBRARIES} ${X11_LIBRARIES})
endif()
# Pageant is built whether we have GTK or not; in its absence we
# degrade to a version that doesn't provide the GTK askpass.
if(GTK_FOUND)
set(pageant_conditional_sources askpass.c)
set(pageant_libs ${GTK_LIBRARIES})
else()
set(pageant_conditional_sources noaskpass.c no-gtk.c)
set(pageant_libs)
endif()
add_executable(pageant
pageant.c
${CMAKE_SOURCE_DIR}/stubs/nogss.c
x11.c
noise.c
${CMAKE_SOURCE_DIR}/ssh/x11fwd.c
${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
${pageant_conditional_sources})
be_list(pageant Pageant)
target_link_libraries(pageant
eventloop console agent settings network crypto utils
${pageant_libs})
installed_program(pageant)

19
unix/noaskpass.c Normal file
View File

@ -0,0 +1,19 @@
/*
* GTK implementation of a GUI password/passphrase prompt.
*/
#include "putty.h"
void random_add_noise(NoiseSourceId source, const void *noise, int length)
{
/* We have no keypress_prng here, so no need to implement this */
}
const bool buildinfo_gtk_relevant = false;
char *gtk_askpass_main(const char *display, const char *wintitle,
const char *prompt, bool *success)
{
*success = false;
return dupstr("this Pageant was built without GTK");
}