summaryrefslogtreecommitdiff
path: root/source/a/shadow
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2009-08-26 10:00:38 -0500
committerEric Hameleers <alien@slackware.com>2018-05-31 22:41:17 +0200
commit5a12e7c134274dba706667107d10d231517d3e05 (patch)
tree55718d5acb710fde798d9f38d0bbaf594ed4b296 /source/a/shadow
downloadcurrent-5a12e7c134274dba706667107d10d231517d3e05.tar.gz
Slackware 13.0slackware-13.0
Wed Aug 26 10:00:38 CDT 2009 Slackware 13.0 x86_64 is released as stable! Thanks to everyone who helped make this release possible -- see the RELEASE_NOTES for the credits. The ISOs are off to the replicator. This time it will be a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. We're taking pre-orders now at store.slackware.com. Please consider picking up a copy to help support the project. Once again, thanks to the entire Slackware community for all the help testing and fixing things and offering suggestions during this development cycle. As always, have fun and enjoy! -P.
Diffstat (limited to 'source/a/shadow')
-rw-r--r--source/a/shadow/adduser437
-rw-r--r--source/a/shadow/shadow-4.0.3.x86_64.diff166
-rwxr-xr-xsource/a/shadow/shadow.SlackBuild156
-rw-r--r--source/a/shadow/shadow.gcc34.diff11
-rw-r--r--source/a/shadow/shadow.login.defs.diff67
-rw-r--r--source/a/shadow/shadow.newgrp.getlogin21
-rw-r--r--source/a/shadow/shadow.newgrp.nopam18
-rw-r--r--source/a/shadow/shadow.remove.obsolete.options.diff78
-rw-r--r--source/a/shadow/shadow.shadowconfig.diff49
-rw-r--r--source/a/shadow/slack-desc19
10 files changed, 1022 insertions, 0 deletions
diff --git a/source/a/shadow/adduser b/source/a/shadow/adduser
new file mode 100644
index 00000000..02385e33
--- /dev/null
+++ b/source/a/shadow/adduser
@@ -0,0 +1,437 @@
+#!/bin/bash
+#
+# Copyright 1995 Hrvoje Dogan, Croatia.
+# Copyright 2002, 2003, 2004, 2008, 2009 Stuart Winter, Surrey, England, UK.
+# Copyright 2004, 2008, 2009 Slackware Linux, Inc., Concord, CA, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+##########################################################################
+# Program: /usr/sbin/adduser
+# Purpose: Interactive front end to /usr/sbin/useradd for Slackware Linux
+# Author : Stuart Winter <mozes@slackware.com>
+# Based on the original Slackware adduser by Hrvoje Dogan
+# with modifications by Patrick Volkerding
+# Version: 1.12
+##########################################################################
+# Usage..: adduser [<new_user_name>]
+##########################################################################
+# History #
+###########
+# v1.12 - 21/07/09
+# * Adjusted the search of /etc/passwd to exclude the NIS inclusion
+# string. Thanks to Dominik L. Borkowski.
+# v1.11 - 04/06/09
+# * Add power and netdev to the suggested group list
+# v1.10 - 24/03/08
+# * To facilitate use of the automatic mounting features of HAL,
+# allow the admin to easily add users to the default groups:
+# audio,cdrom,video,plugdev,floppy.
+# The default is not to add new users to these groups.
+# And by the way, this script is "useradd from Slackware" not
+# "superadduser from Gentoo" ;-)
+# v1.09 - 07/06/04
+# * Added standard Slackware script licence to the head of this file.
+# v1.08 - 25/04/04
+# * Disallow user names that begin with a numeric because useradd
+# (from shadow v4.03) does not allow them. <sw>
+# v1.07 - 07/03/03
+# * When supplying a null string for the uid (meaning 'Choose next available'),
+# if there were file names in the range 'a-z' in the pwd then the
+# egrep command considered these files rather than the null string.
+# The egrep expression is now in quotes.
+# Reported & fixed by Vadim O. Ustiansky <sw>
+# v1.06 - 31/03/03
+# * Ask to chown user.group the home directory if it already exists.
+# This helps reduce later confusion when adding users whose home dir
+# already exists (mounted partition for example) and is owned
+# by a user other than the user to which the directory is being
+# assigned as home. Default is not to chown.
+# Brought to my attention by mRgOBLIN. <sw>
+# v1.05 - 04/01/03
+# * Advise & prevent users from creating logins with '.' characters
+# in the user name. <sw>
+# * Made pending account creation info look neater <sw>
+# v1.04 - 09/06/02
+# * Catered for shadow-4.0.3's 'useradd' binary that no longer
+# will let you create a user that has any uppercase chars in it
+# This was reported on the userlocal.org forums
+# by 'xcp' - thanks. <sw,pjv>
+# v1.03 - 20/05/02
+# * Support 'broken' (null lines in) /etc/passwd and
+# /etc/group files <sw>
+# * For recycling UIDs (default still 'off'), we now look in
+# /etc/login.defs for the UID_MIN value and use it
+# If not found then default to 1000 <sw>
+# v1.02 - 10/04/02
+# * Fix user-specified UID bug. <pjv>
+# v1.01 - 23/03/02
+# * Match Slackware indenting style, simplify. <pjv>
+# v1.00 - 22/03/02
+# * Created
+#######################################################################
+
+# Path to files
+pfile=/etc/passwd
+gfile=/etc/group
+sfile=/etc/shells
+
+# Paths to binaries
+useradd=/usr/sbin/useradd
+chfn=/usr/bin/chfn
+passwd=/usr/bin/passwd
+chmod=/bin/chmod
+
+# Defaults
+defhome=/home
+defshell=/bin/bash
+defchmod=711 # home dir permissions - may be preferable to use 701, however.
+defgroup=users
+AGID="audio cdrom floppy plugdev video power netdev" # additional groups for desktop users
+
+# Determine what the minimum UID is (for UID recycling)
+# (we ignore it if it's not at the beginning of the line (i.e. commented out with #))
+export recycleUIDMIN="$(grep ^UID_MIN /etc/login.defs | awk '{print $2}' 2>/dev/null)"
+# If we couldn't find it, set it to the default of 1000
+if [ -z "$recycleUIDMIN" ]; then
+ export recycleUIDMIN=1000 # this is the default from Slackware's /etc/login.defs
+fi
+
+
+# This setting enables the 'recycling' of older unused UIDs.
+# When you userdel a user, it removes it from passwd and shadow but it will
+# never get used again unless you specify it expliticly -- useradd (appears to) just
+# look at the last line in passwd and increment the uid. I like the idea of
+# recycling uids but you may have very good reasons not to (old forgotten
+# confidential files still on the system could then be owned by this new user).
+# We'll set this to no because this is what the original adduser shell script
+# did and it's what users expect.
+recycleuids=no
+
+# Function to read keyboard input.
+# bash1 is broken (even ash will take read -ep!), so we work around
+# it (even though bash1 is no longer supported on Slackware).
+function get_input() {
+ local output
+ if [ "`echo $BASH_VERSION | cut -b1`" = "1" ]; then
+ echo -n "${1} " >&2 # fudge for use with bash v1
+ read output
+ else # this should work with any other /bin/sh
+ read -ep "${1} " output
+ fi
+ echo $output
+}
+
+# Function to display the account info
+function display () {
+ local goose
+ goose="$(echo $2 | cut -d ' ' -f 2-)" # lop off the prefixed argument useradd needs
+ echo -n "$1 "
+ # If it's null then display the 'other' information
+ if [ -z "$goose" -a ! -z "$3" ]; then
+ echo "$3"
+ else
+ echo "$goose"
+ fi
+}
+
+# Function to check whether groups exist in the /etc/group file
+function check_group () {
+ local got_error group
+ if [ ! -z "$@" ]; then
+ for group in $@ ; do
+ local uid_not_named="" uid_not_num=""
+ grep -v "$^" $gfile | awk -F: '{print $1}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_named=yes
+ grep -v "$^" $gfile | awk -F: '{print $3}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_num=yes
+ if [ ! -z "$uid_not_named" -a ! -z "$uid_not_num" ]; then
+ echo "- Group '$group' does not exist"
+ got_error=yes
+ fi
+ done
+ fi
+ # Return exit code of 1 if at least one of the groups didn't exist
+ if [ ! -z "$got_error" ]; then
+ return 1
+ fi
+}
+
+#: Read the login name for the new user :#
+#
+# Remember that most Mail Transfer Agents are case independant, so having
+# 'uSer' and 'user' may cause confusion/things to break. Because of this,
+# useradd from shadow-4.0.3 no longer accepts usernames containing uppercase,
+# and we must reject them, too.
+
+# Set the login variable to the command line param
+echo
+LOGIN="$1"
+needinput=yes
+while [ ! -z $needinput ]; do
+ if [ -z "$LOGIN" ]; then
+ while [ -z "$LOGIN" ]; do LOGIN="$(get_input "Login name for new user []:")" ; done
+ fi
+ grep "^${LOGIN}:" $pfile >/dev/null 2>&1 # ensure it's not already used
+ if [ $? -eq 0 ]; then
+ echo "- User '$LOGIN' already exists; please choose another"
+ unset LOGIN
+ elif [ ! -z "$( echo $LOGIN | grep "^[0-9]" )" ]; then
+ echo "- User names cannot begin with a number; please choose another"
+ unset LOGIN
+ elif [ ! "$LOGIN" = "`echo $LOGIN | tr A-Z a-z`" ]; then # useradd does not allow uppercase
+ echo "- User '$LOGIN' contains illegal characters (uppercase); please choose another"
+ unset LOGIN
+ elif [ ! -z "$( echo $LOGIN | grep '\.' )" ]; then
+ echo "- User '$LOGIN' contains illegal characters (period/dot); please choose another"
+ unset LOGIN
+ else
+ unset needinput
+ fi
+done
+
+# Display the user name passed from the shell if it hasn't changed
+if [ "$1" = "$LOGIN" ]; then
+ echo "Login name for new user: $LOGIN"
+fi
+
+#: Get the UID for the user & ensure it's not already in use :#
+#
+# Whilst we _can_ allow users with identical UIDs, it's not a 'good thing' because
+# when you change password for the uid, it finds the first match in /etc/passwd
+# which isn't necessarily the correct user
+#
+echo
+needinput=yes
+while [ ! -z "$needinput" ]; do
+ _UID="$(get_input "User ID ('UID') [ defaults to next available ]:")"
+ egrep -v "^$|^\+" $pfile | awk -F: '{print $3}' | grep "^${_UID}$" >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "- That UID is already in use; please choose another"
+ elif [ ! -z "$(echo $_UID | egrep '[A-Za-z]')" ]; then
+ echo "- UIDs are numerics only"
+ else
+ unset needinput
+ fi
+done
+# If we were given a UID, then syntax up the variable to pass to useradd
+if [ ! -z "$_UID" ]; then
+ U_ID="-u ${_UID}"
+else
+ # Will we be recycling UIDs?
+ if [ "$recycleuids" = "yes" ]; then
+ U_ID="-u $(awk -F: '{uid[$3]=1} END { for (i=ENVIRON["recycleUIDMIN"];i in uid;i++);print i}' $pfile)"
+ fi
+fi
+
+#: Get the initial group for the user & ensure it exists :#
+#
+# We check /etc/group for both the text version and the group ID number
+echo
+needinput=yes
+while [ ! -z "$needinput" ]; do
+ GID="$(get_input "Initial group [ ${defgroup} ]:")"
+ check_group "$GID"
+ if [ $? -gt 0 ]; then
+ echo "- Please choose another"
+ else
+ unset needinput
+ fi
+done
+# Syntax the variable ready for useradd
+if [ -z "$GID" ]; then
+ GID="-g ${defgroup}"
+else
+ GID="-g ${GID}"
+fi
+
+#: Get additional groups for the user :#
+#
+echo "Additional UNIX groups:"
+echo
+echo "Users can belong to additional UNIX groups on the system."
+echo "For local users using graphical desktop login managers such"
+echo "as XDM/KDM, users may need to be members of additional groups"
+echo "to access the full functionality of removable media devices."
+echo
+echo "* Security implications *"
+echo "Please be aware that by adding users to additional groups may"
+echo "potentially give access to the removable media of other users."
+echo
+echo "If you are creating a new user for remote shell access only,"
+echo "users do not need to belong to any additional groups as standard,"
+echo "so you may press ENTER at the next prompt."
+echo
+needinput=yes
+while [ ! -z "$needinput" ]; do
+ history -c
+ history -s "$AGID"
+ echo "Press ENTER to continue without adding any additional groups"
+ echo "Or press the UP arrow to add/select/edit additional groups"
+ AGID="$(get_input ": " | tr -d '[:punct:]' | tr -s ' ' | sed 's?^ $??g' )"
+ if [ ! -z "$AGID" ]; then
+ check_group "$AGID" # check all groups at once (treated as N # of params)
+ if [ $? -gt 0 ]; then
+ echo "- Please re-enter the group(s)"
+ echo
+ else
+ unset needinput # we found all groups specified
+ AGID="-G $(echo $AGID | tr ' ' ,)" # useradd takes comma delimited groups
+ fi
+ else
+ unset needinput # we don't *have* to have additional groups
+ fi
+done
+
+#: Get the new user's home dir :#
+#
+echo
+needinput=yes
+while [ ! -z "$needinput" ]; do
+ HME="$(get_input "Home directory [ ${defhome}/${LOGIN} ]")"
+ if [ -z "$HME" ]; then
+ HME="${defhome}/${LOGIN}"
+ fi
+ # Warn the user if the home dir already exists
+ if [ -d "$HME" ]; then
+ echo "- Warning: '$HME' already exists !"
+ getyn="$(get_input " Do you wish to change the home directory path ? (Y/n) ")"
+ if [ "$(echo $getyn | grep -i "n")" ]; then
+ unset needinput
+ # You're most likely going to only do this if you have the dir *mounted* for this user's $HOME
+ getyn="$(get_input " Do you want to chown $LOGIN.$( echo $GID | awk '{print $2}') $HME ? (y/N) ")"
+ if [ "$(echo $getyn | grep -i "y")" ]; then
+ CHOWNHOMEDIR=$HME # set this to the home directory
+ fi
+ fi
+ else
+ unset needinput
+ fi
+done
+HME="-d ${HME}"
+
+#: Get the new user's shell :#
+echo
+needinput=yes
+while [ ! -z "$needinput" ]; do
+ unset got_error
+ SHL="$(get_input "Shell [ ${defshell} ]")"
+ if [ -z "$SHL" ]; then
+ SHL="${defshell}"
+ fi
+ # Warn the user if the shell doesn't exist in /etc/shells or as a file
+ if [ -z "$(grep "^${SHL}$" $sfile)" ]; then
+ echo "- Warning: ${SHL} is not in ${sfile} (potential problem using FTP)"
+ got_error=yes
+ fi
+ if [ ! -f "$SHL" ]; then
+ echo "- Warning: ${SHL} does not exist as a file"
+ got_error=yes
+ fi
+ if [ ! -z "$got_error" ]; then
+ getyn="$(get_input " Do you wish to change the shell ? (Y/n) ")"
+ if [ "$(echo $getyn | grep -i "n")" ]; then
+ unset needinput
+ fi
+ else
+ unset needinput
+ fi
+done
+SHL="-s ${SHL}"
+
+#: Get the expiry date :#
+echo
+needinput=yes
+while [ ! -z "$needinput" ]; do
+ EXP="$(get_input "Expiry date (YYYY-MM-DD) []:")"
+ if [ ! -z "$EXP" ]; then
+ # Check to see whether the expiry date is in the valid format
+ if [ -z "$(echo "$EXP" | grep "^[[:digit:]]\{4\}[-]\?[[:digit:]]\{2\}[-]\?[[:digit:]]\{2\}$")" ]; then
+ echo "- That is not a valid expiration date"
+ else
+ unset needinput
+ EXP="-e ${EXP}"
+ fi
+ else
+ unset needinput
+ fi
+done
+
+# Display the info about the new impending account
+echo
+echo "New account will be created as follows:"
+echo
+echo "---------------------------------------"
+display "Login name.......: " "$LOGIN"
+display "UID..............: " "$_UID" "[ Next available ]"
+display "Initial group....: " "$GID"
+display "Additional groups: " "$AGID" "[ None ]"
+display "Home directory...: " "$HME"
+display "Shell............: " "$SHL"
+display "Expiry date......: " "$EXP" "[ Never ]"
+echo
+
+echo "This is it... if you want to bail out, hit Control-C. Otherwise, press"
+echo "ENTER to go ahead and make the account."
+read junk
+
+echo
+echo "Creating new account..."
+echo
+echo
+
+# Add the account to the system
+CMD="$useradd "$HME" -m "$EXP" "$U_ID" "$GID" "$AGID" "$SHL" "$LOGIN""
+$CMD
+
+if [ $? -gt 0 ]; then
+ echo "- Error running useradd command -- account not created!"
+ echo "(cmd: $CMD)"
+ exit 1
+fi
+
+# chown the home dir ? We can only do this once the useradd has
+# completed otherwise the user name doesn't exist.
+if [ ! -z "${CHOWNHOMEDIR}" ]; then
+ chown "$LOGIN"."$( echo $GID | awk '{print $2}')" "${CHOWNHOMEDIR}"
+fi
+
+# Set the finger information
+$chfn "$LOGIN"
+if [ $? -gt 0 ]; then
+ echo "- Warning: an error occurred while setting finger information"
+fi
+
+# Set a password
+$passwd "$LOGIN"
+if [ $? -gt 0 ]; then
+ echo "* WARNING: An error occured while setting the password for"
+ echo " this account. Please manually investigate this *"
+ exit 1
+fi
+
+# If it was created (it should have been!), set the permissions for that user's dir
+HME="$(echo "$HME" | awk '{print $2}')" # We have to remove the -g prefix
+if [ -d "$HME" ]; then
+ $chmod $defchmod "$HME"
+fi
+
+echo
+echo
+echo "Account setup complete."
+exit 0
diff --git a/source/a/shadow/shadow-4.0.3.x86_64.diff b/source/a/shadow/shadow-4.0.3.x86_64.diff
new file mode 100644
index 00000000..15d16c7c
--- /dev/null
+++ b/source/a/shadow/shadow-4.0.3.x86_64.diff
@@ -0,0 +1,166 @@
+--- shadow-4.0.3/libmisc/failure.h.orig 2004-01-02 18:47:01.000000000 -0800
++++ shadow-4.0.3/libmisc/failure.h 2004-01-02 18:52:38.000000000 -0800
+@@ -4,7 +4,12 @@
+
+ #include "defines.h"
+ #include "faillog.h"
++
++#if HAVE_UTMPX_H
++#include <utmpx.h>
++#else
+ #include <utmp.h>
++#endif
+
+ /*
+ * failure - make failure entry
+@@ -38,7 +43,11 @@
+ * failtmp updates the (struct utmp) formatted failure log which
+ * maintains a record of all login failures.
+ */
++#if HAVE_UTMPX_H
++extern void failtmp(const struct utmpx *);
++#else
+ extern void failtmp(const struct utmp *);
++#endif
+
+ #endif
+
+--- shadow-4.0.3/libmisc/failure.c.orig 2004-01-02 18:47:06.000000000 -0800
++++ shadow-4.0.3/libmisc/failure.c 2004-01-02 18:53:37.000000000 -0800
+@@ -39,7 +39,11 @@
+ #include "getdef.h"
+ #include "failure.h"
+
++#if HAVE_UTMPX_H
++#include <utmpx.h>
++#else
+ #include <utmp.h>
++#endif
+
+ #define YEAR (365L*DAY)
+
+@@ -248,7 +252,11 @@
+ */
+
+ void
++#if HAVE_UTMPX_H
++failtmp(const struct utmpx *failent)
++#else
+ failtmp(const struct utmp *failent)
++#endif
+ {
+ char *ftmp;
+ int fd;
+--- shadow-4.0.3/libmisc/log.c.orig 2004-01-02 18:58:04.000000000 -0800
++++ shadow-4.0.3/libmisc/log.c 2004-01-02 18:58:51.000000000 -0800
+@@ -57,6 +57,7 @@
+ int fd;
+ off_t offset;
+ struct lastlog newlog;
++ time_t ll_time;
+
+ /*
+ * If the file does not exist, don't create it.
+@@ -88,7 +89,8 @@
+ if (ll)
+ *ll = newlog;
+
+- time(&newlog.ll_time);
++ ll_time = newlog.ll_time;
++ time(&ll_time);
+ strncpy(newlog.ll_line, line, sizeof newlog.ll_line);
+ #if HAVE_LL_HOST
+ strncpy(newlog.ll_host, host, sizeof newlog.ll_host);
+--- shadow-4.0.3/libmisc/utmp.c.orig 2004-01-02 18:59:04.000000000 -0800
++++ shadow-4.0.3/libmisc/utmp.c 2004-01-02 19:05:34.000000000 -0800
+@@ -79,6 +79,8 @@
+ {
+ char *line;
+ struct utmp *ut;
++ time_t uttime;
++
+ pid_t pid = getpid();
+
+ setutent();
+@@ -111,7 +113,8 @@
+ /* XXX - assumes /dev/tty?? */
+ strncpy(utent.ut_id, utent.ut_line + 3, sizeof utent.ut_id);
+ strcpy(utent.ut_user, "LOGIN");
+- time(&utent.ut_time);
++ time(&uttime);
++ utent.ut_time = uttime;
+ }
+ }
+
+@@ -284,9 +287,14 @@
+ void
+ setutmp(const char *name, const char *line, const char *host)
+ {
++ time_t uttime;
++
+ utent.ut_type = USER_PROCESS;
+ strncpy(utent.ut_user, name, sizeof utent.ut_user);
+- time(&utent.ut_time);
++
++ time(&uttime);
++ utent.ut_time = uttime;
++
+ /* other fields already filled in by checkutmp above */
+ setutent();
+ pututline(&utent);
+--- shadow-4.0.3/src/lastlog.c.orig 2004-01-02 18:06:09.000000000 -0800
++++ shadow-4.0.3/src/lastlog.c 2004-01-02 18:29:57.000000000 -0800
+@@ -167,6 +167,7 @@
+ static int once;
+ char *cp;
+ struct tm *tm;
++ time_t ll_time;
+
+ #ifdef HAVE_STRFTIME
+ char ptime[80];
+@@ -184,7 +185,9 @@
+ #endif
+ once++;
+ }
+- tm = localtime (&lastlog.ll_time);
++ ll_time = lastlog.ll_time;
++ tm = localtime (&ll_time);
++
+ #ifdef HAVE_STRFTIME
+ strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm);
+ cp = ptime;
+--- shadow-4.0.3/src/login.c.orig 2004-01-02 18:33:13.000000000 -0800
++++ shadow-4.0.3/src/login.c 2004-01-02 18:40:17.000000000 -0800
+@@ -1019,8 +1019,12 @@
+ const char *failent_user;
+
+ #if HAVE_UTMPX_H
++ struct timeval ut_tv;
++ ut_tv.tv_sec = failent.ut_tv.tv_sec;
++ ut_tv.tv_usec = failent.ut_tv.tv_usec;
++
+ failent = utxent;
+- gettimeofday (&(failent.ut_tv), NULL);
++ gettimeofday (&ut_tv, NULL);
+ #else
+ failent = utent;
+ time (&failent.ut_time);
+@@ -1271,15 +1275,16 @@
+ }
+ if (getdef_bool ("LASTLOG_ENAB")
+ && lastlog.ll_time != 0) {
++ time_t ll_time= lastlog.ll_time;
+ #ifdef HAVE_STRFTIME
+ strftime (ptime, sizeof (ptime),
+ "%a %b %e %H:%M:%S %z %Y",
+- localtime (&lastlog.ll_time));
++ localtime (&ll_time));
+ printf (_("Last login: %s on %s"),
+ ptime, lastlog.ll_line);
+ #else
+ printf (_("Last login: %.19s on %s"),
+- ctime (&lastlog.ll_time),
++ ctime (&ll_time),
+ lastlog.ll_line);
+ #endif
+ #ifdef HAVE_LL_HOST /* SVR4 || __linux__ || SUN4 */
diff --git a/source/a/shadow/shadow.SlackBuild b/source/a/shadow/shadow.SlackBuild
new file mode 100755
index 00000000..2f0e1178
--- /dev/null
+++ b/source/a/shadow/shadow.SlackBuild
@@ -0,0 +1,156 @@
+#!/bin/sh
+
+# Copyright 2005-2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+VERSION=4.0.3
+ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-18}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-shadow
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+# Explode the package framework:
+cd $PKG
+explodepkg $CWD/_shadow.tar.gz
+
+cd $TMP
+rm -rf shadow-$VERSION
+tar xjvf $CWD/shadow-$VERSION.tar.bz2
+cd shadow-$VERSION
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+zcat $CWD/shadow.shadowconfig.diff.gz | patch -p1 --verbose --backup || exit 1
+zcat $CWD/shadow.newgrp.nopam.gz | patch -p0 --verbose --backup || exit 1
+zcat $CWD/shadow.login.defs.diff.gz | patch -p0 --verbose --backup || exit 1
+zcat $CWD/shadow.newgrp.getlogin.gz | patch -p1 --verbose --backup || exit 1
+zcat $CWD/shadow.gcc34.diff.gz | patch -p1 --verbose --backup || exit 1
+zcat $CWD/shadow.remove.obsolete.options.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+if [ "$ARCH" = "x86_64" ]; then
+ zcat $CWD/shadow-4.0.3.x86_64.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+fi
+
+./configure \
+ --prefix=/usr \
+ --disable-shared \
+ --disable-desrpc \
+ --build=$ARCH-slackware-linux
+
+make -j6 || exit 1
+cat etc/login.defs.linux > $PKG/etc/login.defs.new
+cat etc/login.access > $PKG/etc/login.access.new
+cat $CWD/adduser > $PKG/usr/sbin/adduser
+
+# These things aren't needed when using glibc, as it
+# supplies its own shadow functions:
+#cat lib/libshadow.a > $PKG/usr/lib/libshadow.a
+#cp -a lib/pwauth.h $PKG/usr/include/shadow/pwauth.h
+#cp -a lib/shadow_.h $PKG/usr/include/shadow/shadow.h
+#chmod 644 $PKG/usr/include/shadow/*
+#chown root.root $PKG/usr/include/shadow/*
+
+cd po
+for file in *.gmo ; do
+ mkdir -p $PKG/usr/share/locale/$(basename $file .gmo)/LC_MESSAGES
+ cat $file > $PKG/usr/share/locale/$(basename $file .gmo)/LC_MESSAGES/shadow.mo
+done
+cd ../src
+cat login > $PKG/bin/login
+cat su > $PKG/bin/su
+cat sulogin > $PKG/sbin/sulogin
+cat ../debian/shadowconfig.sh > $PKG/usr/sbin/shadowconfig
+for file in chpasswd dpasswd faillog groupadd groupdel groupmod grpck \
+lastlog logoutd mkpasswd newusers pwck useradd userdel usermod \
+pwconv pwunconv grpconv grpunconv vipw ; do
+ cat $file > $PKG/usr/sbin/$file
+done
+for file in chage chfn chsh expiry gpasswd newgrp passwd ; do
+ cat $file > $PKG/usr/bin/$file
+done
+cd ..
+cp contrib/adduser.sh /sbin/adduser
+mkdir -p $PKG/usr/doc/shadow-$VERSION
+cp -a \
+ ABOUT-NLS ChangeLog NEWS README TODO doc/* \
+ $PKG/usr/doc/shadow-$VERSION
+chmod 644 $PKG/usr/doc/shadow-$VERSION/*
+
+install_man_pages() {
+for file in chage.1 chfn.1 chsh.1 gpasswd.1 groups.1 login.1 newgrp.1 \
+passwd.1 su.1 ; do
+ if [ -r $file ]; then
+ mkdir -p $1/man1
+ gzip -9c $file > $1/man1/$file.gz
+ fi
+done
+for file in pw_auth.3 shadow.3 ; do
+ if [ -r $file ]; then
+ mkdir -p $1/man3
+ gzip -9c $file > $1/man3/$file.gz
+ fi
+done
+for file in faillog.5 limits.5 login.access.5 login.defs.5 passwd.5 \
+porttime.5 shadow.5 suauth.5 ; do
+ if [ -r $file ]; then
+ mkdir -p $1/man5
+ gzip -9c $file > $1/man5/$file.gz
+ fi
+done
+for file in chpasswd.8 dpasswd.8 faillog.8 groupadd.8 groupdel.8 groupmod.8 \
+grpck.8 lastlog.8 logoutd.8 mkpasswd.8 newusers.8 pwauth.8 pwck.8 pwconv.8 \
+shadowconfig.8 sulogin.8 useradd.8 userdel.8 usermod.8 vipw.8 ; do
+ if [ -r $file ]; then
+ mkdir -p $1/man8
+ gzip -9c $file > $1/man8/$file.gz
+ fi
+done
+}
+
+cd man
+ install_man_pages $PKG/usr/man
+ for dir in * ; do
+ if [ -d $dir ] ; then
+ ( cd $dir ; install_man_pages $PKG/usr/man/$dir )
+ fi
+ done
+cd ..
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build the package:
+cd $PKG
+makepkg -l y -c n $TMP/shadow-$VERSION-$ARCH-$BUILD.txz
+
+# Clean up the extra stuff:
+if [ "$1" = "--cleanup" ]; then
+ rm -rf $TMP/shadow-$VERSION
+ rm -rf $PKG
+fi
diff --git a/source/a/shadow/shadow.gcc34.diff b/source/a/shadow/shadow.gcc34.diff
new file mode 100644
index 00000000..71dff4c8
--- /dev/null
+++ b/source/a/shadow/shadow.gcc34.diff
@@ -0,0 +1,11 @@
+--- ./libmisc/xmalloc.c.orig 1998-12-28 14:34:56.000000000 -0600
++++ ./libmisc/xmalloc.c 2006-08-12 19:02:51.000000000 -0500
+@@ -16,8 +16,6 @@
+
+ #include "defines.h"
+
+-extern char *malloc();
+-
+ char *
+ xmalloc(size_t size)
+ {
diff --git a/source/a/shadow/shadow.login.defs.diff b/source/a/shadow/shadow.login.defs.diff
new file mode 100644
index 00000000..bfed463a
--- /dev/null
+++ b/source/a/shadow/shadow.login.defs.diff
@@ -0,0 +1,67 @@
+--- ./etc/login.defs.linux.orig 2000-08-26 13:27:10.000000000 -0500
++++ ./etc/login.defs.linux 2008-03-24 15:10:09.000000000 -0500
+@@ -170,8 +170,8 @@
+ # *REQUIRED* The default PATH settings, for superuser and normal users.
+ #
+ # (they are minimal, add the rest in the shell startup files)
+-ENV_SUPATH PATH=/sbin:/bin:/usr/sbin:/usr/bin
+-ENV_PATH PATH=/bin:/usr/bin
++ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
++ENV_PATH PATH=/usr/local/bin:/bin:/usr/bin
+
+ #
+ # Terminal permissions
+@@ -185,7 +185,7 @@
+ # TTYPERM to either 622 or 600.
+ #
+ TTYGROUP tty
+-TTYPERM 0600
++TTYPERM 0620
+
+ #
+ # Login configuration initializations:
+@@ -230,7 +230,7 @@
+ #
+ # If compiled with cracklib support, where are the dictionaries
+ #
+-CRACKLIB_DICTPATH /var/cache/cracklib/cracklib_dict
++#CRACKLIB_DICTPATH /var/cache/cracklib/cracklib_dict
+
+ #
+ # Min/max values for automatic uid selection in useradd
+@@ -282,7 +282,7 @@
+ # phone, home phone). If not defined, no changes are allowed.
+ # For backward compatibility, "yes" = "rwh" and "no" = "frwh".
+ #
+-CHFN_RESTRICT rwh
++CHFN_RESTRICT frwh
+
+ #
+ # Password prompt (%s will be replaced by user name).
+@@ -299,7 +299,7 @@
+ # Set to "no" if you need to copy encrypted passwords to other systems
+ # which don't understand the new algorithm. Default is "no".
+ #
+-#MD5_CRYPT_ENAB no
++MD5_CRYPT_ENAB yes
+
+ #
+ # List of groups to add to the user's supplementary group set
+@@ -310,7 +310,16 @@
+ # access to these groups, even when not logged in on the console.
+ # How to do it is left as an exercise for the reader...
+ #
+-#CONSOLE_GROUPS floppy:audio:cdrom
++# Most of these groups are self-explanatory.
++#
++# Note that users are added to these default groups only when
++# logging into a shell with /bin/login, not when using a login
++# manager such as kdm. In that case, users who should have
++# hardware access must be added to the appropriate groups
++# when the user is added with adduser or useradd, or by editing
++# /etc/group directly.
++#
++CONSOLE_GROUPS floppy:audio:cdrom:video
+
+ #
+ # Should login be allowed if we can't cd to the home directory?
diff --git a/source/a/shadow/shadow.newgrp.getlogin b/source/a/shadow/shadow.newgrp.getlogin
new file mode 100644
index 00000000..5d032f15
--- /dev/null
+++ b/source/a/shadow/shadow.newgrp.getlogin
@@ -0,0 +1,21 @@
+--- ./src/newgrp.c.orig 2003-05-31 21:19:39.000000000 -0700
++++ ./src/newgrp.c 2003-05-31 21:21:32.000000000 -0700
+@@ -76,6 +76,7 @@
+ gid_t gid;
+ char *cp;
+ const char *cpasswd, *name, *prog;
++ char *loginname = NULL;
+ char *group = NULL;
+ char *command = NULL;
+ char **envp = environ;
+@@ -386,7 +387,9 @@
+ SYSLOG ((LOG_INFO, "user `%s' switched to group `%s'",
+ name, group));
+ if (getdef_bool ("SYSLOG_SG_ENAB")) {
+- char *loginname = xstrdup (getlogin ());
++ char *user = getlogin ();
++ if (user != NULL)
++ loginname = xstrdup (user);
+ char *tty = xstrdup (ttyname (0));
+
+ if (loginname == NULL)
diff --git a/source/a/shadow/shadow.newgrp.nopam b/source/a/shadow/shadow.newgrp.nopam
new file mode 100644
index 00000000..7920dde0
--- /dev/null
+++ b/source/a/shadow/shadow.newgrp.nopam
@@ -0,0 +1,18 @@
+--- src/newgrp.c.orig 2002-10-12 14:15:34.000000000 +0100
++++ src/newgrp.c 2002-10-12 14:15:42.000000000 +0100
+@@ -398,6 +398,7 @@
+ SYSLOG ((LOG_INFO,
+ "user `%s' (login `%s' on %s) switched to group `%s'",
+ name, loginname, tty, group));
++#ifdef USE_PAM
+ if (getdef_bool ("CLOSE_SESSIONS")) {
+ /*
+ * We want to fork and exec the new shell in the child, leaving the
+@@ -450,6 +451,7 @@
+ signal (SIGTTIN, SIG_DFL);
+ signal (SIGTTOU, SIG_DFL);
+ }
++#endif // USE_PAM
+ }
+ #endif /* USE_SYSLOG */
+
diff --git a/source/a/shadow/shadow.remove.obsolete.options.diff b/source/a/shadow/shadow.remove.obsolete.options.diff
new file mode 100644
index 00000000..100fe2a8
--- /dev/null
+++ b/source/a/shadow/shadow.remove.obsolete.options.diff
@@ -0,0 +1,78 @@
+--- ./man/passwd.1.orig 2002-03-13 11:52:15.000000000 -0600
++++ ./man/passwd.1 2006-08-20 18:29:58.000000000 -0500
+@@ -29,26 +29,17 @@
+ .SH NAME
+ passwd \- change user password
+ .SH SYNOPSIS
+-\fBpasswd\fR [\fB-f\fR|\fB-s\fR] [\fIname\fR]
+-.br
+-\fBpasswd\fR [\fB-g\fR] [\fB-r\fR|\fB-R\fR] \fIgroup\fR
++\fBpasswd\fR [\fIname\fR]
+ .br
+ \fBpasswd\fR [\fB-x \fImax\fR] [\fB-n \fImin\fR]
+ [\fB-w \fIwarn\fR] [\fB-i \fIinact\fR] \fIlogin\fR
+ .br
+ \fBpasswd\fR {\fB-l\fR|\fB-u\fR|\fB-d\fR|\fB-S\fR|\fB-e\fR} \fIlogin\fR
+ .SH DESCRIPTION
+-\fBpasswd\fR changes passwords for user and group accounts.
++\fBpasswd\fR changes passwords for user accounts.
+ A normal user may only change the password for his/her own account,
+ the super user may change the password for any account.
+-The administrator of a group may change the password for the group.
+-\fBpasswd\fR also changes account information, such as the full name
+-of the user, user's login shell, or password expiry date and interval.
+-.PP
+-The \fB-s\fR option makes passwd call chsh to change the user's shell. The
+-\fB-f\fR option makes passwd call chfn to change the user's gecos
+-information. These two options are only meant for compatiblity, since the
+-other programs can be called directly.
++.PP
+ .SS Password Changes
+ The user is first prompted for his/her old password, if one is present.
+ This password is then encrypted and compared against the
+@@ -86,17 +77,6 @@
+ against the first.
+ Both entries are required to match in order for the password
+ to be changed.
+-.SS Group passwords
+-When the \fB-g\fR option is used, the password for the named
+-group is changed.
+-The user must either be the super user, or a group administrator
+-for the named group.
+-The current group password is not prompted for.
+-The \fB-r\fR option is used with the \fB-g\fR option to remove
+-the current password from the named group.
+-This allows group access to all members.
+-The \fB-R\fR option is used with the \fB-g\fR option to restrict
+-the named group for all users.
+ .SS Password expiry information
+ The password aging information may be changed by the super
+ user with the \fB-x\fR, \fB-n\fR, \fB-w\fR, and \fB-i\fR options.
+@@ -191,6 +171,9 @@
+ .br
+ /etc/shadow \- encrypted user passwords
+ .SH "SEE ALSO"
++.BR chfn (1),
++.BR chsh (1),
++.BR gpasswd (1),
+ .BR group (5),
+ .BR passwd (5)
+ .SH AUTHOR
+--- ./src/passwd.c.orig 2002-01-05 09:41:43.000000000 -0600
++++ ./src/passwd.c 2006-08-20 18:31:50.000000000 -0500
+@@ -955,6 +955,7 @@
+ * Please run these programs directly. --marekm
+ */
+
++#ifdef I_LIKE_OBSOLETE_OPTIONS
+ if (argc > 1 && argv[1][0] == '-' && strchr ("gfs", argv[1][1])) {
+ char buf[200];
+
+@@ -980,6 +981,7 @@
+ closelog ();
+ exit (E_FAILURE);
+ }
++#endif
+
+ /*
+ * The remaining arguments will be processed one by one and executed
diff --git a/source/a/shadow/shadow.shadowconfig.diff b/source/a/shadow/shadow.shadowconfig.diff
new file mode 100644
index 00000000..7dc9286e
--- /dev/null
+++ b/source/a/shadow/shadow.shadowconfig.diff
@@ -0,0 +1,49 @@
+--- ./debian/shadowconfig.sh.orig 2001-05-29 23:20:22.000000000 -0700
++++ ./debian/shadowconfig.sh 2003-06-23 16:35:38.000000000 -0700
+@@ -1,23 +1,28 @@
+ #!/bin/bash
+-# turn shadow passwords on or off on a Debian system
++#
++# 'shadowconfig on' will turn shadow passwords on;
++# 'shadowconfig off' will turn shadow passwords off.
++#
++# shadowconfig will print an error message and exit with
++# a nonzero code if it finds anything awry. If that happens,
++# you should correct the error and run it again.
++#
++# Turning shadow passwords on when they are already on, or
++# off when they are already off, is harmless.
++#
++# Be aware that account expiration dates are only supported
++# by shadow passwords -- these dates will be lost when converting
++# from shadow to non-shadow passwords. If you need to save this
++# information, back up your /etc/shadow before turning off
++# shadow passwords.
++#
+
+-set -e
+
+-permfix () {
+- [ -f $1 ] || return 0
+- chown root:shadow $1
+- chmod 2755 $1
+-}
+-export -f permfix
++set -e
+
+ shadowon () {
+ bash<<- EOF
+ set -e
+-
+- permfix /usr/X11R6/bin/xlock
+- permfix /usr/X11R6/bin/xtrlock
+- permfix /bin/vlock
+-
+ pwck -q
+ grpck
+ pwconv
+@@ -65,3 +70,4 @@
+ echo Usage: $0 on \| off
+ ;;
+ esac
++
diff --git a/source/a/shadow/slack-desc b/source/a/shadow/slack-desc
new file mode 100644
index 00000000..57749146
--- /dev/null
+++ b/source/a/shadow/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+shadow: shadow (shadow password suite)
+shadow:
+shadow: This set of login related programs utilizes an alternate, non-readable
+shadow: file to contain the actual encrypted passwords. This is presumed to
+shadow: increase system security by increasing the difficulty with which
+shadow: system crackers obtain encrypted passwords. It was written by
+shadow: Julianne Frances Haugh and the Linux port is maintained by Tomasz
+shadow: Kloczko.
+shadow:
+shadow: This package provides 'login', which is needed to log into the system.
+shadow: