git: 8b46420daada - main - security/putty: upgrade to pre-release 0.78~pre20220916.e1b73f0

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Sun, 18 Sep 2022 11:35:09 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8b46420daadaf0c374278ab9e11e9eba069e834a

commit 8b46420daadaf0c374278ab9e11e9eba069e834a
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-09-16 22:04:43 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-09-18 11:35:04 +0000

    security/putty: upgrade to pre-release 0.78~pre20220916.e1b73f0
    
    ChangeLog: https://lists.tartarus.org/pipermail/putty-announce/2022/000034.html
    
    Please test this thoroughly and if you happen to have a Kerberos-
    or GSSAPI-enabled SSH server, please give the maintainer feedback
    whether GSSAPI works for you and which GSSAPI library you have
    installed.
---
 security/putty/Makefile            | 29 +++++++-----
 security/putty/distinfo            |  6 +--
 security/putty/files/patch-krb5cfg | 95 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+), 14 deletions(-)

diff --git a/security/putty/Makefile b/security/putty/Makefile
index 39c9b76a6fbe..77ec0c8b7e7c 100644
--- a/security/putty/Makefile
+++ b/security/putty/Makefile
@@ -1,8 +1,9 @@
 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
@@ -31,9 +32,12 @@ PLIST_FILES=	bin/plink \
 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>
@@ -75,19 +79,22 @@ CMAKE_ARGS+=	-DCMAKE_DISABLE_FIND_PACKAGE_X11:BOOL=TRUE
 
 .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:
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
+