From 5daa05182bb15ece74703fc4c278268cbe882087 Mon Sep 17 00:00:00 2001 From: Steve Wills Date: Wed, 13 Jun 2018 13:16:51 +0000 Subject: MFH: r466686 r471978 r472316 sysutils/google-compute-engine-oslogin: update to version 1.1.5 PR: 226936 Submitted by: Helen Koike (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 (maintainer) Approved by: ports-secteam (implicit) --- sysutils/google-compute-engine-oslogin/Makefile | 10 +++-- sysutils/google-compute-engine-oslogin/distinfo | 6 +-- .../files/patch-Makefile | 11 ------ .../files/patch-bin_google__oslogin__control | 33 ++++++++++------ ...ch-libnss__cache__oslogin_nss__cache__oslogin.c | 46 ++++++++++++++++++++++ .../files/patch-nss__cache_nss__cache.cc | 13 ++++++ .../files/patch-nss__module_nss__oslogin.cc | 13 +++--- .../files/patch-pam__module_pam__oslogin__admin.cc | 2 +- .../files/patch-pam__module_pam__oslogin__login.cc | 2 +- .../files/patch-utils_oslogin__utils.cc | 4 +- sysutils/google-compute-engine-oslogin/pkg-plist | 3 ++ 11 files changed, 104 insertions(+), 39 deletions(-) delete mode 100644 sysutils/google-compute-engine-oslogin/files/patch-Makefile create mode 100644 sysutils/google-compute-engine-oslogin/files/patch-libnss__cache__oslogin_nss__cache__oslogin.c create mode 100644 sysutils/google-compute-engine-oslogin/files/patch-nss__cache_nss__cache.cc diff --git a/sysutils/google-compute-engine-oslogin/Makefile b/sysutils/google-compute-engine-oslogin/Makefile index f495bdd70a97..8f4d04f5fb99 100644 --- a/sysutils/google-compute-engine-oslogin/Makefile +++ b/sysutils/google-compute-engine-oslogin/Makefile @@ -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 \ diff --git a/sysutils/google-compute-engine-oslogin/distinfo b/sysutils/google-compute-engine-oslogin/distinfo index 218a7a9936b3..92f45032aeec 100644 --- a/sysutils/google-compute-engine-oslogin/distinfo +++ b/sysutils/google-compute-engine-oslogin/distinfo @@ -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 diff --git a/sysutils/google-compute-engine-oslogin/files/patch-Makefile b/sysutils/google-compute-engine-oslogin/files/patch-Makefile deleted file mode 100644 index f80e5295bef8..000000000000 --- a/sysutils/google-compute-engine-oslogin/files/patch-Makefile +++ /dev/null @@ -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) diff --git a/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control b/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control index 4a7122951497..0294fea503ca 100644 --- a/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control +++ b/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control @@ -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 diff --git a/sysutils/google-compute-engine-oslogin/files/patch-libnss__cache__oslogin_nss__cache__oslogin.c b/sysutils/google-compute-engine-oslogin/files/patch-libnss__cache__oslogin_nss__cache__oslogin.c new file mode 100644 index 000000000000..70e8adb10c78 --- /dev/null +++ b/sysutils/google-compute-engine-oslogin/files/patch-libnss__cache__oslogin_nss__cache__oslogin.c @@ -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 + #include + + // 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); ++} diff --git a/sysutils/google-compute-engine-oslogin/files/patch-nss__cache_nss__cache.cc b/sysutils/google-compute-engine-oslogin/files/patch-nss__cache_nss__cache.cc new file mode 100644 index 000000000000..798158742160 --- /dev/null +++ b/sysutils/google-compute-engine-oslogin/files/patch-nss__cache_nss__cache.cc @@ -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. diff --git a/sysutils/google-compute-engine-oslogin/files/patch-nss__module_nss__oslogin.cc b/sysutils/google-compute-engine-oslogin/files/patch-nss__module_nss__oslogin.cc index 14e17802d6a3..b21a6b04f04c 100644 --- a/sysutils/google-compute-engine-oslogin/files/patch-nss__module_nss__oslogin.cc +++ b/sysutils/google-compute-engine-oslogin/files/patch-nss__module_nss__oslogin.cc @@ -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 @@ -8,10 +8,13 @@ #include #include #include -@@ -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); diff --git a/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__admin.cc b/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__admin.cc index 343d64a74838..be094874af55 100644 --- a/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__admin.cc +++ b/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__admin.cc @@ -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 @@ diff --git a/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__login.cc b/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__login.cc index 08ce7062b08b..083462a403ea 100644 --- a/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__login.cc +++ b/sysutils/google-compute-engine-oslogin/files/patch-pam__module_pam__oslogin__login.cc @@ -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 @@ diff --git a/sysutils/google-compute-engine-oslogin/files/patch-utils_oslogin__utils.cc b/sysutils/google-compute-engine-oslogin/files/patch-utils_oslogin__utils.cc index 82830fc235d7..2ad4215a9d1e 100644 --- a/sysutils/google-compute-engine-oslogin/files/patch-utils_oslogin__utils.cc +++ b/sysutils/google-compute-engine-oslogin/files/patch-utils_oslogin__utils.cc @@ -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) { diff --git a/sysutils/google-compute-engine-oslogin/pkg-plist b/sysutils/google-compute-engine-oslogin/pkg-plist index 52fa576559ea..d4fe240eac5d 100644 --- a/sysutils/google-compute-engine-oslogin/pkg-plist +++ b/sysutils/google-compute-engine-oslogin/pkg-plist @@ -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 -- cgit v1.2.3