git: b437f97ec2cb - main - security/pam-modules: redo previously committed incorrect build "fix"

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Mon, 04 Sep 2023 11:33:19 UTC
The branch main has been updated by danfe:

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

commit b437f97ec2cbdb27ca69fc8b09c7f3bb3014973e
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-09-04 11:31:28 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-09-04 11:31:28 +0000

    security/pam-modules: redo previously committed incorrect build "fix"
    
    The xgetname() function expecting `int (*)(char *, size_t)' was written
    for gethostname() which matches this (per POSIX), but also used against
    getdomainname() which does not (its `namelen' argument is int).  Rather
    than forcibly feeding non-matching function, create a thin wrapper with
    correct types.
    
    Fixes:  3a86f14adefa
---
 security/pam-modules/Makefile                      |  2 --
 .../files/patch-pam__innetgr_pam__innetgr.c        | 23 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/security/pam-modules/Makefile b/security/pam-modules/Makefile
index f6ddc291a0a7..5ccf8315e535 100644
--- a/security/pam-modules/Makefile
+++ b/security/pam-modules/Makefile
@@ -39,6 +39,4 @@ PGSQL_VARS=			WANT_PGSQL=client
 REGEX_CONFIGURE_ENABLE=		regex
 SYSLOG_CONFIGURE_ENABLE=	log
 
-.include <bsd.port.options.mk>
-
 .include <bsd.port.mk>
diff --git a/security/pam-modules/files/patch-pam__innetgr_pam__innetgr.c b/security/pam-modules/files/patch-pam__innetgr_pam__innetgr.c
index 8d0193e20744..286bdc7d4e2d 100644
--- a/security/pam-modules/files/patch-pam__innetgr_pam__innetgr.c
+++ b/security/pam-modules/files/patch-pam__innetgr_pam__innetgr.c
@@ -1,11 +1,26 @@
---- pam_innetgr/pam_innetgr.c.orig	2022-02-04 07:04:47.000000000 -0800
-+++ pam_innetgr/pam_innetgr.c	2023-08-28 06:57:10.213329000 -0700
-@@ -131,7 +131,7 @@
+--- pam_innetgr/pam_innetgr.c.orig	2022-02-04 15:04:47 UTC
++++ pam_innetgr/pam_innetgr.c
+@@ -121,6 +121,14 @@ stripdomain(char *hostname, char const *domainname)
+ 	return -1;
+ }
+ 
++#if HAVE_GETDOMAINNAME
++static int
++getdomainname_size_t(char *name, size_t namelen)
++{
++	return getdomainname(name, (int)namelen);
++}
++#endif
++
+ int
+ get_host_domain_names(char **host_name_ptr, char **domain_name_ptr)
+ {
+@@ -131,7 +139,7 @@ get_host_domain_names(char **host_name_ptr, char **dom
  		return -1;
  #if HAVE_GETDOMAINNAME
  	if (use_getdomainname) {
 -		if (xgetname(getdomainname, &domainname)) {
-+		if (xgetname((long int *) getdomainname, &domainname)) {
++		if (xgetname(getdomainname_size_t, &domainname)) {
  			_pam_log(LOG_ERR, "getdomainname: %s", strerror(errno));
  		} else if (strcmp (domainname, "(none)") == 0) {
  			free(domainname);