diff --git a/security/putty/Makefile b/security/putty/Makefile
index 39c9b76a6fbe..77ec0c8b7e7c 100644
--- a/security/putty/Makefile
+++ b/security/putty/Makefile
@@ -1,108 +1,115 @@
 PORTNAME=	putty
-PORTVERSION=	0.77
+DISTVERSION=	0.78~pre20220916.e1b73f0
 CATEGORIES=	security
-MASTER_SITES=	http://the.earth.li/~sgtatham/putty/${PORTVERSION}/ \
-		ftp://ftp.chiark.greenend.org.uk/users/sgtatham/putty-latest/
+#MASTER_SITES=	http://the.earth.li/~sgtatham/putty/${PORTVERSION}/ \
+#		ftp://ftp.chiark.greenend.org.uk/users/sgtatham/putty-latest/
+MASTER_SITES=	https://tartarus.org/~simon/putty-prerel-snapshots/
 
 MAINTAINER=	mandree@FreeBSD.org
 COMMENT=	Secure shell and telnet client including xterm emulator
 WWW=		https://www.chiark.greenend.org.uk/~sgtatham/putty/
 # test plan: test ALL 4 GSSAPI_* options, GTK3 yes/no, WITH_DEBUG=yes build.
 
 LICENSE=	MIT
 LICENSE_FILE=	${PATCH_WRKSRC}/LICENCE
 
 USES=		cmake cpe perl5 pkgconfig
 USE_PERL5=	build
 
 CONFLICTS_INSTALL?=	pssh putty-nogtk
 
 PLIST_FILES=	bin/plink \
 		bin/pscp \
 		bin/psftp \
 		bin/psusan \
 		bin/puttygen \
 		share/man/man1/plink.1.gz \
 		share/man/man1/pscp.1.gz \
 		share/man/man1/psftp.1.gz \
 		share/man/man1/psusan.1.gz \
 		share/man/man1/puttygen.1.gz
 
 OPTIONS_DEFINE=			GTK3
 OPTIONS_DEFAULT=		GSSAPI_NONE GTK3
 OPTIONS_SINGLE=			GSSAPI_SELECT
-OPTIONS_SINGLE_GSSAPI_SELECT=	GSSAPI_MIT \
-				GSSAPI_DYNAMIC \
-				GSSAPI_NONE
+OPTIONS_SINGLE_GSSAPI_SELECT=	GSSAPI_DYNAMIC GSSAPI_NONE
+#OPTIONS_SINGLE_GSSAPI_SELECT=	GSSAPI_BASE \
+#				GSSAPI_DYNAMIC \
+#				GSSAPI_HEIMDAL \
+#				GSSAPI_MIT \
+#				GSSAPI_NONE
 GSSAPI_DYNAMIC_DESC=	EXPERIMENTAL dynamic runtime load of GSS libs
 
 .include <bsd.port.options.mk>
 
 LDFLAGS+=	-Wl,--as-needed
 
 # XXX FIXME this is simplified on these assumptions:
 # - we only support GTK3 in FreeBSD
 #   (Putty would support EOL GTK2 and GTK1 as well)
 # - Putty 0.77 cannot have X11 without the gdk/gdkx.h header i. e. GTK.
 .if ${PORT_OPTIONS:MGTK3} && !defined(WITHOUT_X11)
 USES+=		xorg
 USE_XORG=	x11
 USES+=		gnome
 USE_GNOME=	cairo gdkpixbuf2 gtk30
 CMAKE_ARGS+=	-DPUTTY_GTK_VERSION:STRING=3
 
 PLIST_FILES+=	bin/pageant \
 		bin/pterm \
 		bin/putty \
 		share/man/man1/pageant.1.gz \
 		share/man/man1/pterm.1.gz \
 		share/man/man1/putty.1.gz \
 		share/pixmaps/putty.ico
 DESKTOP_ENTRIES=	"PuTTY" \
 			"${COMMENT}" \
 			"${PREFIX}/share/pixmaps/${PORTNAME}.ico" \
 			"${PORTNAME}" \
 			"" \
 			false
 .else
 # XXX FIXME HACK ALERT
 # PUTTY_GTK_VERSION=OFF is not a valid choice, but manages to
 # skip all version comparisons for GTK in cmake/gtk.cmake:
 CMAKE_ARGS+=	-DPUTTY_GTK_VERSION:STRING=OFF
 # this is standard stuff:
 CMAKE_ARGS+=	-DCMAKE_DISABLE_FIND_PACKAGE_X11:BOOL=TRUE
 .endif
 
 .if ${PORT_OPTIONS:MGSSAPI_HEIMDAL}
 # does not compile currently
-BROKEN=		GSSAPI_HEIMDAL does not compile as of putty 0.77
+BROKEN=		GSSAPI_HEIMDAL does not compile as of putty 0.77 and 0.78~pre20220916.e1b73f0
 USES+=		gssapi:heimdal,flags
 CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
+.elif ${PORT_OPTIONS:MGSSAPI_BASE}
+BROKEN=		GSSAPI_BASE does not work as of putty 0.77 and 0.78~pre20220916.e1b73f0
+USES+=		gssapi:base,flags
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
 .elif ${PORT_OPTIONS:MGSSAPI_MIT}
+BROKEN=		GSSAPI_MIT does not work as of putty 0.77 and 0.78~pre20220916.e1b73f0
 USES+=		gssapi:mit,flags
 CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=STATIC
 .elif ${PORT_OPTIONS:MGSSAPI_DYNAMIC}
 CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=DYNAMIC
+USES+=		gssapi:base,flags
 .else
-# XXX FIXME buglet in putty 0.77: PUTTY_GSSAPI=OFF
-# does not appear to get NO_GSSAPI into .build/CMakeFiles/cmake.h,
-# so we shove it down explicitly:
-CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=OFF -DNO_GSSAPI=ON
+CMAKE_ARGS+=	-DPUTTY_GSSAPI:STRING=OFF
 .endif
 
 post-patch:
 	# we don't want to inherit FreeBSD commits
 	# as PUTTY Git commit revisions,
 	# so pretend we do not have Git:
 	${REINPLACE_CMD} '/FindGit/d' \
 		${WRKSRC}/cmake/setup.cmake \
 		${WRKSRC}/doc/CMakeLists.txt
 
 post-install:
 .if ${PORT_OPTIONS:MGTK3}
 	@${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps
 	${INSTALL_DATA} ${WRKSRC}/windows/putty.ico \
 		${STAGEDIR}${PREFIX}/share/pixmaps/
 .endif
 
 .include <bsd.port.mk>
diff --git a/security/putty/distinfo b/security/putty/distinfo
index 0aa2ce19786d..c372db49ff29 100644
--- a/security/putty/distinfo
+++ b/security/putty/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1653681200
-SHA256 (putty-0.77.tar.gz) = 419a76f45238fd45f2c76b42438993056e74fa78374f136052aaa843085beae5
-SIZE (putty-0.77.tar.gz) = 2619481
+TIMESTAMP = 1663360961
+SHA256 (putty-0.78~pre20220916.e1b73f0.tar.gz) = 73d14697ea397f9eb4c6e5e127ef33a15a499947c129e502b3a55a40ce19388d
+SIZE (putty-0.78~pre20220916.e1b73f0.tar.gz) = 2810612
diff --git a/security/putty/files/patch-krb5cfg b/security/putty/files/patch-krb5cfg
new file mode 100644
index 000000000000..c0e700a9c1a3
--- /dev/null
+++ b/security/putty/files/patch-krb5cfg
@@ -0,0 +1,95 @@
+From 1992df5d7a1ea0636a62facbdb74d32cb4d5b50d Mon Sep 17 00:00:00 2001
+From: Simon Tatham <anakin@pobox.com>
+Date: Wed, 1 Jun 2022 10:48:14 +0100
+Subject: [PATCH] First attempt at supporting krb5-config.
+
+---
+ cmake/platforms/unix.cmake | 63 +++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 62 insertions(+), 1 deletion(-)
+
+diff --git ./cmake/platforms/unix.cmake ./cmake/platforms/unix.cmake
+index 291d1e64..95339f22 100644
+--- ./cmake/platforms/unix.cmake~
++++ ./cmake/platforms/unix.cmake
+@@ -108,16 +108,77 @@ if(PUTTY_GSSAPI STREQUAL DYNAMIC)
+ endif()
+ 
+ if(PUTTY_GSSAPI STREQUAL STATIC)
++  set(KRB5_CFLAGS)
++  set(KRB5_LDFLAGS)
++
++  # First try using pkg-config
+   find_package(PkgConfig)
+   pkg_check_modules(KRB5 krb5-gssapi)
++
++  # Failing that, try the dedicated krb5-config
++  if(NOT KRB5_FOUND)
++    find_program(KRB5_CONFIG krb5-config)
++    if(KRB5_CONFIG)
++      execute_process(COMMAND ${KRB5_CONFIG} --cflags gssapi
++        OUTPUT_VARIABLE krb5_config_cflags
++        OUTPUT_STRIP_TRAILING_WHITESPACE
++        RESULT_VARIABLE krb5_config_cflags_result)
++      execute_process(COMMAND ${KRB5_CONFIG} --libs gssapi
++        OUTPUT_VARIABLE krb5_config_libs
++        OUTPUT_STRIP_TRAILING_WHITESPACE
++        RESULT_VARIABLE krb5_config_libs_result)
++
++      if(krb5_config_cflags_result EQUAL 0 AND krb5_config_libs_result EQUAL 0)
++        set(KRB5_INCLUDE_DIRS)
++        set(KRB5_LIBRARY_DIRS)
++        set(KRB5_LIBRARIES)
++
++        # We can safely put krb5-config's cflags directly into cmake's
++        # cflags, without bothering to extract the include directories.
++        set(KRB5_CFLAGS ${krb5_config_cflags})
++
++        # But krb5-config --libs isn't so simple. It will actually
++        # deliver a mix of libraries and other linker options. We have
++        # to separate them for cmake purposes, because if we pass the
++        # whole lot to add_link_options then they'll appear too early
++        # in the command line (so that by the time our own code refers
++        # to GSSAPI functions it'll be too late to search these
++        # libraries for them), and if we pass the whole lot to
++        # link_libraries then it'll get confused about options that
++        # aren't libraries.
++        separate_arguments(krb5_config_libs NATIVE_COMMAND
++          ${krb5_config_libs})
++        foreach(opt ${krb5_config_libs})
++          string(REGEX MATCH "^-l" ok ${opt})
++          if(ok)
++            list(APPEND KRB5_LIBRARIES ${opt})
++            continue()
++          endif()
++          string(REGEX MATCH "^-L" ok ${opt})
++          if(ok)
++            string(REGEX REPLACE "^-L" "" optval ${opt})
++            list(APPEND KRB5_LIBRARY_DIRS ${optval})
++            continue()
++          endif()
++          list(APPEND KRB5_LDFLAGS ${opt})
++        endforeach()
++
++        message(STATUS "Found Kerberos via krb5-config")
++        set(KRB5_FOUND YES)
++      endif()
++    endif()
++  endif()
++
+   if(KRB5_FOUND)
+     include_directories(${KRB5_INCLUDE_DIRS})
+     link_directories(${KRB5_LIBRARY_DIRS})
+     link_libraries(${KRB5_LIBRARIES})
++    add_compile_options(${KRB5_CFLAGS})
++    add_link_options(${KRB5_LDFLAGS})
+     set(STATIC_GSSAPI ON)
+   else()
+     message(WARNING
+-      "Could not find krb5 via pkg-config -- \
++      "Could not find krb5 via pkg-config or krb5-config -- \
+ cannot provide static GSSAPI support")
+     set(NO_GSSAPI ON)
+   endif()
+-- 
+2.34.1
+