1
0
forked from pool/util-linux
OBS User unknown 2007-08-29 20:46:52 +00:00 committed by Git OBS Bridge
parent 6b1cb9fd1b
commit e9c228c255
4 changed files with 61 additions and 32 deletions

View File

@ -130,7 +130,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
mode = (*loopro ? O_RDONLY : O_RDWR);
if ((ffd = open(file, mode)) < 0) {
@@ -297,15 +331,39 @@ set_loop(const char *device, const char
@@ -297,15 +331,43 @@ set_loop(const char *device, const char
memset(&loopinfo64, 0, sizeof(loopinfo64));
@ -143,6 +143,8 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
+ // a hint for suse users
+ if(!strcmp(encryption, "twofishSL92")) {
+ fprintf(stderr, _("twofishSL92 is not supported via cryptoloop, please use dm-crypt to access the volume\n"));
+ close(fd);
+ close(ffd);
+ return 1;
+ }
if (digits_only(encryption)) {
@ -167,13 +169,15 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
+ fprintf(stderr, _("please either specify '%s%d' or -e '%s' -k '%d'\n"),
+ loopinfo64.lo_crypt_name, loopinfo64.lo_encrypt_key_size<<3,
+ loopinfo64.lo_crypt_name, keysz);
+ close(fd);
+ close(ffd);
+ return 1;
+ }
+ loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI;
}
}
@@ -325,20 +383,57 @@ set_loop(const char *device, const char
@@ -325,20 +387,64 @@ set_loop(const char *device, const char
}
#endif
@ -194,8 +198,11 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
- xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
+
+ pass = xgetpass(pfd, _("Password: "));
+ if(!pass)
+ if(!pass) {
+ close(fd);
+ close(ffd);
+ return 1;
+ }
+
+ // set default hash functions, loop-AES compatible
+ if(loopinfo64.lo_encrypt_type == LO_CRYPT_CRYPTOAPI) {
@ -211,6 +218,8 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
+ if(!keysz) {
+ if(verbose)
+ fprintf(stderr, _("please specify a key length\n"));
+ close(fd);
+ close(ffd);
+ return 1;
+ }
+ loopinfo64.lo_encrypt_key_size = keysz>>3;
@ -229,6 +238,8 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
+ hfunc = phash_none;
+ } else {
+ fprintf(stderr, _("unsupported hash method '%s'\n"), phash);
+ close(fd);
+ close(ffd);
+ return 1;
+ }
+ }
@ -243,7 +254,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
}
if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
@@ -416,8 +511,8 @@ mutter(void) {
@@ -416,8 +522,8 @@ mutter(void) {
}
int
@ -254,7 +265,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
mutter();
return 1;
}
@@ -456,7 +551,13 @@ usage(void) {
@@ -456,7 +562,13 @@ usage(void) {
" %1$s [ options ] {-f|--find|loop_device} file # setup\n"
"\nOptions:\n"
" -e | --encryption <type> enable data encryption with specified <name/num>\n"
@ -268,7 +279,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
" -o | --offset <num> start at offset <num> into file\n"
" -p | --pass-fd <num> read passphrase from file descriptor <num>\n"
" -r | --read-only setup read-only loop device\n"
@@ -497,11 +598,14 @@ error (const char *fmt, ...) {
@@ -497,11 +609,14 @@ error (const char *fmt, ...) {
int
main(int argc, char **argv) {
char *p, *offset, *encryption, *passfd, *device, *file;
@ -283,7 +294,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
unsigned long long off;
struct option longopts[] = {
{ "all", 0, 0, 'a' },
@@ -509,6 +613,8 @@ main(int argc, char **argv) {
@@ -509,6 +624,8 @@ main(int argc, char **argv) {
{ "encryption", 1, 0, 'e' },
{ "find", 0, 0, 'f' },
{ "help", 0, 0, 'h' },
@ -292,7 +303,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
{ "offset", 1, 0, 'o' },
{ "pass-fd", 1, 0, 'p' },
{ "read-only", 0, 0, 'r' },
@@ -524,12 +630,13 @@ main(int argc, char **argv) {
@@ -524,12 +641,13 @@ main(int argc, char **argv) {
delete = find = all = 0;
off = 0;
offset = encryption = passfd = NULL;
@ -307,7 +318,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
longopts, NULL)) != -1) {
switch (c) {
case 'a':
@@ -548,6 +655,12 @@ main(int argc, char **argv) {
@@ -548,6 +666,12 @@ main(int argc, char **argv) {
case 'f':
find = 1;
break;
@ -320,7 +331,7 @@ Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
case 'o':
offset = optarg;
break;
@@ -611,8 +724,10 @@ main(int argc, char **argv) {
@@ -611,8 +735,10 @@ main(int argc, char **argv) {
usage();
if (passfd && sscanf(passfd, "%d", &pfd) != 1)
usage();

View File

@ -0,0 +1,12 @@
Index: util-linux-ng-2.13rc2+git20070725/mount/lomount.c
===================================================================
--- util-linux-ng-2.13rc2+git20070725.orig/mount/lomount.c
+++ util-linux-ng-2.13rc2+git20070725/mount/lomount.c
@@ -325,6 +325,7 @@ set_loop(const char *device, const char
}
if ((fd = open(device, mode)) < 0) {
perror (device);
+ close(ffd);
return 1;
}
*loopro = (mode == O_RDONLY);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 29 12:22:21 CEST 2007 - mkoenig@suse.de
- fix fd leaks in previous patch
-------------------------------------------------------------------
Tue Aug 28 16:42:04 CEST 2007 - lnussel@suse.de

View File

@ -21,7 +21,7 @@ License: BSD 3-Clause, GPL v2 or later
Group: System/Base
Autoreqprov: on
Version: 2.12r+2.13rc2+git20070725
Release: 14
Release: 16
%define upver 2.13rc2+git20070725
Summary: A collection of basic system utilities
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%upver.tar.bz2
@ -52,27 +52,28 @@ Source30: README.largedisk
# add hostid
Patch1: util-linux-2.12-misc_utils_hostid.patch
# 104405 - mount -a doesn't work with hotpluggable devices
Patch16: util-linux-mount_opt_nofail.patch
Patch2: util-linux-mount_opt_nofail.patch
# 176582 - If the user doesn't specify -t <fstype> mount.fstype will never be called
#TODO: check alternative upstream fix
#Patch96: util-linux-2.12r-mount_external_prog_on_guess.patch
# 160822 - fix for 153657
Patch29: util-linux-2.12r-fdisk_cyl.patch
Patch3: util-linux-2.12r-fdisk_cyl.patch
# 238687 - let mkfs tools open block devices with O_EXCL
Patch34: util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch
Patch4: util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch
# 241372 - remove legacy warnings from fdisk
Patch35: util-linux-2.12r-fdisk_remove_bogus_warnings.patch
Patch5: util-linux-2.12r-fdisk_remove_bogus_warnings.patch
# 254437 - swapon should automatically reset the suspend signature
# TODO: Needs to be ported to new version
Patch38: util-linux-2.12r-mount_swapon_swsuspend_resume.patch
# suse48633 - util-linux on x86_64 does not contain "rdev" and "vidmode"
Patch45: util-linux-2.13-sys_utils_build_rdev_x86_64.patch
Patch6: util-linux-2.13-sys_utils_build_rdev_x86_64.patch
# 297172 - mount does not free loop devices if it fails
Patch46: util-linux-2.13-loop.patch
Patch47: util-linux-2.13-mount_create_mtab.patch
Patch48: util-linux-2.13-schedutils_error_handling.patch
Patch7: util-linux-2.13-loop.patch
Patch8: util-linux-2.13-mount_create_mtab.patch
Patch9: util-linux-2.13-schedutils_error_handling.patch
# 304861 - support password hashing and key length
Patch49: cryptsetup-2.13-crypto.diff
Patch10: cryptsetup-2.13-crypto.diff
Patch11: util-linux-2.13-mount_fd_leak.patch
##
##
## adjtimex
@ -108,19 +109,17 @@ Authors:
%prep
%setup -q -a 9 -b 10 -b 11 -b 12 -b 13 -n %name-ng-%upver
%patch1 -p1
%patch16 -p1
#%patch26
%patch29 -p1
#%patch30 -p1
#%patch32 -p1
%patch34 -p1
%patch35 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
#%patch38 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
#
cd adjtimex-*
%patch50 -p1
@ -561,6 +560,8 @@ fi
#%endif
%changelog
* Wed Aug 29 2007 - mkoenig@suse.de
- fix fd leaks in previous patch
* Tue Aug 28 2007 - lnussel@suse.de
- add support for specifying the key length and password hash
algorithm [#304861]