1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-30 10:38:37 +00:00

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:	3a86f14ade
This commit is contained in:
Alexey Dokuchaev 2023-09-04 11:31:28 +00:00
parent 161c5b7100
commit b437f97ec2
2 changed files with 19 additions and 6 deletions

View File

@ -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>

View File

@ -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);