[PATCH] Add initial Travis CI support
by Dmitry V. Levin
This runs "make distcheck" using gcc-9, gcc-8, gcc-7, and clang
on x86_64, x86, x32, aarch64, s390x, and ppc64le architectures.
* .travis.yml: New file.
* ci/install-dependencies.sh: Likewise.
* ci/run-build-and-tests.sh: Likewise.
Resolves: https://github.com/linux-pam/linux-pam/issues/28
---
I've also pushed it to ldv/travis-ci branch.
.travis.yml | 115 +++++++++++++++++++++++++++++++++++++
ci/install-dependencies.sh | 83 ++++++++++++++++++++++++++
ci/run-build-and-tests.sh | 88 ++++++++++++++++++++++++++++
3 files changed, 286 insertions(+)
create mode 100644 .travis.yml
create mode 100755 ci/install-dependencies.sh
create mode 100755 ci/run-build-and-tests.sh
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..ae627ed4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,115 @@
+language: c
+
+dist: bionic
+
+before_install: ci/install-dependencies.sh
+
+script: ci/run-build-and-tests.sh
+
+sudo: required
+
+git:
+ depth: 2147483647
+
+env:
+ global:
+ - VERBOSE=1
+
+matrix:
+ include:
+ - compiler: gcc
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: gcc-9
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: gcc-8
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: clang
+ arch: amd64
+ env:
+ - TARGET=x86_64
+ - compiler: gcc
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: gcc-9
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: gcc-8
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: clang
+ arch: amd64
+ env:
+ - TARGET=x86
+ - compiler: gcc
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: gcc-9
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: gcc-8
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: clang
+ arch: amd64
+ env:
+ - TARGET=x32
+ - compiler: gcc
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: gcc-9
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: gcc-8
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: clang
+ arch: arm64
+ env:
+ - TARGET=aarch64
+ - compiler: gcc
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: gcc-9
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: gcc-8
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: clang
+ arch: s390x
+ env:
+ - TARGET=s390x
+ - compiler: gcc
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
+ - compiler: gcc-9
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
+ - compiler: gcc-8
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
+ - compiler: clang
+ arch: ppc64le
+ env:
+ - TARGET=ppc64le
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
new file mode 100755
index 00000000..aaeaf389
--- /dev/null
+++ b/ci/install-dependencies.sh
@@ -0,0 +1,83 @@
+#!/bin/sh -ex
+#
+# Copyright (c) 2018-2019 The strace developers.
+# All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+j=-j`nproc` || j=
+type sudo >/dev/null 2>&1 && sudo=sudo || sudo=
+packages="
+autoconf
+automake
+autopoint
+bison
+bzip2
+docbook-xml
+docbook-xsl
+flex
+gettext
+libaudit-dev
+libcrack2-dev
+libdb-dev
+libfl-dev
+libselinux1-dev
+libtool
+libxcrypt-dev
+libxml2-utils
+make
+pkg-config
+sed
+w3m
+xsltproc
+xz-utils
+$CC"
+
+retry_if_failed()
+{
+ for i in `seq 0 99`; do
+ "$@" && i= && break || sleep 1
+ done
+ [ -z "$i" ]
+}
+
+updated=
+apt_get_install()
+{
+ [ -n "$updated" ] || {
+ retry_if_failed $sudo apt-get -qq update
+ updated=1
+ }
+ retry_if_failed $sudo \
+ apt-get -qq --no-install-suggests --no-install-recommends \
+ install -y "$@"
+}
+
+case "$CC" in
+ gcc-*)
+ retry_if_failed \
+ $sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+ ;;
+esac
+
+case "$TARGET" in
+ x32|x86)
+ packages="$packages gcc-multilib"
+ case "$CC" in
+ gcc-*) packages="$packages $CC-multilib" ;;
+ esac
+ ;;
+esac
+
+apt_get_install $packages
+
+case "${CHECK-}" in
+ coverage)
+ apt_get_install lcov python-pip python-setuptools
+ retry_if_failed \
+ pip install --user codecov
+ ;;
+ valgrind)
+ apt_get_install valgrind
+ ;;
+esac
diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
new file mode 100755
index 00000000..db55bdd0
--- /dev/null
+++ b/ci/run-build-and-tests.sh
@@ -0,0 +1,88 @@
+#!/bin/sh -ex
+#
+# Copyright (c) 2018-2019 The strace developers.
+# All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking'
+export DISTCHECK_CONFIGURE_FLAGS
+
+case "${TARGET-}" in
+ x32)
+ CC="$CC -mx32"
+ ;;
+ x86)
+ CC="$CC -m32"
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu"
+ ;;
+esac
+
+CPPFLAGS=
+
+case "${CHECK-}" in
+ coverage)
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-code-coverage"
+ CFLAGS='-g -O0'
+ CFLAGS_FOR_BUILD="$CFLAGS"
+ export CFLAGS CFLAGS_FOR_BUILD
+ ;;
+ valgrind)
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-valgrind"
+ ;;
+esac
+
+echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
+uname -a |head -1
+libc="$(ldd /bin/sh |sed -n 's|^[^/]*\(/[^ ]*/libc\.so[^ ]*\).*|\1|p' |head -1)"
+$libc |head -1
+$CC --version |head -1
+make --version |head -1
+autoconf --version |head -1
+automake --version |head -1
+libtoolize --version |head -1
+kver="$(printf '%s\n%s\n' '#include <linux/version.h>' 'LINUX_VERSION_CODE' | $CC $CPPFLAGS -E -P -)"
+printf 'kernel-headers %s.%s.%s\n' $(($kver/65536)) $(($kver/256%256)) $(($kver%256))
+echo 'END OF BUILD ENVIRONMENT INFORMATION'
+
+export CC_FOR_BUILD="$CC"
+
+./autogen.sh
+./configure $DISTCHECK_CONFIGURE_FLAGS \
+ || {
+ rc=$?
+ cat config.log
+ echo "$CC -dumpspecs follows"
+ $CC -dumpspecs
+ exit $rc
+}
+
+j=-j`nproc` || j=
+
+case "${CHECK-}" in
+ coverage)
+ make -k $j all VERBOSE=${VERBOSE-}
+ make -k $j check VERBOSE=${VERBOSE-}
+ codecov --gcov-args=-abcp ||:
+ echo 'BEGIN OF TEST SUITE INFORMATION'
+ tail -n 99999 -- tests*/test-suite.log
+ echo 'END OF TEST SUITE INFORMATION'
+ ;;
+ valgrind)
+ make -k $j all VERBOSE=${VERBOSE-}
+ rc=$?
+ for n in ${VALGRIND_TOOLS:-memcheck helgrind drd}; do
+ make -k $j -C "${VALGRIND_TESTDIR:-.}" \
+ check-valgrind-$n VERBOSE=${VERBOSE-} ||
+ rc=$?
+ done
+ echo 'BEGIN OF TEST SUITE INFORMATION'
+ tail -n 99999 -- tests*/test-suite*.log ||
+ rc=$?
+ echo 'END OF TEST SUITE INFORMATION'
+ [ "$rc" -eq 0 ]
+ ;;
+ *)
+ make -k $j distcheck VERBOSE=${VERBOSE-}
+ ;;
+esac
--
ldv
3 years, 11 months
[PATCH 00/33] Introduce pam_inline.h and use it to cleanup modules a bit
by Dmitry V. Levin
This series introduces a new internal header file for definitions
of handly inline functions and macros providing some convenient
functionality to libpam and its modules.
These macros are then used to cleanup the following coding patterns:
- sizeof(x) / sizeof(*x)
- if (!strncmp(*argv,"user_readenv=",13))
*user_readenv = atoi(13+*argv);
- if (strncasecmp(argv, "remember=", 9) == 0)
options->remember = strtol(&argv[9], NULL, 10);
I've also pushed the series to ldv/pam_str_skip_prefix branch
so you can have a look at travis build logs.
Dmitry V. Levin (33):
Introduce pam_inline.h
Use PAM_ARRAY_SIZE
Introduce pam_str_skip_prefix_len and pam_str_skip_prefix
modules/pam_access: use pam_str_skip_prefix
modules/pam_cracklib: use pam_str_skip_prefix
modules/pam_echo: use pam_str_skip_prefix
modules/pam_env: use pam_str_skip_prefix
modules/pam_ftp: use pam_str_skip_prefix
modules/pam_issue: use pam_str_skip_prefix
modules/pam_lastlog: use pam_str_skip_prefix
modules/pam_limits: use pam_str_skip_prefix
modules/pam_listfile: use pam_str_skip_prefix
modules/pam_localuser: use pam_str_skip_prefix
modules/pam_mail: use pam_str_skip_prefix
modules/pam_mkhomedir: use pam_str_skip_prefix
modules/pam_motd: use pam_str_skip_prefix
modules/pam_namespace: use pam_str_skip_prefix
modules/pam_nologin: use pam_str_skip_prefix
modules/pam_rhosts: use pam_str_skip_prefix
modules/pam_securetty: use pam_str_skip_prefix and pam_str_skip_prefix_len
modules/pam_selinux: use pam_str_skip_prefix
modules/pam_tally2: use pam_str_skip_prefix
modules/pam_tally: use pam_str_skip_prefix
modules/pam_timestamp: use pam_str_skip_prefix
modules/pam_tty_audit: use pam_str_skip_prefix
modules/pam_unix: use pam_str_skip_prefix and pam_str_skip_prefix_len
modules/pam_wheel: use pam_str_skip_prefix
modules/pam_xauth: use pam_str_skip_prefix
Introduce pam_str_skip_icase_prefix_len and pam_str_skip_icase_prefix
modules/pam_exec: use pam_str_skip_icase_prefix
modules/pam_pwhistory: use pam_str_skip_icase_prefix
modules/pam_umask: use pam_str_skip_icase_prefix
modules/pam_userdb: use pam_str_skip_icase_prefix
libpam/Makefile.am | 3 +-
libpam/include/pam_cc_compat.h | 6 +++
libpam/include/pam_inline.h | 60 +++++++++++++++++++++++
libpam/pam_handlers.c | 3 +-
modules/pam_access/pam_access.c | 19 +++++---
modules/pam_cracklib/pam_cracklib.c | 70 ++++++++++++++-------------
modules/pam_echo/pam_echo.c | 6 ++-
modules/pam_env/pam_env.c | 45 +++++++++--------
modules/pam_exec/pam_exec.c | 13 +++--
modules/pam_ftp/pam_ftp.c | 11 +++--
modules/pam_issue/pam_issue.c | 14 ++++--
modules/pam_lastlog/pam_lastlog.c | 19 +++++---
modules/pam_limits/pam_limits.c | 8 +--
modules/pam_listfile/pam_listfile.c | 14 +++---
modules/pam_localuser/pam_localuser.c | 7 ++-
modules/pam_mail/pam_mail.c | 10 ++--
modules/pam_mkhomedir/pam_mkhomedir.c | 11 +++--
modules/pam_motd/pam_motd.c | 10 ++--
modules/pam_namespace/pam_namespace.c | 7 +--
modules/pam_nologin/pam_nologin.c | 7 ++-
modules/pam_pwhistory/pam_pwhistory.c | 13 +++--
modules/pam_rhosts/pam_rhosts.c | 7 ++-
modules/pam_securetty/pam_securetty.c | 12 ++---
modules/pam_selinux/pam_selinux.c | 5 +-
modules/pam_tally/pam_tally.c | 29 ++++++-----
modules/pam_tally2/pam_tally2.c | 33 +++++++------
modules/pam_timestamp/hmacfile.c | 4 +-
modules/pam_timestamp/pam_timestamp.c | 15 ++++--
modules/pam_tty_audit/pam_tty_audit.c | 9 ++--
modules/pam_umask/pam_umask.c | 21 +++++---
modules/pam_unix/md5_crypt.c | 5 +-
modules/pam_unix/passverify.c | 3 +-
modules/pam_unix/support.c | 14 ++++--
modules/pam_userdb/pam_userdb.c | 15 +++---
modules/pam_wheel/pam_wheel.c | 6 ++-
modules/pam_xauth/pam_xauth.c | 33 +++++++------
tests/tst-pam_get_item.c | 10 ++--
tests/tst-pam_set_item.c | 8 +--
xtests/tst-pam_pwhistory1.c | 12 ++---
xtests/tst-pam_time1.c | 7 ++-
40 files changed, 377 insertions(+), 227 deletions(-)
create mode 100644 libpam/include/pam_inline.h
--
ldv
4 years
[PATCH] pam_get_authtok: fix i18n of default prompts
by Dmitry V. Levin
Change formatting of default prompts, making them translatable
to those languages that use a different word order.
From non-i18n perspective this change is essentially a no-op.
* libpam/pam_get_authtok.c (PROMPTCURRENT): Replace with
PROMPT_CURRENT_ARG and PROMPT_CURRENT_NOARG.
(PROMPT1): Replace with PROMPT_NEW_ARG and PROMPT_NEW_NOARG.
(PROMPT2): Replace with PROMPT_RETYPE_ARG and PROMPT_RETYPE_NOARG.
(pam_get_authtok_internal, pam_get_authtok_verify): Use new macros.
* po/Linux-PAM.pot: Regenerated.
Resolves: https://github.com/linux-pam/linux-pam/issues/29
---
libpam/pam_get_authtok.c | 54 +++++++++++++++++++++++++---------------
po/Linux-PAM.pot | 28 +++++++++++++++------
2 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/libpam/pam_get_authtok.c b/libpam/pam_get_authtok.c
index 99eb25f2..3fa7f7df 100644
--- a/libpam/pam_get_authtok.c
+++ b/libpam/pam_get_authtok.c
@@ -37,12 +37,15 @@
#include <security/pam_ext.h>
#define PROMPT _("Password: ")
-/* For Translators: "%s%s" could be replaced with "<service> " or "". */
-#define PROMPTCURRENT _("Current %s%spassword: ")
-/* For Translators: "%s%s" could be replaced with "<service> " or "". */
-#define PROMPT1 _("New %s%spassword: ")
-/* For Translators: "%s%s" could be replaced with "<service> " or "". */
-#define PROMPT2 _("Retype new %s%spassword: ")
+/* For Translators: "%s" is replaced with "<service>". */
+#define PROMPT_CURRENT_ARG _("Current %s password: ")
+#define PROMPT_CURRENT_NOARG _("Current password: ")
+/* For Translators: "%s" is replaced with "<service>". */
+#define PROMPT_NEW_ARG _("New %s password: ")
+#define PROMPT_NEW_NOARG _("New password: ")
+/* For Translators: "%s" is replaced with "<service>". */
+#define PROMPT_RETYPE_ARG _("Retype new %s password: ")
+#define PROMPT_RETYPE_NOARG _("Retype new password: ")
#define MISTYPED_PASS _("Sorry, passwords do not match.")
#define PAM_GETAUTHTOK_NOVERIFY 1
@@ -142,21 +145,30 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item,
{
pamh->authtok_verified = 0;
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
- PROMPT1, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ PROMPT_NEW_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ "%s", PROMPT_NEW_NOARG);
if (retval == PAM_SUCCESS && chpass > 1 && resp[0] != NULL)
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[1],
- PROMPT2, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ {
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[1],
+ PROMPT_RETYPE_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[1],
+ "%s", PROMPT_RETYPE_NOARG);
+ }
}
else if (item == PAM_OLDAUTHTOK)
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
- PROMPTCURRENT, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ {
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ PROMPT_CURRENT_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ "%s", PROMPT_CURRENT_NOARG);
+ }
else
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0], "%s",
- PROMPT);
+ retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0], "%s", PROMPT);
if (retval != PAM_SUCCESS || resp[0] == NULL ||
(chpass > 1 && resp[1] == NULL))
@@ -232,9 +244,11 @@ pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
retval = pam_get_item (pamh, PAM_AUTHTOK_TYPE, (const void **)&authtok_type);
if (retval != PAM_SUCCESS || authtok_type == NULL)
authtok_type = "";
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
- PROMPT2, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
+ PROMPT_RETYPE_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
+ "%s", PROMPT_RETYPE_NOARG);
}
if (retval != PAM_SUCCESS || resp == NULL)
diff --git a/po/Linux-PAM.pot b/po/Linux-PAM.pot
index 914a679c..b40adea8 100644
--- a/po/Linux-PAM.pot
+++ b/po/Linux-PAM.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Linux-PAM 1.4.0\n"
"Report-Msgid-Bugs-To: http://sourceforge.net/projects/pam\n"
-"POT-Creation-Date: 2020-03-03 10:51+0100\n"
+"POT-Creation-Date: 2020-03-05 20:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
@@ -38,29 +38,41 @@ msgstr ""
#: libpam/pam_get_authtok.c:41
#, c-format
-msgid "Current %s%spassword: "
+msgid "Current %s password: "
msgstr ""
-#: libpam/pam_get_authtok.c:43
+#: libpam/pam_get_authtok.c:42
+msgid "Current password: "
+msgstr ""
+
+#: libpam/pam_get_authtok.c:44
#, c-format
-msgid "New %s%spassword: "
+msgid "New %s password: "
msgstr ""
#: libpam/pam_get_authtok.c:45
+msgid "New password: "
+msgstr ""
+
+#: libpam/pam_get_authtok.c:47
#, c-format
-msgid "Retype new %s%spassword: "
+msgid "Retype new %s password: "
+msgstr ""
+
+#: libpam/pam_get_authtok.c:48
+msgid "Retype new password: "
msgstr ""
-#: libpam/pam_get_authtok.c:46
+#: libpam/pam_get_authtok.c:49
msgid "Sorry, passwords do not match."
msgstr ""
-#: libpam/pam_get_authtok.c:139 libpam/pam_get_authtok.c:228
+#: libpam/pam_get_authtok.c:142 libpam/pam_get_authtok.c:240
#, c-format
msgid "Retype %s"
msgstr ""
-#: libpam/pam_get_authtok.c:166 libpam/pam_get_authtok.c:244
+#: libpam/pam_get_authtok.c:178 libpam/pam_get_authtok.c:258
msgid "Password change has been aborted."
msgstr ""
--
ldv
4 years
pam_start_confdir implementation to address issue #143
by Tomas Mraz
The attached patch adds a new pam_start_confdir() API call to address
the issue #143. It allows setting a directory from which the service
PAM configuration is to be loaded. Please review.
--
Tomáš Mráz
No matter how far down the wrong road you've gone, turn back.
Turkish proverb
[You'll know whether the road is wrong if you carefully listen to your
conscience.]
4 years