git: 8bb43708468c - main - security/pam_howdy: + PAM module for Howdy Face Recognition.

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Wed, 29 Mar 2023 11:38:49 UTC
The branch main has been updated by arrowd:

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

commit 8bb43708468c6d423b784981b1facdcfa61e1b45
Author:     Alexey Yushkin <636808@mail.ru>
AuthorDate: 2023-03-29 11:36:55 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2023-03-29 11:38:17 +0000

    security/pam_howdy: + PAM module for Howdy Face Recognition.
    
    This is a beta version for the upcoming release.
    
    Co-authored-by: Alexey Donskov <voxnod@gmail.com>
    
    Reviewed by:    arrowd
---
 security/Makefile                               |  1 +
 security/pam_howdy/Makefile                     | 33 ++++++++++++++++++++++
 security/pam_howdy/distinfo                     |  3 ++
 security/pam_howdy/files/patch-enter__device.cc | 10 +++++++
 security/pam_howdy/files/patch-main.cc          | 37 +++++++++++++++++++++++++
 security/pam_howdy/files/patch-meson.build      | 23 +++++++++++++++
 security/pam_howdy/pkg-descr                    |  3 ++
 7 files changed, 110 insertions(+)

diff --git a/security/Makefile b/security/Makefile
index 7a5c1905a97f..8138752548fa 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -721,6 +721,7 @@
     SUBDIR += pam_fprint
     SUBDIR += pam_google_authenticator
     SUBDIR += pam_helper
+    SUBDIR += pam_howdy
     SUBDIR += pam_jail
     SUBDIR += pam_kde
     SUBDIR += pam_krb5
diff --git a/security/pam_howdy/Makefile b/security/pam_howdy/Makefile
new file mode 100644
index 000000000000..60af8998ca62
--- /dev/null
+++ b/security/pam_howdy/Makefile
@@ -0,0 +1,33 @@
+PORTNAME=	pam_howdy
+PORTVERSION=	3.0.0.b
+CATEGORIES=	security
+
+MAINTAINER=	arrowd@FreeBSD.org
+COMMENT=	PAM module for Howdy Face Recognition
+WWW=		https://github.com/boltgolt/howdy
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/../../../LICENSE
+
+BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+LIB_DEPENDS=	libevdev.so:devel/libevdev \
+		libinih.so:devel/inih \
+		libINIReader.so:devel/inih \
+		libepoll-shim.so:devel/libepoll-shim
+
+USES=		gettext-runtime localbase:ldflags pkgconfig meson ninja
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	boltgolt
+GH_PROJECT=	howdy
+GH_TAGNAME=	30728a6d3634479c24ffd4e094c34a30bbb43058
+
+WRKSRC_SUBDIR=	howdy/src/pam
+PLIST_FILES=	lib/pam_howdy.so
+
+post-patch:
+	${REINPLACE_CMD} \
+		-e 's|/lib/security|${LOCALBASE}/lib|' \
+		${WRKSRC}/meson.build
+
+.include <bsd.port.mk>
diff --git a/security/pam_howdy/distinfo b/security/pam_howdy/distinfo
new file mode 100644
index 000000000000..6328e9b0e71d
--- /dev/null
+++ b/security/pam_howdy/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1680089055
+SHA256 (boltgolt-howdy-3.0.0.b-30728a6d3634479c24ffd4e094c34a30bbb43058_GH0.tar.gz) = 76078fbfb48a186678476cf9844987c97793a71135f1e612d761350c6b27fa42
+SIZE (boltgolt-howdy-3.0.0.b-30728a6d3634479c24ffd4e094c34a30bbb43058_GH0.tar.gz) = 130651
diff --git a/security/pam_howdy/files/patch-enter__device.cc b/security/pam_howdy/files/patch-enter__device.cc
new file mode 100644
index 000000000000..59eff8cc9ba2
--- /dev/null
+++ b/security/pam_howdy/files/patch-enter__device.cc
@@ -0,0 +1,10 @@
+--- enter_device.cc.orig	2023-03-08 16:41:32 UTC
++++ enter_device.cc
+@@ -3,6 +3,7 @@
+ #include <cstring>
+ #include <memory>
+ #include <stdexcept>
++#include <string>
+ 
+ EnterDevice::EnterDevice()
+     : raw_device(libevdev_new(), &libevdev_free),
diff --git a/security/pam_howdy/files/patch-main.cc b/security/pam_howdy/files/patch-main.cc
new file mode 100644
index 000000000000..6a3890b21e2d
--- /dev/null
+++ b/security/pam_howdy/files/patch-main.cc
@@ -0,0 +1,37 @@
+--- main.cc.orig	2023-03-08 16:41:32 UTC
++++ main.cc
+@@ -35,13 +35,25 @@
+ #include <INIReader.h>
+ 
+ #include <security/pam_appl.h>
++
++#ifndef __FreeBSD__
+ #include <security/pam_ext.h>
++#else
++#include <sys/types.h>
++#include <security/pam_appl.h>
++#endif
++
+ #include <security/pam_modules.h>
+ 
++
+ #include "enter_device.hh"
+ #include "main.hh"
+ #include "optional_task.hh"
+ 
++#ifdef __FreeBSD__
++#define euidaccess eaccess
++#endif
++
+ const auto DEFAULT_TIMEOUT =
+     std::chrono::duration<int, std::chrono::milliseconds::period>(100);
+ const auto MAX_RETRIES = 5;
+@@ -229,7 +241,7 @@ auto identify(pam_handle_t *pamh, int flags, int argc,
+ 
+   // Wrap the PAM conversation function in our own, easier function
+   auto conv_function = [conv](int msg_type, const char *msg_str) {
+-    const struct pam_message msg = {.msg_style = msg_type, .msg = msg_str};
++    const struct pam_message msg = {.msg_style = msg_type, .msg = const_cast<char *>(msg_str)};
+     const struct pam_message *msgp = &msg;
+ 
+     struct pam_response res = {};
diff --git a/security/pam_howdy/files/patch-meson.build b/security/pam_howdy/files/patch-meson.build
new file mode 100644
index 000000000000..761de0f00a2c
--- /dev/null
+++ b/security/pam_howdy/files/patch-meson.build
@@ -0,0 +1,23 @@
+--- meson.build.orig	2023-03-08 16:41:32 UTC
++++ meson.build
+@@ -5,6 +5,11 @@ threads = dependency('threads')
+ libpam = meson.get_compiler('cpp').find_library('pam')
+ threads = dependency('threads')
+ 
++# On FreeBSD, libepoll-shim library is required for signalfd.h
++epoll_shim = dependency('epoll-shim', required : false)
++# On libintl library is required for gettext
++libintl_dep = meson.get_compiler('cpp').find_library('intl', required: false)
++
+ # Translations
+ subdir('po')
+ 
+@@ -17,6 +22,8 @@ shared_library(
+ 		inih_cpp,
+ 		threads,
+ 		libevdev,
++		epoll_shim,
++		libintl_dep,
+ 	],
+ 	install: true,
+ 	install_dir: '/lib/security',
diff --git a/security/pam_howdy/pkg-descr b/security/pam_howdy/pkg-descr
new file mode 100644
index 000000000000..2b5965ff998a
--- /dev/null
+++ b/security/pam_howdy/pkg-descr
@@ -0,0 +1,3 @@
+Howdy PAM is an authentication tool that allows you to unlock your desktop
+session using your webcam. It uses facial recognition to authenticate and
+unlock the session. This package provides PAM module for Howdy.