automatic version update by autodist [release 8.22-1mamba;Thu Dec 19 2013]

This commit is contained in:
Automatic Build System 2024-01-05 21:31:11 +01:00
parent af39fc5054
commit ad7721ca70
12 changed files with 5670 additions and 0 deletions

View File

@ -1,2 +1,10 @@
# coreutils
These are the GNU core utilities.
This package is the union of the old GNU fileutils, sh-utils, and textutils packages.
These tools're the GNU versions of common useful and popular file and text utilities which are used for:
- file management
- shell scripts
- modifying text file (spliting, joining, comparing, modifying, ...)
Most of these programs have significant advantages over their Unix counterparts, such as greater speed, additional options, and fewer arbitrary limits.

View File

@ -0,0 +1,18 @@
--- coreutils-5.2.1/src/su.c.badpaths Tue Apr 05 14:26:55 2005
+++ coreutils-5.2.1/src/su.c Tue Apr 05 14:40:21 EDT 2005
@@ -147,6 +147,15 @@
#define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
#endif
+/* The default paths which get set are both bogus and oddly influenced
+ by <paths.h> and -D on the commands line. Just to be clear, we'll set
+ these explicitly. -ewt */
+#undef DEFAULT_LOGIN_PATH
+#undef DEFAULT_ROOT_LOGIN_PATH
+#define DEFAULT_LOGIN_PATH "/bin:/usr/bin:/usr/local/bin"
+#define DEFAULT_ROOT_LOGIN_PATH \
+ "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
+
/* The shell to run if none is given in the user's passwd entry. */
#define DEFAULT_SHELL "/bin/sh"

View File

@ -0,0 +1,60 @@
diff -ru coreutils-6.9.orig/lib/utimens.c coreutils-6.9/lib/utimens.c
--- coreutils-6.9.orig/lib/utimens.c 2007-01-18 09:33:34.000000000 +0100
+++ coreutils-6.9/lib/utimens.c 2008-01-23 18:53:02.000000000 +0100
@@ -75,7 +75,7 @@
Return 0 on success, -1 (setting errno) on failure. */
int
-futimens (int fd ATTRIBUTE_UNUSED,
+cu_futimens (int fd ATTRIBUTE_UNUSED,
char const *file, struct timespec const timespec[2])
{
/* Some Linux-based NFS clients are buggy, and mishandle time stamps
@@ -185,5 +185,5 @@
int
utimens (char const *file, struct timespec const timespec[2])
{
- return futimens (-1, file, timespec);
+ return cu_futimens (-1, file, timespec);
}
diff -ru coreutils-6.9.orig/lib/utimens.h coreutils-6.9/lib/utimens.h
--- coreutils-6.9.orig/lib/utimens.h 2008-01-23 18:49:40.000000000 +0100
+++ coreutils-6.9/lib/utimens.h 2008-01-23 18:53:03.000000000 +0100
@@ -1,3 +1,3 @@
#include <time.h>
-int futimens (int, char const *, struct timespec const [2]);
+int cu_futimens (int, char const *, struct timespec const [2]);
int utimens (char const *, struct timespec const [2]);
diff -ru coreutils-6.9.orig/src/copy.c coreutils-6.9/src/copy.c
--- coreutils-6.9.orig/src/copy.c 2007-03-18 22:36:43.000000000 +0100
+++ coreutils-6.9/src/copy.c 2008-01-23 18:50:53.000000000 +0100
@@ -518,7 +518,7 @@
timespec[0] = get_stat_atime (src_sb);
timespec[1] = get_stat_mtime (src_sb);
- if (futimens (dest_desc, dst_name, timespec) != 0)
+ if (cu_futimens (dest_desc, dst_name, timespec) != 0)
{
error (0, errno, _("preserving times for %s"), quote (dst_name));
if (x->require_preserve)
diff -ru coreutils-6.9.orig/src/touch.c coreutils-6.9/src/touch.c
--- coreutils-6.9.orig/src/touch.c 2007-03-18 22:36:43.000000000 +0100
+++ coreutils-6.9/src/touch.c 2008-01-23 18:50:54.000000000 +0100
@@ -167,7 +167,7 @@
if (amtime_now)
{
- /* Pass NULL to futimens so it will not fail if we have
+ /* Pass NULL to cu_futimens so it will not fail if we have
write access to the file, but don't own it. */
t = NULL;
}
@@ -182,7 +182,7 @@
t = timespec;
}
- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
+ ok = (cu_futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
if (fd == STDIN_FILENO)
{

View File

@ -0,0 +1,13 @@
diff -ru coreutils-6.9.orig/src/su.c coreutils-6.9/src/su.c
--- coreutils-6.9.orig/src/su.c 2007-04-19 12:05:12.000000000 +0200
+++ coreutils-6.9/src/su.c 2007-04-19 12:07:56.000000000 +0200
@@ -387,6 +387,9 @@
xsetenv ("USER", pw->pw_name);
xsetenv ("LOGNAME", pw->pw_name);
}
+ xsetenv ("PATH", (pw->pw_uid
+ ? DEFAULT_LOGIN_PATH
+ : DEFAULT_ROOT_LOGIN_PATH));
}
}
}

View File

@ -0,0 +1,58 @@
--- coreutils-6.9/src/uname.c.orig 2007-04-17 16:52:43.000000000 +0200
+++ coreutils-6.9/src/uname.c 2007-04-17 17:08:42.000000000 +0200
@@ -287,6 +287,36 @@
# endif
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char processor[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (processor, name.machine);
+ element = processor;
+#ifdef __linux__
+ if (!strcmp (element, "i686"))
+ {
+ /* Check for Athlon */
+ char line[1024];
+ FILE *f = fopen ("/proc/cpuinfo", "r");
+ if (f)
+ {
+ while (fgets (line, sizeof (line), f) > 0)
+ {
+ if (strncmp (line, "vendor_id", 9) == 0)
+ {
+ if (strstr (line, "AuthenticAMD"))
+ element = "athlon";
+ break;
+ }
+ }
+ fclose (f);
+ }
+ }
+#endif
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}
@@ -312,6 +342,18 @@
element = hardware_platform;
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char hardware_platform[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (hardware_platform, name.machine);
+ if (hardware_platform[0] == 'i' && hardware_platform[2] == '8'
+ && hardware_platform[3] == '6' && hardware_platform[4] == 0)
+ hardware_platform[1] = '3';
+ element = hardware_platform;
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}

View File

@ -0,0 +1,12 @@
diff -Nru coreutils-7.6.orig/src/date.c coreutils-7.6/src/date.c
--- coreutils-7.6.orig/src/date.c 2009-09-01 13:01:16.000000000 +0200
+++ coreutils-7.6/src/date.c 2009-10-11 13:18:29.000000000 +0200
@@ -456,7 +456,7 @@
written by date, which means "date" must generate output
using the POSIX locale; but adding _() would cause "date"
to use a Korean translation of the format. */
- format = "%a %b %e %H:%M:%S %Z %Y";
+ format = dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z %Y"), LC_TIME);
}
}

View File

@ -0,0 +1,55 @@
Submitted by: William Immendorf <will.immendorf@gmail.com>
Date: 2010-05-08
Inital Package Version: 8.5
Origin: http://cvs.fedoraproject.org/viewvc/devel/coreutils/coreutils-8.2-uname-processortype.patch
Upstream Status: Rejected
Description: Fixes the output of uname's -i and -p parameters
diff -Naur coreutils-8.5.orig/src/uname.c coreutils-8.5/src/uname.c
--- coreutils-8.5.orig/src/uname.c 2010-05-08 11:50:59.153186845 -0500
+++ coreutils-8.5/src/uname.c 2010-05-08 11:51:14.254062912 -0500
@@ -301,13 +301,19 @@
if (toprint & PRINT_PROCESSOR)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_ARCHITECTURE
{
static char processor[257];
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ }
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
@@ -345,7 +351,7 @@
if (toprint & PRINT_HARDWARE_PLATFORM)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
@@ -353,6 +359,14 @@
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
+ element[1]='3';
+ }
#endif
#ifdef UNAME_HARDWARE_PLATFORM
if (element == unknown)

4650
coreutils-8.22-i18n.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
--- coreutils-8.4.orig/src/tail.c 2010-01-03 18:06:20.000000000 +0100
+++ coreutils-8.4/src/tail.c 2010-03-24 17:44:09.709925764 +0100
@@ -54,7 +54,7 @@
/* inotify needs to know if a file is local. */
# include "fs.h"
-# if HAVE_SYS_STATFS_H
+# if HAVE_SYS_STATVFS_H
# include <sys/statfs.h>
# endif
#endif

428
coreutils-8.4-pam.patch Normal file
View File

@ -0,0 +1,428 @@
diff -urNp coreutils-8.4-orig/configure.ac coreutils-8.4/configure.ac
--- coreutils-8.4-orig/configure.ac 2010-01-11 18:20:42.000000000 +0100
+++ coreutils-8.4/configure.ac 2010-02-12 10:17:46.000000000 +0100
@@ -126,6 +126,13 @@ if test "$gl_gcc_warnings" = yes; then
AC_SUBST([GNULIB_WARN_CFLAGS])
fi
+dnl Give the chance to enable PAM
+AC_ARG_ENABLE(pam, dnl
+[ --enable-pam Enable use of the PAM libraries],
+[AC_DEFINE(USE_PAM, 1, [Define if you want to use PAM])
+LIB_PAM="-ldl -lpam -lpam_misc"
+AC_SUBST(LIB_PAM)])
+
AC_FUNC_FORK
optional_bin_progs=
diff -urNp coreutils-8.4-orig/doc/coreutils.texi coreutils-8.4/doc/coreutils.texi
--- coreutils-8.4-orig/doc/coreutils.texi 2010-01-03 18:06:20.000000000 +0100
+++ coreutils-8.4/doc/coreutils.texi 2010-02-12 10:17:46.000000000 +0100
@@ -15081,8 +15081,11 @@ to certain shells, etc.).
@findex syslog
@command{su} can optionally be compiled to use @code{syslog} to report
failed, and optionally successful, @command{su} attempts. (If the system
-supports @code{syslog}.) However, GNU @command{su} does not check if the
-user is a member of the @code{wheel} group; see below.
+supports @code{syslog}.)
+
+This version of @command{su} has support for using PAM for
+authentication. You can edit @file{/etc/pam.d/su} to customize its
+behaviour.
The program accepts the following options. Also see @ref{Common options}.
@@ -15124,6 +15127,8 @@ environment variables except @env{TERM},
@env{PATH} to a compiled-in default value. Change to @var{user}'s home
directory. Prepend @samp{-} to the shell's name, intended to make it
read its login startup file(s).
+Additionaly @env{DISPLAY} and @env{XAUTHORITY} environment variables
+are preserved as well for PAM functionality.
@item -m
@itemx -p
@@ -15163,33 +15168,6 @@ Exit status:
the exit status of the subshell otherwise
@end display
-@cindex wheel group, not supported
-@cindex group wheel, not supported
-@cindex fascism
-@subsection Why GNU @command{su} does not support the @samp{wheel} group
-
-(This section is by Richard Stallman.)
-
-@cindex Twenex
-@cindex MIT AI lab
-Sometimes a few of the users try to hold total power over all the
-rest. For example, in 1984, a few users at the MIT AI lab decided to
-seize power by changing the operator password on the Twenex system and
-keeping it secret from everyone else. (I was able to thwart this coup
-and give power back to the users by patching the kernel, but I
-wouldn't know how to do that in Unix.)
-
-However, occasionally the rulers do tell someone. Under the usual
-@command{su} mechanism, once someone learns the root password who
-sympathizes with the ordinary users, he or she can tell the rest. The
-``wheel group'' feature would make this impossible, and thus cement the
-power of the rulers.
-
-I'm on the side of the masses, not that of the rulers. If you are
-used to supporting the bosses and sysadmins in whatever they do, you
-might find this idea strange at first.
-
-
@node timeout invocation
@section @command{timeout}: Run a command with a time limit
diff -urNp coreutils-8.4-orig/src/Makefile.am coreutils-8.4/src/Makefile.am
--- coreutils-8.4-orig/src/Makefile.am 2010-01-03 18:06:20.000000000 +0100
+++ coreutils-8.4/src/Makefile.am 2010-02-12 10:17:46.000000000 +0100
@@ -361,7 +361,7 @@ factor_LDADD += $(LIB_GMP)
uptime_LDADD += $(GETLOADAVG_LIBS)
# for crypt
-su_LDADD += $(LIB_CRYPT)
+su_LDADD += $(LIB_CRYPT) @LIB_PAM@
# for various ACL functions
copy_LDADD += $(LIB_ACL)
diff -urNp coreutils-8.4-orig/src/su.c coreutils-8.4/src/su.c
--- coreutils-8.4-orig/src/su.c 2010-02-12 10:15:15.000000000 +0100
+++ coreutils-8.4/src/su.c 2010-02-12 10:24:29.000000000 +0100
@@ -37,6 +37,16 @@
restricts who can su to UID 0 accounts. RMS considers that to
be fascist.
+#ifdef USE_PAM
+
+ Actually, with PAM, su has nothing to do with whether or not a
+ wheel group is enforced by su. RMS tries to restrict your access
+ to a su which implements the wheel group, but PAM considers that
+ to be fascist, and gives the user/sysadmin the opportunity to
+ enforce a wheel group by proper editing of /etc/pam.conf
+
+#endif
+
Compile-time options:
-DSYSLOG_SUCCESS Log successful su's (by default, to root) with syslog.
-DSYSLOG_FAILURE Log failed su's (by default, to root) with syslog.
@@ -53,6 +63,15 @@
#include <pwd.h>
#include <grp.h>
+#ifdef USE_PAM
+# include <signal.h>
+# include <sys/wait.h>
+# include <sys/fsuid.h>
+# include <unistd.h>
+# include <security/pam_appl.h>
+# include <security/pam_misc.h>
+#endif /* USE_PAM */
+
#include "system.h"
#include "getpass.h"
@@ -120,10 +139,17 @@
/* The user to become if none is specified. */
#define DEFAULT_USER "root"
+#ifndef USE_PAM
char *crypt (char const *key, char const *salt);
+#endif
-static void run_shell (char const *, char const *, char **, size_t)
+static void run_shell (char const *, char const *, char **, size_t,
+ const struct passwd *)
+#ifdef USE_PAM
+ ;
+#else
ATTRIBUTE_NORETURN;
+#endif
/* If true, pass the `-f' option to the subshell. */
static bool fast_startup;
@@ -209,7 +235,26 @@ log_su (struct passwd const *pw, bool su
}
#endif
+#ifdef USE_PAM
+static pam_handle_t *pamh = NULL;
+static int retval;
+static struct pam_conv conv = {
+ misc_conv,
+ NULL
+};
+
+#define PAM_BAIL_P if (retval) { \
+ pam_end(pamh, PAM_SUCCESS); \
+ return 0; \
+}
+#define PAM_BAIL_P_VOID if (retval) { \
+ pam_end(pamh, PAM_SUCCESS); \
+return; \
+}
+#endif
+
/* Ask the user for a password.
+ If PAM is in use, let PAM ask for the password if necessary.
Return true if the user gives the correct password for entry PW,
false if not. Return true without asking for a password if run by UID 0
or if PW has an empty password. */
@@ -217,6 +262,44 @@ log_su (struct passwd const *pw, bool su
static bool
correct_password (const struct passwd *pw)
{
+#ifdef USE_PAM
+ struct passwd *caller;
+ char *tty_name, *ttyn;
+ retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh);
+ PAM_BAIL_P;
+
+ if (getuid() != 0 && !isatty(0)) {
+ fprintf(stderr, "standard in must be a tty\n");
+ exit(1);
+ }
+
+ caller = getpwuid(getuid());
+ if(caller != NULL && caller->pw_name != NULL) {
+ retval = pam_set_item(pamh, PAM_RUSER, caller->pw_name);
+ PAM_BAIL_P;
+ }
+
+ ttyn = ttyname(0);
+ if (ttyn) {
+ if (strncmp(ttyn, "/dev/", 5) == 0)
+ tty_name = ttyn+5;
+ else
+ tty_name = ttyn;
+ retval = pam_set_item(pamh, PAM_TTY, tty_name);
+ PAM_BAIL_P;
+ }
+ retval = pam_authenticate(pamh, 0);
+ PAM_BAIL_P;
+ retval = pam_acct_mgmt(pamh, 0);
+ if (retval == PAM_NEW_AUTHTOK_REQD) {
+ /* password has expired. Offer option to change it. */
+ retval = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
+ PAM_BAIL_P;
+ }
+ PAM_BAIL_P;
+ /* must be authenticated if this point was reached */
+ return 1;
+#else /* !USE_PAM */
char *unencrypted, *encrypted, *correct;
#if HAVE_GETSPNAM && HAVE_STRUCT_SPWD_SP_PWDP
/* Shadow passwd stuff for SVR3 and maybe other systems. */
@@ -241,6 +324,7 @@ correct_password (const struct passwd *p
encrypted = crypt (unencrypted, correct);
memset (unencrypted, 0, strlen (unencrypted));
return STREQ (encrypted, correct);
+#endif /* !USE_PAM */
}
/* Update `environ' for the new shell based on PW, with SHELL being
@@ -254,12 +338,18 @@ modify_environment (const struct passwd
/* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
Unset all other environment variables. */
char const *term = getenv ("TERM");
+ char const *display = getenv ("DISPLAY");
+ char const *xauthority = getenv ("XAUTHORITY");
if (term)
term = xstrdup (term);
environ = xmalloc ((6 + !!term) * sizeof (char *));
environ[0] = NULL;
if (term)
xsetenv ("TERM", term);
+ if (display)
+ xsetenv ("DISPLAY", display);
+ if (xauthority)
+ xsetenv ("XAUTHORITY", xauthority);
xsetenv ("HOME", pw->pw_dir);
xsetenv ("SHELL", shell);
xsetenv ("USER", pw->pw_name);
@@ -292,8 +382,13 @@ change_identity (const struct passwd *pw
{
#ifdef HAVE_INITGROUPS
errno = 0;
- if (initgroups (pw->pw_name, pw->pw_gid) == -1)
+ if (initgroups (pw->pw_name, pw->pw_gid) == -1) {
+#ifdef USE_PAM
+ pam_close_session(pamh, 0);
+ pam_end(pamh, PAM_ABORT);
+#endif
error (EXIT_CANCELED, errno, _("cannot set groups"));
+ }
endgrent ();
#endif
if (setgid (pw->pw_gid))
@@ -302,6 +397,31 @@ change_identity (const struct passwd *pw
error (EXIT_CANCELED, errno, _("cannot set user id"));
}
+#ifdef USE_PAM
+static int caught=0;
+/* Signal handler for parent process later */
+static void su_catch_sig(int sig)
+{
+ ++caught;
+}
+
+int
+pam_copyenv (pam_handle_t *pamh)
+{
+ char **env;
+
+ env = pam_getenvlist(pamh);
+ if(env) {
+ while(*env) {
+ if (putenv (*env))
+ xalloc_die ();
+ env++;
+ }
+ }
+ return(0);
+}
+#endif
+
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
If COMMAND is nonzero, pass it to the shell with the -c option.
Pass ADDITIONAL_ARGS to the shell as more arguments; there
@@ -309,17 +429,49 @@ change_identity (const struct passwd *pw
static void
run_shell (char const *shell, char const *command, char **additional_args,
- size_t n_additional_args)
+ size_t n_additional_args, const struct passwd *pw)
{
size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1;
char const **args = xnmalloc (n_args, sizeof *args);
size_t argno = 1;
+#ifdef USE_PAM
+ int child;
+ sigset_t ourset;
+ int status;
+
+ retval = pam_open_session(pamh,0);
+ if (retval != PAM_SUCCESS) {
+ fprintf (stderr, "could not open session\n");
+ exit (1);
+ }
+
+/* do this at the last possible moment, because environment variables may
+ be passed even in the session phase
+*/
+ if(pam_copyenv(pamh) != PAM_SUCCESS)
+ fprintf (stderr, "error copying PAM environment\n");
+
+ /* Credentials should be set in the parent */
+ if (pam_setcred(pamh, PAM_ESTABLISH_CRED) != PAM_SUCCESS) {
+ pam_close_session(pamh, 0);
+ fprintf(stderr, "could not set PAM credentials\n");
+ exit(1);
+ }
+
+ child = fork();
+ if (child == 0) { /* child shell */
+ change_identity (pw);
+ pam_end(pamh, 0);
+#endif
if (simulate_login)
{
char *arg0;
char *shell_basename;
+ if(chdir(pw->pw_dir))
+ error(0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
+
shell_basename = last_component (shell);
arg0 = xmalloc (strlen (shell_basename) + 2);
arg0[0] = '-';
@@ -344,6 +496,67 @@ run_shell (char const *shell, char const
error (0, errno, "%s", shell);
exit (exit_status);
}
+#ifdef USE_PAM
+ } else if (child == -1) {
+ fprintf(stderr, "can not fork user shell: %s", strerror(errno));
+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
+ pam_close_session(pamh, 0);
+ pam_end(pamh, PAM_ABORT);
+ exit(1);
+ }
+ /* parent only */
+ sigfillset(&ourset);
+ if (sigprocmask(SIG_BLOCK, &ourset, NULL)) {
+ fprintf(stderr, "%s: signal malfunction\n", PROGRAM_NAME);
+ caught = 1;
+ }
+ if (!caught) {
+ struct sigaction action;
+ action.sa_handler = su_catch_sig;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigemptyset(&ourset);
+ if (sigaddset(&ourset, SIGTERM)
+ || sigaddset(&ourset, SIGALRM)
+ || sigaction(SIGTERM, &action, NULL)
+ || sigprocmask(SIG_UNBLOCK, &ourset, NULL)) {
+ fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME);
+ caught = 1;
+ }
+ }
+ if (!caught) {
+ do {
+ int pid;
+
+ pid = waitpid(-1, &status, WUNTRACED);
+
+ if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) {
+ kill(getpid(), WSTOPSIG(status));
+ /* once we get here, we must have resumed */
+ kill(pid, SIGCONT);
+ }
+ } while (0 != WIFSTOPPED(status));
+ }
+
+ if (caught) {
+ fprintf(stderr, "\nSession terminated, killing shell...");
+ kill (child, SIGTERM);
+ }
+ /* Not checking retval on this because we need to call close session */
+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
+ retval = pam_close_session(pamh, 0);
+ PAM_BAIL_P_VOID;
+ retval = pam_end(pamh, PAM_SUCCESS);
+ PAM_BAIL_P_VOID;
+ if (caught) {
+ sleep(2);
+ kill(child, SIGKILL);
+ fprintf(stderr, " ...killed.\n");
+ exit(-1);
+ }
+ exit ((0 != WIFEXITED (status)) ? WEXITSTATUS (status)
+ : WTERMSIG (status) + 128);
+#endif /* USE_PAM */
}
/* Return true if SHELL is a restricted shell (one not returned by
@@ -511,9 +724,9 @@ main (int argc, char **argv)
shell = xstrdup (shell ? shell : pw->pw_shell);
modify_environment (pw, shell);
+#ifndef USE_PAM
change_identity (pw);
- if (simulate_login && chdir (pw->pw_dir) != 0)
- error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
+#endif
/* error() flushes stderr, but does not check for write failure.
Normally, we would catch this via our atexit() hook of
@@ -523,5 +736,5 @@ main (int argc, char **argv)
if (ferror (stderr))
exit (EXIT_CANCELED);
- run_shell (shell, command, argv + optind, MAX (0, argc - optind));
+ run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw);
}

9
coreutils-pam-su Normal file
View File

@ -0,0 +1,9 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth include system-auth
auth required pam_nologin.so
account include system-auth
password include system-auth
session include system-auth
session required pam_limits.so
#session optional pam_console.so

348
coreutils.spec Normal file
View File

@ -0,0 +1,348 @@
%define i18npatch_version %version
Name: coreutils
Version: 8.22
Release: 1mamba
Summary: A GNU set of tools commonly used in shell scripts
Group: System/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.gnu.org/software/coreutils/
Source0: ftp://ftp.gnu.org/gnu/coreutils/%{name}-%{version}.tar.xz
Source1: coreutils-pam-su
Patch0: %{name}-7.6-langinfo.patch
# http://www.linuxfromscratch.org/patches/downloads/coreutils
#Patch2: http://www.linuxfromscratch.org/patches/downloads/coreutils/coreutils-%{i18npatch_version}-i18n-1.patch
# or http://pkgs.fedoraproject.org/cgit/coreutils.git/plain/coreutils-i18n.patch
Patch2: coreutils-8.22-i18n.patch
#%{name}-8.16-i18n-1.patch
Patch3: %{name}-5.2.1-su_paths.patch
Patch5: %{name}-8.4-pam.patch
Patch6: %{name}-6.9-uname_element_unknown.patch
Patch7: %{name}-6.9-su_setrootpaths.patch
Patch8: %{name}-6.9-rename_futimens.patch
Patch9: %{name}-8.4-cross_compile.patch
Patch10: %{name}-8.14-uname-1.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libacl-devel
BuildRequires: libattr-devel
BuildRequires: libcap-devel
BuildRequires: libgmp-devel
BuildRequires: libselinux-devel
## AUTOBUILDREQ-END
%if "%{stage1}" != "1"
BuildRequires: perl-Digest-SHA1
%endif
BuildRequires: gettext-devel
BuildRequires: bison
BuildRequires: autoconf >= 2.58
BuildRequires: automake >= 1.8
Requires(post):%{__install_info}
%if "%{stage1}" != "1"
Requires: perl-Digest-SHA1
%endif
Provides: fileutils = %{version}
Provides: sh-utils = %{version}
Provides: textutils = %{?epoch:%epoch:}%{version}
Provides: mktemp
Obsoletes: textutils
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
These are the GNU core utilities.
This package is the union of the old GNU fileutils, sh-utils, and textutils packages.
These tools're the GNU versions of common useful and popular file and text utilities which are used for:
- file management
- shell scripts
- modifying text file (spliting, joining, comparing, modifying, ...)
Most of these programs have significant advantages over their Unix counterparts, such as greater speed, additional options, and fewer arbitrary limits.
%prep
%setup -q
%patch0 -p1 -b .langinfo
# lin18nux/LSB compliance
%patch2 -p1 -b .i18n
#%patch3 -p1 -b .su_paths
# RMS will never accept the PAM patch because it removes his historical
# rant about Twenex and the wheel group, so we'll (Fedora) continue to
# maintain it here indefinitely
#%patch5 -p1 -b .pam
%patch6 -p1 -b .uname_element_unknown.patch
#%patch7 -p1 -b .su_setrootpaths.patch
#%patch9 -p1
%patch10 -p1
# docs should say /var/run/[uw]tmp not /etc/[uw]tmp
sed -i 's,/etc/utmp,/var/run/utmp,g;
s,/etc/wtmp,/var/run/wtmp,g' doc/coreutils.texi
%build
export CFLAGS="%{optflags} -fpic -D_GNU_SOURCE=1"
# see: ./lib/config.h
CONFIG_OPTS="DEFAULT_POSIX2_VERSION=200112"
%if "%{_host}" != "%{_build}"
# disable help2man execution
sed -i "s|\.x\.1:|disabled.x.1:|" man/Makefile.in
cat > config.cache << _EOF
fu_cv_sys_stat_statvfs=yes
gl_cv_func_sleep_works=yes
_EOF
%endif
touch aclocal.m4 configure config.hin Makefile.in */Makefile.in
#aclocal -I m4 &&
#autoconf --force &&
#automake-1.10 --copy --add-missing &&
%configure ${CONFIG_OPTS} \
%if "%{_host}" != "%{_build}"
--cache-file=config.cache
%endif
# export CPPFLAGS="-DUSE_PAM"
#LDFLAGS="-lpam -lpam_misc" \
%make all -j1 \
%if "%{_host}" != "%{_build}"
LIB_SELINUX="-lsepol -lselinux"
%endif
[ -f ChangeLog -a ! -f ChangeLog.bz2 ] && bzip2 -9f ChangeLog
## don't run basic-1 test, since it breaks when run in the background
#sed -i '/basic-1/d' tests/Makefile*
#chmod a+x tests/misc/sort-mb-tests
## FIXME: cut test fails; disabling it
#sed -i '/misc\/cut/d' tests/Makefile*
## run the test suite
#%if "%{_host}" == "%{_build}"
#%ifnarch arm
##env RUN_EXPENSIVE_TESTS=yes make check
#make check || make check
#%endif
#%endif
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%makeinstall
install -d %{buildroot}{/bin,%_bindir,%_sbindir}
for f in basename cat chgrp chmod chown cp cut date dd df echo env false \
link ln ls mkdir mknod mktemp mv nice pwd rm rmdir sleep sort stty sync \
touch true uname unlink; do
[ -f %{buildroot}%{_bindir}/$f ] && mv %{buildroot}{%_bindir,/bin}/$f
done
# mktemp,cat: create a link for backward compatibility
ln -sf /bin/mktemp %{buildroot}%{_bindir}/mktemp
ln -sf /bin/cut %{buildroot}%{_bindir}/cut
mv %{buildroot}%{_bindir}/chroot %{buildroot}%{_sbindir}
# These tools come from other packages
for f in hostname groups kill uptime; do
rm -f %{buildroot}{%_bindir/$f,%_mandir/man1/${f}.1}
done
#install src/su %{buildroot}/bin/su
#install -D -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/pam.d/su
ln -sf ../../bin/env %{buildroot}%{_bindir}/env
ln -sf ../usr/bin/install %{buildroot}/bin/install
%find_lang %{name}
%post
%install_info %{name}.info
exit 0
%preun
%uninstall_info %{name}.info
exit 0
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%files -f %{name}.lang
%defattr(-,root,root)
#%attr(4775,root,root) /bin/su
#%config %{_sysconfdir}/pam.d/su
/bin/*
%{_bindir}/*
%{_sbindir}/*
%{_libexecdir}/coreutils/libstdbuf.so
%{_infodir}/*
%{_mandir}/man1/*
%doc AUTHORS THANKS
#%doc AUTHORS ChangeLog* NEWS README TODO
#%doc THANKS THANKS-to-translators THANKStt.in
%changelog
* Thu Dec 19 2013 Automatic Build System <autodist@mambasoft.it> 8.22-1mamba
- automatic version update by autodist
* Tue Jun 18 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 8.21-2mamba
- provide /usr/bin/cat symlink required to build openjdk
* Mon Feb 18 2013 Automatic Build System <autodist@mambasoft.it> 8.21-1mamba
- update to 8.21
* Mon Dec 03 2012 Automatic Build System <autodist@mambasoft.it> 8.20-1mamba
- update to 8.20
* Tue Aug 21 2012 Automatic Build System <autodist@mambasoft.it> 8.19-1mamba
- automatic version update by autodist
* Sun Aug 19 2012 Automatic Build System <autodist@mambasoft.it> 8.18-1mamba
- automatic version update by autodist
* Wed May 23 2012 Automatic Build System <autodist@mambasoft.it> 8.17-1mamba
- automatic version update by autodist
* Wed Apr 04 2012 Automatic Build System <autodist@mambasoft.it> 8.16-1mamba
- automatic version update by autodist
* Wed Jan 25 2012 Automatic Build System <autodist@mambasoft.it> 8.15-1mamba
- automatic version update by autodist
* Fri Oct 14 2011 Automatic Build System <autodist@mambasoft.it> 8.14-1mamba
- update to 8.14
* Fri Jul 22 2011 Automatic Build System <autodist@mambasoft.it> 8.12-1mamba
- automatic update by autodist
* Sun Feb 13 2011 Automatic Build System <autodist@mambasoft.it> 8.10-1mamba
- automatic update by autodist
* Wed Jan 05 2011 Automatic Build System <autodist@mambasoft.it> 8.9-1mamba
- automatic update by autodist
* Thu Dec 23 2010 Automatic Build System <autodist@mambasoft.it> 8.8-1mamba
- automatic update to 8.8 by autodist
* Sun Nov 14 2010 Automatic Build System <autodist@mambasoft.it> 8.7-1mamba
- automatic update to 8.7 by autodist
* Fri Oct 29 2010 Automatic Build System <autodist@mambasoft.it> 8.6-1mamba
- automatic update by autodist
* Mon Jul 12 2010 Automatic Build System <autodist@mambasoft.it> 8.5-2mamba
- automatic rebuild by autodist
* Sat May 08 2010 Automatic Build System <autodist@mambasoft.it> 8.5-1mamba
- automatic update to 8.5 by autodist
* Fri Apr 09 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 8.4-2mamba
- re-enabled the pam patch from fedora
* Thu Jan 14 2010 Automatic Build System <autodist@mambasoft.it> 8.4-1mamba
- automatic update to 8.4 by autodist
* Fri Jan 08 2010 Automatic Build System <autodist@mambasoft.it> 8.3-1mamba
- automatic update to 8.3 by autodist
* Mon Dec 21 2009 Automatic Build System <autodist@mambasoft.it> 8.2-1mamba
- automatic update by autodist
* Sun Oct 11 2009 Automatic Build System <autodist@mambasoft.it> 7.6-1mamba
- automatic update to 7.6 by autodist
* Thu Sep 10 2009 Automatic Build System <autodist@mambasoft.it> 7.5-1mamba
- automatic update by autodist
* Fri May 08 2009 Automatic Build System <autodist@mambasoft.it> 7.4-1mamba
- automatic update to 7.4 by autodist
* Wed Apr 15 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 7.2-1mamba
- automatic update to 7.2 by autodist
* Tue Jul 01 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 6.12-1mamba
- update to 6.12
- add provide for mktemp
- updated i18n patch from Fedora CVS (http://cvs.fedoraproject.org)
- dropped rename_futimens patch applied upstream
* Wed Jan 23 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9-7mamba
- rebuild with rpm 4.4.9
* Tue Jul 03 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9-6mamba
- removed unused prereq for shadow-common
* Mon Jul 02 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9-5mamba
- su pam file fixed (remove use of pam_stack.so in favour of include directive)
* Mon Apr 30 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9-4mamba
- fix exit errors on pre and post scripts
* Thu Apr 19 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9-3mamba
- restore the su_setrootpaths patch for setting non-login root path
* Wed Apr 17 2007 Davide Madrisan <davide.madrisan@gmail.com> 6.9-2mamba
- fixed the output of uname
* Wed Apr 04 2007 Davide Madrisan <davide.madrisan@gmail.com> 6.9-1mamba
- update to version 6.9
- dropped the patch used to allow tools to accept obsolete options defined
in POSIX 1003.2-1992
- dropped coreutils-5.2.1-su_setrootpaths.patch: merged upstream
- dropped the now obsolete coreutils-6.9-uname.patch used to fix uname output
* Tue Sep 06 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 5.2.1-12qilnx
- fixes for ppc build
* Thu Jul 21 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 5.2.1-11qilnx
- su: set root paths (/sbin,/usr/sbin) for non simulated login escalations
* Thu May 18 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 5.2.1-10qilnx
- added %%config before /etc/pam.d/su
* Wed May 18 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 5.2.1-9qilnx
- added su with pam support, will replace shadow-tools's su
* Thu Apr 14 2005 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.1-8qilnx
- obsoletes `textutils' present in old QiLinux releases
* Fri Apr 08 2005 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.1-7qilnx
- fixed uname output
* Fri Apr 08 2005 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.1-6qilnx
- allow old options if the environment variable POSIXLY_CORRECT in not set
* Tue Apr 05 2005 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.1-5qilnx
- added patch to made coreutils LSB compliant
* Wed Oct 27 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 5.2.1-4qilnx
- moved install to /bin and made symlink in /usr/bin
* Fri Sep 17 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 5.2.1-3qilnx
- fixed the symlink to /bin/env in /usr/bin/env
* Thu Sep 02 2004 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.1-2qilnx
- fixed path for some coreutils tools
* Mon Mar 15 2004 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.1-1qilnx
- new version rebuild
* Tue Feb 24 2004 Davide Madrisan <davide.madrisan@qilinux.it> 5.2.0-1qilnx
- package updated to last stable version available
* Wed Nov 05 2003 Davide Madrisan <davide.madrisan@qilinux.it> 5.0.91-1qilnx
- rebuilt with version 5.0.91
* Mon May 09 2003 Silvan Calarco <silvan.calarco@qinet.it> 4.5.12-2qilnx
- removed hostname executable and man page (the one from net-tools will be used)
- removed su (conflicting with shadow-utils)
- removed /bin/kill, /bin/groups, /bin/uptime
* Mon May 09 2003 Silvan Calarco <silvan.calarco@qinet.it> 4.5.12-1qilnx
- first build as a replacement of old sh-utils, file-utils, text-utils packages