diff --git a/.gitignore b/.gitignore index e69de29..4488e11 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,6 @@ +/.project +passwd-0.78.tar.bz2 +/passwd-0.78.99.tar.bz2 +/passwd-0.79.tar.bz2 +/passwd-0.80.tar.bz2 +/passwd-0.80.autotoolized.tar.bz2 diff --git a/passwd-0.80-S-output.patch b/passwd-0.80-S-output.patch new file mode 100644 index 0000000..5294d5e --- /dev/null +++ b/passwd-0.80-S-output.patch @@ -0,0 +1,48 @@ +diff --git a/libuser.c b/libuser.c +index 7a36520..06c6200 100644 +--- a/libuser.c ++++ b/libuser.c +@@ -245,6 +245,7 @@ pwdb_display_status(const char *username) + struct lu_ent *ent; + struct lu_error *error = NULL; + char *current; ++ char *current_user; + char *realname; + const char *msg; + int shadow = 1; +@@ -268,9 +269,10 @@ pwdb_display_status(const char *username) + goto bail; + } + current = lu_ent_get_first_value_strdup(ent, LU_SHADOWPASSWORD); ++ current_user = lu_ent_get_first_value_strdup(ent, LU_USERPASSWORD); + if (current == NULL) { + shadow = 0; +- current = lu_ent_get_first_value_strdup(ent, LU_USERPASSWORD); ++ current = current_user; + } else { + sp_lstchg = (time_t) ent_value_int64(ent, LU_SHADOWLASTCHANGE); + sp_min = ent_value_int64(ent, LU_SHADOWMIN); +@@ -310,6 +312,13 @@ pwdb_display_status(const char *username) + msg = _("Password set, DES crypt."); + } + if (shadow) { ++ if (status[0] != 'N' && current_user && strlen(current_user) == 0) { ++ fprintf(stderr, "%s: %s\n", progname, ++ _("There is a password information set in /etc/shadow," ++ " but the password field in /etc/passwd is empty.")); ++ msg = _("Empty password."); ++ status = "NP"; ++ } + sp_lstchg = sp_lstchg * 24L * 3600L; + localtime_r(&sp_lstchg, &tm); + strftime(date, sizeof(date), "%Y-%m-%d", &tm); +@@ -319,6 +328,9 @@ pwdb_display_status(const char *username) + printf("%s %s (%s)\n", realname, status, msg); + } + g_free(current); ++ if (shadow && current_user) { ++ g_free(current_user); ++ } + } else { + printf(_("No password set.\n")); + } diff --git a/passwd-0.80-manpage.patch b/passwd-0.80-manpage.patch new file mode 100644 index 0000000..b14fd0d --- /dev/null +++ b/passwd-0.80-manpage.patch @@ -0,0 +1,48 @@ +diff --git a/man/passwd.1 b/man/passwd.1 +index 1bc2a6e..9727b88 100644 +--- a/man/passwd.1 ++++ b/man/passwd.1 +@@ -40,7 +40,7 @@ + passwd \- update user's authentication tokens + + .SH SYNOPSIS +-.B passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username] ++.B passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [-?] [--usage] [username] + .sp 2 + .SH DESCRIPTION + The passwd utility is used to update user's authentication token(s). +@@ -82,7 +82,7 @@ function correctly. + .SH OPTIONS + + .TP +-\fB\-k\fR, \fB\-\-keep\fR ++\fB\-k\fR, \fB\-\-keep\-tokens\fR + The option + .B \-k + is used to indicate that the update should only be for expired +@@ -158,8 +158,8 @@ root only. + This will output a short information about the status of the password + for a given account. The status information consists of 7 fields. The + first field is the user's login name. The second field indicates if the +-user account has a locked password (L), has no password (NP), or has a +-usable password (P). The third field gives the date of the last password ++user account has a locked password (LK), has no password (NP), or has a ++usable password (PS). The third field gives the date of the last password + change. The next four fields are the minimum age, maximum age, warning + period, and inactivity period for the password. These ages are expressed + in days. +@@ -174,6 +174,14 @@ from the real date of the last password change by ±1 day. + .sp + This option is available to root only. + ++.TP ++\fB\-?\fR, \fB\-\-help\fR ++Print a help message and exit. ++ ++.TP ++\fB\-\-usage\fR ++Print a short usage message and exit. ++ + .SH "Remember the following two principles" + + .IP \fBProtect\ your\ password.\fR diff --git a/passwd.spec b/passwd.spec new file mode 100644 index 0000000..36f7883 --- /dev/null +++ b/passwd.spec @@ -0,0 +1,360 @@ +%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1} +%define WITH_SELINUX 1 +%endif +%if %{?WITH_AUDIT:0}%{!?WITH_AUDIT:1} +%define WITH_AUDIT 1 +%endif +Summary: An utility for setting or changing passwords using PAM +Name: passwd +Version: 0.80 +Release: 9%{?dist} +License: BSD or GPL+ +URL: https://pagure.io/passwd +Source: https://releases.pagure.org/passwd/passwd-%{version}.autotoolized.tar.bz2 +Patch0: passwd-0.80-manpage.patch +Patch1: passwd-0.80-S-output.patch +Requires: pam >= 1.0.90, /etc/pam.d/system-auth +%if %{WITH_SELINUX} +Requires: libselinux >= 2.1.6-3 +BuildRequires: libselinux-devel >= 2.1.6-3 +%endif +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/IJFYI5Q2BYZKIGDFS2WLOBDUSEGWHIKV/ +BuildRequires: gcc +BuildRequires: glib2-devel, libuser-devel, pam-devel, libuser >= 0.53-1 +BuildRequires: gettext, popt-devel +%if %{WITH_AUDIT} +BuildRequires: audit-libs-devel >= 2.4.5 +Requires: audit-libs >= 2.4.5 +%endif + +%description +This package contains a system utility (passwd) which sets +or changes passwords, using PAM (Pluggable Authentication +Modules) library. + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 -b .manpage +%patch1 -p1 -b .S-output + +%build +%configure \ +%if %{WITH_SELINUX} + --with-selinux \ +%else + --without-selinux \ +%endif +%if %{WITH_AUDIT} + --with-audit +%else + --without-audit +%endif +make DEBUG= RPM_OPT_FLAGS="$RPM_OPT_FLAGS" + +%install +rm -rf $RPM_BUILD_ROOT + +make install DESTDIR=$RPM_BUILD_ROOT +install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/ +install -m 644 passwd.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/passwd +%find_lang %{name} +for dir in $(ls -1d $RPM_BUILD_ROOT%{_mandir}/{??,??_??}) ; do + dir=$(echo $dir | sed -e "s|^$RPM_BUILD_ROOT||") + lang=$(basename $dir) + echo "%%lang($lang) $dir/man*/*" >> %{name}.lang +done + + +%files -f %{name}.lang +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc AUTHORS ChangeLog NEWS +%config(noreplace) %{_sysconfdir}/pam.d/passwd +%attr(4755,root,root) %{_bindir}/passwd +%{_mandir}/man1/passwd.1* + +%changelog +* Tue Jul 28 2020 Fedora Release Engineering - 0.80-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jan 29 2020 Fedora Release Engineering - 0.80-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Dec 04 2019 Jiri Kucera - 0.80-7 +- fix inconsistencies in manpage +- fix incorrect -S output + Resolves: #1612221, #1740166 + +* Fri Jul 26 2019 Fedora Release Engineering - 0.80-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 0.80-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.80-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Apr 17 2018 Jiri Kucera - 0.80-3 +- passwd-0.80 relies on AUDIT_ACCT_LOCK and AUDIT_ACCT_UNLOCK that + were introduced at audit-2.4.5 + +* Thu Apr 12 2018 Jiri Kucera - 0.80-2 +- Removed autotools dependencies + +* Thu Mar 29 2018 Jiri Kucera - 0.80-1 +- Update to passwd-0.80 + Resolves: #1293929 + +* Thu Mar 29 2018 Jiri Kucera - 0.79-15 +- Mercurial changeset ID changed to the corresponding Git + changeset ID + +* Wed Feb 21 2018 Jiri Kucera - 0.79-14 +- Added missing gcc dependency + +* Thu Feb 08 2018 Fedora Release Engineering - 0.79-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 0.79-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.79-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu Jul 20 2017 Miloslav Trmač - 0.79-10 +- Redirect URL: and Source: from fedorahosted.org to pagure.io + Resolves: #1472576 + +* Sat Feb 11 2017 Fedora Release Engineering - 0.79-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Feb 04 2016 Fedora Release Engineering - 0.79-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Mon Nov 2 2015 Miloslav Trmač - 0.79-7 +- Support passwords up to PAM_MAX_RESP_SIZE - 1 with --stdin + Resolves: #1187105 + +* Thu Jun 18 2015 Fedora Release Engineering - 0.79-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sun Aug 17 2014 Fedora Release Engineering - 0.79-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Wed Jul 30 2014 Tom Callaway - 0.79-4 +- fix license handling + +* Fri Jun 06 2014 Fedora Release Engineering - 0.79-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 0.79-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Sat Jun 22 2013 Miloslav Trmač - 0.79-1 +- Update to passwd-0.79 + Resolves: #926312, #948790 + +* Thu Feb 14 2013 Fedora Release Engineering - 0.78.99-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Dec 4 2012 Miloslav Trmač - 0.78.99-3 +- Fix License: + +* Fri Jul 20 2012 Fedora Release Engineering - 0.78.99-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jan 27 2012 Tomas Mraz 0.78.99-1 +- use better (auditable) libselinux calls for checking + the access to passwd (#518268) +- add support for the -e option as seen on Debian passwd +- make the binary PIE and full RELRO (#784483) + +* Fri Jan 13 2012 Fedora Release Engineering - 0.78-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Tomas Mraz 0.78-3 +- add the postlogin substack to the PAM configuration (#665063) + +* Fri Jul 16 2010 Tomas Mraz 0.78-1 +- added japanese translation of the man page (#611692) +- updated translations + +* Tue Apr 6 2010 Tomas Mraz 0.77-5 +- first part of fix for pam_gnome_keyring prompting (#578624) + needs support for use_authtok to be added to pam_gnome_keyring + +* Thu Jan 28 2010 Tomas Mraz 0.77-4 +- add COPYING and other things to doc +- correct the licence field + +* Mon Sep 14 2009 Tomas Mraz 0.77-1 +- updated translations +- improved manual page + +* Wed Feb 11 2009 Tomas Mraz 0.76-1 +- identify SHA-256 and SHA-512 password hashes (#484994) + +* Tue Apr 8 2008 Tomas Mraz 0.75-2 +- add optional pam_gnome_keyring module to passwd pam + config (#441225) + +* Wed Feb 20 2008 Tomas Mraz 0.75-1 +- fix disabling SELinux and audit in spec (#433284) +- remove obsolete no.po (#332121) +- updated translations + +* Tue Sep 25 2007 Tomas Mraz 0.74-5 +- buildrequires popt-devel + +* Wed Aug 22 2007 Tomas Mraz 0.74-4 +- spec file cleanups + +* Thu Apr 5 2007 Tomas Mraz 0.74-3 +- use std buildroot, add dist tag (#226232) + +* Tue Jan 30 2007 Tomas Mraz 0.74-2 +- do not explicitly strip the binary + +* Tue Dec 12 2006 Tomas Mraz 0.74-1 +- minor fixes in error reporting +- localize messages (#204022) + +* Mon Jul 17 2006 Tomas Mraz 0.73-1 +- fixed broken logic from the last change (#196851) + +* Fri Jul 14 2006 Tomas Mraz 0.72-1 +- merged audit patch to upstream cvs +- improved passwd -S output (#170344) +- make passwd -d work with stripped down proc (#196851) +- corrected link to pam docs (#193084) +- spec file cleanups + +* Wed Jul 12 2006 Jesse Keating - 0.71-3.2.1 +- rebuild + +* Fri Feb 10 2006 Jesse Keating - 0.71-3.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 0.71-3.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Tue Jan 31 2006 Steve Grubb 0.71-3 +- Adjust audit patch so it builds without libaudit + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Tue Oct 25 2005 Steve Grubb 0.71-2 +- adjust audit communication to use common logging functions + +* Fri Oct 7 2005 Tomas Mraz 0.71-1 +- use include instead of pam_stack in pam config + +* Fri Jun 17 2005 Tomas Mraz 0.70-1 +- replace laus with audit +- auto* build changes + +* Fri Jan 28 2005 Jindrich Novy 0.69-1 +- spec file fixes +- add libuser >= 0.53-1 BuildPrereq (#139331) + +* Tue Jan 25 2005 Dan Walsh +- improve SELinux priv checking + +* Mon Aug 23 2004 Jindrich Novy +- applied cleanup patch from Steve Grubb #120060 +- fixed man page #115380 +- added libselinux-devel to BuildPrereq #123750, #119416 + +* Thu Aug 19 2004 Jindrich Novy 0.68-10 +- moved to 0.68-10 to fix problem with RHEL4-Alpha4 #129548 +- updated GNU build scripts and file structure to recent style + +* Wed Feb 4 2004 Dan Walsh 0.68-8 +- add check for enforcing mode + +* Mon Jan 26 2004 Dan Walsh 0.68-7 +- fix is_selinux_enabled + +* Fri Sep 5 2003 Dan Walsh 0.68-6 +- turn off selinux + +* Fri Sep 5 2003 Dan Walsh 0.68-5.sel +- Add SELinux support + +* Mon Jul 28 2003 Dan Walsh 0.68-4 +- Add SELinux support + +* Thu Feb 13 2003 Nalin Dahyabhai 0.68-3 +- add aging adjustment flags to passwd(1)'s synopsis, were just in the + reference section before + +* Mon Jan 27 2003 Nalin Dahyabhai 0.68-2 +- rebuild + +* Mon Dec 9 2002 Nalin Dahyabhai 0.68-1 +- implement aging adjustments for pwdb + +* Mon Nov 11 2002 Nalin Dahyabhai 0.67-4 +- modify default PAM configuration file to not specify directories, so that + the same configuration can be used for all arches on multilib systems +- fix BuildPrereq on glib-devel to specify glib2-devel instead +- remove unpackaged files in %%install phase + +* Tue May 28 2002 Nalin Dahyabhai 0.67-3 +- rebuild + +* Mon May 20 2002 Nalin Dahyabhai 0.67-2 +- rebuild in new environment + +* Wed Mar 13 2002 Nalin Dahyabhai 0.67-1 +- add the -i, -n, -w, and -x options to passwd + +* Mon Mar 11 2002 Nalin Dahyabhai 0.65-5 +- rebuild + +* Mon Feb 25 2002 Nalin Dahyabhai 0.65-4 +- rebuild + +* Fri Feb 22 2002 Nalin Dahyabhai 0.65-3 +- rebuild + +* Thu Jan 31 2002 Nalin Dahyabhai 0.65-2 +- rebuild to get dependencies right + +* Tue Jan 29 2002 Nalin Dahyabhai 0.65-1 +- change dependency from pwdb to libuser + +* Fri Jan 25 2002 Nalin Dahyabhai 0.64.1-9 +- rebuild + +* Thu Aug 30 2001 Nalin Dahyabhai 0.64.1-8 +- man page fix (-r is the opposite of -l, not --stdin, which precedes it) + from Felipe Gustavo de Almeida + +* Mon Aug 6 2001 Nalin Dahyabhai 0.64.1-7 +- fix unguarded printf() (noted by Chris Evans) +- add missing build dependency on pwdb and pam-devel (#49550) + +* Sun Jun 24 2001 Elliot Lee +- Bump release + rebuild. + +* Wed Jul 12 2000 Prospector +- automatic rebuild + +* Mon Jun 5 2000 Nalin Dahyabhai +- move man pages to _mandir + +* Thu Jun 1 2000 Nalin Dahyabhai +- modify PAM setup to use system-auth +- modify for building as non-root users + +* Mon Feb 7 2000 Bill Nottingham +- fix manpage links + +* Fri Feb 04 2000 Nalin Dahyabhai +- document --stdin in man page +- fix for gzipped man pages + +* Sat Apr 10 1999 Cristian Gafton +- first build from the new source code base. diff --git a/sources b/sources new file mode 100644 index 0000000..f00d1b8 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (passwd-0.80.autotoolized.tar.bz2) = a9c557cc4261d565935d6c1ace4a8f59194c9dfc55a9a36db7da16a017a3bdd088ddb10aba905e396e002c8fb13001123f4fda9045141f47238c125fb44a83ed diff --git a/tests/changing-password-with-stdin-opiton-limits/Makefile b/tests/changing-password-with-stdin-opiton-limits/Makefile new file mode 100644 index 0000000..89be2ed --- /dev/null +++ b/tests/changing-password-with-stdin-opiton-limits/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +# Description: Test for changing password with --stdin opiton limits +# Author: Eva Mrakova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Eva Mrakova " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for changing password with --stdin opiton limits" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: passwd" >> $(METADATA) + @echo "Requires: passwd" >> $(METADATA) + @echo "Requires: expect" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/changing-password-with-stdin-opiton-limits/PURPOSE b/tests/changing-password-with-stdin-opiton-limits/PURPOSE new file mode 100644 index 0000000..e45dcb8 --- /dev/null +++ b/tests/changing-password-with-stdin-opiton-limits/PURPOSE @@ -0,0 +1,6 @@ +PURPOSE of /CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +Description: Test for changing password with --stdin opiton limits 512 bytes long +Author: Eva Mrakova +Bug summary: changing password with --stdin opiton limits password size to 79 characters + +Tests changing password 511 chars long diff --git a/tests/changing-password-with-stdin-opiton-limits/runtest.sh b/tests/changing-password-with-stdin-opiton-limits/runtest.sh new file mode 100644 index 0000000..8300888 --- /dev/null +++ b/tests/changing-password-with-stdin-opiton-limits/runtest.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/passwd/Regression/changing-password-with-stdin-opiton-limits +# Description: Test for changing password with --stdin opiton limits +# Author: Eva Mrakova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="passwd" + +TSTUSR="testuser" +# max length password: 512 chars (supported by pam_unix, PAM_MAX_RESP_SIZE) +# such long passwords do not work on RHEL6 for pam <= pam-1.1.1-20.el6 +# similarly for RHEL7 and pam-1.1.8-12.el7 +TSTPASSWD=$(tr -dc 'A-Za-z0-9' +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/passwd/Regression/passwd-exit-status-1 +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Ondrej Moris " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for passwd exit status 1" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: passwd" >> $(METADATA) + @echo "Requires: passwd" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/passwd-exit-status-1/PURPOSE b/tests/passwd-exit-status-1/PURPOSE new file mode 100644 index 0000000..e043296 --- /dev/null +++ b/tests/passwd-exit-status-1/PURPOSE @@ -0,0 +1,26 @@ +PURPOSE of /CoreOS/passwd/Regression/passwd-exit-status-1 +Description: Test for passwd exit status 1 +Author: Ondrej Moris +Bug summary: passwd exit status 1 + +Description: + +Description of problem: +passwd exits with status 1 when argument -S is passed. + +Version-Release number of selected component (if applicable): +5.X + +How reproducible: +allways + +Steps to Reproduce: +1. passwd -S user +2. echo $? + + +Actual results: +1 + +Expected results: +0 diff --git a/tests/passwd-exit-status-1/runtest.sh b/tests/passwd-exit-status-1/runtest.sh new file mode 100644 index 0000000..1dd27f2 --- /dev/null +++ b/tests/passwd-exit-status-1/runtest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/passwd/Regression/passwd-exit-status-1 +# Description: Test for passwd exit status 1 +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/bin/rhts-environment.sh +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE="passwd" + +rlJournalStart + + rlPhaseStartSetup + + rlAssertRpm $PACKAGE + + rlPhaseEnd + + rlPhaseStartTest + + rlRun "passwd -S root" 0 + rlRun "passwd -S nonExistingUser" 1-255 + + rlPhaseEnd + + rlPhaseStartCleanup + rlPhaseEnd + +rlJournalPrintText + +rlJournalEnd diff --git a/tests/smoke-test/Makefile b/tests/smoke-test/Makefile new file mode 100644 index 0000000..1dc28d2 --- /dev/null +++ b/tests/smoke-test/Makefile @@ -0,0 +1,65 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/passwd/Sanity/smoke-test +# Description: Test basic functionality. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/passwd/Sanity/smoke-test +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Ondrej Moris " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test basic functionality." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: passwd" >> $(METADATA) + @echo "Requires: passwd" >> $(METADATA) + @echo "Requires: openssh" >> $(METADATA) + @echo "Requires: expect" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/smoke-test/PURPOSE b/tests/smoke-test/PURPOSE new file mode 100644 index 0000000..9e29998 --- /dev/null +++ b/tests/smoke-test/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/passwd/Sanity/smoke-test +Description: Test basic functionality. +Author: Ondrej Moris + +tests basic passwd command usage scenarios diff --git a/tests/smoke-test/runtest.sh b/tests/smoke-test/runtest.sh new file mode 100644 index 0000000..a819137 --- /dev/null +++ b/tests/smoke-test/runtest.sh @@ -0,0 +1,141 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/passwd/Sanity/smoke-test +# Description: Test basic functionality. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/bin/rhts-environment.sh +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE="passwd" + +function set_password { + +expect >/tmp/out 2>&1 </tmp/out 2>&1 < /tmp/out 2>&1" 1-255 "Unlocking account" + rlRun "grep \"Unsafe\" /tmp/out" 0 "Checking warning message" + rlRun "passwd -uf $U" 0 "Force Unlocking account" + sleep 3 + rlRun "echo c | passwd --stdin $U" 0 "Changing password via stdin to 'c'" + sleep 3 + rlRun "check_password $U c" 0 "Checking good password" + rlRun "check_password $U x" 1-255 "Checking wrong password" + rlRun "passwd -d $U" 0 "Disabling account" + sleep 3 + rlRun "check_password $U c" 1-255 "Checking good password" + rlRun "check_password $U x" 1-255 "Checking wrong password" + rlRun "echo d | passwd --stdin $U" 0 "Changing password via stdin to 'd'" + sleep 3 + rlRun "check_password $U d" 0 "Checking good password" + rlRun "check_password $U x" 1-255 "Checking wrong password" + rlRun "passwd -S $U" 0 "Checking good account information" + rlRun "passwd -S nonexistinguser" 1-255 "Checking wrong account information" + + rlPhaseEnd + + rlPhaseStartCleanup + + rlRun "userdel -r $U" 0 "Removing testing account" + rlRun "rm -f /tmp/out" 0 "Removing output file" + + rlPhaseEnd + +rlJournalPrintText + +rlJournalEnd diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..9ed8858 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,30 @@ +--- +# Tests that run in classic context +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + tests: + - changing-password-with-stdin-opiton-limits + - passwd-exit-status-1 + - smoke-test + required_packages: + - expect + - findutils # beakerlib needs find command + - openssh # smoke-test needs openssh + - passwd + +# Tests that run in container context +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - container + tests: + - changing-password-with-stdin-opiton-limits + - passwd-exit-status-1 + required_packages: + - expect + - findutils # beakerlib needs find command + - passwd