- fix #209911 - losetup.8 updated (use dm-crypt rather than deprecated

cryptoloop)
- fix #210338 - spurious error from '/bin/login -h $PHONENUMBER' (bug in
    IPv6 patch)
- fix #208634 - mkswap "works" without warning on a mounted device
This commit is contained in:
kzak 2006-10-12 10:10:37 +00:00
parent f47effa044
commit 04e2fdeac1
5 changed files with 133 additions and 26 deletions

View File

@ -1,5 +1,5 @@
--- util-linux-2.13-pre6/login-utils/login.c.ipv6 2006-07-17 11:05:48.000000000 +0200
+++ util-linux-2.13-pre6/login-utils/login.c 2006-07-17 11:05:48.000000000 +0200
--- util-linux-2.13-pre6/login-utils/login.c.ipv6 2006-10-12 10:10:34.000000000 +0200
+++ util-linux-2.13-pre6/login-utils/login.c 2006-10-12 10:17:16.000000000 +0200
@@ -173,7 +173,7 @@
#ifdef HAVE_SECURITY_PAM_MISC_H
static struct passwd pwdcopy;
@ -18,19 +18,15 @@
}
#if HAVE_UPDWTMP /* bad luck for ancient systems */
updwtmp(_PATH_BTMP, &ut);
@@ -380,13 +380,32 @@
@@ -380,13 +380,33 @@
hostname = strdup(optarg); /* strdup: Ambrose C. Li */
{
- struct hostent *he = gethostbyname(hostname);
+ struct addrinfo hints, *addr_info;
+ int k=0;
+ struct addrinfo hints, *info = NULL;
+
+ memset(&hints, '\0', sizeof(hints));
+ hints.ai_flags = AI_ADDRCONFIG;
+
+ if (getaddrinfo(hostname, NULL, &hints, &addr_info) != 0)
+ fprintf(stderr, "getaddrinfo: %s\n", strerror(errno));
+
+ hostaddress[0] = 0;
@ -39,25 +35,30 @@
- if (he && he->h_addr_list && he->h_addr_list[0])
- memcpy(hostaddress, he->h_addr_list[0],
- sizeof(hostaddress));
+ if (addr_info && (addr_info->ai_family == AF_INET))
+ if (getaddrinfo(hostname, NULL, &hints, &info)==0 && info)
+ {
+ struct sockaddr_in *sa4;
+
+ sa4 = (struct sockaddr_in *)addr_info->ai_addr;
+ memcpy(hostaddress, &(sa4->sin_addr), sizeof(sa4->sin_addr));
+ if (info->ai_family == AF_INET)
+ {
+ struct sockaddr_in *sa4;
+
+ sa4 = (struct sockaddr_in *) info->ai_addr;
+ memcpy(hostaddress, &(sa4->sin_addr),
+ sizeof(sa4->sin_addr));
+ }
+ if (info->ai_family == AF_INET6)
+ {
+ struct sockaddr_in6 *sa6;
+
+ sa6 = (struct sockaddr_in6 *) info->ai_addr;
+ memcpy(hostaddress, &(sa6->sin6_addr),
+ sizeof(sa6->sin6_addr));
+ }
+ freeaddrinfo(info);
+ }
+ if (addr_info && (addr_info->ai_family == AF_INET6))
+ {
+ struct sockaddr_in6 *sa6;
+
+ sa6 = (struct sockaddr_in6 *)addr_info->ai_addr;
+ memcpy(hostaddress, &(sa6->sin6_addr), sizeof(sa6->sin6_addr));
+ }
+ freeaddrinfo(addr_info);
}
break;
@@ -906,7 +925,7 @@
@@ -906,7 +926,7 @@
if (hostname) {
xstrncpy(ut.ut_host, hostname, sizeof(ut.ut_host));
if (hostaddress[0])
@ -67,7 +68,7 @@
pututline(&ut);
--- util-linux-2.13-pre6/login-utils/login.h.ipv6 2005-08-02 14:01:18.000000000 +0200
+++ util-linux-2.13-pre6/login-utils/login.h 2006-07-17 11:05:48.000000000 +0200
+++ util-linux-2.13-pre6/login-utils/login.h 2006-10-12 10:10:34.000000000 +0200
@@ -1,7 +1,7 @@
/* defined in login.c */
extern void badlogin(const char *s);

View File

@ -1,5 +1,25 @@
--- util-linux-2.13-pre2/mount/lomount.c.all 2005-08-29 16:59:06.000000000 +0200
+++ util-linux-2.13-pre2/mount/lomount.c 2005-08-29 17:17:49.000000000 +0200
--- util-linux-2.13-pre6/mount/losetup.8.all 2006-10-12 10:34:47.000000000 +0200
+++ util-linux-2.13-pre6/mount/losetup.8 2006-10-12 10:37:35.000000000 +0200
@@ -9,6 +9,8 @@
.B losetup
.I loop_device
.sp
+.B losetup -a
+.sp
.in -5
Delete loop:
.sp
@@ -66,6 +68,8 @@
.B \-e
option.)
.SH OPTIONS
+.IP \fB\-a\fP
+Show status of all loop devices.
.IP \fB\-d\fP
Detach the file or device associated with the specified loop device.
.IP "\fB\-E \fIencryption_type\fP"
--- util-linux-2.13-pre6/mount/lomount.c.all 2004-12-20 23:11:04.000000000 +0100
+++ util-linux-2.13-pre6/mount/lomount.c 2006-10-12 10:29:55.000000000 +0200
@@ -28,6 +28,8 @@
extern char *xstrdup (const char *s); /* not: #include "sundries.h" */
extern void error (const char *fmt, ...); /* idem */

View File

@ -0,0 +1,13 @@
--- util-linux-2.13-pre6/mount/losetup.8.kzak 2006-10-12 10:39:39.000000000 +0200
+++ util-linux-2.13-pre6/mount/losetup.8 2006-10-12 10:40:04.000000000 +0200
@@ -133,6 +133,10 @@
.fi
.SH RESTRICTION
DES encryption is painfully slow. On the other hand, XOR is terribly weak.
+
+Cryptoloop is deprecated and unmaintained in 2.6 kernels. Use dm-crypt. For
+more details see
+.B cryptsetup(8).
.\" .SH AUTHORS
.\" .nf
.\" Original version: Theodore Ts'o <tytso@athena.mit.edu>

View File

@ -0,0 +1,62 @@
--- util-linux-2.13-pre6/disk-utils/mkswap.c.kzak 2006-10-12 11:33:50.000000000 +0200
+++ util-linux-2.13-pre6/disk-utils/mkswap.c 2006-10-12 11:36:08.000000000 +0200
@@ -36,6 +36,7 @@
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <mntent.h>
#include <sys/ioctl.h> /* for _IO */
#include <sys/utsname.h>
#include <sys/stat.h>
@@ -485,6 +486,29 @@
return (c >= '1' && c <= '9');
}
+
+/*
+ * Check to make certain that our new filesystem won't be created on
+ * an already mounted partition. Code adapted from mke2fs, Copyright
+ * (C) 1994 Theodore Ts'o. Also licensed under GPL.
+ * (C) 2006 Karel Zak -- port to mkswap
+ */
+static int
+check_mount(void) {
+ FILE * f;
+ struct mntent * mnt;
+
+ if ((f = setmntent (MOUNTED, "r")) == NULL)
+ return 0;
+ while ((mnt = getmntent (f)) != NULL)
+ if (strcmp (device_name, mnt->mnt_fsname) == 0)
+ break;
+ endmntent (f);
+ if (!mnt)
+ return 0;
+ return 1;
+}
+
int
main(int argc, char ** argv) {
struct stat statbuf;
@@ -648,8 +672,19 @@
/* Want a block device. Probably not /dev/hda or /dev/hdb. */
if (!S_ISBLK(statbuf.st_mode))
check=0;
- else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
- die(_("Will not try to make swapdevice on '%s'"));
+ else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) {
+ fprintf(stderr,
+ _("%s: error: "
+ "will not try to make swapdevice on '%s'\n"),
+ program_name, device_name);
+ exit(1);
+ } else if (check_mount()) {
+ fprintf(stderr,
+ _("%s: error: "
+ "%s is mounted; will not make swapspace.\n"),
+ program_name, device_name);
+ exit(1);
+ }
#ifdef __sparc__
if (!force && version == 0) {

View File

@ -9,7 +9,7 @@
Summary: A collection of basic system utilities.
Name: util-linux
Version: 2.13
Release: 0.43%{?dist}
Release: 0.44%{?dist}
License: distributable
Group: System Environment/Base
@ -213,6 +213,10 @@ Patch249: util-linux-2.13-mount-sloppy.patch
Patch250: util-linux-2.13-mount-uhelper.patch
# Removes obsolete NFS code (we use /sbin/[u]mount.nfs[4] from nfs-utils)
Patch251: util-linux-2.13-mount-nonfs.patch
# Losetup.8 update -- add info about dm-crypt
Patch252: util-linux-2.13-losetup-deprecated.patch
# 208634 - mkswap "works" without warning on a mounted device
Patch253: util-linux-2.13-mkswap-mounted.patch
# When adding patches, please make sure that it is easy to find out what bug # the
# patch fixes.
@ -305,6 +309,8 @@ cp %{SOURCE8} %{SOURCE9} .
%patch249 -p1
%patch250 -p1
%patch251 -p1
%patch252 -p1
%patch253 -p1 -b .kzak
%build
unset LINGUAS || :
@ -708,6 +714,11 @@ exit 0
/sbin/losetup
%changelog
* Thu Oct 12 2006 Karel Zak <kzak@redhat.com> 2.13-0.44
- fix #209911 - losetup.8 updated (use dm-crypt rather than deprecated cryptoloop)
- fix #210338 - spurious error from '/bin/login -h $PHONENUMBER' (bug in IPv6 patch)
- fix #208634 - mkswap "works" without warning on a mounted device
* Sun Oct 01 2006 Jesse Keating <jkeating@redhat.com> - 2.13-0.43
- rebuilt for unwind info generation, broken in gcc-4.1.1-21