forked from pool/util-linux
update to 2.20-rc2
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=84
This commit is contained in:
parent
9b3333d97a
commit
4667eec309
@ -38,10 +38,10 @@ Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
|
||||
create mode 100644 mount/sha512.c
|
||||
create mode 100644 mount/sha512.h
|
||||
|
||||
Index: util-linux-2.20-rc1/mount/Makefile.am
|
||||
Index: util-linux-2.20-rc2/mount/Makefile.am
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/mount/Makefile.am
|
||||
+++ util-linux-2.20-rc1/mount/Makefile.am
|
||||
--- util-linux-2.20-rc2.orig/mount/Makefile.am
|
||||
+++ util-linux-2.20-rc2/mount/Makefile.am
|
||||
@@ -7,7 +7,7 @@ sbin_PROGRAMS = losetup swapon
|
||||
dist_man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8
|
||||
|
||||
@ -51,10 +51,10 @@ Index: util-linux-2.20-rc1/mount/Makefile.am
|
||||
|
||||
# generic header for mount and umount
|
||||
hdrs_mount = fstab.h mount_mntent.h mount_constants.h \
|
||||
Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
Index: util-linux-2.20-rc2/mount/lomount.c
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/mount/lomount.c
|
||||
+++ util-linux-2.20-rc1/mount/lomount.c
|
||||
--- util-linux-2.20-rc2.orig/mount/lomount.c
|
||||
+++ util-linux-2.20-rc2/mount/lomount.c
|
||||
@@ -23,6 +23,12 @@
|
||||
#include "sundries.h"
|
||||
#include "xmalloc.h"
|
||||
@ -68,7 +68,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
|
||||
#ifdef LOOP_SET_FD
|
||||
|
||||
@@ -509,12 +515,22 @@ show_loop_fd(int fd, char *device) {
|
||||
@@ -510,12 +516,22 @@ show_loop_fd(int fd, char *device) {
|
||||
|
||||
if (loopinfo64.lo_encrypt_type ||
|
||||
loopinfo64.lo_crypt_name[0]) {
|
||||
@ -94,7 +94,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
@@ -764,7 +780,7 @@ xgetpass(int pfd, const char *prompt) {
|
||||
@@ -765,7 +781,7 @@ xgetpass(int pfd, const char *prompt) {
|
||||
}
|
||||
|
||||
if (pass == NULL)
|
||||
@ -103,7 +103,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
|
||||
pass[i] = 0;
|
||||
return pass;
|
||||
@@ -778,6 +794,24 @@ digits_only(const char *s) {
|
||||
@@ -779,6 +795,24 @@ digits_only(const char *s) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
/*
|
||||
* return codes:
|
||||
* 0 - success
|
||||
@@ -786,10 +820,11 @@ digits_only(const char *s) {
|
||||
@@ -787,10 +821,11 @@ digits_only(const char *s) {
|
||||
*/
|
||||
int
|
||||
set_loop(const char *device, const char *file, unsigned long long offset,
|
||||
@ -142,7 +142,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
char *filename;
|
||||
|
||||
if (verbose) {
|
||||
@@ -827,13 +862,37 @@ set_loop(const char *device, const char
|
||||
@@ -828,13 +863,37 @@ set_loop(const char *device, const char
|
||||
filename = (char *) file;
|
||||
xstrncpy((char *)loopinfo64.lo_file_name, filename, LO_NAME_SIZE);
|
||||
|
||||
@ -182,7 +182,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -854,20 +913,69 @@ set_loop(const char *device, const char
|
||||
@@ -855,20 +914,69 @@ set_loop(const char *device, const char
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -264,21 +264,34 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
}
|
||||
|
||||
if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
|
||||
@@ -1022,7 +1130,13 @@ usage(FILE *f) {
|
||||
@@ -1024,14 +1132,20 @@ usage(FILE *out) {
|
||||
progname);
|
||||
|
||||
fprintf(f, _("\nOptions:\n"
|
||||
" -e | --encryption <type> enable data encryption with specified <name/num>\n"
|
||||
+ " -H | --phash <type> hash password using specified algorithm (sha512/sha256/sha384/rmd160/none)\n"
|
||||
" -h | --help this help\n"
|
||||
+ " -k | --keybits <num> specify number of bits in the hashed key given\n"
|
||||
+ " to the cipher. Some ciphers support several key\n"
|
||||
+ " sizes and might be more efficient with a smaller\n"
|
||||
+ " key size. Key sizes < 128 are generally not\n"
|
||||
+ " recommended\n"
|
||||
" -o | --offset <num> start at offset <num> into file\n"
|
||||
" --sizelimit <num> loop limited to only <num> bytes of the file\n"
|
||||
" -p | --pass-fd <num> read passphrase from file descriptor <num>\n"
|
||||
@@ -1036,11 +1150,14 @@ usage(FILE *f) {
|
||||
fputs(_("\nOptions:\n"), out);
|
||||
- fputs(_(" -e, --encryption <type> enable data encryption with specified <name/num>\n"
|
||||
- " -h, --help this help\n"
|
||||
- " -o, --offset <num> start at offset <num> into file\n"
|
||||
+ fputs(_(" -e | --encryption <type> enable data encryption with specified <name/num>\n"
|
||||
+ " -H | --phash <type> hash password using specified algorithm (sha512/sha256/sha384/rmd160/none)\n"
|
||||
+ " -h | --help this help\n"
|
||||
+ " -k | --keybits <num> specify number of bits in the hashed key given\n"
|
||||
+ " to the cipher. Some ciphers support several key\n"
|
||||
+ " sizes and might be more efficient with a smaller\n"
|
||||
+ " key size. Key sizes < 128 are generally not\n"
|
||||
+ " recommended\n"
|
||||
+ " -o | --offset <num> start at offset <num> into file\n"
|
||||
" --sizelimit <num> loop limited to only <num> bytes of the file\n"
|
||||
- " -p, --pass-fd <num> read passphrase from file descriptor <num>\n"
|
||||
- " -r, --read-only setup read-only loop device\n"
|
||||
+ " -p | --pass-fd <num> read passphrase from file descriptor <num>\n"
|
||||
+ " -r | --read-only setup read-only loop device\n"
|
||||
" --show print device name (with -f <file>)\n"
|
||||
- " -v, --verbose verbose mode\n\n"), out);
|
||||
+ " -v | --verbose verbose mode\n\n"), out);
|
||||
|
||||
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
@@ -1039,11 +1153,14 @@ usage(FILE *out) {
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *p, *offset, *sizelimit, *encryption, *passfd, *device, *file, *assoc;
|
||||
@ -293,7 +306,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
uintmax_t off = 0, slimit = 0;
|
||||
|
||||
static const struct option longopts[] = {
|
||||
@@ -1050,6 +1167,8 @@ main(int argc, char **argv) {
|
||||
@@ -1053,6 +1170,8 @@ main(int argc, char **argv) {
|
||||
{ "encryption", 1, 0, 'e' },
|
||||
{ "find", 0, 0, 'f' },
|
||||
{ "help", 0, 0, 'h' },
|
||||
@ -302,7 +315,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
{ "associated", 1, 0, 'j' },
|
||||
{ "offset", 1, 0, 'o' },
|
||||
{ "sizelimit", 1, 0, 128 },
|
||||
@@ -1066,12 +1185,13 @@ main(int argc, char **argv) {
|
||||
@@ -1069,12 +1188,13 @@ main(int argc, char **argv) {
|
||||
|
||||
capacity = delete = find = all = 0;
|
||||
assoc = offset = sizelimit = encryption = passfd = NULL;
|
||||
@ -317,7 +330,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
longopts, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
@@ -1099,6 +1219,12 @@ main(int argc, char **argv) {
|
||||
@@ -1102,6 +1222,12 @@ main(int argc, char **argv) {
|
||||
case 'j':
|
||||
assoc = optarg;
|
||||
break;
|
||||
@ -330,7 +343,7 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
case 'o':
|
||||
offset = optarg;
|
||||
break;
|
||||
@@ -1188,8 +1314,10 @@ main(int argc, char **argv) {
|
||||
@@ -1191,8 +1317,10 @@ main(int argc, char **argv) {
|
||||
else {
|
||||
if (passfd && sscanf(passfd, "%d", &pfd) != 1)
|
||||
usage(stderr);
|
||||
@ -342,10 +355,10 @@ Index: util-linux-2.20-rc1/mount/lomount.c
|
||||
if (res == 2 && find) {
|
||||
if (verbose)
|
||||
printf(_("stolen loop=%s...trying again\n"),
|
||||
Index: util-linux-2.20-rc1/mount/lomount.h
|
||||
Index: util-linux-2.20-rc2/mount/lomount.h
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/mount/lomount.h
|
||||
+++ util-linux-2.20-rc1/mount/lomount.h
|
||||
--- util-linux-2.20-rc2.orig/mount/lomount.h
|
||||
+++ util-linux-2.20-rc2/mount/lomount.h
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef UTIL_LINUX_LOMOUNT_H
|
||||
#define UTIL_LINUX_LOMOUNT_H
|
||||
@ -357,10 +370,10 @@ Index: util-linux-2.20-rc1/mount/lomount.h
|
||||
extern int del_loop(const char *);
|
||||
extern int is_loop_device(const char *);
|
||||
extern int is_loop_autoclear(const char *device);
|
||||
Index: util-linux-2.20-rc1/mount/losetup.8
|
||||
Index: util-linux-2.20-rc2/mount/losetup.8
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/mount/losetup.8
|
||||
+++ util-linux-2.20-rc1/mount/losetup.8
|
||||
--- util-linux-2.20-rc2.orig/mount/losetup.8
|
||||
+++ util-linux-2.20-rc2/mount/losetup.8
|
||||
@@ -96,9 +96,18 @@ find the first unused loop device. If a
|
||||
argument is present, use this device. Otherwise, print its name
|
||||
.IP "\fB\-h, \-\-help\fP"
|
||||
@ -389,10 +402,10 @@ Index: util-linux-2.20-rc1/mount/losetup.8
|
||||
|
||||
Cryptoloop is deprecated in favor of dm-crypt. For more details see
|
||||
.BR cryptsetup (8).
|
||||
Index: util-linux-2.20-rc1/mount/mount.8
|
||||
Index: util-linux-2.20-rc2/mount/mount.8
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/mount/mount.8
|
||||
+++ util-linux-2.20-rc1/mount/mount.8
|
||||
--- util-linux-2.20-rc2.orig/mount/mount.8
|
||||
+++ util-linux-2.20-rc2/mount/mount.8
|
||||
@@ -915,6 +915,15 @@ Every time the inode is modified, the i_
|
||||
.B noiversion
|
||||
Do not increment the i_version inode field.
|
||||
@ -420,10 +433,10 @@ Index: util-linux-2.20-rc1/mount/mount.8
|
||||
|
||||
Since Linux 2.6.25 is supported auto-destruction of loop devices and
|
||||
then any loop device allocated by
|
||||
Index: util-linux-2.20-rc1/mount/mount.c
|
||||
Index: util-linux-2.20-rc2/mount/mount.c
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/mount/mount.c
|
||||
+++ util-linux-2.20-rc1/mount/mount.c
|
||||
--- util-linux-2.20-rc2.orig/mount/mount.c
|
||||
+++ util-linux-2.20-rc2/mount/mount.c
|
||||
@@ -105,6 +105,9 @@ struct mountargs {
|
||||
void *data;
|
||||
};
|
||||
@ -515,10 +528,10 @@ Index: util-linux-2.20-rc1/mount/mount.c
|
||||
switch (argc+specseen) {
|
||||
case 0:
|
||||
/* mount -a */
|
||||
Index: util-linux-2.20-rc1/mount/rmd160.c
|
||||
Index: util-linux-2.20-rc2/mount/rmd160.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ util-linux-2.20-rc1/mount/rmd160.c
|
||||
+++ util-linux-2.20-rc2/mount/rmd160.c
|
||||
@@ -0,0 +1,532 @@
|
||||
+/* rmd160.c - RIPE-MD160
|
||||
+ * Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
@ -1052,10 +1065,10 @@ Index: util-linux-2.20-rc1/mount/rmd160.c
|
||||
+ rmd160_final( &hd );
|
||||
+ memcpy( outbuf, hd.buf, 20 );
|
||||
+}
|
||||
Index: util-linux-2.20-rc1/mount/rmd160.h
|
||||
Index: util-linux-2.20-rc2/mount/rmd160.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ util-linux-2.20-rc1/mount/rmd160.h
|
||||
+++ util-linux-2.20-rc2/mount/rmd160.h
|
||||
@@ -0,0 +1,11 @@
|
||||
+#ifndef RMD160_H
|
||||
+#define RMD160_H
|
||||
@ -1068,10 +1081,10 @@ Index: util-linux-2.20-rc1/mount/rmd160.h
|
||||
+#endif /*RMD160_H*/
|
||||
+
|
||||
+
|
||||
Index: util-linux-2.20-rc1/mount/sha512.c
|
||||
Index: util-linux-2.20-rc2/mount/sha512.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ util-linux-2.20-rc1/mount/sha512.c
|
||||
+++ util-linux-2.20-rc2/mount/sha512.c
|
||||
@@ -0,0 +1,432 @@
|
||||
+/*
|
||||
+ * sha512.c
|
||||
@ -1505,10 +1518,10 @@ Index: util-linux-2.20-rc1/mount/sha512.c
|
||||
+ memset(&ctx, 0, sizeof(ctx));
|
||||
+}
|
||||
+#endif
|
||||
Index: util-linux-2.20-rc1/mount/sha512.h
|
||||
Index: util-linux-2.20-rc2/mount/sha512.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ util-linux-2.20-rc1/mount/sha512.h
|
||||
+++ util-linux-2.20-rc2/mount/sha512.h
|
||||
@@ -0,0 +1,45 @@
|
||||
+/*
|
||||
+ * sha512.h
|
||||
|
@ -1,36 +0,0 @@
|
||||
From dd8f12f4bc28eaf8e746ae2e4489a4445793d4e3 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Uzel <petr.uzel@suse.cz>
|
||||
Date: Wed, 10 Aug 2011 14:08:55 +0200
|
||||
Subject: [PATCH] dmesg: avoid mess at the end of dmesg output
|
||||
|
||||
Since util-linux commit a7ee94f2204011f26232ed3133514bf6e0d4a62c,
|
||||
dmesg incorrectly calculates number of bytes that are remaining in the
|
||||
buffer in get_next_record(). This could, under specific circumstances,
|
||||
cause printing mess at the end of dmesg output:
|
||||
|
||||
> dmesg | tail
|
||||
[ 1191.478725] Adding 285488k swap on /root/swapfile. Priority:-2 extents:15 across:1186612k
|
||||
[ 1205.588331] Adding 285488k swap on /root/swapfile. Priority:-2 extents:15 across:1186612k
|
||||
\xffffffba\xffffffba
|
||||
|
||||
Reported-by: Glenn Doig <doiggl@velocitynet.com.au>
|
||||
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710417
|
||||
|
||||
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
|
||||
---
|
||||
sys-utils/dmesg.c | 2 ++
|
||||
1 files changed, 2 insertions(+), 0 deletions(-)
|
||||
|
||||
Index: util-linux-2.20-rc1/sys-utils/dmesg.c
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/sys-utils/dmesg.c
|
||||
+++ util-linux-2.20-rc1/sys-utils/dmesg.c
|
||||
@@ -492,6 +492,8 @@ static int get_next_record(struct dmesg_
|
||||
|
||||
rec->next_size -= end - rec->next;
|
||||
rec->next = rec->next_size > 0 ? end + 1 : NULL;
|
||||
+ if (rec->next_size > 0)
|
||||
+ rec->next_size--;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,322 +0,0 @@
|
||||
Index: util-linux-2.20-rc1/term-utils/agetty.8
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/term-utils/agetty.8
|
||||
+++ util-linux-2.20-rc1/term-utils/agetty.8
|
||||
@@ -87,9 +87,11 @@ whatever init(8) may have set, and is in
|
||||
Assume that the tty is 8-bit clean, hence disable parity detection.
|
||||
.TP
|
||||
\-a, \-\-autologin \fIusername\fP
|
||||
-Log the specified user automatically in without asking for a login
|
||||
-name and password. Check the \-f option from
|
||||
-\fB/bin/login\fP for this.
|
||||
+Log the specified user automatically in without asking for a login name and
|
||||
+password. The \-f \fIusername\fP option is added to the \fB/bin/login\fP
|
||||
+command line by default. The \-\-login-options option changes this default
|
||||
+behaviour and then only \\u is replaced by the \fIusername\fP and no other
|
||||
+option is added to the login command line.
|
||||
.TP
|
||||
\-c, \-\-noreset
|
||||
Don't reset terminal cflags (control modes). See \fItermios(3)\fP for more
|
||||
@@ -160,9 +162,10 @@ is run as root.
|
||||
.TP
|
||||
\-o, \-\-login\-options \fI"login_options"\fP
|
||||
Options that are passed to the login program. \\u is replaced
|
||||
-by the login name. Defaults to "-- \\u", which is suitable for
|
||||
-\fB/bin/login\fP. Please read the SECURITY NOTICE below if
|
||||
-you want to use this.
|
||||
+by the login name. The default \fB/bin/login\fP command line
|
||||
+is "/bin/login -- <username>".
|
||||
+
|
||||
+Please read the SECURITY NOTICE below if you want to use this.
|
||||
.TP
|
||||
\-p, \-\-login\-pause
|
||||
Wait for any key before dropping to the login prompt. Can be combined
|
||||
Index: util-linux-2.20-rc1/term-utils/agetty.c
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/term-utils/agetty.c
|
||||
+++ util-linux-2.20-rc1/term-utils/agetty.c
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
/* Login prompt. */
|
||||
#define LOGIN "login: "
|
||||
-#define ARRAY_SIZE_MAX 16 /* Numbers of args for login beside "-- \\u" */
|
||||
+#define LOGIN_ARGV_MAX 16 /* Numbers of args for login */
|
||||
|
||||
/* Some shorthands for control characters. */
|
||||
#define CTL(x) (x ^ 0100) /* Assumes ASCII dialect */
|
||||
@@ -262,9 +262,8 @@ static void log_err(const char *, ...) _
|
||||
static void log_warn (const char *, ...)
|
||||
__attribute__((__format__(printf, 1, 2)));
|
||||
static ssize_t append(char *dest, size_t len, const char *sep, const char *src);
|
||||
-static void checkname (const char* nm);
|
||||
-static void replacename (char** arr, const char* nm);
|
||||
-static void mkarray (char** arr, char* str);
|
||||
+static void check_username (const char* nm);
|
||||
+static void login_options_to_argv(char *argv[], int *argc, char *str, char *username);
|
||||
|
||||
/* Fake hostname for ut_host specified on command line. */
|
||||
static char *fakehost;
|
||||
@@ -278,19 +277,18 @@ FILE *dbf;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
- char *logname = NULL; /* login name, given to /bin/login */
|
||||
- char logcmd[NAME_MAX+1];
|
||||
- char *logarr[ARRAY_SIZE_MAX + 2]; /* arguments plus "-- \\u" */
|
||||
+ char *username = NULL; /* login name, given to /bin/login */
|
||||
struct chardata chardata; /* will be set by get_logname() */
|
||||
struct termios termios; /* terminal mode bits */
|
||||
static struct options options = {
|
||||
.flags = F_ISSUE, /* show /etc/issue (SYSV_STYLE) */
|
||||
.login = _PATH_LOGIN, /* default login program */
|
||||
- .logopt = "-- \\u", /* escape for user name */
|
||||
.tty = "tty1", /* default tty line */
|
||||
.term = DEFAULT_VCTERM, /* terminal type */
|
||||
.issue = ISSUE /* default issue file */
|
||||
};
|
||||
+ char *login_argv[LOGIN_ARGV_MAX + 1];
|
||||
+ int login_argc = 0;
|
||||
struct sigaction sa, sa_hup, sa_quit, sa_int;
|
||||
sigset_t set;
|
||||
|
||||
@@ -315,6 +313,8 @@ int main(int argc, char **argv)
|
||||
/* Parse command-line arguments. */
|
||||
parse_args(argc, argv, &options);
|
||||
|
||||
+ login_argv[login_argc++] = options.login; /* set login program name */
|
||||
+
|
||||
/* Update the utmp file. */
|
||||
#ifdef SYSV_STYLE
|
||||
update_utmp(&options);
|
||||
@@ -379,16 +379,15 @@ int main(int argc, char **argv)
|
||||
chardata = init_chardata;
|
||||
if ((options.flags & F_NOPROMPT) == 0) {
|
||||
if (options.autolog) {
|
||||
- /* Do the auto login */
|
||||
+ /* Do the auto login. */
|
||||
debug("doing auto login\n");
|
||||
do_prompt(&options, &termios);
|
||||
printf("%s%s (automatic login)\n", LOGIN, options.autolog);
|
||||
- logname = options.autolog;
|
||||
- options.logopt = "-f \\u";
|
||||
+ username = options.autolog;
|
||||
} else {
|
||||
/* Read the login name. */
|
||||
debug("reading login name\n");
|
||||
- while ((logname =
|
||||
+ while ((username =
|
||||
get_logname(&options, &termios, &chardata)) == 0)
|
||||
if ((options.flags & F_VCONSOLE) == 0)
|
||||
next_speed(&options, &termios);
|
||||
@@ -410,13 +409,25 @@ int main(int argc, char **argv)
|
||||
sigaction(SIGQUIT, &sa_quit, NULL);
|
||||
sigaction(SIGINT, &sa_int, NULL);
|
||||
|
||||
- *logcmd = '\0';
|
||||
- append(logcmd, sizeof(logcmd), NULL, options.login);
|
||||
- append(logcmd, sizeof(logcmd), " ", options.logopt);
|
||||
-
|
||||
- checkname(logname);
|
||||
- mkarray(logarr, logcmd);
|
||||
- replacename(logarr, logname);
|
||||
+ if (username)
|
||||
+ check_username(username);
|
||||
+
|
||||
+ if (options.logopt) {
|
||||
+ /*
|
||||
+ * The --login-options completely overwrites the default
|
||||
+ * way how agetty composes login(1) command line.
|
||||
+ */
|
||||
+ login_options_to_argv(login_argv, &login_argc,
|
||||
+ options.logopt, username);
|
||||
+ } else if (username) {
|
||||
+ if (options.autolog)
|
||||
+ login_argv[login_argc++] = "-f";
|
||||
+ else
|
||||
+ login_argv[login_argc++] = "--";
|
||||
+ login_argv[login_argc++] = username;
|
||||
+ }
|
||||
+
|
||||
+ login_argv[login_argc] = NULL; /* last login argv */
|
||||
|
||||
if (options.chroot) {
|
||||
if (chroot(options.chroot) < 0)
|
||||
@@ -435,8 +446,87 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Let the login program take care of password validation. */
|
||||
- execv(options.login, logarr);
|
||||
- log_err(_("%s: can't exec %s: %m"), options.tty, options.login);
|
||||
+ execv(options.login, login_argv);
|
||||
+ log_err(_("%s: can't exec %s: %m"), options.tty, login_argv[0]);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Returns : @str if \u not found
|
||||
+ * : @username if @str equal to "\u"
|
||||
+ * : newly allocated string if \u mixed with something other
|
||||
+ */
|
||||
+static char *replace_u(char *str, char *username)
|
||||
+{
|
||||
+ char *entry = NULL, *p = str;
|
||||
+ size_t usz = username ? strlen(username) : 0;
|
||||
+
|
||||
+ while (*p) {
|
||||
+ size_t sz;
|
||||
+ char *tp, *old = entry;
|
||||
+
|
||||
+ if (memcmp(p, "\\u", 2)) {
|
||||
+ p++;
|
||||
+ continue; /* no \u */
|
||||
+ }
|
||||
+ sz = strlen(str);
|
||||
+
|
||||
+ if (p == str && sz == 2)
|
||||
+ /* 'str' contains only '\u' */
|
||||
+ return username;
|
||||
+
|
||||
+ tp = entry = malloc(sz + usz);
|
||||
+ if (!tp)
|
||||
+ log_err(_("failed to allocate memory: %m"));
|
||||
+
|
||||
+ if (p != str) {
|
||||
+ /* copy chars befor \u */
|
||||
+ memcpy(tp, str, p - str);
|
||||
+ tp += p - str;
|
||||
+ }
|
||||
+ if (usz) {
|
||||
+ /* copy username */
|
||||
+ memcpy(tp, username, usz);
|
||||
+ tp += usz;
|
||||
+ }
|
||||
+ if (*(p + 2))
|
||||
+ /* copy chars after \u + \0 */
|
||||
+ memcpy(tp, p + 2, sz - (p - str) - 1);
|
||||
+ else
|
||||
+ *tp = '\0';
|
||||
+
|
||||
+ p = tp;
|
||||
+ str = entry;
|
||||
+ free(old);
|
||||
+ }
|
||||
+
|
||||
+ return entry ? entry : str;
|
||||
+}
|
||||
+
|
||||
+static void login_options_to_argv(char *argv[], int *argc,
|
||||
+ char *str, char *username)
|
||||
+{
|
||||
+ char *p;
|
||||
+ int i = *argc;
|
||||
+
|
||||
+ while (str && isspace(*str))
|
||||
+ str++;
|
||||
+ p = str;
|
||||
+
|
||||
+ while (p && *p && i < LOGIN_ARGV_MAX) {
|
||||
+ if (isspace(*p)) {
|
||||
+ *p = '\0';
|
||||
+ while (isspace(*++p))
|
||||
+ ;
|
||||
+ if (*p) {
|
||||
+ argv[i++] = replace_u(str, username);
|
||||
+ str = p;
|
||||
+ }
|
||||
+ } else
|
||||
+ p++;
|
||||
+ }
|
||||
+ if (str && *str && i < LOGIN_ARGV_MAX)
|
||||
+ argv[i++] = replace_u(str, username);
|
||||
+ *argc = i;
|
||||
}
|
||||
|
||||
/* Parse command-line arguments. */
|
||||
@@ -920,7 +1010,7 @@ static void termio_init(struct options *
|
||||
mode = K_RAW;
|
||||
switch(mode) {
|
||||
case K_UNICODE:
|
||||
- setlocale(LC_CTYPE, "en_US.UTF-8");
|
||||
+ setlocale(LC_CTYPE, "C.UTF-8");
|
||||
op->flags |= F_UTF8;
|
||||
break;
|
||||
case K_RAW:
|
||||
@@ -977,7 +1067,14 @@ static void termio_init(struct options *
|
||||
/* Flush input and output queues, important for modems! */
|
||||
tcflush(STDIN_FILENO, TCIOFLUSH);
|
||||
|
||||
- tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
|
||||
+#ifdef IUTF8
|
||||
+ tp->c_iflag = tp->c_iflag & IUTF8;
|
||||
+ if (tp->c_iflag & IUTF8)
|
||||
+ op->flags |= F_UTF8;
|
||||
+#else
|
||||
+ tp->c_iflag = 0;
|
||||
+#endif
|
||||
+ tp->c_lflag = tp->c_oflag = 0;
|
||||
|
||||
if ((op->flags & F_KEEPCFLAGS) == 0)
|
||||
tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
|
||||
@@ -1826,12 +1923,13 @@ static ssize_t append(char *dest, size_t
|
||||
|
||||
return dsz + ssz + sz;
|
||||
}
|
||||
+
|
||||
/*
|
||||
* Do not allow the user to pass an option as a user name
|
||||
* To be more safe: Use `--' to make sure the rest is
|
||||
* interpreted as non-options by the program, if it supports it.
|
||||
*/
|
||||
-static void checkname(const char* nm)
|
||||
+static void check_username(const char* nm)
|
||||
{
|
||||
const char *p = nm;
|
||||
if (!nm)
|
||||
@@ -1848,48 +1946,3 @@ err:
|
||||
log_err("checkname: %m");
|
||||
}
|
||||
|
||||
-static void replacename(char** arr, const char* nm)
|
||||
-{
|
||||
- const char *p;
|
||||
- char *tmp;
|
||||
- while ((p = *arr)) {
|
||||
- const char *p1 = p;
|
||||
- while (*p1) {
|
||||
- if (memcmp(p1, "\\u", 2) == 0) {
|
||||
- tmp = malloc(strlen(p) + strlen(nm));
|
||||
- if (!tmp)
|
||||
- log_err(_("failed to allocate memory: %m"));
|
||||
- if (p1 != p)
|
||||
- memcpy(tmp, p, (p1 - p));
|
||||
- *(tmp + (p1 - p)) = 0;
|
||||
- strcat(tmp, nm);
|
||||
- strcat(tmp, p1+2);
|
||||
- *arr = tmp;
|
||||
- }
|
||||
- p1++;
|
||||
- }
|
||||
- arr++;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void mkarray(char** arr, char* str)
|
||||
-{
|
||||
- char* p = str;
|
||||
- char* start = p;
|
||||
- int i = 0;
|
||||
-
|
||||
- while (*p && i < ARRAY_SIZE_MAX) {
|
||||
- if (isspace(*p)) {
|
||||
- *p = 0;
|
||||
- while (isspace(*++p))
|
||||
- ;
|
||||
- if (*p) {
|
||||
- arr[i++] = start;
|
||||
- start = p;
|
||||
- }
|
||||
- } else
|
||||
- p++;
|
||||
- }
|
||||
- arr[i++] = start;
|
||||
- arr[i++] = (char*) 0;
|
||||
-}
|
@ -1,65 +0,0 @@
|
||||
From 474b1ae3ca463acec0c625fb7076bcc746671479 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Uzel <petr.uzel@suse.cz>
|
||||
Date: Wed, 10 Aug 2011 15:23:53 +0200
|
||||
Subject: [PATCH] hexdump: fix segfault due to uninitialized memory
|
||||
|
||||
util-linux commit 85bf44b714ab184907eb448eba389218956d6a51
|
||||
replaced all calls to emalloc() with xmalloc(), whose semantics
|
||||
is however different - it does not zero allocated memory. This
|
||||
made hexdump segfault if MALLOC_PERTURB_ was set.
|
||||
|
||||
Reported-by: Kyrill Detinov <lazy.kent@opensuse.org>
|
||||
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710877
|
||||
|
||||
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
|
||||
---
|
||||
text-utils/display.c | 4 ++--
|
||||
text-utils/parse.c | 6 +++---
|
||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: util-linux-2.20-rc1/text-utils/display.c
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/text-utils/display.c
|
||||
+++ util-linux-2.20-rc1/text-utils/display.c
|
||||
@@ -233,8 +233,8 @@ get(void)
|
||||
u_char *tmpp;
|
||||
|
||||
if (!curp) {
|
||||
- curp = xmalloc(blocksize);
|
||||
- savp = xmalloc(blocksize);
|
||||
+ curp = xcalloc(1, blocksize);
|
||||
+ savp = xcalloc(1, blocksize);
|
||||
} else {
|
||||
tmpp = curp;
|
||||
curp = savp;
|
||||
Index: util-linux-2.20-rc1/text-utils/parse.c
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/text-utils/parse.c
|
||||
+++ util-linux-2.20-rc1/text-utils/parse.c
|
||||
@@ -86,7 +86,7 @@ void add(const char *fmt)
|
||||
const char *savep;
|
||||
|
||||
/* Start new linked list of format units. */
|
||||
- tfs = xmalloc(sizeof(FS));
|
||||
+ tfs = xcalloc(1, sizeof(FS));
|
||||
if (!fshead)
|
||||
fshead = tfs;
|
||||
else
|
||||
@@ -102,7 +102,7 @@ void add(const char *fmt)
|
||||
break;
|
||||
|
||||
/* Allocate a new format unit and link it in. */
|
||||
- tfu = xmalloc(sizeof(FU));
|
||||
+ tfu = xcalloc(1, sizeof(FU));
|
||||
*nextfu = tfu;
|
||||
nextfu = &tfu->nextfu;
|
||||
tfu->reps = 1;
|
||||
@@ -219,7 +219,7 @@ void rewrite(FS *fs)
|
||||
* conversion character gets its own.
|
||||
*/
|
||||
for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
|
||||
- pr = xmalloc(sizeof(PR));
|
||||
+ pr = xcalloc(1, sizeof(PR));
|
||||
if (!fu->nextpr)
|
||||
fu->nextpr = pr;
|
||||
else
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34edb87c1ae46a54921ea73dc9b07d010d0611cf79ff982f20bfc6841bae2fcc
|
||||
size 4513042
|
3
util-linux-2.20-rc2.tar.bz2
Normal file
3
util-linux-2.20-rc2.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bcdbb6413ef6a83c44e7e79db41cbd8ea7f0990781c12591e4e2339582c4397c
|
||||
size 4510886
|
@ -1,43 +0,0 @@
|
||||
From e20e7ff216288102ae012f6a0e80948e41f59452 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Uzel <petr.uzel@suse.cz>
|
||||
Date: Mon, 1 Aug 2011 17:42:41 +0200
|
||||
Subject: [PATCH] look: fix manpage formatting
|
||||
|
||||
|
||||
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
|
||||
---
|
||||
misc-utils/look.1 | 4 ++--
|
||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: util-linux-2.20-rc1/misc-utils/look.1
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/misc-utils/look.1
|
||||
+++ util-linux-2.20-rc1/misc-utils/look.1
|
||||
@@ -54,9 +54,9 @@ that
|
||||
is invoked with).
|
||||
.PP
|
||||
If
|
||||
-.Ar file
|
||||
+.I file
|
||||
is not specified, the file
|
||||
-.Pa /usr/share/dict/words
|
||||
+.I /usr/share/dict/words
|
||||
is used, only alphanumeric characters are compared and the case of
|
||||
alphabetic characters is ignored.
|
||||
.SH OPTIONS
|
||||
Index: util-linux-2.20-rc1/misc-utils/cal.1
|
||||
===================================================================
|
||||
--- util-linux-2.20-rc1.orig/misc-utils/cal.1
|
||||
+++ util-linux-2.20-rc1/misc-utils/cal.1
|
||||
@@ -35,9 +35,8 @@
|
||||
.\" @(#)cal.1 8.1 (Berkeley) 6/6/93
|
||||
.\"
|
||||
.TH CAL "1" "June 2011" "util-linux" "User Commands"
|
||||
-.Sh NAME
|
||||
-.Nm cal
|
||||
-.Nd displays a calendar
|
||||
+.SH NAME
|
||||
+cal \- displays a calendar
|
||||
.SH SYNOPSIS
|
||||
.B cal
|
||||
[\fIoptions\fR] [[[\fIday\fR] \fImonth\fR] \fIyear\fR]
|
@ -1,27 +0,0 @@
|
||||
From 0b8743b58e9755079bc5ffa51e9f66c088322596 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Uzel <petr.uzel@suse.cz>
|
||||
Date: Tue, 2 Aug 2011 15:18:11 +0200
|
||||
Subject: [PATCH] wall: build with SUID_{C,LD}FLAGS
|
||||
|
||||
|
||||
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
|
||||
---
|
||||
term-utils/Makefile.am | 2 ++
|
||||
1 files changed, 2 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/term-utils/Makefile.am b/term-utils/Makefile.am
|
||||
index 7b545c3..b423bbd 100644
|
||||
--- a/term-utils/Makefile.am
|
||||
+++ b/term-utils/Makefile.am
|
||||
@@ -55,6 +55,8 @@ if BUILD_WALL
|
||||
usrbin_exec_PROGRAMS += wall
|
||||
wall_SOURCES = wall.c ttymsg.c ttymsg.h $(top_srcdir)/lib/strutils.c
|
||||
dist_man_MANS += wall.1
|
||||
+wall_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
|
||||
+wall_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
|
||||
endif
|
||||
|
||||
if BUILD_WRITE
|
||||
--
|
||||
1.7.3.4
|
||||
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 17 10:37:20 UTC 2011 - puzel@novell.com
|
||||
|
||||
- update to util-linux-2.20-rc2
|
||||
- bugfixes
|
||||
- drop patches:
|
||||
- util-linux-fix-manpages.patch
|
||||
- util-linux-wall-build-with-pie.patch
|
||||
- util-linux-2.20-rc1-agetty-fixes.patch
|
||||
- util-linux-2.20-rc1-hexdump-segfault.patch
|
||||
- util-linux-2.20-rc-fix-dmesg.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 10 13:42:33 UTC 2011 - puzel@novell.com
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
%define time_ver 1.7
|
||||
%define which_ver 2.20
|
||||
%define adjtimex_ver 1.28
|
||||
%define util_linux_tar_ver 2.20-rc1
|
||||
%define util_linux_tar_ver 2.20-rc2
|
||||
|
||||
Name: util-linux
|
||||
BuildRequires: audit-devel
|
||||
@ -81,14 +81,7 @@ Source51: blkid.conf
|
||||
Patch1: util-linux-2.12r-fdisk_remove_bogus_warnings.patch
|
||||
# crypto patch
|
||||
Patch2: util-linux-2.17.1-mount_losetup_crypto.patch
|
||||
Patch3: util-linux-fix-manpages.patch
|
||||
Patch4: util-linux-wall-build-with-pie.patch
|
||||
# bnc#711240 - squashed 4 upstream patches
|
||||
Patch5: util-linux-2.20-rc1-agetty-fixes.patch
|
||||
# bnc#710471
|
||||
Patch6: util-linux-2.20-rc-fix-dmesg.patch
|
||||
# bnc#710877
|
||||
Patch7: util-linux-2.20-rc1-hexdump-segfault.patch
|
||||
|
||||
##
|
||||
## adjtimex
|
||||
##
|
||||
@ -189,11 +182,6 @@ Files to develop applications using the libmount library.
|
||||
%setup -q -a 9 -b 11 -b 12 -b 13 -n %{name}-%{util_linux_tar_ver}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
#
|
||||
cd adjtimex-*
|
||||
@ -458,7 +446,6 @@ fi
|
||||
%defattr(-,root,root)
|
||||
%doc login-utils/README.poeigl
|
||||
%doc misc-utils/README.cal
|
||||
%doc misc-utils/README.namei
|
||||
%doc mount/README.mount
|
||||
%doc hwclock/README.hwclock
|
||||
%doc text-utils/README.col
|
||||
|
Loading…
Reference in New Issue
Block a user