MFH: r466686 r471978 r472316

sysutils/google-compute-engine-oslogin: update to version 1.1.5

PR:		226936
Submitted by:	Helen Koike <helen.koike@collabora.com> (maintainer)

Mark as broken on various tier-2 archs.

Approved by:	portmgr (tier-2 blanket)

sysutils/google-compute-engine-oslogin: fix oslogin and update to 1.3.0

PR:		228949
Submitted by:	Helen Koike <helen.koike@collabora.com> (maintainer)

Approved by:	ports-secteam (implicit)
This commit is contained in:
Steve Wills 2018-06-13 13:16:51 +00:00
parent c85aa609e1
commit 5daa05182b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q2/; revision=472318
11 changed files with 104 additions and 39 deletions

View File

@ -1,8 +1,7 @@
# $FreeBSD$
PORTNAME= google-compute-engine-oslogin
DISTVERSION= 1.1.2
PORTREVISION= 1
DISTVERSION= 1.3.0
CATEGORIES= sysutils
MAINTAINER= helen.koike@collabora.com
@ -11,6 +10,10 @@ COMMENT= OS Login Guest Environment for Google Compute Engine
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/../LICENSE
BROKEN_mips= fails to compile: utils/oslogin_utils.cc:16:23: curl/curl.h: No such file or directory
BROKEN_mips64= fails to compile: utils/oslogin_utils.cc:16:23: curl/curl.h: No such file or directory
BROKEN_powerpc64= fails to compile: utils/oslogin_utils.cc:16:23: curl/curl.h: No such file or directory
LIB_DEPENDS= libcurl.so:ftp/curl \
libjson-c.so:devel/json-c
RUN_DEPENDS= gsed:textproc/gsed \
@ -22,7 +25,7 @@ USE_GCC= any
USE_GITHUB= yes
GH_ACCOUNT= GoogleCloudPlatform
GH_PROJECT= compute-image-packages
GH_TAGNAME= 20171213
GH_TAGNAME= 20180611
MAKE_ARGS= JSON_INCLUDE_PATH=${LOCALBASE}/include/json-c \
BIN_INSTALL_PATH=/bin \
PAM_INSTALL_PATH=/lib \
@ -39,6 +42,7 @@ post-patch:
post-install:
${LN} -sf libnss_${PORTNAME}-${DISTVERSION}.so ${STAGEDIR}${PREFIX}/lib/nss_oslogin.so.1
${LN} -sf libnss_cache_${PORTNAME}-${DISTVERSION}.so ${STAGEDIR}${PREFIX}/lib/nss_cache_oslogin.so.1
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/google_authorized_keys \
${STAGEDIR}${PREFIX}/lib/libnss_google-compute-engine-oslogin-${DISTVERSION}.so \
${STAGEDIR}${PREFIX}/lib/pam_oslogin_admin.so \

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1514471176
SHA256 (GoogleCloudPlatform-compute-image-packages-1.1.2-20171213_GH0.tar.gz) = 483d97c6d64cd7d9002247db63af8cb591e526a09ce52fd8d545c66da3ebb181
SIZE (GoogleCloudPlatform-compute-image-packages-1.1.2-20171213_GH0.tar.gz) = 131055
TIMESTAMP = 1528807879
SHA256 (GoogleCloudPlatform-compute-image-packages-1.3.0-20180611_GH0.tar.gz) = f71bdc6d01cff014bb4d066096be9a6e067fd3028c730cc4c9557001ec99ab6e
SIZE (GoogleCloudPlatform-compute-image-packages-1.3.0-20180611_GH0.tar.gz) = 143678

View File

@ -1,11 +0,0 @@
--- Makefile.orig 2017-12-13 23:47:59 UTC
+++ Makefile
@@ -15,7 +15,7 @@ AUTHKEYS_INSTALL_PATH = /usr/bin
JSON_INCLUDE_PATH = /usr/include/json-c
INCLUDE_FLAGS = -I$(JSON_INCLUDE_PATH)
-CXX = g++
+CXX ?= g++
CXXFLAGS += -fPIC# -Wall
PAMFLAGS = $(LDFLAGS) $(INCLUDE_FLAGS) -shared
NSSFLAGS = $(LDFLAGS) $(INCLUDE_FLAGS) -shared -Wl,-soname,$(NSS_LIBRARY_SONAME)

View File

@ -1,6 +1,6 @@
--- bin/google_oslogin_control.orig 2017-12-13 23:47:59 UTC
--- bin/google_oslogin_control.orig 2018-06-11 17:16:50 UTC
+++ bin/google_oslogin_control
@@ -65,29 +65,31 @@ overwrite_file() {
@@ -65,24 +65,26 @@ overwrite_file() {
remove_from_config() {
config=$1
@ -9,7 +9,11 @@
}
remove_from_nss_config() {
- sed -i '/^passwd:/ s/ cache_oslogin oslogin//' ${nss_config}.new
- sed -i '/^passwd:/ s/ cache oslogin//' ${nss_config}.new
- sed -i '/^passwd:/ s/ oslogin//' ${nss_config}.new
+ gsed -i '/^passwd:/ s/ cache_oslogin oslogin//' ${nss_config}.new
+ gsed -i '/^passwd:/ s/ cache oslogin//' ${nss_config}.new
+ gsed -i '/^passwd:/ s/ oslogin//' ${nss_config}.new
}
@ -23,24 +27,27 @@
add_to_nss_config() {
remove_from_nss_config
- sed -i '/^passwd:/ s/$/ oslogin/' ${nss_config}.new
+ gsed -i '/^passwd:/ s/$/ oslogin/' ${nss_config}.new
- sed -i '/^passwd:/ s/$/ cache_oslogin oslogin/' ${nss_config}.new
+ gsed -i '/^passwd:/ s/$/ cache_oslogin oslogin/' ${nss_config}.new
+ # Replace compat by files (as compat cannot be used with other sources)
+ gsed -i '/^passwd:/ s/compat/files/' ${nss_config}.new
}
add_to_pam_config() {
remove_from_config ${pam_config}
- sed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_admin}" ${pam_config}.new
- sed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_login}" ${pam_config}.new
- sed -i "/pam_loginuid.so/ a${added_comment}\n${pam_homedir}" ${pam_config}.new
+ gsed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_admin}" ${pam_config}.new
+ gsed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_login}" ${pam_config}.new
+ gsed -i "/session.*pam_permit.so/ a${added_comment}\n${pam_homedir}" ${pam_config}.new
@@ -99,9 +101,9 @@ ${pam_homedir}
"
echo "${added_config}$(cat ${pam_config}.new)" > ${pam_config}.new
else
- sed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_admin}" ${pam_config}.new
- sed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_login}" ${pam_config}.new
- sed -i "/pam_loginuid.so/ a${added_comment}\n${pam_homedir}" ${pam_config}.new
+ gsed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_admin}" ${pam_config}.new
+ gsed -i "/account.*pam_nologin.so/ a${added_comment}\n${pam_login}" ${pam_config}.new
+ gsed -i "/session.*pam_permit.so/ a${added_comment}\n${pam_homedir}" ${pam_config}.new
fi
}
restart_service() {
@@ -100,7 +102,7 @@ restart_service() {
@@ -115,7 +117,7 @@ restart_service() {
fi
fi
if which service > /dev/null 2>&1; then

View File

@ -0,0 +1,46 @@
--- libnss_cache_oslogin/nss_cache_oslogin.c.orig 2018-06-11 17:16:50 UTC
+++ libnss_cache_oslogin/nss_cache_oslogin.c
@@ -16,6 +16,7 @@
#include "nss_cache_oslogin.h"
+#include <nsswitch.h>
#include <sys/mman.h>
// Locking implementation: use pthreads.
@@ -32,7 +33,7 @@ static pthread_mutex_t mutex = PTHREAD_M
static FILE *p_file = NULL;
static char p_filename[NSS_CACHE_OSLOGIN_PATH_LENGTH] =
- "/etc/oslogin_passwd.cache";
+ "/usr/local/etc/oslogin_passwd.cache";
#ifdef BSD
extern int fgetpwent_r(FILE *, struct passwd *, char *, size_t,
struct passwd **);
@@ -435,3 +436,26 @@ enum nss_status _nss_cache_oslogin_getpw
return ret;
}
+
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwent_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_setpwent);
+NSS_METHOD_PROTOTYPE(__nss_compat_endpwent);
+
+static ns_mtab methods[] = {
+ { NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, (void*)_nss_cache_oslogin_getpwnam_r },
+ { NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, (void*)_nss_cache_oslogin_getpwuid_r },
+ { NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, (void*)_nss_cache_oslogin_getpwent_r },
+ { NSDB_PASSWD, "endpwent", __nss_compat_endpwent, (void*)_nss_cache_oslogin_endpwent },
+ { NSDB_PASSWD, "setpwent", __nss_compat_setpwent, (void*)_nss_cache_oslogin_setpwent },
+};
+
+ns_mtab *
+nss_module_register (const char *name, unsigned int *size,
+ nss_module_unregister_fn *unregister)
+{
+ *size = sizeof (methods) / sizeof (methods[0]);
+ *unregister = NULL;
+ return (methods);
+}

View File

@ -0,0 +1,13 @@
--- nss_cache/nss_cache.cc.orig 2018-06-11 17:16:50 UTC
+++ nss_cache/nss_cache.cc
@@ -31,8 +31,8 @@ using oslogin_utils::MutexLock;
using oslogin_utils::NssCache;
// File paths for the nss cache file.
-static const char kDefaultFilePath[] = "/etc/oslogin_passwd.cache";
-static const char kDefaultBackupFilePath[] = "/etc/oslogin_passwd.cache.bak";
+static const char kDefaultFilePath[] = "/usr/local/etc/oslogin_passwd.cache";
+static const char kDefaultBackupFilePath[] = "/usr/local/etc/oslogin_passwd.cache.bak";
// Local NSS Cache size. This affects the maximum number of passwd entries per
// http request.

View File

@ -1,4 +1,4 @@
--- nss_module/nss_oslogin.cc.orig 2017-12-13 23:47:59 UTC
--- nss_module/nss_oslogin.cc.orig 2018-06-11 17:16:50 UTC
+++ nss_module/nss_oslogin.cc
@@ -16,6 +16,7 @@
#include <errno.h>
@ -8,10 +8,13 @@
#include <pthread.h>
#include <pwd.h>
#include <sys/types.h>
@@ -150,4 +151,27 @@ int _nss_oslogin_getpwent_r(struct passw
}
return NSS_STATUS_SUCCESS;
}
@@ -103,4 +104,30 @@ int _nss_oslogin_getpwnam_r(const char *
// nss_getpwent_r() is intentionally left unimplemented. This functionality is
// now covered by the nss_cache binary and nss_cache module.
+void _nss_oslogin_getpwent_r() {}
+void _nss_oslogin_endpwent() {}
+void _nss_oslogin_setpwent() {}
+
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r);

View File

@ -1,4 +1,4 @@
--- pam_module/pam_oslogin_admin.cc.orig 2017-12-13 23:47:59 UTC
--- pam_module/pam_oslogin_admin.cc.orig 2018-06-11 17:16:50 UTC
+++ pam_module/pam_oslogin_admin.cc
@@ -14,7 +14,6 @@

View File

@ -1,4 +1,4 @@
--- pam_module/pam_oslogin_login.cc.orig 2017-12-13 23:47:59 UTC
--- pam_module/pam_oslogin_login.cc.orig 2018-06-11 17:16:50 UTC
+++ pam_module/pam_oslogin_login.cc
@@ -14,7 +14,6 @@

View File

@ -1,6 +1,6 @@
--- utils/oslogin_utils.cc.orig 2017-12-13 23:47:59 UTC
--- utils/oslogin_utils.cc.orig 2018-06-11 17:16:50 UTC
+++ utils/oslogin_utils.cc
@@ -218,7 +218,14 @@ bool ValidatePasswd(struct passwd* resul
@@ -255,7 +255,14 @@ bool ValidatePasswd(struct passwd* resul
}
}
if (strlen(result->pw_shell) == 0) {

View File

@ -1,6 +1,9 @@
bin/google_authorized_keys
bin/google_oslogin_control
bin/google_oslogin_nss_cache
lib/libnss_cache_google-compute-engine-oslogin-%%DISTVERSION%%.so
lib/libnss_google-compute-engine-oslogin-%%DISTVERSION%%.so
lib/nss_oslogin.so.1
lib/nss_cache_oslogin.so.1
lib/pam_oslogin_admin.so
lib/pam_oslogin_login.so