+++ /dev/null
-.\" {PTM/PB/0.1/18-05-1999/"zresetuj czêstotliwo¶æ samopowtarzania i opó¼nienia klawiatury"}
-.\" Copyright 1992, 1994 Rickard E. Faith (faith@cs.unc.edu)
-.\" May be distributed under the GNU General Public License
-.\" Updated Wed Jun 22 21:09:43 1994, faith@cs.unc.edu
-.TH KBDRATE 8 "22 June 1994" "Linux 1.1.19" "Podrêcznik programisty linuksowego"
-.SH NAZWA
-kbdrate \- zresetuj czêsto¶æ samopowtarzania i opó¼nienia klawiatury
-.SH SK£ADNIA
-.B kbdrate
-.RB [ \-s "] [" \-r
-.IR czêsto¶æ ]
-.RB [ \-d
-.IR opó¼nienie ]
-.SH OPIS
-.B kbdrate
-jest u¿ywane do zmiany czêstotliwo¶ci samopowtarzania i opó¼nienia
-klawiatury IBM. Opó¼nienie jest ilo¶ci± czasu, przez który klawisz musi byæ
-wci¶niêty, nim zacznie siê automatycznie powtarzaæ.
-
-U¿ywanie
-.B kbdrate
-bez opcji zresetuje czêstotliwo¶æ na 10,9 znaków na sekundê (cps) i ustawi
-opó¼nienie na 250 milisekund (mS). S± to warto¶ci domy¶lne IBM.
-.SH OPCJE
-.TP
-.B \-s
-Cicho. Nie drukuj ¿adnych komunikatów.
-.TP
-.BI \-r " czêsto¶æ"
-Zmieñ czêsto¶æ na
-.I czêsto¶æ
-cps. Dopuszczalny zasiêg waha siê w zakresie 2.0 do 30.0 cps. Mo¿liwe s±
-tylko niektóre warto¶ci, a program sam wybierze te, które s± najbli¿sze
-podanej warto¶ci. Mo¿liwe warto¶ci, w znakach na sekundê to:
-2.0, 2.1, 2.3, 2.5, 2.7, 3.0, 3.3, 3.7, 4.0, 4.3, 4.6,
-5.0, 5.5, 6.0, 6.7, 7.5, 8.0, 8.6, 9.2, 10.0, 10.9, 12.0, 13.3, 15.0, 16.0,
-17.1, 18.5, 20.0, 21.8, 24.0, 26.7, 30.0.
-.TP
-.BI \-d " opó¼nienie"
-Zmieñ opó¼nienie na
-.I opó¼nienie
-milisekund. Dopuszczalny zakres jest od 250 do 1000 mS, lecz jedynymi
-dopuszczalnymi warto¶ciami (opartymi na ograniczeniach sprzêtowych) s±:
-250mS, 500mS, 750mS i 1000mS.
-.SH B£ÊDY
-Nie wszystkie klawiatury obs³uguj± wszystkie czêsto¶ci.
-.PP
-Nie wszystkie czêsto¶ci s± mapowane tak samo.
-.PP
-Ustawianie czêsto¶ci powtarzania nie dzia³a na klawiaturze Gateway AnyKey.
-Jeli kto¶ z t± klawiatur± wie jak j± programowaæ, to niech wy¶le
-wiadomo¶æ do faith@cs.unc.edu.
-.SH PLIKI
-.I /etc/rc.local
-.br
-.I /dev/port
-.SH AUTOR
-Rik Faith (faith@cs.unc.edu)
+++ /dev/null
---- util-linux-2.12pre/mount/sundries.h_ORIG 2002-11-01 02:00:50.000000000 +0100
-+++ util-linux-2.12pre/mount/sundries.h 2003-08-09 14:31:41.000000000 +0200
-@@ -17,7 +17,8 @@
- extern int verbose;
- extern int sloppy;
-
--#define streq(s, t) (strcmp ((s), (t)) == 0)
-+#define streq(s, t) (strcmp ((s), (t)) == 0)
-+#define streqn(s, t, n) (strncmp((s), (t), (n)) == 0)
-
- /* Functions in sundries.c that are used in mount.c and umount.c */
- void block_signals (int how);
---- util-linux-2.12pre/mount/fstab.h_ORIG 2000-12-03 00:13:47.000000000 +0100
-+++ util-linux-2.12pre/mount/fstab.h 2003-08-09 13:52:48.000000000 +0200
-@@ -1,17 +1,10 @@
- #include <mntent.h>
--#define _PATH_FSTAB "/etc/fstab"
--#ifdef _PATH_MOUNTED
--#define MOUNTED_LOCK _PATH_MOUNTED "~"
--#define MOUNTED_TEMP _PATH_MOUNTED ".tmp"
--#else
--#define MOUNTED_LOCK "/etc/mtab~"
--#define MOUNTED_TEMP "/etc/mtab.tmp"
--#endif
--#define LOCK_TIMEOUT 10
--
--int mtab_is_writable(void);
--int mtab_does_not_exist(void);
--int mtab_is_a_symlink(void);
-+#define _PATH_FSTAB "/etc/fstab"
-+#define PATH_PROC "/proc/"
-+#define PATH_PROC_MOUNTS PATH_PROC "mounts"
-+#define MTAB_LOCK_SUFFIX "~"
-+#define MTAB_TEMP_SUFFIX ".tmp"
-+#define LOCK_TIMEOUT 10
-
- struct mntentchn {
- struct mntentchn *nxt, *prev;
-@@ -31,6 +24,10 @@
- struct mntentchn *getfsvolspec (const char *label);
-
- #include <mntent.h>
-+
-+void get_mtab_info (void);
-+int mtab_is_writable(void);
-+int mtab_does_not_exist(void);
- void lock_mtab (void);
- void unlock_mtab (void);
- void update_mtab (const char *special, struct mntent *with);
---- util-linux-2.12pre/mount/fstab.c_ORIG 2003-07-05 22:16:05.000000000 +0200
-+++ util-linux-2.12pre/mount/fstab.c 2003-08-09 14:31:30.000000000 +0200
-@@ -1,7 +1,10 @@
--/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
-+/*
-+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
- * - added Native Language Support
-- * Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
-+ * 1999-03-21 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
- * - fixed strerr(errno) in gettext calls
-+ * 2003-08-08 Thomas Hood <jdthood@yahoo.co.uk>
-+ * - Write through a symlink at /etc/mtab if it doesn't point into /proc/
- */
-
- #include <unistd.h>
-@@ -11,65 +14,128 @@
- #include <sys/stat.h>
- #include "mntent.h"
- #include "fstab.h"
-+#include "realpath.h"
- #include "sundries.h" /* for xmalloc() etc */
- #include "get_label_uuid.h"
- #include "nls.h"
-
--#define streq(s, t) (strcmp ((s), (t)) == 0)
--
--#define PROC_MOUNTS "/proc/mounts"
--
--
- /* Information about mtab. ------------------------------------*/
--static int have_mtab_info = 0;
--static int var_mtab_does_not_exist = 0;
--static int var_mtab_is_a_symlink = 0;
-
--static void
-+/* A 64 bit number can be displayed in 20 decimal digits */
-+#define LEN_LARGEST_PID 20
-+#define MTAB_PATH_MAX (PATH_MAX - (sizeof(MTAB_LOCK_SUFFIX) - 1) - LEN_LARGEST_PID)
-+static char mtab_path[MTAB_PATH_MAX];
-+static char mtab_lock_path[PATH_MAX];
-+static char mtab_lock_targ[PATH_MAX];
-+static char mtab_temp_path[PATH_MAX];
-+
-+/*
-+ * Set mtab_path to the real path of the mtab file
-+ * or to the null string if that path is inaccessible
-+ *
-+ * Run this early
-+ */
-+void
- get_mtab_info(void) {
- struct stat mtab_stat;
-
-- if (!have_mtab_info) {
-- if (lstat(MOUNTED, &mtab_stat))
-- var_mtab_does_not_exist = 1;
-- else if (S_ISLNK(mtab_stat.st_mode))
-- var_mtab_is_a_symlink = 1;
-- have_mtab_info = 1;
-+ if (lstat(MOUNTED, &mtab_stat)) {
-+ /* Assume that the lstat error means that the file does not exist */
-+ /* (Maybe we should check errno here) */
-+ strcpy(mtab_path, MOUNTED);
-+ } else if (S_ISLNK(mtab_stat.st_mode)) {
-+ /* Is a symlink */
-+ int len;
-+ char *r = myrealpath(MOUNTED, mtab_path, MTAB_PATH_MAX);
-+ mtab_path[MTAB_PATH_MAX - 1] = 0; /* Just to be sure */
-+ len = strlen(mtab_path);
-+ if (
-+ r == NULL
-+ || len == 0
-+ || len >= (MTAB_PATH_MAX - 1)
-+ || streqn(mtab_path, PATH_PROC, sizeof(PATH_PROC) - 1)
-+ ) {
-+ /* Real path invalid or inaccessible */
-+ mtab_path[0] = '\0';
-+ return;
-+ }
-+ /* mtab_path now contains mtab's real path */
-+ } else {
-+ /* Exists and is not a symlink */
-+ strcpy(mtab_path, MOUNTED);
- }
-+
-+ sprintf(mtab_lock_path, "%s%s", mtab_path, MTAB_LOCK_SUFFIX);
-+ sprintf(mtab_lock_targ, "%s%s%d", mtab_path, MTAB_LOCK_SUFFIX, getpid());
-+ sprintf(mtab_temp_path, "%s%s", mtab_path, MTAB_TEMP_SUFFIX);
-+
-+ return;
- }
-
--int
--mtab_does_not_exist(void) {
-- get_mtab_info();
-- return var_mtab_does_not_exist;
-+/*
-+ * Tell whether or not the mtab real path is accessible
-+ *
-+ * get_mtab_info() must have been run
-+ */
-+static int
-+mtab_is_accessible(void) {
-+ return (mtab_path[0] != '\0');
- }
-
-+/*
-+ * Tell whether or not the mtab file currently exists
-+ *
-+ * Note that the answer here is independent of whether or
-+ * not the file is writable, so if you are planning to create
-+ * the mtab file then check mtab_is_writable() too.
-+ *
-+ * get_mtab_info() must have been run
-+ */
- int
--mtab_is_a_symlink(void) {
-- get_mtab_info();
-- return var_mtab_is_a_symlink;
-+mtab_does_not_exist(void) {
-+ struct stat mtab_stat;
-+
-+ if (!mtab_is_accessible())
-+ return 1;
-+
-+ if (lstat(mtab_path, &mtab_stat))
-+ return 1;
-+
-+ return 0;
- }
-
-+/*
-+ * Tell whether or not mtab is writable (whether or not it currently exists)
-+ *
-+ * This depends on whether or not the real path is accessible and,
-+ * if so, whether or not the file can be opened. This function
-+ * has the side effect of creating the file if it is writable.
-+ *
-+ * get_mtab_info() must have been run
-+ */
- int
- mtab_is_writable() {
-- static int ret = -1;
-+ static int is_writable = -1;
-+ int fd;
-
-- /* Should we write to /etc/mtab upon an update?
-- Probably not if it is a symlink to /proc/mounts, since that
-- would create a file /proc/mounts in case the proc filesystem
-- is not mounted. */
-- if (mtab_is_a_symlink())
-- return 0;
--
-- if (ret == -1) {
-- int fd = open(MOUNTED, O_RDWR | O_CREAT, 0644);
-- if (fd >= 0) {
-- close(fd);
-- ret = 1;
-- } else
-- ret = 0;
-+ if (is_writable != -1)
-+ return is_writable;
-+
-+ if (!mtab_is_accessible()) {
-+ is_writable = 0;
-+ return is_writable;
- }
-- return ret;
-+
-+ lock_mtab();
-+ fd = open(mtab_path, O_RDWR | O_CREAT, 0644);
-+ if (fd >= 0) {
-+ close(fd);
-+ is_writable = 1;
-+ } else {
-+ is_writable = 0;
-+ }
-+ unlock_mtab();
-+ return is_writable;
- }
-
- /* Contents of mtab and fstab ---------------------------------*/
-@@ -132,21 +198,21 @@
- got_mtab = 1;
- mc->nxt = mc->prev = NULL;
-
-- fnam = MOUNTED;
-+ fnam = mtab_path;
- mfp = my_setmntent (fnam, "r");
- if (mfp == NULL || mfp->mntent_fp == NULL) {
- int errsv = errno;
-- fnam = PROC_MOUNTS;
-+ fnam = PATH_PROC_MOUNTS;
- mfp = my_setmntent (fnam, "r");
- if (mfp == NULL || mfp->mntent_fp == NULL) {
- error(_("warning: can't open %s: %s"),
-- MOUNTED, strerror (errsv));
-+ mtab_path, strerror (errsv));
- return;
- }
- if (verbose)
- printf (_("mount: could not open %s - "
- "using %s instead\n"),
-- MOUNTED, PROC_MOUNTS);
-+ mtab_path, PATH_PROC_MOUNTS);
- }
- read_mntentchn(mfp, fnam, mc);
- }
-@@ -231,8 +297,8 @@
- char devuuid[16];
- char *devlabel;
-
-- return !get_label_uuid(device, &devlabel, devuuid) &&
-- !strcmp(label, devlabel);
-+ return !get_label_uuid(device, &devlabel, devuuid)
-+ && streq(label, devlabel);
- }
-
- static int
-@@ -240,8 +306,8 @@
- char devuuid[16];
- char *devlabel;
-
-- return !get_label_uuid(device, &devlabel, devuuid) &&
-- !memcmp(uuid, devuuid, sizeof(devuuid));
-+ return !get_label_uuid(device, &devlabel, devuuid)
-+ && !memcmp(uuid, devuuid, sizeof(devuuid));
- }
-
- /* Find the entry (SPEC,FILE) in fstab */
-@@ -338,9 +404,6 @@
- /* Flag for already existing lock file. */
- static int we_created_lockfile = 0;
-
--/* Flag to indicate that signals have been set up. */
--static int signals_have_been_setup = 0;
--
- /* Ensure that the lock is released if we are interrupted. */
- static void
- handler (int sig) {
-@@ -352,29 +415,28 @@
- /* nothing, fcntl will fail anyway */
- }
-
--/* Create the lock file.
-- The lock file will be removed if we catch a signal or when we exit. */
-+/*
-+ * Create the lock file
-+ *
-+ * The lock file will be removed if we catch a signal or when we exit
-+ */
- /* The old code here used flock on a lock file /etc/mtab~ and deleted
-- this lock file afterwards. However, as rgooch remarks, that has a
-- race: a second mount may be waiting on the lock and proceed as
-- soon as the lock file is deleted by the first mount, and immediately
-- afterwards a third mount comes, creates a new /etc/mtab~, applies
-- flock to that, and also proceeds, so that the second and third mount
-- now both are scribbling in /etc/mtab.
-+ this lock file afterwards. However, as rgooch remarks, that races:
-+ a second mount may be waiting on the lock which will proceed as
-+ soon as the lock file is deleted by the first mount; immediately
-+ afterwards a third mount can come, create a new /etc/mtab~, apply
-+ flock to that, and also proceed, so that the second and third mount
-+ now both scribble in /etc/mtab.
- The new code uses a link() instead of a creat(), where we proceed
-- only if it was us that created the lock, and hence we always have
-+ only if it was we that created the lock, and hence we always have
- to delete the lock afterwards. Now the use of flock() is in principle
-- superfluous, but avoids an arbitrary sleep(). */
--
--/* Where does the link point to? Obvious choices are mtab and mtab~~.
-- HJLu points out that the latter leads to races. Right now we use
-- mtab~.<pid> instead. */
--#define MOUNTLOCK_LINKTARGET MOUNTED_LOCK "%d"
-+ superfluous, but using it allows us to avoid an arbitrary sleep(). */
-
- void
- lock_mtab (void) {
- int tries = 3;
-- char *linktargetfile;
-+ /* Flag to indicate that signals have been set up. */
-+ static int signals_have_been_setup = 0;
-
- if (!signals_have_been_setup) {
- int sig = 0;
-@@ -395,41 +457,36 @@
- signals_have_been_setup = 1;
- }
-
-- /* somewhat clumsy, but some ancient systems do not have snprintf() */
-- /* use 20 as upper bound for the length of %d output */
-- linktargetfile = xmalloc(strlen(MOUNTLOCK_LINKTARGET) + 20);
-- sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid ());
--
- /* Repeat until it was us who made the link */
- while (!we_created_lockfile) {
- struct flock flock;
- int errsv, fd, i, j;
-
-- i = open (linktargetfile, O_WRONLY|O_CREAT, 0);
-+ i = open (mtab_lock_targ, O_WRONLY|O_CREAT, 0);
- if (i < 0) {
- int errsv = errno;
-- /* linktargetfile does not exist (as a file)
-+ /* mtab_lock_targ does not exist (as a file)
- and we cannot create it. Read-only filesystem?
- Too many files open in the system?
- Filesystem full? */
- die (EX_FILEIO, _("can't create lock file %s: %s "
- "(use -n flag to override)"),
-- linktargetfile, strerror (errsv));
-+ mtab_lock_targ, strerror (errsv));
- }
- close(i);
-
-- j = link(linktargetfile, MOUNTED_LOCK);
-+ j = link(mtab_lock_targ, mtab_lock_path);
- errsv = errno;
-
-- (void) unlink(linktargetfile);
-+ (void) unlink(mtab_lock_targ);
-
- if (j < 0 && errsv != EEXIST) {
- die (EX_FILEIO, _("can't link lock file %s: %s "
- "(use -n flag to override)"),
-- MOUNTED_LOCK, strerror (errsv));
-+ mtab_lock_path, strerror (errsv));
- }
-
-- fd = open (MOUNTED_LOCK, O_WRONLY);
-+ fd = open (mtab_lock_path, O_WRONLY);
-
- if (fd < 0) {
- int errsv = errno;
-@@ -438,7 +495,7 @@
- continue;
- die (EX_FILEIO, _("can't open lock file %s: %s "
- "(use -n flag to override)"),
-- MOUNTED_LOCK, strerror (errsv));
-+ mtab_lock_path, strerror (errsv));
- }
-
- flock.l_type = F_WRLCK;
-@@ -452,7 +509,7 @@
- if (verbose) {
- int errsv = errno;
- printf(_("Can't lock lock file %s: %s\n"),
-- MOUNTED_LOCK, strerror (errsv));
-+ mtab_lock_path, strerror (errsv));
- }
- /* proceed anyway */
- }
-@@ -465,17 +522,17 @@
- if (fcntl (fd, F_SETLKW, &flock) == -1) {
- int errsv = errno;
- die (EX_FILEIO, _("can't lock lock file %s: %s"),
-- MOUNTED_LOCK, (errno == EINTR) ?
-+ mtab_lock_path, (errno == EINTR) ?
- _("timed out") : strerror (errsv));
- }
- alarm(0);
- /* Limit the number of iterations - maybe there
-- still is some old /etc/mtab~ */
-+ still is some old lock */
- if (tries++ > 3) {
- if (tries > 5)
- die (EX_FILEIO, _("Cannot create link %s\n"
- "Perhaps there is a stale lock file?\n"),
-- MOUNTED_LOCK);
-+ mtab_lock_path);
- sleep(1);
- }
- }
-@@ -488,7 +545,7 @@
- void
- unlock_mtab (void) {
- if (we_created_lockfile) {
-- unlink (MOUNTED_LOCK);
-+ unlink (mtab_lock_path);
- we_created_lockfile = 0;
- }
- }
-@@ -506,16 +563,16 @@
- void
- update_mtab (const char *dir, struct mntent *instead) {
- mntFILE *mfp, *mftmp;
-- const char *fnam = MOUNTED;
-+ const char *fnam = mtab_path;
- struct mntentchn mtabhead; /* dummy */
- struct mntentchn *mc, *mc0, absent;
-
-- if (mtab_does_not_exist() || mtab_is_a_symlink())
-+ if (mtab_does_not_exist())
- return;
-
- lock_mtab();
-
-- /* having locked mtab, read it again */
-+ /* Having got the lock, we read mtab again */
- mc0 = mc = &mtabhead;
- mc->nxt = mc->prev = NULL;
-
-@@ -555,11 +612,11 @@
- }
-
- /* write chain to mtemp */
-- mftmp = my_setmntent (MOUNTED_TEMP, "w");
-+ mftmp = my_setmntent (mtab_temp_path, "w");
- if (mftmp == NULL || mftmp->mntent_fp == NULL) {
- int errsv = errno;
- error (_("cannot open %s (%s) - mtab not updated"),
-- MOUNTED_TEMP, strerror (errsv));
-+ mtab_temp_path, strerror (errsv));
- goto leave;
- }
-
-@@ -567,7 +624,7 @@
- if (my_addmntent(mftmp, &(mc->m)) == 1) {
- int errsv = errno;
- die (EX_FILEIO, _("error writing %s: %s"),
-- MOUNTED_TEMP, strerror (errsv));
-+ mtab_temp_path, strerror (errsv));
- }
- }
-
-@@ -575,25 +632,25 @@
- S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
- int errsv = errno;
- fprintf(stderr, _("error changing mode of %s: %s\n"),
-- MOUNTED_TEMP, strerror (errsv));
-+ mtab_temp_path, strerror (errsv));
- }
- my_endmntent (mftmp);
-
- { /*
- * If mount is setuid and some non-root user mounts sth,
-- * then mtab.tmp might get the group of this user. Copy uid/gid
-- * from the present mtab before renaming.
-+ * then the temp file might get the group of this user.
-+ * Copy uid/gid from the present mtab before renaming.
- */
- struct stat sbuf;
-- if (stat (MOUNTED, &sbuf) == 0)
-- chown (MOUNTED_TEMP, sbuf.st_uid, sbuf.st_gid);
-+ if (stat (mtab_path, &sbuf) == 0)
-+ chown (mtab_temp_path, sbuf.st_uid, sbuf.st_gid);
- }
-
- /* rename mtemp to mtab */
-- if (rename (MOUNTED_TEMP, MOUNTED) < 0) {
-+ if (rename (mtab_temp_path, mtab_path) < 0) {
- int errsv = errno;
- fprintf(stderr, _("can't rename %s to %s: %s\n"),
-- MOUNTED_TEMP, MOUNTED, strerror(errsv));
-+ mtab_temp_path, mtab_path, strerror(errsv));
- }
-
- leave:
---- util-linux-2.12pre/mount/mount.c_ORIG 2003-07-13 23:26:13.000000000 +0200
-+++ util-linux-2.12pre/mount/mount.c 2003-08-09 00:22:21.000000000 +0200
-@@ -39,6 +39,8 @@
- * 2000-11-08 aeb: accept nonnumeric uid=, gid= options
- * 2001-07-13 Michael K. Johnson <johnsonm@redhat.com>
- * - implemented -a -O
-+ * 2003-08-08 Thomas Hood <jdthood@yahoo.co.uk>
-+ * - Write through a symlink at /etc/mtab if it doesn't point into /proc/
- */
-
- #include <unistd.h>
-@@ -396,7 +398,11 @@
- return ret;
- }
-
--/* Create mtab with a root entry. */
-+/*
-+ * Create mtab with a root entry.
-+ *
-+ * Caller should check that mtab is writable first
-+ */
- static void
- create_mtab (void) {
- struct mntentchn *fstab;
-@@ -1433,6 +1439,9 @@
- initproctitle(argc, argv);
- #endif
-
-+ get_mtab_info();
-+ /* Keep in mind that /etc/mtab may be a symlink */
-+
- while ((c = getopt_long (argc, argv, "afFhilL:no:O:p:rsU:vVwt:",
- longopts, NULL)) != -1) {
- switch (c) {
-@@ -1554,7 +1563,7 @@
- die (EX_USAGE, _("mount: only root can do that"));
- }
-
-- if (!nomtab && mtab_does_not_exist()) {
-+ if (!nomtab && mtab_does_not_exist() && mtab_is_writable()) {
- if (verbose > 1)
- printf(_("mount: no %s found - creating it..\n"),
- MOUNTED);
---- util-linux-2.12pre/mount/umount.c_ORIG 2002-11-01 02:00:50.000000000 +0100
-+++ util-linux-2.12pre/mount/umount.c 2003-08-09 00:47:17.000000000 +0200
-@@ -27,6 +27,8 @@
- * 010914: Jamie Strandboge - use tcp if that was used for mount
- * 011005: hch - add lazy umount support
- * 020105: aeb - permission test owner umount
-+ * 20030808: Thomas Hood <jdthood@yahoo.co.uk>
-+ * - Write through a symlink at /etc/mtab if it doesn't point into /proc/
- */
-
- #include <stdio.h>
-@@ -240,8 +242,11 @@
- }
- }
-
--/* Umount a single device. Return a status code, so don't exit
-- on a non-fatal error. We lock/unlock around each umount. */
-+/*
-+ * Umount a single device
-+ *
-+ * Returns a status code; doesn't exit on a non-fatal error
-+ */
- static int
- umount_one (const char *spec, const char *node, const char *type,
- const char *opts, struct mntentchn *mc) {
-@@ -321,7 +326,8 @@
- remnt.mnt_type = remnt.mnt_fsname = NULL;
- remnt.mnt_dir = xstrdup(node);
- remnt.mnt_opts = "ro";
-- update_mtab(node, &remnt);
-+ if (!nomtab && mtab_is_writable())
-+ update_mtab(node, &remnt);
- return 0;
- } else if (errno != EBUSY) { /* hmm ... */
- perror("remount");
-@@ -619,6 +625,8 @@
-
- umask(033);
-
-+ get_mtab_info();
-+
- while ((c = getopt_long (argc, argv, "adfhlnrt:O:vV",
- longopts, NULL)) != -1)
- switch (c) {
---- util-linux-2.12pre/mount/mount.8_ORIG 2003-07-13 23:18:35.000000000 +0200
-+++ util-linux-2.12pre/mount/mount.8 2003-08-09 08:55:43.000000000 +0200
-@@ -38,8 +38,10 @@
- .\" 010714, Michael K. Johnson <johnsonm@redhat.com> added -O
- .\" 010725, Nikita Danilov <NikitaDanilov@Yahoo.COM>: reiserfs options
- .\" 011124, Karl Eichwalder <ke@gnu.franken.de>: tmpfs options
-+.\" 030808, Thomas Hood <jdthood@yahoo.co.uk>: symlinking /etc/mtab
-+.\" 030809, Thomas Hood <jdthood@yahoo.co.uk>: use 'file system' consistently
- .\"
--.TH MOUNT 8 "14 September 1997" "Linux 2.0" "Linux Programmer's Manual"
-+.TH MOUNT 8 "8 August 2003" "Linux 2.0" "Linux Programmer's Manual"
- .SH NAME
- mount \- mount a file system
- .SH SYNOPSIS
-@@ -110,7 +112,7 @@
- .RE
- After this call the same contents is accessible in two places.
-
--This call attaches only (part of) a single filesystem, not possible
-+This call attaches only (part of) a single file system, not possible
- submounts. The entire file hierarchy including submounts is attached
- a second place using
- .RS
-@@ -167,7 +169,7 @@
- keyword. Adding the
- .B \-F
- option will make mount fork, so that the
--filesystems are mounted simultaneously.
-+file systems are mounted simultaneously.
- .LP
- (ii) When mounting a file system mentioned in
- .IR fstab ,
-@@ -198,7 +200,7 @@
- .RE
- For more details, see
- .BR fstab (5).
--Only the user that mounted a filesystem can unmount it again.
-+Only the user that mounted a file system can unmount it again.
- If any user should be able to unmount, then use
- .B users
- instead of
-@@ -227,23 +229,46 @@
-
- When the
- .I proc
--filesystem is mounted (say at
-+file system is mounted (usually at
- .IR /proc ),
- the files
- .I /etc/mtab
- and
- .I /proc/mounts
--have very similar contents. The former has somewhat
-+have very similar contents. The former contains somewhat
- more information, such as the mount options used,
--but is not necessarily up-to-date (cf. the
-+but is not necessarily completely accurate (cf. the
- .B \-n
--option below). It is possible to replace
-+and
-+.B \-f
-+options below). It is possible to replace
- .I /etc/mtab
- by a symbolic link to
- .IR /proc/mounts ,
--but some information is lost that way, and in particular
--working with the loop device will be less convenient,
--and using the "user" option will fail.
-+but some information is lost that way. As a result,
-+working with the loop device is less convenient
-+and the "user" option does not work.
-+
-+You can also replace
-+.I /etc/mtab
-+by a symbolic link to
-+another location such as
-+.IR /var/run/mtab .
-+This may be useful if your root file system is mounted read-only
-+but you have another file system such as
-+.I /var
-+that is writable where you can store the mtab.
-+Note that in this case you will have to mount
-+.I /var
-+first using the
-+.B \-n
-+option. Once the target of the
-+.I /etc/mtab
-+symbolic link is writable you can run
-+.B mount
-+again with the
-+.B \-f
-+option to add the missing entry.
-
- .SH OPTIONS
- The full set of options used by an invocation of
-@@ -271,7 +296,7 @@
- Verbose mode.
- .TP
- .B \-a
--Mount all filesystems (of the given types) mentioned in
-+Mount all file systems (of the given types) mentioned in
- .IR fstab .
- .TP
- .B \-F
-@@ -317,7 +342,7 @@
- .TP
- .B \-s
- Tolerate sloppy mount options rather than failing. This will ignore
--mount options not supported by a filesystem type. Not all filesystems
-+mount options not supported by a file system type. Not all file systems
- support this option. This option exists for support of the Linux
- autofs\-based automounter.
- .TP
-@@ -396,7 +421,7 @@
- .B mount
- program has to do is issue a simple
- .IR mount (2)
--system call, and no detailed knowledge of the filesystem type is required.
-+system call, and no detailed knowledge of the file system type is required.
- For a few types however (like nfs, smbfs, ncpfs) ad hoc code is
- necessary. The nfs ad hoc code is built in, but smbfs and ncpfs
- have a separate mount program. In order to make it possible to
-@@ -416,7 +441,7 @@
- .B \-t
- option is given, or if the
- .B auto
--type is specified, the superblock is probed for the filesystem type
-+type is specified, the superblock is probed for the file system type
- .RI ( adfs ,
- .IR bfs ,
- .IR cramfs ,
-@@ -442,7 +467,7 @@
- .IR /etc/filesystems ,
- or, if that does not exist,
- .IR /proc/filesystems .
--All of the filesystem types listed there will be tried,
-+All of the file system types listed there will be tried,
- except for those that are labeled "nodev" (e.g.,
- .IR devpts ,
- .I proc
-@@ -462,7 +487,7 @@
- can be useful to change the probe order (e.g., to try vfat before msdos)
- or if you use a kernel module autoloader.
- Warning: the probing uses a heuristic (the presence of appropriate `magic'),
--and could recognize the wrong filesystem type, possibly with catastrophic
-+and could recognize the wrong file system type, possibly with catastrophic
- consequences. If your data is valuable, don't ask
- .B mount
- to guess.
-@@ -489,7 +514,7 @@
- .B \-O
- Used in conjunction with
- .BR \-a ,
--to limit the set of filesystems to which the
-+to limit the set of file systems to which the
- .B \-a
- is applied. Like
- .B \-t
-@@ -520,7 +545,7 @@
- .RS
- .B "mount \-a \-t ext2 \-O _netdev"
- .RE
--mounts all ext2 filesystems with the _netdev option, not all filesystems
-+mounts all ext2 file systems with the _netdev option, not all file systems
- that are either ext2 or have the _netdev option specified.
- .RE
- .TP
-@@ -558,8 +583,8 @@
- Permit execution of binaries.
- .TP
- .B _netdev
--The filesystem resides on a device that requires network access
--(used to prevent the system from attempting to mount these filesystems
-+The file system resides on a device that requires network access
-+(used to prevent the system from attempting to mount these file systems
- until the network has been enabled on the system).
- .TP
- .B noatime
-@@ -789,7 +814,7 @@
- Define the behaviour when an error is encountered.
- (Either ignore errors and just mark the file system erroneous and continue,
- or remount the file system read-only, or panic and halt the system.)
--The default is set in the filesystem superblock, and can be
-+The default is set in the file system superblock, and can be
- changed using
- .BR tune2fs (8).
- .TP
-@@ -815,18 +840,18 @@
- .BI sb= n
- Instead of block 1, use block
- .I n
--as superblock. This could be useful when the filesystem has been damaged.
-+as superblock. This could be useful when the file system has been damaged.
- (Earlier, copies of the superblock would be made every 8192 blocks: in
- block 1, 8193, 16385, ... (and one got hundreds or even thousands
--of copies on a big filesystem). Since version 1.08,
-+of copies on a big file system). Since version 1.08,
- .B mke2fs
- has a \-s (sparse superblock) option to reduce the number of backup
- superblocks, and since version 1.15 this is the default. Note
--that this may mean that ext2 filesystems created by a recent
-+that this may mean that ext2 file systems created by a recent
- .B mke2fs
- cannot be mounted r/w under Linux 2.0.*.)
- The block number here uses 1k units. Thus, if you want to use logical
--block 32768 on a filesystem with 4k blocks, use "sb=131072".
-+block 32768 on a file system with 4k blocks, use "sb=131072".
- .TP
- .BR grpquota " / " noquota " / " quota " / " usrquota
- These options are accepted but ignored.
-@@ -880,12 +905,12 @@
- .SH "Mount options for fat"
- (Note:
- .I fat
--is not a separate filesystem, but a common part of the
-+is not a separate file system, but a common part of the
- .IR msdos ,
- .I umsdos
- and
- .I vfat
--filesystems.)
-+file systems.)
- .TP
- .BR blocksize=512 " / " blocksize=1024 " / " blocksize=2048
- Set blocksize (default 512).
-@@ -934,7 +959,7 @@
- .TP
- .BI codepage= value
- Sets the codepage for converting to shortname characters on FAT
--and VFAT filesystems. By default, codepage 437 is used.
-+and VFAT file systems. By default, codepage 437 is used.
- .TP
- .BR conv=b[inary] " / " conv=t[ext] " / " conv=a[uto]
- The
-@@ -1035,10 +1060,10 @@
- Do not abort mounting when certain consistency checks fail.
-
- .SH "Mount options for iso9660"
--ISO 9660 is a standard describing a filesystem structure to be used
--on CD-ROMs. (This filesystem type is also seen on some DVDs. See also the
-+ISO 9660 is a standard describing a file system structure to be used
-+on CD-ROMs. (This file system type is also seen on some DVDs. See also the
- .I udf
--filesystem.)
-+file system.)
-
- Normal
- .I iso9660
-@@ -1050,7 +1075,7 @@
- Rock Ridge is an extension to iso9660 that provides all of these unix like
- features. Basically there are extensions to each directory record that
- supply all of the additional information, and when Rock Ridge is in use,
--the filesystem is indistinguishable from a normal UNIX file system (except
-+the file system is indistinguishable from a normal UNIX file system (except
- that it is read-only, of course).
- .TP
- .B norock
-@@ -1260,7 +1285,7 @@
- hard links instead of being suppressed.
- .TP
- \fBuid=\fP\fIvalue\fP, \fBgid=\fP\fIvalue\fP and \fBumask=\fP\fIvalue\fP
--Set the file permission on the filesystem.
-+Set the file permission on the file system.
- The umask value is given in octal.
- By default, the files are owned by root and not readable by somebody else.
-
-@@ -1270,12 +1295,12 @@
- These options are recognized, but have no effect as far as I can see.
-
- .SH "Mount options for ramfs"
--Ramfs is a memory based filesystem. Mount it and you have it. Unmount it
-+Ramfs is a memory based file system. Mount it and you have it. Unmount it
- and it is gone. Present since Linux 2.3.99pre4.
- There are no mount options.
-
- .SH "Mount options for reiserfs"
--Reiserfs is a journaling filesystem.
-+Reiserfs is a journaling file system.
- The reiserfs mount options are more fully described at
- .IR http://www.namesys.com/mount-options.html .
- .TP
-@@ -1384,7 +1409,7 @@
- for Ki, Mi, Gi (binary kilo, mega and giga) and can be changed on remount.
- .TP
- .BI size= nbytes
--Override default size of the filesystem.
-+Override default size of the file system.
- The size is given in bytes, and rounded down to entire pages.
- The default is half of the memory.
- .TP
-@@ -1398,7 +1423,7 @@
- Set initial permissions of the root directory.
-
- .SH "Mount options for udf"
--udf is the "Universal Disk Format" filesystem defined by the Optical
-+udf is the "Universal Disk Format" file system defined by the Optical
- Storage Technology Association, and is often used for DVD-ROM.
- See also
- .IR iso9660 .
-@@ -1447,7 +1472,7 @@
- Override the PartitionDesc location. (unused)
- .TP
- .B lastblock=
--Set the last block of the filesystem.
-+Set the last block of the file system.
- .TP
- .B fileset=
- Override the fileset block location. (unused)
-@@ -1471,23 +1496,23 @@
- (Don't forget to give the \-r option.)
- .TP
- .B 44bsd
--For filesystems created by a BSD-like system (NetBSD,FreeBSD,OpenBSD).
-+For file systems created by a BSD-like system (NetBSD,FreeBSD,OpenBSD).
- .TP
- .B sun
--For filesystems created by SunOS or Solaris on Sparc.
-+For file systems created by SunOS or Solaris on Sparc.
- .TP
- .B sunx86
--For filesystems created by Solaris on x86.
-+For file systems created by Solaris on x86.
- .TP
- .B nextstep
--For filesystems created by NeXTStep (on NeXT station) (currently read only).
-+For file systems created by NeXTStep (on NeXT station) (currently read only).
- .TP
- .B nextstep-cd
- For NextStep CDROMs (block_size == 2048), read-only.
- .TP
- .B openstep
--For filesystems created by OpenStep (currently read only).
--The same filesystem type is also used by Mac OS X.
-+For file systems created by OpenStep (currently read only).
-+The same file system type is also used by Mac OS X.
- .RE
-
- .TP
-@@ -1525,7 +1550,7 @@
- This lets you backup and restore filenames that are created with any
- Unicode characters. Without this option, a '?' is used when no
- translation is possible. The escape character is ':' because it is
--otherwise illegal on the vfat filesystem. The escape sequence
-+otherwise illegal on the vfat file system. The escape sequence
- that gets used, where u is the unicode character,
- is: ':', (u & 0x3f), ((u>>6) & 0x3f), (u>>12).
- .TP
-@@ -1538,8 +1563,8 @@
- .IR name~num.ext .
- .TP
- .B utf8
--UTF8 is the filesystem safe 8-bit encoding of Unicode that is used
--by the console. It can be be enabled for the filesystem with this option.
-+UTF8 is the file system safe 8-bit encoding of Unicode that is used
-+by the console. It can be be enabled for the file system with this option.
- If `uni_xlate' gets set, UTF8 gets disabled.
- .TP
- .B shortname=[lower|win95|winnt|mixed]
-@@ -1592,9 +1617,9 @@
- .BI logbufs= value
- Set the number of in-memory log buffers.
- Valid numbers range from 2-8 inclusive.
--The default value is 8 buffers for filesystems with a blocksize of 64K,
--4 buffers for filesystems with a blocksize of 32K,
--3 buffers for filesystems with a blocksize of 16K,
-+The default value is 8 buffers for file systems with a blocksize of 64K,
-+4 buffers for file systems with a blocksize of 32K,
-+3 buffers for file systems with a blocksize of 16K,
- and 2 buffers for all other configurations.
- Increasing the number of buffers may increase performance on
- some workloads at the cost of the memory used for the
-@@ -1608,7 +1633,7 @@
- .TP
- \fBlogdev=\fP\fIdevice\fP and \fBrtdev=\fP\fIdevice\fP
- Use an external log (metadata journal) and/or real-time device.
--An XFS filesystem has up to three parts: a data section, a log section,
-+An XFS file system has up to three parts: a data section, a log section,
- and a real-time section.
- The real-time section is optional, and the log section can be separate
- from the data section or contained within it.
-@@ -1622,8 +1647,8 @@
- Access timestamps are not updated when a file is read.
- .TP
- .B norecovery
--The filesystem will be mounted without running log recovery.
--If the filesystem was not cleanly unmounted, it is likely to
-+The file system will be mounted without running log recovery.
-+If the file system was not cleanly unmounted, it is likely to
- be inconsistent when mounted in
- .B norecovery
- mode.
-@@ -1651,13 +1676,13 @@
- volume.
- .I value
- must be specified in 512-byte block units.
--If this option is not specified and the filesystem was made on a stripe
-+If this option is not specified and the file system was made on a stripe
- volume or the stripe width or unit were specified for the RAID device at
- mkfs time, then the mount system call will restore the value from the
- superblock.
--For filesystems that are made directly on RAID devices, these options can be
-+For file systems that are made directly on RAID devices, these options can be
- used to override the information in the superblock if the underlying disk
--layout changes after the filesystem has been created.
-+layout changes after the file system has been created.
- The
- .B swidth
- option is required if the
+++ /dev/null
---- util-linux-2.10m/mount/nfsmount.c.nfsv3 Thu Jun 22 11:24:15 2000
-+++ util-linux-2.10m/mount/nfsmount.c Thu Jun 22 11:25:14 2000
-@@ -106,7 +106,7 @@ find_kernel_nfs_mount_version(void) {
- if (kernel_version) {
- if (kernel_version < MAKE_VERSION(2,1,32))
- nfs_mount_version = 1;
-- else if (kernel_version < MAKE_VERSION(2,3,99))
-+ else if (kernel_version < MAKE_VERSION(2,2,16))
- nfs_mount_version = 3;
- else
- nfs_mount_version = 4; /* since 2.3.99pre4 */
+++ /dev/null
-diff -urN util-linux-2.9w/mount/Makefile util-linux-2.9w.int/mount/Makefile
---- util-linux-2.9w/mount/Makefile Fri Jul 9 04:56:39 1999
-+++ util-linux-2.9w.int/mount/Makefile Mon Sep 6 14:05:07 1999
-@@ -36,7 +36,7 @@
- GEN_FILES = nfsmount.x nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
-
- # comment these out if you are not compiling in loop support
--LO_OBJS=lomount.o
-+LO_OBJS=lomount.o rmd160.o
-
- all: $(PROGS)
-
-@@ -64,7 +64,7 @@
- swapon: swapon.o version.o
- $(LINK) $^ -o $@
-
--losetup: losetup.o
-+losetup: losetup.o rmd160.o
- $(LINK) $^ -o $@
-
- mount.o umount.o nfsmount.o losetup.o fstab.o sundries.o: sundries.h
-diff -urN util-linux-2.9w/mount/lomount.c util-linux-2.9w.int/mount/lomount.c
---- util-linux-2.9w/mount/lomount.c Fri Jul 9 04:56:39 1999
-+++ util-linux-2.9w.int/mount/lomount.c Mon Sep 6 14:05:07 1999
-@@ -26,6 +26,7 @@
-
- #include "loop.h"
- #include "lomount.h"
-+#include "rmd160.h"
- #include "nls.h"
-
- char *xstrdup (const char *s); /* not: #include "sundries.h" */
-@@ -40,6 +41,14 @@
- { LO_CRYPT_NONE, "none" },
- { LO_CRYPT_XOR, "xor" },
- { LO_CRYPT_DES, "DES" },
-+ { LO_CRYPT_FISH2, "twofish" },
-+ { LO_CRYPT_BLOW, "blowfish"},
-+ { LO_CRYPT_CAST128, "cast128"},
-+ { LO_CRYPT_SERPENT, "serpent"},
-+ { LO_CRYPT_MARS, "mars" },
-+ { LO_CRYPT_RC6, "rc6" },
-+ { LO_CRYPT_DFC, "dfc" },
-+ { LO_CRYPT_IDEA, "idea"},
- { -1, NULL }
- };
-
-@@ -218,6 +227,24 @@
- return 1;
- }
- break;
-+ case LO_CRYPT_FISH2:
-+ case LO_CRYPT_BLOW:
-+ pass = getpass("Password :");
-+ MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
-+ loopinfo.lo_encrypt_key_size=20; /* 160 Bit key */
-+ break;
-+
-+ case LO_CRYPT_IDEA:
-+ case LO_CRYPT_CAST128:
-+ case LO_CRYPT_SERPENT:
-+ case LO_CRYPT_MARS:
-+ case LO_CRYPT_RC6:
-+ case LO_CRYPT_DFC:
-+ pass = getpass("Password :");
-+ MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
-+ loopinfo.lo_encrypt_key_size=16; /* 128 Bit key */
-+ break;
-+
- default:
- fprintf (stderr,
- _("Don't know how to get key for encryption system %d\n"),
-diff -urN util-linux-2.9w/mount/losetup.8 util-linux-2.9w.int/mount/losetup.8
---- util-linux-2.9w/mount/losetup.8 Fri Jul 9 04:56:39 1999
-+++ util-linux-2.9w.int/mount/losetup.8 Mon Sep 6 14:05:24 1999
-@@ -36,11 +36,47 @@
- .PD 0
- .IP \fBXOR\fP
- use a simple XOR encryption.
-+.IP \fBBlowfish\fP
-+use Blowfish encryption. Blowfish encryption is only available if you
-+are using the international kernel and Blowfish encryption has been
-+enabled in the Crypto API.
-+.IP \fBTwofish\fP
-+use Twofish encryption. Twofish encryption is only available if you
-+are using the international kernel and Twofish encryption has been
-+enabled in the Crypto API.
-+.IP \fBCAST\fP
-+use CAST encryption. CAST encryption is only available if you
-+are using the international kernel and CAST encryption has been
-+enabled in the Crypto API.
- .IP \fBDES\fP
- use DES encryption. DES encryption is only available if the optional
- DES package has been added to the kernel. DES encryption uses an additional
- start value that is used to protect passwords against dictionary
--attacks.
-+attacks. Use of DES is deprecated.
-+.IP \fBDFC\fP
-+use DFC encryption. DFC encryption is only available if you
-+are using the international kernel and DFC encryption has been
-+enabled in the Crypto API.
-+.IP \fBIDEA\fP
-+use IDEA encryption. IDEA encryption is only available if you
-+are using the international kernel and IDEA encryption has been
-+enabled in the Crypto API.
-+.IP \fBMARS\fP
-+use MARS encryption. MARS encryption is only available if you
-+are using the international kernel and MARS encryption has been
-+enabled in the Crypto API.
-+.IP \fBRC5\fP
-+use RC5 encryption. RC5 encryption is only available if you
-+are using the international kernel and RC5 encryption has been
-+enabled in the Crypto API.
-+.IP \fBRC6\fP
-+use RC6 encryption. RC6 encryption is only available if you
-+are using the international kernel and RC6 encryption has been
-+enabled in the Crypto API.
-+.IP \fBSerpent\fP
-+use Serpent encryption. Serpent encryption is only available if you
-+are using the international kernel and Serpent encryption has been
-+enabled in the Crypto API.
- .PD
- .RE
- .IP "\fB\-o \fIoffset\fP"
-@@ -49,6 +85,7 @@
- .SH FILES
- .nf
- /dev/loop0,/dev/loop1,... loop devices (major=7)
-+/proc/cipher/* available ciphers
- .fi
- .SH EXAMPLE
- If you are using the loadable module you must have the module loaded
-@@ -60,9 +97,8 @@
- .nf
- .IP
- dd if=/dev/zero of=/file bs=1k count=100
--losetup -e des /dev/loop0 /file
--Password:
--Init (up to 16 hex digits):
-+losetup -e blowfish /dev/loop0 /file
-+Password :
- mkfs -t ext2 /dev/loop0 100
- mount -t ext2 /dev/loop0 /mnt
- ...
-@@ -76,8 +112,12 @@
- # rmmod loop
- .LP
- .fi
--.SH RESTRICTION
--DES encryption is painfully slow. On the other hand, XOR is terribly weak.
-+.SH RESTRICTIONS
-+DES encryption is painfully slow. On the other hand, XOR is terribly
-+weak. Both are insecure nowadays. Some ciphers require a licence for
-+you to be allowed to use them.
-+.SH BUGS
-+CAST, DES, RC5 and Twofish are currently broken and cannot be used.
- .SH AUTHORS
- .nf
- Original version: Theodore Ts'o <tytso@athena.mit.edu>
-diff -urN util-linux-2.9w/mount/losetup.c util-linux-2.9w.int/mount/losetup.c
---- util-linux-2.9w/mount/losetup.c Fri Jul 9 04:56:39 1999
-+++ util-linux-2.9w.int/mount/losetup.c Mon Sep 6 14:19:53 1999
-@@ -17,6 +17,7 @@
-
- #include "loop.h"
- #include "lomount.h"
-+#include "rmd160.h"
- #include "nls.h"
-
- #ifdef LOOP_SET_FD
-@@ -31,6 +32,14 @@
- { LO_CRYPT_NONE,"none" },
- { LO_CRYPT_XOR, "xor" },
- { LO_CRYPT_DES, "DES" },
-+ { LO_CRYPT_FISH2, "twofish" },
-+ { LO_CRYPT_BLOW, "blowfish" },
-+ { LO_CRYPT_CAST128, "cast128" },
-+ { LO_CRYPT_SERPENT, "serpent" },
-+ { LO_CRYPT_MARS, "mars" },
-+ { LO_CRYPT_RC6, "rc6" },
-+ { LO_CRYPT_DFC, "dfc" },
-+ { LO_CRYPT_IDEA, "idea" },
- { -1, NULL }
- };
-
-@@ -85,7 +94,7 @@
- struct loop_info loopinfo;
- int fd, ffd, mode, i;
- char *pass;
--
-+
- mode = *loopro ? O_RDONLY : O_RDWR;
- if ((ffd = open (file, mode)) < 0 && !*loopro
- && (errno != EROFS || (ffd = open (file, mode = O_RDONLY)) < 0)) {
-@@ -118,6 +127,7 @@
- loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
- break;
- case LO_CRYPT_DES:
-+ printf(_("WARNING: Use of DES is depreciated.\n"));
- pass = getpass(_("Password: "));
- strncpy(loopinfo.lo_encrypt_key, pass, 8);
- loopinfo.lo_encrypt_key[8] = 0;
-@@ -133,6 +143,22 @@
- exit(1);
- }
- break;
-+ case LO_CRYPT_FISH2:
-+ case LO_CRYPT_BLOW:
-+ pass = getpass("Password :");
-+ MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
-+ loopinfo.lo_encrypt_key_size=20; /* 160 Bit key */
-+ break;
-+ case LO_CRYPT_CAST128:
-+ case LO_CRYPT_SERPENT:
-+ case LO_CRYPT_MARS:
-+ case LO_CRYPT_RC6:
-+ case LO_CRYPT_DFC:
-+ case LO_CRYPT_IDEA:
-+ pass = getpass("Passphrase :");
-+ MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
-+ loopinfo.lo_encrypt_key_size=16; /* 128 Bit key */
-+ break;
- default:
- fprintf(stderr,
- _("Don't know how to get key for encryption system %d\n"),
-@@ -171,11 +197,18 @@
-
- static int usage(void)
- {
-+ struct crypt_type_struct *c;
- fprintf(stderr, _("usage:\n\
- %s loop_device # give info\n\
- %s -d loop_device # delete\n\
- %s [ -e encryption ] [ -o offset ] loop_device file # setup\n"),
- progname, progname, progname);
-+ fprintf(stderr, " where encryption is one of:\n");
-+ c = &crypt_type_tbl[0];
-+ while(c->name) {
-+ fprintf(stderr, " %s\n", c->name);
-+ c++;
-+ }
- exit(1);
- }
-
-diff -urN util-linux-2.9w/mount/rmd160.c util-linux-2.9w.int/mount/rmd160.c
---- util-linux-2.9w/mount/rmd160.c Thu Jan 1 01:00:00 1970
-+++ util-linux-2.9w.int/mount/rmd160.c Mon Sep 6 14:05:07 1999
-@@ -0,0 +1,371 @@
-+/********************************************************************\
-+ *
-+ * FILE: rmd160.c
-+ *
-+ * CONTENTS: A sample C-implementation of the RIPEMD-160
-+ * hash-function.
-+ * TARGET: any computer with an ANSI C compiler
-+ *
-+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
-+ * DATE: 1 March 1996
-+ * VERSION: 1.0
-+ *
-+ * Copyright (c) Katholieke Universiteit Leuven
-+ * 1996, All Rights Reserved
-+ *
-+\********************************************************************/
-+
-+/* header files */
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include "rmd160.h"
-+
-+/********************************************************************/
-+
-+/* macro definitions */
-+
-+/* collect four bytes into one word: */
-+#define BYTES_TO_DWORD(strptr) \
-+ (((dword) *((strptr)+3) << 24) | \
-+ ((dword) *((strptr)+2) << 16) | \
-+ ((dword) *((strptr)+1) << 8) | \
-+ ((dword) *(strptr)))
-+
-+/* ROL(x, n) cyclically rotates x over n bits to the left */
-+/* x must be of an unsigned 32 bits type and 0 <= n < 32. */
-+#define ROL(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-+
-+/* the five basic functions F(), G() and H() */
-+#define F(x, y, z) ((x) ^ (y) ^ (z))
-+#define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
-+#define H(x, y, z) (((x) | ~(y)) ^ (z))
-+#define I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
-+#define J(x, y, z) ((x) ^ ((y) | ~(z)))
-+
-+/* the ten basic operations FF() through III() */
-+#define FF(a, b, c, d, e, x, s) {\
-+ (a) += F((b), (c), (d)) + (x);\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define GG(a, b, c, d, e, x, s) {\
-+ (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define HH(a, b, c, d, e, x, s) {\
-+ (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define II(a, b, c, d, e, x, s) {\
-+ (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define JJ(a, b, c, d, e, x, s) {\
-+ (a) += J((b), (c), (d)) + (x) + 0xa953fd4eUL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define FFF(a, b, c, d, e, x, s) {\
-+ (a) += F((b), (c), (d)) + (x);\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define GGG(a, b, c, d, e, x, s) {\
-+ (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define HHH(a, b, c, d, e, x, s) {\
-+ (a) += H((b), (c), (d)) + (x) + 0x6d703ef3UL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define III(a, b, c, d, e, x, s) {\
-+ (a) += I((b), (c), (d)) + (x) + 0x5c4dd124UL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+#define JJJ(a, b, c, d, e, x, s) {\
-+ (a) += J((b), (c), (d)) + (x) + 0x50a28be6UL;\
-+ (a) = ROL((a), (s)) + (e);\
-+ (c) = ROL((c), 10);\
-+ }
-+
-+
-+/********************************************************************/
-+
-+void MDinit(dword *MDbuf)
-+{
-+ MDbuf[0] = 0x67452301UL;
-+ MDbuf[1] = 0xefcdab89UL;
-+ MDbuf[2] = 0x98badcfeUL;
-+ MDbuf[3] = 0x10325476UL;
-+ MDbuf[4] = 0xc3d2e1f0UL;
-+
-+ return;
-+}
-+
-+/********************************************************************/
-+
-+void compress(dword *MDbuf, dword *X)
-+{
-+ dword aa = MDbuf[0], bb = MDbuf[1], cc = MDbuf[2],
-+ dd = MDbuf[3], ee = MDbuf[4];
-+ dword aaa = MDbuf[0], bbb = MDbuf[1], ccc = MDbuf[2],
-+ ddd = MDbuf[3], eee = MDbuf[4];
-+
-+ /* round 1 */
-+ FF(aa, bb, cc, dd, ee, X[ 0], 11);
-+ FF(ee, aa, bb, cc, dd, X[ 1], 14);
-+ FF(dd, ee, aa, bb, cc, X[ 2], 15);
-+ FF(cc, dd, ee, aa, bb, X[ 3], 12);
-+ FF(bb, cc, dd, ee, aa, X[ 4], 5);
-+ FF(aa, bb, cc, dd, ee, X[ 5], 8);
-+ FF(ee, aa, bb, cc, dd, X[ 6], 7);
-+ FF(dd, ee, aa, bb, cc, X[ 7], 9);
-+ FF(cc, dd, ee, aa, bb, X[ 8], 11);
-+ FF(bb, cc, dd, ee, aa, X[ 9], 13);
-+ FF(aa, bb, cc, dd, ee, X[10], 14);
-+ FF(ee, aa, bb, cc, dd, X[11], 15);
-+ FF(dd, ee, aa, bb, cc, X[12], 6);
-+ FF(cc, dd, ee, aa, bb, X[13], 7);
-+ FF(bb, cc, dd, ee, aa, X[14], 9);
-+ FF(aa, bb, cc, dd, ee, X[15], 8);
-+
-+ /* round 2 */
-+ GG(ee, aa, bb, cc, dd, X[ 7], 7);
-+ GG(dd, ee, aa, bb, cc, X[ 4], 6);
-+ GG(cc, dd, ee, aa, bb, X[13], 8);
-+ GG(bb, cc, dd, ee, aa, X[ 1], 13);
-+ GG(aa, bb, cc, dd, ee, X[10], 11);
-+ GG(ee, aa, bb, cc, dd, X[ 6], 9);
-+ GG(dd, ee, aa, bb, cc, X[15], 7);
-+ GG(cc, dd, ee, aa, bb, X[ 3], 15);
-+ GG(bb, cc, dd, ee, aa, X[12], 7);
-+ GG(aa, bb, cc, dd, ee, X[ 0], 12);
-+ GG(ee, aa, bb, cc, dd, X[ 9], 15);
-+ GG(dd, ee, aa, bb, cc, X[ 5], 9);
-+ GG(cc, dd, ee, aa, bb, X[ 2], 11);
-+ GG(bb, cc, dd, ee, aa, X[14], 7);
-+ GG(aa, bb, cc, dd, ee, X[11], 13);
-+ GG(ee, aa, bb, cc, dd, X[ 8], 12);
-+
-+ /* round 3 */
-+ HH(dd, ee, aa, bb, cc, X[ 3], 11);
-+ HH(cc, dd, ee, aa, bb, X[10], 13);
-+ HH(bb, cc, dd, ee, aa, X[14], 6);
-+ HH(aa, bb, cc, dd, ee, X[ 4], 7);
-+ HH(ee, aa, bb, cc, dd, X[ 9], 14);
-+ HH(dd, ee, aa, bb, cc, X[15], 9);
-+ HH(cc, dd, ee, aa, bb, X[ 8], 13);
-+ HH(bb, cc, dd, ee, aa, X[ 1], 15);
-+ HH(aa, bb, cc, dd, ee, X[ 2], 14);
-+ HH(ee, aa, bb, cc, dd, X[ 7], 8);
-+ HH(dd, ee, aa, bb, cc, X[ 0], 13);
-+ HH(cc, dd, ee, aa, bb, X[ 6], 6);
-+ HH(bb, cc, dd, ee, aa, X[13], 5);
-+ HH(aa, bb, cc, dd, ee, X[11], 12);
-+ HH(ee, aa, bb, cc, dd, X[ 5], 7);
-+ HH(dd, ee, aa, bb, cc, X[12], 5);
-+
-+ /* round 4 */
-+ II(cc, dd, ee, aa, bb, X[ 1], 11);
-+ II(bb, cc, dd, ee, aa, X[ 9], 12);
-+ II(aa, bb, cc, dd, ee, X[11], 14);
-+ II(ee, aa, bb, cc, dd, X[10], 15);
-+ II(dd, ee, aa, bb, cc, X[ 0], 14);
-+ II(cc, dd, ee, aa, bb, X[ 8], 15);
-+ II(bb, cc, dd, ee, aa, X[12], 9);
-+ II(aa, bb, cc, dd, ee, X[ 4], 8);
-+ II(ee, aa, bb, cc, dd, X[13], 9);
-+ II(dd, ee, aa, bb, cc, X[ 3], 14);
-+ II(cc, dd, ee, aa, bb, X[ 7], 5);
-+ II(bb, cc, dd, ee, aa, X[15], 6);
-+ II(aa, bb, cc, dd, ee, X[14], 8);
-+ II(ee, aa, bb, cc, dd, X[ 5], 6);
-+ II(dd, ee, aa, bb, cc, X[ 6], 5);
-+ II(cc, dd, ee, aa, bb, X[ 2], 12);
-+
-+ /* round 5 */
-+ JJ(bb, cc, dd, ee, aa, X[ 4], 9);
-+ JJ(aa, bb, cc, dd, ee, X[ 0], 15);
-+ JJ(ee, aa, bb, cc, dd, X[ 5], 5);
-+ JJ(dd, ee, aa, bb, cc, X[ 9], 11);
-+ JJ(cc, dd, ee, aa, bb, X[ 7], 6);
-+ JJ(bb, cc, dd, ee, aa, X[12], 8);
-+ JJ(aa, bb, cc, dd, ee, X[ 2], 13);
-+ JJ(ee, aa, bb, cc, dd, X[10], 12);
-+ JJ(dd, ee, aa, bb, cc, X[14], 5);
-+ JJ(cc, dd, ee, aa, bb, X[ 1], 12);
-+ JJ(bb, cc, dd, ee, aa, X[ 3], 13);
-+ JJ(aa, bb, cc, dd, ee, X[ 8], 14);
-+ JJ(ee, aa, bb, cc, dd, X[11], 11);
-+ JJ(dd, ee, aa, bb, cc, X[ 6], 8);
-+ JJ(cc, dd, ee, aa, bb, X[15], 5);
-+ JJ(bb, cc, dd, ee, aa, X[13], 6);
-+
-+ /* parallel round 1 */
-+ JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8);
-+ JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9);
-+ JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9);
-+ JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11);
-+ JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13);
-+ JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15);
-+ JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15);
-+ JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5);
-+ JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7);
-+ JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7);
-+ JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8);
-+ JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11);
-+ JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14);
-+ JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14);
-+ JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12);
-+ JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6);
-+
-+ /* parallel round 2 */
-+ III(eee, aaa, bbb, ccc, ddd, X[ 6], 9);
-+ III(ddd, eee, aaa, bbb, ccc, X[11], 13);
-+ III(ccc, ddd, eee, aaa, bbb, X[ 3], 15);
-+ III(bbb, ccc, ddd, eee, aaa, X[ 7], 7);
-+ III(aaa, bbb, ccc, ddd, eee, X[ 0], 12);
-+ III(eee, aaa, bbb, ccc, ddd, X[13], 8);
-+ III(ddd, eee, aaa, bbb, ccc, X[ 5], 9);
-+ III(ccc, ddd, eee, aaa, bbb, X[10], 11);
-+ III(bbb, ccc, ddd, eee, aaa, X[14], 7);
-+ III(aaa, bbb, ccc, ddd, eee, X[15], 7);
-+ III(eee, aaa, bbb, ccc, ddd, X[ 8], 12);
-+ III(ddd, eee, aaa, bbb, ccc, X[12], 7);
-+ III(ccc, ddd, eee, aaa, bbb, X[ 4], 6);
-+ III(bbb, ccc, ddd, eee, aaa, X[ 9], 15);
-+ III(aaa, bbb, ccc, ddd, eee, X[ 1], 13);
-+ III(eee, aaa, bbb, ccc, ddd, X[ 2], 11);
-+
-+ /* parallel round 3 */
-+ HHH(ddd, eee, aaa, bbb, ccc, X[15], 9);
-+ HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7);
-+ HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15);
-+ HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11);
-+ HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8);
-+ HHH(ddd, eee, aaa, bbb, ccc, X[14], 6);
-+ HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6);
-+ HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14);
-+ HHH(aaa, bbb, ccc, ddd, eee, X[11], 12);
-+ HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13);
-+ HHH(ddd, eee, aaa, bbb, ccc, X[12], 5);
-+ HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14);
-+ HHH(bbb, ccc, ddd, eee, aaa, X[10], 13);
-+ HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13);
-+ HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7);
-+ HHH(ddd, eee, aaa, bbb, ccc, X[13], 5);
-+
-+ /* parallel round 4 */
-+ GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15);
-+ GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5);
-+ GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8);
-+ GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11);
-+ GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14);
-+ GGG(ccc, ddd, eee, aaa, bbb, X[11], 14);
-+ GGG(bbb, ccc, ddd, eee, aaa, X[15], 6);
-+ GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14);
-+ GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6);
-+ GGG(ddd, eee, aaa, bbb, ccc, X[12], 9);
-+ GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12);
-+ GGG(bbb, ccc, ddd, eee, aaa, X[13], 9);
-+ GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12);
-+ GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5);
-+ GGG(ddd, eee, aaa, bbb, ccc, X[10], 15);
-+ GGG(ccc, ddd, eee, aaa, bbb, X[14], 8);
-+
-+ /* parallel round 5 */
-+ FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8);
-+ FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5);
-+ FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12);
-+ FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9);
-+ FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12);
-+ FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5);
-+ FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14);
-+ FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6);
-+ FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8);
-+ FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13);
-+ FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6);
-+ FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5);
-+ FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15);
-+ FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13);
-+ FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11);
-+ FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11);
-+
-+ /* combine results */
-+ ddd += cc + MDbuf[1]; /* final result for MDbuf[0] */
-+ MDbuf[1] = MDbuf[2] + dd + eee;
-+ MDbuf[2] = MDbuf[3] + ee + aaa;
-+ MDbuf[3] = MDbuf[4] + aa + bbb;
-+ MDbuf[4] = MDbuf[0] + bb + ccc;
-+ MDbuf[0] = ddd;
-+
-+ return;
-+}
-+
-+/********************************************************************/
-+
-+void MDfinish(dword *MDbuf, byte *strptr, dword lswlen, dword mswlen)
-+{
-+ unsigned int i; /* counter */
-+ dword X[16]; /* message words */
-+
-+ memset(X, 0, 16*sizeof(dword));
-+
-+ /* put bytes from strptr into X */
-+ for (i=0; i<(lswlen&63); i++) {
-+ /* byte i goes into word X[i div 4] at pos. 8*(i mod 4) */
-+ X[i>>2] ^= (dword) *strptr++ << (8 * (i&3));
-+ }
-+
-+ /* append "1" bit to the message. Be careful :
-+ message = "" -> "10000000" = 128 */
-+ X[(lswlen>>2)&15] ^= (dword)1 << (8*(lswlen&3)+7);
-+
-+ if ((lswlen & 63) > 55) {
-+ /* length goes to next block */
-+ compress(MDbuf, X);
-+ memset(X, 0, 16*sizeof(dword));
-+ }
-+
-+ /* append length in bits*/
-+ X[14] = lswlen << 3;
-+ X[15] = (lswlen >> 29) | (mswlen << 3);
-+ compress(MDbuf, X);
-+
-+ return;
-+}
-+
-+void MDcalc(byte *MD,byte *sp,dword sl)
-+{ dword X[16];
-+ dword MDbuf[5];
-+ int i,j;
-+
-+ MDinit(MDbuf);
-+
-+ while (sl >= 64)
-+ {
-+ memset(X,0,16*sizeof(dword));
-+
-+ for (i=0; i<64; i++)
-+ X[i>>2] |= ((dword)(*sp++)) << (8 * (i&3));
-+
-+ sl-=64;
-+ compress(MDbuf,X);
-+
-+ };
-+ MDfinish(MDbuf,sp,sl,0);
-+
-+ for (i=0;i<5;i++)
-+ for (j=0;j<4;j++)
-+ *MD++=(byte)((MDbuf[i]>>(j*8))&0xFF);
-+}
-+
-+/************************ end of file rmd160.c **********************/
-+
-diff -urN util-linux-2.9w/mount/rmd160.h util-linux-2.9w.int/mount/rmd160.h
---- util-linux-2.9w/mount/rmd160.h Thu Jan 1 01:00:00 1970
-+++ util-linux-2.9w.int/mount/rmd160.h Mon Sep 6 14:05:07 1999
-@@ -0,0 +1,58 @@
-+/********************************************************************\
-+ *
-+ * FILE: rmd160.h
-+ *
-+ * CONTENTS: Header file for a sample C-implementation of the
-+ * RIPEMD-160 hash-function.
-+ * TARGET: any computer with an ANSI C compiler
-+ *
-+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
-+ * DATE: 1 March 1996
-+ * VERSION: 1.0
-+ *
-+ * Copyright (c) Katholieke Universiteit Leuven
-+ * 1996, All Rights Reserved
-+ *
-+\********************************************************************/
-+
-+#ifndef RMD160H /* make sure this file is read only once */
-+#define RMD160H
-+
-+/********************************************************************/
-+
-+/* typedef 8 and 32 bit types, resp. */
-+/* adapt these, if necessary,
-+ for your operating system and compiler */
-+
-+typedef unsigned char byte;
-+typedef unsigned long dword;
-+
-+/********************************************************************/
-+
-+/* function prototypes */
-+
-+void MDinit(dword *MDbuf);
-+/*
-+ * initializes MDbuffer to "magic constants"
-+ */
-+
-+void compress(dword *MDbuf, dword *X);
-+/*
-+ * the compression function.
-+ * transforms MDbuf using message bytes X[0] through X[15]
-+ */
-+
-+void MDfinish(dword *MDbuf, byte *strptr, dword lswlen, dword mswlen);
-+/*
-+ * puts bytes from strptr into X and pad out; appends length
-+ * and finally, compresses the last block(s)
-+ * note: length in bits == 8 * (lswlen + 2^32 mswlen).
-+ * note: there are (lswlen mod 64) bytes left in strptr.
-+ */
-+
-+void MDcalc(byte *MDbuf,byte *sp,dword sl);
-+
-+#endif /* RMD160H */
-+
-+/*********************** end of file rmd160.h ***********************/
-+
+++ /dev/null
---- util-linux-2.12.orig/mount/Makefile
-+++ util-linux-2.12/mount/Makefile
-@@ -24,7 +26,7 @@
-
- MAYBE = pivot_root swapoff
-
--LO_OBJS = lomount.o $(LIB)/xstrncpy.o
-+LO_OBJS = lomount.o $(LIB)/xstrncpy.o rmd160.o
- NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
- GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
-
-@@ -57,7 +59,7 @@
- main_losetup.o: lomount.c
- $(COMPILE) -DMAIN lomount.c -o $@
-
--losetup: main_losetup.o $(LIB)/xstrncpy.o
-+losetup: main_losetup.o $(LIB)/xstrncpy.o rmd160.o
- $(LINK) $^ -o $@
-
- mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h
---- util-linux-2.12/mount/lomount.c.orig 2003-07-17 01:56:53.000000000 +0200
-+++ util-linux-2.12/mount/lomount.c 2004-08-04 19:27:23.000000000 +0200
-@@ -33,15 +33,80 @@
-
- #include "loop.h"
- #include "lomount.h"
-+#include "rmd160.h"
- #include "xstrncpy.h"
- #include "nls.h"
-
- extern int verbose;
--extern char *xstrdup (const char *s); /* not: #include "sundries.h" */
-+extern char *xstrdup (const char *s); /* not: #include "sundries.h" */
- extern void error (const char *fmt, ...); /* idem */
-
- #ifdef LOOP_SET_FD
-
-+#include <getopt.h>
-+#include <stdarg.h>
-+
-+struct crypt_type_struct {
-+ int id;
-+ char *name;
-+ int keylength;
-+} crypt_type_tbl[] = {
-+ { LO_CRYPT_NONE, "none", 0 },
-+ { LO_CRYPT_XOR, "xor", 0 },
-+ { LO_CRYPT_DES, "des", 8 },
-+ { LO_CRYPT_FISH2, "twofish", 20 },
-+ { LO_CRYPT_BLOW, "blowfish", 20 },
-+ { LO_CRYPT_CAST128, "cast", 16 },
-+ { LO_CRYPT_SERPENT, "serpent", 16 },
-+ { LO_CRYPT_MARS, "mars", 16 },
-+ { LO_CRYPT_RC6, "rc6", 16 },
-+ { LO_CRYPT_3DES, "des-ede3", 24 },
-+ { LO_CRYPT_DFC, "dfc", 16 },
-+ { LO_CRYPT_IDEA, "idea", 16 },
-+ { LO_CRYPT_RIJNDAEL, "rijndael", 16 },
-+ { -1, NULL,0 }
-+};
-+
-+static struct option longopts[] = {
-+ { "delete", 0, 0, 'd' },
-+ { "detach", 0, 0, 'd' },
-+ { "encryption", 1, 0, 'e' },
-+ { "help", 0, 0, 'h' },
-+ { "nopasshash", 1, 0, 'N' },
-+ { "offset", 1, 0, 'o' },
-+ { "pass-fd", 1, 0, 'p' },
-+ { "verbose", 0, 0, 'v' },
-+ { "keybits", 1, 0, 'k' },
-+ { NULL, 0, 0, 0 }
-+};
-+
-+static int
-+name_to_id(const char *name)
-+{
-+ int i;
-+
-+ if (name) {
-+ for (i = 0; crypt_type_tbl[i].id != -1; i++)
-+ if (!strcasecmp (name, crypt_type_tbl[i].name))
-+ return crypt_type_tbl[i].id;
-+ } else
-+ return LO_CRYPT_NONE;
-+ return LO_CRYPT_CRYPTOAPI;
-+}
-+
-+#ifdef MAIN
-+static char *
-+id_to_name(int id) {
-+ int i;
-+
-+ for (i = 0; crypt_type_tbl[i].id != -1; i++)
-+ if (id == crypt_type_tbl[i].id)
-+ return crypt_type_tbl[i].name;
-+ return "undefined";
-+}
-+#endif
-+
-+
- static int
- loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info)
- {
-@@ -126,7 +191,8 @@
- printf(_(", offset %d"), loopinfo.lo_offset);
-
- if (loopinfo.lo_encrypt_type)
-- printf(_(", encryption type %d\n"),
-+ printf(_(", encryption %s (type %d)\n"),
-+ id_to_name(loopinfo.lo_encrypt_type),
- loopinfo.lo_encrypt_type);
-
- printf("\n");
-@@ -189,10 +255,9 @@
- error(_("mount: could not find any device /dev/loop#"));
- else if (!someloop) {
- error(_(
-- "mount: Could not find any loop device. Maybe this kernel "
-- "does not know\n"
-- " about the loop device? (If so, recompile or "
-- "`modprobe loop'.)"));
-+ "mount: Could not find any loop device. Maybe this kernel does not know\n"
-+ " about the loop device? (If so, recompile or `modprobe loop'), or\n"
-+ " maybe /dev/loop# has the wrong major number?"));
- } else
- error(_("mount: could not find any free loop device"));
- return 0;
-@@ -247,10 +312,20 @@
-
- int
- set_loop(const char *device, const char *file, int offset,
-- const char *encryption, int pfd, int *loopro) {
-+ const char *encryption, int pfd, int keysz, int *loopro, int hash_password) {
- struct loop_info64 loopinfo64;
- int fd, ffd, mode;
- char *pass;
-+ int tried_old;
-+
-+ int kerneli=open("/proc/crypto/cipher",O_RDONLY);
-+
-+ if (kerneli>=0) {
-+ close(kerneli);
-+ kerneli=1;
-+ } else {
-+ kerneli=0;
-+ }
-
- mode = (*loopro ? O_RDONLY : O_RDWR);
- if ((ffd = open(file, mode)) < 0) {
-@@ -276,8 +351,13 @@
- loopinfo64.lo_encrypt_type = atoi(encryption);
- } else {
- loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI;
-- snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE,
-+ if (kerneli)
-+ snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE,
-+ "%s-cbc", encryption);
-+ else
-+ snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE,
- "%s", encryption);
-+ loopinfo64.lo_crypt_name[LO_NAME_SIZE-1] = 0;
- }
- }
-
-@@ -296,29 +376,98 @@
- }
- #endif
-
-+ if (keysz==0)
-+ keysz=LO_KEY_SIZE*8;
-+ tried_old=0;
-+again:
- switch (loopinfo64.lo_encrypt_type) {
- case LO_CRYPT_NONE:
- loopinfo64.lo_encrypt_key_size = 0;
- break;
- case LO_CRYPT_XOR:
- pass = getpass(_("Password: "));
-- xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
-+ xstrncpy(loopinfo64.lo_encrypt_key, pass, keysz/8);
- loopinfo64.lo_encrypt_key_size =
- strlen(loopinfo64.lo_encrypt_key);
- break;
-- default:
-+ case LO_CRYPT_FISH2:
-+ case LO_CRYPT_BLOW:
-+ case LO_CRYPT_IDEA:
-+ case LO_CRYPT_CAST128:
-+ case LO_CRYPT_SERPENT:
-+ case LO_CRYPT_MARS:
-+ case LO_CRYPT_RC6:
-+ case LO_CRYPT_3DES:
-+ case LO_CRYPT_DFC:
-+ case LO_CRYPT_RIJNDAEL:
-+ {
-+#define HASHLENGTH 20
-+#define PASSWDBUFFLEN 130 /* getpass returns only max. 128 bytes, see man getpass */
-+ char keybits[2*HASHLENGTH];
-+ char passwdbuff[PASSWDBUFFLEN];
-+ int keylength;
-+ int i;
-+
- pass = xgetpass(pfd, _("Password: "));
-- xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
-- loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
-+ strncpy(passwdbuff+1,pass,PASSWDBUFFLEN-1);
-+ passwdbuff[PASSWDBUFFLEN-1] = '\0';
-+ passwdbuff[0] = 'A';
-+ rmd160_hash_buffer(keybits,pass,strlen(pass));
-+ rmd160_hash_buffer(keybits+HASHLENGTH,passwdbuff,strlen(pass)+1);
-+ memcpy((char*)loopinfo64.lo_encrypt_key,keybits,2*HASHLENGTH);
-+ keylength=0;
-+ for(i=0; crypt_type_tbl[i].id != -1; i++){
-+ if(loopinfo64.lo_encrypt_type == crypt_type_tbl[i].id){
-+ keylength = crypt_type_tbl[i].keylength;
-+ break;
-+ }
-+ }
-+ loopinfo64.lo_encrypt_key_size=keylength;
-+ break;
-+ }
-+ default:
-+ if (hash_password) {
-+ char keybits[2*HASHLENGTH];
-+ char passwdbuff[PASSWDBUFFLEN];
-+
-+ pass = xgetpass(pfd, _("Password: "));
-+ strncpy(passwdbuff+1,pass,PASSWDBUFFLEN-1);
-+ passwdbuff[PASSWDBUFFLEN-1] = '\0';
-+ passwdbuff[0] = 'A';
-+ rmd160_hash_buffer(keybits,pass,strlen(pass));
-+ rmd160_hash_buffer(keybits+HASHLENGTH,passwdbuff,strlen(pass)+1);
-+ memcpy((char*)loopinfo64.lo_encrypt_key,keybits,keysz/8);
-+ } else {
-+ pass = xgetpass(pfd, _("Password: "));
-+ xstrncpy(loopinfo64.lo_encrypt_key, pass, keysz/8);
-+ }
-+ loopinfo64.lo_encrypt_key_size = keysz/8;
- }
-
- if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
- perror("ioctl: LOOP_SET_FD");
- return 1;
- }
-- close (ffd);
--
-- if (ioctl(fd, LOOP_SET_STATUS64, &loopinfo64) < 0) {
-+ if (kerneli) {
-+ struct loop_info loopinfo;
-+ loop_info64_to_old(&loopinfo64,&loopinfo);
-+ if (ioctl (fd, LOOP_SET_STATUS, &loopinfo) < 0) {
-+ /* Try again with old-style LO_CRYPT_XX if
-+ new-style LO_CRYPT_CRYPTOAPI ioctl didn't work */
-+ if (tried_old) {
-+ error("The cipher does not exist, or a cipher module "
-+ "needs to be loaded into the kernel");
-+ perror ("ioctl: LOOP_SET_STATUS");
-+ goto fail;
-+ }
-+ strncpy (loopinfo64.lo_file_name, file, LO_NAME_SIZE);
-+ loopinfo64.lo_file_name[LO_NAME_SIZE - 1] = 0;
-+ loopinfo64.lo_encrypt_type = name_to_id (encryption);
-+ tried_old = 1;
-+ goto again;
-+ }
-+ } else {
-+ if (ioctl(fd, LOOP_SET_STATUS64, &loopinfo64) < 0) {
- struct loop_info loopinfo;
- int errsv = errno;
-
-@@ -333,8 +482,10 @@
- perror("ioctl: LOOP_SET_STATUS");
- goto fail;
- }
-+ }
- }
-
-+ close (ffd);
- close (fd);
- if (verbose > 1)
- printf(_("set_loop(%s,%s,%d): success\n"),
-@@ -343,6 +494,7 @@
-
- fail:
- (void) ioctl (fd, LOOP_CLR_FD, 0);
-+ close (ffd);
- close (fd);
- return 1;
- }
-@@ -411,8 +563,24 @@
- fprintf(stderr, _("usage:\n\
- %s loop_device # give info\n\
- %s -d loop_device # delete\n\
-- %s [ -e encryption ] [ -o offset ] loop_device file # setup\n"),
-- progname, progname, progname);
-+ %s [ options ] loop_device file # setup\n\
-+ where options include\n\
-+ --offset <num>, -o <num>\n\
-+ start at offset <num> into file.\n\
-+ --pass-fd <num>, -p <num>\n\
-+ read passphrase from file descriptor <num>\n\
-+ instead of the terminal.\n\
-+ --encryption <cipher>, -e <cipher>\n\
-+ encrypt with <cipher>.\n\
-+ Check /proc/crypto or /proc/crypto/cipher for available ciphers.\n\
-+ --nohashpass, -N\n\
-+ Don't hash the password given. (previous versions hash, non-debian doesn't.\n\
-+ --keybits <num>, -k <num>\n\
-+ 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"), progname, progname, progname);
- exit(1);
- }
-
-@@ -445,20 +613,23 @@
-
- int
- main(int argc, char **argv) {
-- char *offset, *encryption, *passfd;
-+ char *offset, *encryption, *passfd, *keysize;
- int delete, off, c;
- int res = 0;
- int ro = 0;
- int pfd = -1;
-+ int keysz = 0;
-+ int hash_password = 1;
-
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-
- delete = off = 0;
-- offset = encryption = passfd = NULL;
-+ offset = encryption = passfd = keysize = NULL;
- progname = argv[0];
-- while ((c = getopt(argc,argv,"de:E:o:p:v")) != -1) {
-+ while ((c = getopt_long(argc,argv,"de:E:hk:No:p:v",
-+ longopts, NULL)) != EOF) {
- switch (c) {
- case 'd':
- delete = 1;
-@@ -467,6 +638,12 @@
- case 'e':
- encryption = optarg;
- break;
-+ case 'N':
-+ hash_password=0;
-+ break;
-+ case 'k':
-+ keysize = optarg;
-+ break;
- case 'o':
- offset = optarg;
- break;
-@@ -494,8 +671,10 @@
- usage();
- if (passfd && sscanf(passfd,"%d",&pfd) != 1)
- usage();
-+ if (keysize && sscanf(keysize,"%d",&keysz) != 1)
-+ usage();
- res = set_loop(argv[optind], argv[optind+1], off,
-- encryption, pfd, &ro);
-+ encryption, pfd, keysz, &ro, hash_password);
- }
- return res;
- }
---- util-linux-2.12.orig/mount/lomount.h
-+++ util-linux-2.12/mount/lomount.h
-@@ -1,6 +1,6 @@
- extern int verbose;
- extern int set_loop(const char *, const char *, int, const char *,
-- int, int *);
-+ int, int, int *, int);
- extern int del_loop(const char *);
- extern int is_loop_device(const char *);
- extern char * find_unused_loop_device(void);
---- util-linux-2.12.orig/mount/loop.h
-+++ util-linux-2.12/mount/loop.h
-@@ -1,8 +1,39 @@
--#define LO_CRYPT_NONE 0
--#define LO_CRYPT_XOR 1
--#define LO_CRYPT_DES 2
-+#define LO_CRYPT_NONE 0
-+#define LO_CRYPT_XOR 1
-+#define LO_CRYPT_DES 2
- #define LO_CRYPT_CRYPTOAPI 18
-
-+#ifndef LO_CRYPT_FISH2
-+#define LO_CRYPT_FISH2 3
-+#endif
-+#ifndef LO_CRYPT_BLOW
-+#define LO_CRYPT_BLOW 4
-+#endif
-+#ifndef LO_CRYPT_CAST128
-+#define LO_CRYPT_CAST128 5
-+#endif
-+#ifndef LO_CRYPT_IDEA
-+#define LO_CRYPT_IDEA 6
-+#endif
-+#ifndef LO_CRYPT_SERPENT
-+#define LO_CRYPT_SERPENT 7
-+#endif
-+#ifndef LO_CRYPT_MARS
-+#define LO_CRYPT_MARS 8
-+#endif
-+#ifndef LO_CRYPT_RC6
-+#define LO_CRYPT_RC6 11
-+#endif
-+#ifndef LO_CRYPT_3DES
-+#define LO_CRYPT_3DES 12
-+#endif
-+#ifndef LO_CRYPT_DFC
-+#define LO_CRYPT_DFC 15
-+#endif
-+#ifndef LO_CRYPT_RIJNDAEL
-+#define LO_CRYPT_RIJNDAEL 16
-+#endif
-+
- #define LOOP_SET_FD 0x4C00
- #define LOOP_CLR_FD 0x4C01
- #define LOOP_SET_STATUS 0x4C02
---- util-linux-2.12.orig/mount/losetup.8
-+++ util-linux-2.12/mount/losetup.8
-@@ -50,19 +50,24 @@
- .B \-e
- option.)
- .SH OPTIONS
--.IP \fB\-d\fP
--Detach the file or device associated with the specified loop device.
-+.IP "\fB\-\-delete, \-\-detach, \-d\fP"
-+detach the file or device associated with the specified loop device.
- .IP "\fB\-E \fIencryption_type\fP"
- Enable data encryption with specified number.
--.IP "\fB\-e \fIencryption_name\fP"
-+.IP "\fB\-\-encryption, \-e \fIencryption\fP"
- Enable data encryption with specified name.
--.IP "\fB\-o \fIoffset\fP"
-+.IP "\fB\-\-nohashpass, \-N\fP"
-+Do not hash the password. Many previous Debian releases run the password through a
-+hash function, non-Debian systems appear to.
-+.IP "\fB\-\-offset, \-o \fIoffset\fP"
- The data start is moved \fIoffset\fP bytes into the specified file or
- device.
--.IP "\fB\-p \fInum\fP"
-+.IP "\fB\-\-pass-fd, \-p \fInum\fP"
- Read the passphrase from file descriptor with number
- .I num
- instead of from the terminal.
-+.IP "\fB\-\-keybits, \-k \fInum\fP"
-+set the number of bits to use in key to \fInum\fP.
- .SH RETURN VALUE
- .B losetup
- returns 0 on success, nonzero on failure. When
-@@ -109,6 +114,9 @@
- .fi
- .SH RESTRICTION
- DES encryption is painfully slow. On the other hand, XOR is terribly weak.
-+Both are insecure nowadays. Some ciphers may require a licence for you to be
-+allowed to use them.
-+.fi
- .\" .SH AUTHORS
- .\" .nf
- .\" Original version: Theodore Ts'o <tytso@athena.mit.edu>
---- util-linux-2.12.orig/mount/mount.8
-+++ util-linux-2.12/mount/mount.8
-@@ -270,6 +270,12 @@
- .B \-v
- Verbose mode.
- .TP
-+.B \-p "\fInum\fP"
-+If the mount requires a passphrase to be entered, read it from file
-+descriptor
-+.IR num\fP
-+instead of from the terminal.
-+.TP
- .B \-a
- Mount all filesystems (of the given types) mentioned in
- .IR fstab .
-@@ -633,6 +639,15 @@
- .BR noexec ", " nosuid ", and " nodev
- (unless overridden by subsequent options, as in the option line
- .BR users,exec,dev,suid ).
-+.TP
-+.B encryption
-+Specifies an encryption algorithm to use. Used in conjunction with the
-+.BR loop " option."
-+.TP
-+.B keybits
-+Specifies the key size to use for an encryption algorithm. Used in conjunction
-+with the
-+.BR loop " and " encryption " options."
- .RE
- .TP
- .B \-\-bind
-@@ -1696,7 +1711,10 @@
- .BR loop ", " offset " and " encryption ,
- that are really options to
- .BR losetup (8).
--If no explicit loop device is mentioned
-+If the mount requires a passphrase, you will be prompted for one unless
-+you specify a file descriptor to read from instead with the
-+.BR \-\-pass-fd
-+option. If no explicit loop device is mentioned
- (but just an option `\fB\-o loop\fP' is given), then
- .B mount
- will try to find some unused loop device and use that.
-@@ -1767,7 +1785,7 @@
- .BR e2label (8),
- .BR xfs_admin (8),
- .BR mountd (8),
--.BR nfsd (8),
-+.BR rpc.nfsd (8),
- .BR mke2fs (8),
- .BR tune2fs (8),
- .BR losetup (8)
---- util-linux-2.12.orig/mount/mount.c
-+++ util-linux-2.12/mount/mount.c
-@@ -92,6 +92,9 @@
- /* Nonzero for chatty (-v). */
- int verbose = 0;
-
-+/* Do we hash the password or not */
-+int hash_password = 1;
-+
- /* Nonzero for sloppy (-s). */
- int sloppy = 0;
-
-@@ -116,6 +119,9 @@
- /* Contains the fd to read the passphrase from, if any. */
- static int pfd = -1;
-
-+/* Contains the preferred keysize in bits we want to use */
-+static int keysz = 0;
-+
- /* Map from -o and fstab option strings to the flag argument to mount(2). */
- struct opt_map {
- const char *opt; /* option name */
-@@ -195,7 +201,7 @@
- };
-
- static char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption,
-- *opt_speed;
-+ *opt_keybits, *opt_nohashpass, *opt_speed;
-
- static struct string_opt_map {
- char *tag;
-@@ -206,6 +212,8 @@
- { "vfs=", 1, &opt_vfstype },
- { "offset=", 0, &opt_offset },
- { "encryption=", 0, &opt_encryption },
-+ { "keybits=", 0, &opt_keybits },
-+ { "nohashpass", 0, &opt_nohashpass },
- { "speed=", 0, &opt_speed },
- { NULL, 0, NULL }
- };
-@@ -586,7 +594,8 @@
- *type = opt_vfstype;
- }
-
-- *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_encryption);
-+ *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_encryption ||
-+ opt_keybits);
- *loopfile = *spec;
-
- if (*loop) {
-@@ -604,8 +613,12 @@
- if (verbose)
- printf(_("mount: going to use the loop device %s\n"), *loopdev);
- offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0;
-- if (set_loop(*loopdev, *loopfile, offset,
-- opt_encryption, pfd, &loopro)) {
-+ if (!keysz && opt_keybits)
-+ keysz = strtoul(opt_keybits, NULL, 0);
-+ if (opt_nohashpass)
-+ hash_password=0;
-+ if (set_loop (*loopdev, *loopfile, offset, opt_encryption, pfd,
-+ keysz, &loopro, hash_password)) {
- if (verbose)
- printf(_("mount: failed setting up loop device\n"));
- return EX_FAIL;
-@@ -1371,6 +1384,7 @@
- { "options", 1, 0, 'o' },
- { "test-opts", 1, 0, 'O' },
- { "pass-fd", 1, 0, 'p' },
-+ { "keybits", 1, 0, 'k' },
- { "types", 1, 0, 't' },
- { "bind", 0, 0, 128 },
- { "replace", 0, 0, 129 },
-@@ -1424,6 +1438,8 @@
- int c, result = 0, specseen;
- char *options = NULL, *test_opts = NULL, *spec, *node;
- char *volumelabel = NULL;
-+ char *passfd = NULL;
-+ char *keysize = NULL;
- char *uuid = NULL;
- char *types = NULL;
- struct mntentchn *mc;
-@@ -1447,7 +1463,7 @@
- initproctitle(argc, argv);
- #endif
-
-- while ((c = getopt_long (argc, argv, "afFhilL:no:O:p:rsU:vVwt:",
-+ while ((c = getopt_long (argc, argv, "afFhilL:k:no:O:p:rsU:vVwt:",
- longopts, NULL)) != -1) {
- switch (c) {
- case 'a': /* mount everything in fstab */
-@@ -1471,6 +1487,9 @@
- case 'L':
- volumelabel = optarg;
- break;
-+ case 'k':
-+ keysize = optarg;
-+ break;
- case 'n': /* do not write /etc/mtab */
- ++nomtab;
- break;
-@@ -1598,6 +1617,11 @@
- } else
- spec = NULL; /* just for gcc */
-
-+ if (passfd && sscanf(passfd,"%d",&pfd) != 1)
-+ die (EX_USAGE, _("mount: argument to --pass-fd or -p must be a number"));
-+ if (keysize && sscanf(keysize,"%d",&keysz) != 1)
-+ die (EX_USAGE, _("mount: argument to --keybits or -k must be a number"));
-+
- switch (argc+specseen) {
- case 0:
- /* mount -a */
---- util-linux-2.12.orig/mount/rmd160.c
-+++ util-linux-2.12/mount/rmd160.c
-@@ -0,0 +1,532 @@
-+/* rmd160.c - RIPE-MD160
-+ * Copyright (C) 1998 Free Software Foundation, Inc.
-+ */
-+
-+/* This file was part of GnuPG. Modified for use within the Linux
-+ * mount utility by Marc Mutz <Marc@Mutz.com>. None of this code is
-+ * by myself. I just removed everything that you don't need when all
-+ * you want to do is to use rmd160_hash_buffer().
-+ * My comments are marked with (mm). */
-+
-+/* GnuPG is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * GnuPG is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */
-+
-+#include <string.h> /* (mm) for memcpy */
-+#include <endian.h> /* (mm) for BIG_ENDIAN and BYTE_ORDER */
-+#include "rmd160.h"
-+
-+/* (mm) these are used by the original GnuPG file. In order to modify
-+ * that file not too much, we keep the notations. maybe it would be
-+ * better to include linux/types.h and typedef __u32 to u32 and __u8
-+ * to byte? */
-+typedef unsigned int u32; /* taken from e.g. util-linux's minix.h */
-+typedef unsigned char byte;
-+
-+typedef struct {
-+ u32 h0,h1,h2,h3,h4;
-+ u32 nblocks;
-+ byte buf[64];
-+ int count;
-+} RMD160_CONTEXT;
-+
-+/****************
-+ * Rotate a 32 bit integer by n bytes
-+ */
-+#if defined(__GNUC__) && defined(__i386__)
-+static inline u32
-+rol( u32 x, int n)
-+{
-+ __asm__("roll %%cl,%0"
-+ :"=r" (x)
-+ :"0" (x),"c" (n));
-+ return x;
-+}
-+#else
-+ #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
-+#endif
-+
-+/*********************************
-+ * RIPEMD-160 is not patented, see (as of 25.10.97)
-+ * http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
-+ * Note that the code uses Little Endian byteorder, which is good for
-+ * 386 etc, but we must add some conversion when used on a big endian box.
-+ *
-+ *
-+ * Pseudo-code for RIPEMD-160
-+ *
-+ * RIPEMD-160 is an iterative hash function that operates on 32-bit words.
-+ * The round function takes as input a 5-word chaining variable and a 16-word
-+ * message block and maps this to a new chaining variable. All operations are
-+ * defined on 32-bit words. Padding is identical to that of MD4.
-+ *
-+ *
-+ * RIPEMD-160: definitions
-+ *
-+ *
-+ * nonlinear functions at bit level: exor, mux, -, mux, -
-+ *
-+ * f(j, x, y, z) = x XOR y XOR z (0 <= j <= 15)
-+ * f(j, x, y, z) = (x AND y) OR (NOT(x) AND z) (16 <= j <= 31)
-+ * f(j, x, y, z) = (x OR NOT(y)) XOR z (32 <= j <= 47)
-+ * f(j, x, y, z) = (x AND z) OR (y AND NOT(z)) (48 <= j <= 63)
-+ * f(j, x, y, z) = x XOR (y OR NOT(z)) (64 <= j <= 79)
-+ *
-+ *
-+ * added constants (hexadecimal)
-+ *
-+ * K(j) = 0x00000000 (0 <= j <= 15)
-+ * K(j) = 0x5A827999 (16 <= j <= 31) int(2**30 x sqrt(2))
-+ * K(j) = 0x6ED9EBA1 (32 <= j <= 47) int(2**30 x sqrt(3))
-+ * K(j) = 0x8F1BBCDC (48 <= j <= 63) int(2**30 x sqrt(5))
-+ * K(j) = 0xA953FD4E (64 <= j <= 79) int(2**30 x sqrt(7))
-+ * K'(j) = 0x50A28BE6 (0 <= j <= 15) int(2**30 x cbrt(2))
-+ * K'(j) = 0x5C4DD124 (16 <= j <= 31) int(2**30 x cbrt(3))
-+ * K'(j) = 0x6D703EF3 (32 <= j <= 47) int(2**30 x cbrt(5))
-+ * K'(j) = 0x7A6D76E9 (48 <= j <= 63) int(2**30 x cbrt(7))
-+ * K'(j) = 0x00000000 (64 <= j <= 79)
-+ *
-+ *
-+ * selection of message word
-+ *
-+ * r(j) = j (0 <= j <= 15)
-+ * r(16..31) = 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8
-+ * r(32..47) = 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12
-+ * r(48..63) = 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2
-+ * r(64..79) = 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
-+ * r0(0..15) = 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12
-+ * r0(16..31)= 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2
-+ * r0(32..47)= 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13
-+ * r0(48..63)= 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14
-+ * r0(64..79)= 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
-+ *
-+ *
-+ * amount for rotate left (rol)
-+ *
-+ * s(0..15) = 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8
-+ * s(16..31) = 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12
-+ * s(32..47) = 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5
-+ * s(48..63) = 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12
-+ * s(64..79) = 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
-+ * s'(0..15) = 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6
-+ * s'(16..31)= 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11
-+ * s'(32..47)= 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5
-+ * s'(48..63)= 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8
-+ * s'(64..79)= 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
-+ *
-+ *
-+ * initial value (hexadecimal)
-+ *
-+ * h0 = 0x67452301; h1 = 0xEFCDAB89; h2 = 0x98BADCFE; h3 = 0x10325476;
-+ * h4 = 0xC3D2E1F0;
-+ *
-+ *
-+ * RIPEMD-160: pseudo-code
-+ *
-+ * It is assumed that the message after padding consists of t 16-word blocks
-+ * that will be denoted with X[i][j], with 0 <= i <= t-1 and 0 <= j <= 15.
-+ * The symbol [+] denotes addition modulo 2**32 and rol_s denotes cyclic left
-+ * shift (rotate) over s positions.
-+ *
-+ *
-+ * for i := 0 to t-1 {
-+ * A := h0; B := h1; C := h2; D = h3; E = h4;
-+ * A' := h0; B' := h1; C' := h2; D' = h3; E' = h4;
-+ * for j := 0 to 79 {
-+ * T := rol_s(j)(A [+] f(j, B, C, D) [+] X[i][r(j)] [+] K(j)) [+] E;
-+ * A := E; E := D; D := rol_10(C); C := B; B := T;
-+ * T := rol_s'(j)(A' [+] f(79-j, B', C', D') [+] X[i][r'(j)]
-+ [+] K'(j)) [+] E';
-+ * A' := E'; E' := D'; D' := rol_10(C'); C' := B'; B' := T;
-+ * }
-+ * T := h1 [+] C [+] D'; h1 := h2 [+] D [+] E'; h2 := h3 [+] E [+] A';
-+ * h3 := h4 [+] A [+] B'; h4 := h0 [+] B [+] C'; h0 := T;
-+ * }
-+ */
-+
-+/* Some examples:
-+ * "" 9c1185a5c5e9fc54612808977ee8f548b2258d31
-+ * "a" 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe
-+ * "abc" 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc
-+ * "message digest" 5d0689ef49d2fae572b881b123a85ffa21595f36
-+ * "a...z" f71c27109c692c1b56bbdceb5b9d2865b3708dbc
-+ * "abcdbcde...nopq" 12a053384a9c0c88e405a06c27dcf49ada62eb2b
-+ * "A...Za...z0...9" b0e20b6e3116640286ed3a87a5713079b21f5189
-+ * 8 times "1234567890" 9b752e45573d4b39f4dbd3323cab82bf63326bfb
-+ * 1 million times "a" 52783243c1697bdbe16d37f97f68f08325dc1528
-+ */
-+
-+
-+static void
-+rmd160_init( RMD160_CONTEXT *hd )
-+{
-+ hd->h0 = 0x67452301;
-+ hd->h1 = 0xEFCDAB89;
-+ hd->h2 = 0x98BADCFE;
-+ hd->h3 = 0x10325476;
-+ hd->h4 = 0xC3D2E1F0;
-+ hd->nblocks = 0;
-+ hd->count = 0;
-+}
-+
-+
-+
-+/****************
-+ * Transform the message X which consists of 16 32-bit-words
-+ */
-+static void
-+transform( RMD160_CONTEXT *hd, byte *data )
-+{
-+ u32 a,b,c,d,e,aa,bb,cc,dd,ee,t;
-+ #if BYTE_ORDER == BIG_ENDIAN
-+ u32 x[16];
-+ { int i;
-+ byte *p2, *p1;
-+ for(i=0, p1=data, p2=(byte*)x; i < 16; i++, p2 += 4 ) {
-+ p2[3] = *p1++;
-+ p2[2] = *p1++;
-+ p2[1] = *p1++;
-+ p2[0] = *p1++;
-+ }
-+ }
-+ #else
-+ #if 0
-+ u32 *x =(u32*)data;
-+ #else
-+ /* this version is better because it is always aligned;
-+ * The performance penalty on a 586-100 is about 6% which
-+ * is acceptable - because the data is more local it might
-+ * also be possible that this is faster on some machines.
-+ * This function (when compiled with -02 on gcc 2.7.2)
-+ * executes on a 586-100 (39.73 bogomips) at about 1900kb/sec;
-+ * [measured with a 4MB data and "gpgm --print-md rmd160"] */
-+ u32 x[16];
-+ memcpy( x, data, 64 );
-+ #endif
-+ #endif
-+
-+
-+#define K0 0x00000000
-+#define K1 0x5A827999
-+#define K2 0x6ED9EBA1
-+#define K3 0x8F1BBCDC
-+#define K4 0xA953FD4E
-+#define KK0 0x50A28BE6
-+#define KK1 0x5C4DD124
-+#define KK2 0x6D703EF3
-+#define KK3 0x7A6D76E9
-+#define KK4 0x00000000
-+#define F0(x,y,z) ( (x) ^ (y) ^ (z) )
-+#define F1(x,y,z) ( ((x) & (y)) | (~(x) & (z)) )
-+#define F2(x,y,z) ( ((x) | ~(y)) ^ (z) )
-+#define F3(x,y,z) ( ((x) & (z)) | ((y) & ~(z)) )
-+#define F4(x,y,z) ( (x) ^ ((y) | ~(z)) )
-+#define R(a,b,c,d,e,f,k,r,s) do { t = a + f(b,c,d) + k + x[r]; \
-+ a = rol(t,s) + e; \
-+ c = rol(c,10); \
-+ } while(0)
-+
-+ /* left lane */
-+ a = hd->h0;
-+ b = hd->h1;
-+ c = hd->h2;
-+ d = hd->h3;
-+ e = hd->h4;
-+ R( a, b, c, d, e, F0, K0, 0, 11 );
-+ R( e, a, b, c, d, F0, K0, 1, 14 );
-+ R( d, e, a, b, c, F0, K0, 2, 15 );
-+ R( c, d, e, a, b, F0, K0, 3, 12 );
-+ R( b, c, d, e, a, F0, K0, 4, 5 );
-+ R( a, b, c, d, e, F0, K0, 5, 8 );
-+ R( e, a, b, c, d, F0, K0, 6, 7 );
-+ R( d, e, a, b, c, F0, K0, 7, 9 );
-+ R( c, d, e, a, b, F0, K0, 8, 11 );
-+ R( b, c, d, e, a, F0, K0, 9, 13 );
-+ R( a, b, c, d, e, F0, K0, 10, 14 );
-+ R( e, a, b, c, d, F0, K0, 11, 15 );
-+ R( d, e, a, b, c, F0, K0, 12, 6 );
-+ R( c, d, e, a, b, F0, K0, 13, 7 );
-+ R( b, c, d, e, a, F0, K0, 14, 9 );
-+ R( a, b, c, d, e, F0, K0, 15, 8 );
-+ R( e, a, b, c, d, F1, K1, 7, 7 );
-+ R( d, e, a, b, c, F1, K1, 4, 6 );
-+ R( c, d, e, a, b, F1, K1, 13, 8 );
-+ R( b, c, d, e, a, F1, K1, 1, 13 );
-+ R( a, b, c, d, e, F1, K1, 10, 11 );
-+ R( e, a, b, c, d, F1, K1, 6, 9 );
-+ R( d, e, a, b, c, F1, K1, 15, 7 );
-+ R( c, d, e, a, b, F1, K1, 3, 15 );
-+ R( b, c, d, e, a, F1, K1, 12, 7 );
-+ R( a, b, c, d, e, F1, K1, 0, 12 );
-+ R( e, a, b, c, d, F1, K1, 9, 15 );
-+ R( d, e, a, b, c, F1, K1, 5, 9 );
-+ R( c, d, e, a, b, F1, K1, 2, 11 );
-+ R( b, c, d, e, a, F1, K1, 14, 7 );
-+ R( a, b, c, d, e, F1, K1, 11, 13 );
-+ R( e, a, b, c, d, F1, K1, 8, 12 );
-+ R( d, e, a, b, c, F2, K2, 3, 11 );
-+ R( c, d, e, a, b, F2, K2, 10, 13 );
-+ R( b, c, d, e, a, F2, K2, 14, 6 );
-+ R( a, b, c, d, e, F2, K2, 4, 7 );
-+ R( e, a, b, c, d, F2, K2, 9, 14 );
-+ R( d, e, a, b, c, F2, K2, 15, 9 );
-+ R( c, d, e, a, b, F2, K2, 8, 13 );
-+ R( b, c, d, e, a, F2, K2, 1, 15 );
-+ R( a, b, c, d, e, F2, K2, 2, 14 );
-+ R( e, a, b, c, d, F2, K2, 7, 8 );
-+ R( d, e, a, b, c, F2, K2, 0, 13 );
-+ R( c, d, e, a, b, F2, K2, 6, 6 );
-+ R( b, c, d, e, a, F2, K2, 13, 5 );
-+ R( a, b, c, d, e, F2, K2, 11, 12 );
-+ R( e, a, b, c, d, F2, K2, 5, 7 );
-+ R( d, e, a, b, c, F2, K2, 12, 5 );
-+ R( c, d, e, a, b, F3, K3, 1, 11 );
-+ R( b, c, d, e, a, F3, K3, 9, 12 );
-+ R( a, b, c, d, e, F3, K3, 11, 14 );
-+ R( e, a, b, c, d, F3, K3, 10, 15 );
-+ R( d, e, a, b, c, F3, K3, 0, 14 );
-+ R( c, d, e, a, b, F3, K3, 8, 15 );
-+ R( b, c, d, e, a, F3, K3, 12, 9 );
-+ R( a, b, c, d, e, F3, K3, 4, 8 );
-+ R( e, a, b, c, d, F3, K3, 13, 9 );
-+ R( d, e, a, b, c, F3, K3, 3, 14 );
-+ R( c, d, e, a, b, F3, K3, 7, 5 );
-+ R( b, c, d, e, a, F3, K3, 15, 6 );
-+ R( a, b, c, d, e, F3, K3, 14, 8 );
-+ R( e, a, b, c, d, F3, K3, 5, 6 );
-+ R( d, e, a, b, c, F3, K3, 6, 5 );
-+ R( c, d, e, a, b, F3, K3, 2, 12 );
-+ R( b, c, d, e, a, F4, K4, 4, 9 );
-+ R( a, b, c, d, e, F4, K4, 0, 15 );
-+ R( e, a, b, c, d, F4, K4, 5, 5 );
-+ R( d, e, a, b, c, F4, K4, 9, 11 );
-+ R( c, d, e, a, b, F4, K4, 7, 6 );
-+ R( b, c, d, e, a, F4, K4, 12, 8 );
-+ R( a, b, c, d, e, F4, K4, 2, 13 );
-+ R( e, a, b, c, d, F4, K4, 10, 12 );
-+ R( d, e, a, b, c, F4, K4, 14, 5 );
-+ R( c, d, e, a, b, F4, K4, 1, 12 );
-+ R( b, c, d, e, a, F4, K4, 3, 13 );
-+ R( a, b, c, d, e, F4, K4, 8, 14 );
-+ R( e, a, b, c, d, F4, K4, 11, 11 );
-+ R( d, e, a, b, c, F4, K4, 6, 8 );
-+ R( c, d, e, a, b, F4, K4, 15, 5 );
-+ R( b, c, d, e, a, F4, K4, 13, 6 );
-+
-+ aa = a; bb = b; cc = c; dd = d; ee = e;
-+
-+ /* right lane */
-+ a = hd->h0;
-+ b = hd->h1;
-+ c = hd->h2;
-+ d = hd->h3;
-+ e = hd->h4;
-+ R( a, b, c, d, e, F4, KK0, 5, 8);
-+ R( e, a, b, c, d, F4, KK0, 14, 9);
-+ R( d, e, a, b, c, F4, KK0, 7, 9);
-+ R( c, d, e, a, b, F4, KK0, 0, 11);
-+ R( b, c, d, e, a, F4, KK0, 9, 13);
-+ R( a, b, c, d, e, F4, KK0, 2, 15);
-+ R( e, a, b, c, d, F4, KK0, 11, 15);
-+ R( d, e, a, b, c, F4, KK0, 4, 5);
-+ R( c, d, e, a, b, F4, KK0, 13, 7);
-+ R( b, c, d, e, a, F4, KK0, 6, 7);
-+ R( a, b, c, d, e, F4, KK0, 15, 8);
-+ R( e, a, b, c, d, F4, KK0, 8, 11);
-+ R( d, e, a, b, c, F4, KK0, 1, 14);
-+ R( c, d, e, a, b, F4, KK0, 10, 14);
-+ R( b, c, d, e, a, F4, KK0, 3, 12);
-+ R( a, b, c, d, e, F4, KK0, 12, 6);
-+ R( e, a, b, c, d, F3, KK1, 6, 9);
-+ R( d, e, a, b, c, F3, KK1, 11, 13);
-+ R( c, d, e, a, b, F3, KK1, 3, 15);
-+ R( b, c, d, e, a, F3, KK1, 7, 7);
-+ R( a, b, c, d, e, F3, KK1, 0, 12);
-+ R( e, a, b, c, d, F3, KK1, 13, 8);
-+ R( d, e, a, b, c, F3, KK1, 5, 9);
-+ R( c, d, e, a, b, F3, KK1, 10, 11);
-+ R( b, c, d, e, a, F3, KK1, 14, 7);
-+ R( a, b, c, d, e, F3, KK1, 15, 7);
-+ R( e, a, b, c, d, F3, KK1, 8, 12);
-+ R( d, e, a, b, c, F3, KK1, 12, 7);
-+ R( c, d, e, a, b, F3, KK1, 4, 6);
-+ R( b, c, d, e, a, F3, KK1, 9, 15);
-+ R( a, b, c, d, e, F3, KK1, 1, 13);
-+ R( e, a, b, c, d, F3, KK1, 2, 11);
-+ R( d, e, a, b, c, F2, KK2, 15, 9);
-+ R( c, d, e, a, b, F2, KK2, 5, 7);
-+ R( b, c, d, e, a, F2, KK2, 1, 15);
-+ R( a, b, c, d, e, F2, KK2, 3, 11);
-+ R( e, a, b, c, d, F2, KK2, 7, 8);
-+ R( d, e, a, b, c, F2, KK2, 14, 6);
-+ R( c, d, e, a, b, F2, KK2, 6, 6);
-+ R( b, c, d, e, a, F2, KK2, 9, 14);
-+ R( a, b, c, d, e, F2, KK2, 11, 12);
-+ R( e, a, b, c, d, F2, KK2, 8, 13);
-+ R( d, e, a, b, c, F2, KK2, 12, 5);
-+ R( c, d, e, a, b, F2, KK2, 2, 14);
-+ R( b, c, d, e, a, F2, KK2, 10, 13);
-+ R( a, b, c, d, e, F2, KK2, 0, 13);
-+ R( e, a, b, c, d, F2, KK2, 4, 7);
-+ R( d, e, a, b, c, F2, KK2, 13, 5);
-+ R( c, d, e, a, b, F1, KK3, 8, 15);
-+ R( b, c, d, e, a, F1, KK3, 6, 5);
-+ R( a, b, c, d, e, F1, KK3, 4, 8);
-+ R( e, a, b, c, d, F1, KK3, 1, 11);
-+ R( d, e, a, b, c, F1, KK3, 3, 14);
-+ R( c, d, e, a, b, F1, KK3, 11, 14);
-+ R( b, c, d, e, a, F1, KK3, 15, 6);
-+ R( a, b, c, d, e, F1, KK3, 0, 14);
-+ R( e, a, b, c, d, F1, KK3, 5, 6);
-+ R( d, e, a, b, c, F1, KK3, 12, 9);
-+ R( c, d, e, a, b, F1, KK3, 2, 12);
-+ R( b, c, d, e, a, F1, KK3, 13, 9);
-+ R( a, b, c, d, e, F1, KK3, 9, 12);
-+ R( e, a, b, c, d, F1, KK3, 7, 5);
-+ R( d, e, a, b, c, F1, KK3, 10, 15);
-+ R( c, d, e, a, b, F1, KK3, 14, 8);
-+ R( b, c, d, e, a, F0, KK4, 12, 8);
-+ R( a, b, c, d, e, F0, KK4, 15, 5);
-+ R( e, a, b, c, d, F0, KK4, 10, 12);
-+ R( d, e, a, b, c, F0, KK4, 4, 9);
-+ R( c, d, e, a, b, F0, KK4, 1, 12);
-+ R( b, c, d, e, a, F0, KK4, 5, 5);
-+ R( a, b, c, d, e, F0, KK4, 8, 14);
-+ R( e, a, b, c, d, F0, KK4, 7, 6);
-+ R( d, e, a, b, c, F0, KK4, 6, 8);
-+ R( c, d, e, a, b, F0, KK4, 2, 13);
-+ R( b, c, d, e, a, F0, KK4, 13, 6);
-+ R( a, b, c, d, e, F0, KK4, 14, 5);
-+ R( e, a, b, c, d, F0, KK4, 0, 15);
-+ R( d, e, a, b, c, F0, KK4, 3, 13);
-+ R( c, d, e, a, b, F0, KK4, 9, 11);
-+ R( b, c, d, e, a, F0, KK4, 11, 11);
-+
-+
-+ t = hd->h1 + d + cc;
-+ hd->h1 = hd->h2 + e + dd;
-+ hd->h2 = hd->h3 + a + ee;
-+ hd->h3 = hd->h4 + b + aa;
-+ hd->h4 = hd->h0 + c + bb;
-+ hd->h0 = t;
-+}
-+
-+
-+/* Update the message digest with the contents
-+ * of INBUF with length INLEN.
-+ */
-+static void
-+rmd160_write( RMD160_CONTEXT *hd, byte *inbuf, size_t inlen)
-+{
-+ if( hd->count == 64 ) { /* flush the buffer */
-+ transform( hd, hd->buf );
-+ hd->count = 0;
-+ hd->nblocks++;
-+ }
-+ if( !inbuf )
-+ return;
-+ if( hd->count ) {
-+ for( ; inlen && hd->count < 64; inlen-- )
-+ hd->buf[hd->count++] = *inbuf++;
-+ rmd160_write( hd, NULL, 0 );
-+ if( !inlen )
-+ return;
-+ }
-+
-+ while( inlen >= 64 ) {
-+ transform( hd, inbuf );
-+ hd->count = 0;
-+ hd->nblocks++;
-+ inlen -= 64;
-+ inbuf += 64;
-+ }
-+ for( ; inlen && hd->count < 64; inlen-- )
-+ hd->buf[hd->count++] = *inbuf++;
-+}
-+
-+/* The routine terminates the computation
-+ */
-+
-+static void
-+rmd160_final( RMD160_CONTEXT *hd )
-+{
-+ u32 t, msb, lsb;
-+ byte *p;
-+
-+ rmd160_write(hd, NULL, 0); /* flush */;
-+
-+ msb = 0;
-+ t = hd->nblocks;
-+ if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
-+ msb++;
-+ msb += t >> 26;
-+ t = lsb;
-+ if( (lsb = t + hd->count) < t ) /* add the count */
-+ msb++;
-+ t = lsb;
-+ if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
-+ msb++;
-+ msb += t >> 29;
-+
-+ if( hd->count < 56 ) { /* enough room */
-+ hd->buf[hd->count++] = 0x80; /* pad */
-+ while( hd->count < 56 )
-+ hd->buf[hd->count++] = 0; /* pad */
-+ }
-+ else { /* need one extra block */
-+ hd->buf[hd->count++] = 0x80; /* pad character */
-+ while( hd->count < 64 )
-+ hd->buf[hd->count++] = 0;
-+ rmd160_write(hd, NULL, 0); /* flush */;
-+ memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
-+ }
-+ /* append the 64 bit count */
-+ hd->buf[56] = lsb ;
-+ hd->buf[57] = lsb >> 8;
-+ hd->buf[58] = lsb >> 16;
-+ hd->buf[59] = lsb >> 24;
-+ hd->buf[60] = msb ;
-+ hd->buf[61] = msb >> 8;
-+ hd->buf[62] = msb >> 16;
-+ hd->buf[63] = msb >> 24;
-+ transform( hd, hd->buf );
-+
-+ p = hd->buf;
-+ #if BYTE_ORDER == BIG_ENDIAN
-+ #define X(a) do { *p++ = hd->h##a ; *p++ = hd->h##a >> 8; \
-+ *p++ = hd->h##a >> 16; *p++ = hd->h##a >> 24; } while(0)
-+ #else /* little endian */
-+ #define X(a) do { *(u32*)p = hd->h##a ; p += 4; } while(0)
-+ #endif
-+ X(0);
-+ X(1);
-+ X(2);
-+ X(3);
-+ X(4);
-+ #undef X
-+}
-+
-+/****************
-+ * Shortcut functions which puts the hash value of the supplied buffer
-+ * into outbuf which must have a size of 20 bytes.
-+ */
-+void
-+rmd160_hash_buffer( char *outbuf, const char *buffer, size_t length )
-+{
-+ RMD160_CONTEXT hd;
-+
-+ rmd160_init( &hd );
-+ rmd160_write( &hd, (byte*)buffer, length );
-+ rmd160_final( &hd );
-+ memcpy( outbuf, hd.buf, 20 );
-+}
---- util-linux-2.12.orig/mount/rmd160.h
-+++ util-linux-2.12/mount/rmd160.h
-@@ -0,0 +1,9 @@
-+#ifndef RMD160_H
-+#define RMD160_H
-+
-+void
-+rmd160_hash_buffer( char *outbuf, const char *buffer, size_t length );
-+
-+#endif /*RMD160_H*/
-+
-+
-
+++ /dev/null
-my_dev_t is used only in struct loop_info definition (see <linux/loop.h>).
-It has to be _old_ kernel dev_t type (i.e. used before 2.6.x).
-For 2.6.x headers use __kernel_old_dev_t (for x86: 16-bit, while
-__kernel_dev_t is 32-bit and recent glibc dev_t is 64-bit)
-
---- util-linux-2.12.orig/mount/my_dev_t.h 2003-07-16 22:05:50.000000000 +0200
-+++ util-linux-2.12/mount/my_dev_t.h 2004-12-19 14:31:34.467427960 +0100
-@@ -4,4 +4,4 @@
- /* for ancient systems use "unsigned short" */
-
- #include <linux/posix_types.h>
--#define my_dev_t __kernel_dev_t
-+#define my_dev_t __kernel_old_dev_t
+++ /dev/null
---- util-linux-2.11y/mount/pivot_root.c.wiget Thu Mar 6 14:51:43 2003
-+++ util-linux-2.11y/mount/pivot_root.c Thu Mar 6 15:00:55 2003
-@@ -5,6 +5,7 @@
- #define __LIBRARY__
-
- #include <stdio.h>
-+#include <errno.h>
-
- #ifdef __ia64__
- # include <sys/syscall.h>
+++ /dev/null
---- fdisk/fdisksunlabel.c 2003-07-13 15:21:52.000000000 +0200
-+++ fdisk/fdisksunlabel.c 2004-12-22 16:36:24.000000000 +0100
-@@ -379,8 +379,8 @@
- }
-
- set_all_unchanged();
-- set_changed(0);
- get_boot(create_empty_sun);
-+ set_changed(0);
- }
-
- void
-@@ -524,9 +524,14 @@
- scround(stop), 0, mesg);
- if (display_in_cyl_units)
- first *= units_per_sector;
-- else
-+ else {
- /* Starting sector has to be properly aligned */
-- first = (first + heads * sectors - 1) / (heads * sectors);
-+ int cs = heads * sectors;
-+ int x = first % cs;
-+
-+ if (x)
-+ first += cs - x;
-+ }
- if (n == 2 && first != 0)
- printf ("\
- It is highly recommended that the third partition covers the whole disk\n\
-@@ -560,7 +565,7 @@
- } else
- break;
- }
-- stop = cylinders * heads * sectors;
-+ stop = cylinders * heads * sectors; /* ancient */
- stop2 = stop;
- for (i = 0; i < partitions; i++) {
- if (starts[i] > first && starts[i] < stop)
+++ /dev/null
---- util-linux-2.12/hwclock/cmos.c.orig 2002-07-07 13:08:47.000000000 +0200
-+++ util-linux-2.12/hwclock/cmos.c 2003-12-28 01:00:22.066729304 +0100
-@@ -50,7 +50,7 @@
- #include "nls.h"
-
- #if defined(__i386__)
--#include <asm/io.h> /* for inb, outb */
-+#include <sys/io.h> /* for inb, outb */
- #elif defined(__alpha__)
- /* <asm/io.h> fails to compile, probably because of u8 etc */
- extern unsigned int inb(unsigned long port);
+++ /dev/null
-diff -Naur util-linux-2.11r-o/mount/lomount.c util-linux-2.11r/mount/lomount.c
---- util-linux-2.11r-o/mount/lomount.c Mon Jul 9 16:10:58 2001
-+++ util-linux-2.11r/mount/lomount.c Mon Jul 9 16:19:24 2001
-@@ -6,6 +6,11 @@
- * - added Native Language Support
- * Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
- * - fixed strerr(errno) in gettext calls
-+ * 2000-09-24 Marc Mutz <Marc@Mutz.com>
-+ * - added long option names and the --pass-fd option to pass
-+ * passphrases via fd's to losetup/mount. Used for encryption in
-+ * non-interactive environments. The idea behind xgetpass() is stolen
-+ * from GnuPG, v.1.0.3 (http://www.gnupg.org/).
- */
-
- #define PROC_DEVICES "/proc/devices"
-@@ -206,12 +211,50 @@
- return 0;
- }
-
-+/* A function to read the passphrase either from the terminal or from
-+ * an open file descriptor */
-+static char *
-+xgetpass (int pfd, const char *prompt)
-+{
-+ if (pfd < 0) /* terminal */
-+ return (getpass(prompt));
-+ else { /* file descriptor */
-+ char *pass = NULL;
-+ int buflen, i;
-+
-+ buflen=0;
-+ for (i=0; ; i++) {
-+ if (i >= buflen-1) {
-+ /* we're running out of space in the buffer.
-+ * Make it bigger: */
-+ char *tmppass = pass;
-+ buflen += 128;
-+ pass = realloc(tmppass,buflen);
-+ if (pass == NULL) {
-+ /* realloc failed. Stop reading _now_. */
-+ error("not enough memory while reading passphrase");
-+ pass = tmppass; /* the old buffer hasn't changed */
-+ break;
-+ }
-+ };
-+ if ( read(pfd,pass+i, 1) != 1 || pass[i] == '\n' )
-+ break;
-+ }
-+ if (pass == NULL)
-+ return "";
-+ else {
-+ pass[i] = 0;
-+ return pass;
-+ }
-+ }
-+}
-+
- #define HASHLENGTH 20
- #define PASSWDBUFFLEN 130 /* getpass returns only max. 128 bytes, see man getpass */
-
- int
- set_loop (const char *device, const char *file, int offset,
-- const char *encryption, int *loopro) {
-+ const char *encryption, int pfd, int *loopro) {
- struct loop_info loopinfo;
- int fd, ffd, mode, i;
- int keylength;
-@@ -262,17 +305,19 @@
- loopinfo.lo_encrypt_key_size = 0;
- break;
- case LO_CRYPT_XOR:
-- pass = getpass (_("Password: "));
-+ /* WARNING: xgetpass() can return massive amounts of data,
-+ * not only 128 bytes like the original getpass(3) */
-+ pass = xgetpass (pfd,_("Password: "));
- xstrncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
- loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
- break;
- case LO_CRYPT_DES:
- printf(_("WARNING: Use of DES is depreciated.\n"));
-- pass = getpass (_("Password: "));
-+ pass = xgetpass (pfd,_("Password: "));
- strncpy (loopinfo.lo_encrypt_key, pass, 8);
- loopinfo.lo_encrypt_key[8] = 0;
- loopinfo.lo_encrypt_key_size = 8;
-- pass = getpass (_("Init (up to 16 hex digits): "));
-+ pass = xgetpass (pfd,_("Init (up to 16 hex digits): "));
- for (i = 0; i < 16 && pass[i]; i++)
- if (isxdigit (pass[i])) {
- loopinfo.lo_init[i >> 3] |= (pass[i] > '9' ?
-@@ -293,7 +338,7 @@
- case LO_CRYPT_RC6:
- case LO_CRYPT_DES_EDE3:
- case LO_CRYPT_DFC:
-- pass = getpass("Password :");
-+ pass = xgetpass(pfd,"Password :");
- strncpy(passwdbuff+1,pass,PASSWDBUFFLEN-1);
- passwdbuff[0] = 'A';
- rmd160_hash_buffer(keybits,pass,strlen(pass));
-@@ -361,7 +406,7 @@
-
- int
- set_loop (const char *device, const char *file, int offset,
-- const char *encryption, int *loopro) {
-+ const char *encryption, int pfd, int *loopro) {
- mutter();
- return 1;
- }
-@@ -390,20 +435,34 @@
- int verbose = 0;
- static char *progname;
-
-+static struct option longopts[] = {
-+ { "delete", 0, 0, 'd' },
-+ { "detach", 0, 0, 'd' },
-+ { "encryption", 1, 0, 'e' },
-+ { "help", 0, 0, 'h' },
-+ { "offset", 1, 0, 'o' },
-+ { "pass-fd", 1, 0, 'p' },
-+ { "verbose", 0, 0, 'v' },
-+ { NULL, 0, 0, 0 }
-+};
-+
-+
- static void
- usage(void) {
-- struct crypt_type_struct *c;
- fprintf(stderr, _("usage:\n\
- %s loop_device # give info\n\
- %s -d loop_device # delete\n\
-- %s [ -e encryption ] [ -o offset ] loop_device file # setup\n"),
-+ %s [ options ] loop_device file # setup\n\
-+ where options include\n\
-+ --offset <num>, -o <num>\n\
-+ start at offset <num> into file.\n\
-+ --pass-fd <num>, -p <num>\n\
-+ read passphrase from file descriptor <num>\n\
-+ instead of the terminal.\n\
-+ --encryption <cipher>, -e <cipher>\n\
-+ encrypt with <cipher>.\n\
-+ Check /proc/crypto/cipher for available ciphers.\n"),
- progname, progname, progname);
-- fprintf(stderr, " where encryption is one of:\n");
-- c = &crypt_type_tbl[0];
-- while(c->name) {
-- fprintf(stderr, " %s\n", c->name);
-- c++;
-- }
- exit(1);
- }
-
-@@ -436,8 +495,9 @@
-
- int
- main(int argc, char **argv) {
-- char *offset, *encryption;
-+ char *offset, *encryption, *passfd;
- int delete,off,c;
-+ int pfd = -1;
- int res = 0;
- int ro = 0;
-
-@@ -446,9 +506,10 @@
- textdomain(PACKAGE);
-
- delete = off = 0;
-- offset = encryption = NULL;
-+ offset = encryption = passfd = NULL;
- progname = argv[0];
-- while ((c = getopt(argc,argv,"de:o:v")) != -1) {
-+ while ((c = getopt_long(argc,argv,"de:ho:p:v",
-+ longopts, NULL)) != -1) {
- switch (c) {
- case 'd':
- delete = 1;
-@@ -459,6 +520,9 @@
- case 'o':
- offset = optarg;
- break;
-+ case 'p':
-+ passfd = optarg;
-+ break;
- case 'v':
- verbose = 1;
- break;
-@@ -467,7 +531,7 @@
- }
- }
- if (argc == 1) usage();
-- if ((delete && (argc != optind+1 || encryption || offset)) ||
-+ if ((delete && (argc != optind+1 || encryption || offset || passfd)) ||
- (!delete && (argc < optind+1 || argc > optind+2)))
- usage();
- if (argc == optind+1) {
-@@ -478,7 +542,9 @@
- } else {
- if (offset && sscanf(offset,"%d",&off) != 1)
- usage();
-- res = set_loop(argv[optind],argv[optind+1],off,encryption,&ro);
-+ if (passfd && sscanf(passfd,"%d",&pfd) != 1)
-+ usage();
-+ res = set_loop(argv[optind],argv[optind+1],off,encryption,pfd,&ro);
- }
- return res;
- }
-diff -Naur util-linux-2.11g-o/mount/lomount.h util-linux-2.11g/mount/lomount.h
---- util-linux-2.11g-o/mount/lomount.h Fri Dec 8 19:08:02 2000
-+++ util-linux-2.11g/mount/lomount.h Mon Jul 9 16:11:38 2001
-@@ -1,5 +1,5 @@
- extern int verbose;
--extern int set_loop (const char *, const char *, int, const char *, int *);
-+extern int set_loop (const char *, const char *, int, const char *, int, int *);
- extern int del_loop (const char *);
- extern int is_loop_device (const char *);
- extern char * find_unused_loop_device (void);
-diff -Naur util-linux-2.11g-o/mount/losetup.8 util-linux-2.11g/mount/losetup.8
---- util-linux-2.11g-o/mount/losetup.8 Mon Jul 9 16:10:58 2001
-+++ util-linux-2.11g/mount/losetup.8 Mon Jul 9 16:11:38 2001
-@@ -10,6 +10,9 @@
- ] [
- .B \-o
- .I offset
-+] [
-+.B \-p
-+.I num
- ]
- .I loop_device file
- .br
-@@ -26,9 +29,9 @@
- \fIloop_device\fP argument is given, the status of the corresponding loop
- device is shown.
- .SH OPTIONS
--.IP \fB\-d\fP
-+.IP "\fB\-\-delete, \-\-detach, \-d\fP"
- detach the file or device associated with the specified loop device.
--.IP "\fB\-e \fIencryption\fP"
-+.IP "\fB\-\-encryption, \-e \fIencryption\fP"
- .RS
- enable data encryption. The following keywords are recognized:
- .IP \fBNONE\fP
-@@ -79,9 +82,12 @@
- enabled in the Crypto API.
- .PD
- .RE
--.IP "\fB\-o \fIoffset\fP"
-+.IP "\fB\-\-offset, \-o \fIoffset\fP"
- the data start is moved \fIoffset\fP bytes into the specified file or
- device.
-+.IP "\fB\-\-pass-fd, \-p \fInum\fP"
-+read the passphrase from file descriptor \fInum\fP instead of the
-+terminal.
- .SH RETURN VALUE
- .B losetup
- returns 0 on success, nonzero on failure. When
-diff -Naur util-linux-2.11g-o/mount/mount.8 util-linux-2.11g/mount/mount.8
---- util-linux-2.11g-o/mount/mount.8 Wed Jun 27 01:19:12 2001
-+++ util-linux-2.11g/mount/mount.8 Mon Jul 9 16:11:38 2001
-@@ -248,6 +248,12 @@
- .B \-v
- Verbose mode.
- .TP
-+.B \-p "\fInum\fP"
-+If the mount requires a passphrase to be entered, read it from file
-+descriptor
-+.IR num\fP
-+instead of from the terminal.
-+.TP
- .B \-a
- Mount all filesystems (of the given types) mentioned in
- .IR fstab .
-@@ -1475,7 +1481,10 @@
- .BR loop ", " offset " and " encryption ,
- that are really options to
- .BR losetup (8).
--If no explicit loop device is mentioned
-+If the mount requires a passphrase, you will be prompted for one unless
-+you specify a file descriptor to read from instead with the
-+.BR \-\-pass-fd
-+option. If no explicit loop device is mentioned
- (but just an option `\fB\-o loop\fP' is given), then
- .B mount
- will try to find some unused loop device and use that.
-diff -Naur util-linux-2.11r-o/mount/mount.c util-linux-2.11r/mount/mount.c
---- util-linux-2.11r-o/mount/mount.c Fri Jun 8 01:24:28 2001
-+++ util-linux-2.11r/mount/mount.c Mon Jul 9 16:22:13 2001
-@@ -108,6 +108,9 @@
- /* True if ruid != euid. */
- static int suid = 0;
-
-+/* Contains the fd no. to read the passphrase from, if any */
-+static int pfd = -1;
-+
- /* Map from -o and fstab option strings to the flag argument to mount(2). */
- struct opt_map {
- const char *opt; /* option name */
-@@ -587,7 +590,7 @@
- if (verbose)
- printf(_("mount: going to use the loop device %s\n"), *loopdev);
- offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0;
-- if (set_loop (*loopdev, *loopfile, offset, opt_encryption, &loopro)) {
-+ if (set_loop (*loopdev, *loopfile, offset, opt_encryption, pfd, &loopro)) {
- if (verbose)
- printf(_("mount: failed setting up loop device\n"));
- return EX_FAIL;
-@@ -1305,6 +1308,7 @@
- { "read-write", 0, 0, 'w' },
- { "rw", 0, 0, 'w' },
- { "options", 1, 0, 'o' },
-+ { "pass-fd", 1, 0, 'p' },
- { "test-opts", 1, 0, 'O' },
- { "types", 1, 0, 't' },
- { "bind", 0, 0, 128 },
-@@ -1337,7 +1341,7 @@
- " mount --bind olddir newdir\n"
- "A device can be given by name, say /dev/hda1 or /dev/cdrom,\n"
- "or by label, using -L label or by uuid, using -U uuid .\n"
-- "Other options: [-nfFrsvw] [-o options].\n"
-+ "Other options: [-nfFrsvw] [-o options] [-p num].\n"
- "For many more details, say man 8 mount .\n"
- ));
- /*
-@@ -1353,6 +1357,7 @@
- int c, result = 0, specseen;
- char *options = NULL, *spec, *node;
- char *volumelabel = NULL;
-+ char *passfd = NULL;
- char *uuid = NULL;
- char *types = NULL;
- struct mntentchn *mc;
-@@ -1374,7 +1379,7 @@
- initproctitle(argc, argv);
- #endif
-
-- while ((c = getopt_long (argc, argv, "afFhlL:no:O:rsU:vVwt:",
-+ while ((c = getopt_long (argc, argv, "afFhlL:no:O:p:rsU:vVwt:",
- longopts, NULL)) != -1) {
- switch (c) {
- case 'a': /* mount everything in fstab */
-@@ -1408,6 +1413,9 @@
- readonly = 1;
- readwrite = 0;
- break;
-+ case 'p': /* read passphrase from given fd */
-+ passfd = optarg;
-+ break;
- case 's': /* allow sloppy mount options */
- sloppy = 1;
- break;
-@@ -1491,6 +1499,9 @@
- printf(_("mount: mounting %s\n"), spec);
- } else
- spec = NULL; /* just for gcc */
-+
-+ if (passfd && sscanf(passfd,"%d",&pfd) != 1)
-+ die (EX_USAGE, _("mount: argument to --pass-fd or -p must be a number"));
-
- switch (argc+specseen) {
- case 0:
+++ /dev/null
-diff -Nur util-linux-2.9s/text-utils/Makefile util-linux-2.9s.pld/text-utils/Makefile
---- util-linux-2.9s/text-utils/Makefile Fri Jun 11 08:39:14 1999
-+++ util-linux-2.9s.pld/text-utils/Makefile Fri Jun 11 08:38:57 1999
-@@ -20,7 +20,7 @@
-
- # Where to put datebase files?
-
--USRLIB= more.help
-+DATAMISC= more.help
-
- all: $(BIN) $(USRBIN)
-
-@@ -68,10 +68,10 @@
- endif
-
- install install.shadow install.text-utils: all
-- $(INSTALLDIR) $(BINDIR) $(USRBINDIR) $(USRLIBDIR) $(MAN1DIR)
-+ $(INSTALLDIR) $(BINDIR) $(USRBINDIR) $(DATAMISCDIR) $(MAN1DIR)
- $(INSTALLBIN) $(BIN) $(BINDIR)
- $(INSTALLBIN) $(USRBIN) $(USRBINDIR)
-- $(INSTALLDAT) $(USRLIB) $(USRLIBDIR)
-+ $(INSTALLDAT) $(DATAMISC) $(DATAMISCDIR)
- $(INSTALLMAN) $(MAN1) $(MAN1DIR)
-
- .PHONY: clean distclean
+++ /dev/null
-diff -urN util-linux-2.11b.org/login-utils/login.c util-linux-2.11b/login-utils/login.c
---- util-linux-2.11b.org/login-utils/login.c Wed May 2 19:09:39 2001
-+++ util-linux-2.11b/login-utils/login.c Wed May 2 19:06:08 2001
-@@ -312,6 +312,9 @@
-
- memset(&ut, 0, sizeof(ut));
-
-+ if (!username)
-+ username = "unknown";
-+
- strncpy(ut.ut_user, username, sizeof(ut.ut_user));
-
- strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id));
-@@ -576,6 +579,12 @@
-
- if(passwd_req == 1) {
- int failcount=0;
-+
-+ /* if we didn't get a user on the command line,
-+ set it to NULL */
-+ pam_get_item(pamh, PAM_USER, (const void **) &username);
-+ if (!username || username[0] == '\0')
-+ pam_set_item(pamh, PAM_USER, NULL);
-
- /* there may be better ways to deal with some of these
- conditions, but at least this way I don't think we'll
+++ /dev/null
---- util-linux-2.12pre/login-utils/Makefile.selinux 2001-09-29 14:11:24.000000000 -0400
-+++ util-linux-2.12pre/login-utils/Makefile 2004-01-26 08:07:45.156687235 -0500
-@@ -48,6 +48,12 @@
- PAMFL=-DUSE_PAM=1
- endif
-
-+ifeq "$(HAVE_SELINUX)" "yes"
-+CFLAGS += -DWITH_SELINUX=1 -g
-+SELINUXLLIB=-lselinux
-+SELINUXOBJS=selinux_utils.o
-+endif
-+
- ifeq "$(HAVE_SHADOW)" "no"
- ifeq "$(HAVE_PAM)" "no"
- ifeq "$(HAVE_PASSWD)" "no"
-@@ -96,18 +102,18 @@
- wall.o: ttymsg.h $(LIB)/carefulputc.h
-
- agetty: agetty.o $(LIB)/xstrncpy.o
--chfn: chfn.o islocal.o setpwnam.o $(LIB)/env.o $(LIB)/xstrncpy.o
-- $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
--chsh: chsh.o islocal.o setpwnam.o $(LIB)/env.o
-- $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
-+chfn: chfn.o islocal.o setpwnam.o $(SELINUXOBJS) $(LIB)/env.o $(LIB)/xstrncpy.o
-+ $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM) $(SELINUXLLIB)
-+chsh: chsh.o islocal.o setpwnam.o $(SELINUXOBJS) $(LIB)/env.o
-+ $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM) $(SELINUXLLIB)
- last: last.o
-
- ifeq "$(HAVE_PAM)" "yes"
- login: login.o $(LIB)/setproctitle.o $(LIB)/xstrncpy.o
-- $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
-+ $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM) $(SELINUXLLIB)
- else
- login: login.o $(LIB)/xstrncpy.o $(LIB)/setproctitle.o checktty.o
-- $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT)
-+ $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(SELINUXLLIB)
- endif
-
- mesg: mesg.o $(ERR_O)
-@@ -124,6 +130,7 @@
- $(CC) $(LDFLAGS) -o $@ $^
-
- vipw: vipw.o $(LIB)/xstrncpy.o
-+ $(CC) $(LDFLAGS) -o $@ $^ $(SELINUXLLIB)
-
- newgrp.o: $(LIB)/pathnames.h
- $(CC) -c $(CFLAGS) $(PAMFL) newgrp.c
---- util-linux-2.12pre/login-utils/chfn.c.selinux 2004-01-26 08:07:43.716619491 -0500
-+++ util-linux-2.12pre/login-utils/chfn.c 2004-01-26 08:08:31.588874751 -0500
-@@ -40,6 +40,12 @@
- #include "nls.h"
- #include "env.h"
-
-+#ifdef WITH_SELINUX
-+#include <selinux/selinux.h>
-+#include <selinux/av_permissions.h>
-+#include "selinux_utils.h"
-+#endif
-+
- #if REQUIRE_PASSWORD && USE_PAM
- #include <security/pam_appl.h>
- #include <security/pam_misc.h>
-@@ -136,6 +142,27 @@
- exit(1);
- }
-
-+#ifdef WITH_SELINUX
-+ if (is_selinux_enabled()>0) {
-+ if(uid == 0) {
-+ if (checkAccess(oldf.username,PASSWD__CHFN)!=0) {
-+ security_context_t user_context;
-+ if (getprevcon(&user_context) < 0)
-+ user_context=(security_context_t) strdup(_("Unknown user context"));
-+ fprintf(stderr, _("%s: %s is not authorized to change the finger info of %s\n"),
-+ whoami, user_context, oldf.username);
-+ freecon(user_context);
-+ exit(1);
-+ }
-+ }
-+ if (setupDefaultContext("/etc/passwd") != 0) {
-+ fprintf(stderr,_("%s: Can't set default context for /etc/passwd"),
-+ whoami);
-+ exit(1);
-+ }
-+ }
-+#endif
-+
- /* Reality check */
- if (uid != 0 && uid != oldf.pw->pw_uid) {
- errno = EACCES;
---- util-linux-2.12pre/login-utils/vipw.c.selinux 2001-10-20 03:23:57.000000000 -0400
-+++ util-linux-2.12pre/login-utils/vipw.c 2004-01-26 08:08:46.459576650 -0500
-@@ -67,6 +67,10 @@
- #include "xstrncpy.h"
- #include "nls.h"
-
-+#ifdef WITH_SELINUX
-+#include <selinux/selinux.h>
-+#endif
-+
- #define FILENAMELEN 67
-
- char *progname;
-@@ -189,6 +193,24 @@
- sprintf(tmp, "%s%s", orig_file, ".OLD");
- unlink(tmp);
- link(orig_file, tmp);
-+
-+#ifdef WITH_SELINUX
-+ if (is_selinux_enabled()>0) {
-+ security_context_t passwd_context=NULL;
-+ int ret=0;
-+ if (getfilecon(orig_file,&passwd_context) < 0) {
-+ (void) fprintf(stderr,_("%s: Can't get context for %s"),progname,orig_file);
-+ pw_error(orig_file, 1, 1);
-+ }
-+ ret=setfilecon(tmp_file,passwd_context);
-+ freecon(passwd_context);
-+ if (ret!=0) {
-+ (void) fprintf(stderr,_("%s: Can't set context for %s"),progname,tmp_file);
-+ pw_error(tmp_file, 1, 1);
-+ }
-+ }
-+#endif
-+
- if (rename(tmp_file, orig_file) == -1) {
- int errsv = errno;
- fprintf(stderr,
-@@ -266,7 +288,9 @@
-
- if (stat(tmp_file, &begin))
- pw_error(tmp_file, 1, 1);
-+
- pw_edit(0);
-+
- if (stat(tmp_file, &end))
- pw_error(tmp_file, 1, 1);
- if (begin.st_mtime == end.st_mtime) {
-@@ -281,6 +305,7 @@
- chmod(tmp_file, 0400);
- #endif
- pw_unlock();
-+
- }
-
- int main(int argc, char *argv[]) {
---- util-linux-2.12pre/login-utils/chsh.c.selinux 2004-01-26 08:07:45.016680649 -0500
-+++ util-linux-2.12pre/login-utils/chsh.c 2004-01-26 08:08:56.480049975 -0500
-@@ -47,6 +47,12 @@
- #include <security/pam_misc.h>
- #endif
-
-+#ifdef WITH_SELINUX
-+#include <selinux/selinux.h>
-+#include <selinux/av_permissions.h>
-+#include "selinux_utils.h"
-+#endif
-+
- typedef unsigned char boolean;
- #define false 0
- #define true 1
-@@ -121,6 +127,27 @@
- exit(1);
- }
-
-+#ifdef WITH_SELINUX
-+ if (is_selinux_enabled()>0) {
-+ if(uid == 0) {
-+ if (checkAccess(pw->pw_name,PASSWD__CHSH)!=0) {
-+ security_context_t user_context;
-+ if (getprevcon(&user_context) < 0)
-+ user_context=(security_context_t) strdup(_("Unknown user context"));
-+ fprintf(stderr, _("%s: %s is not authorized to change the shell of %s\n"),
-+ whoami, user_context, pw->pw_name);
-+ freecon(user_context);
-+ exit(1);
-+ }
-+ }
-+ if (setupDefaultContext("/etc/passwd") != 0) {
-+ fprintf(stderr,_("%s: Can't set default context for /etc/passwd"),
-+ whoami);
-+ exit(1);
-+ }
-+ }
-+#endif
-+
- oldshell = pw->pw_shell;
- if (!oldshell[0]) oldshell = "/bin/sh";
-
---- /dev/null 2004-01-20 06:10:08.000000000 -0500
-+++ util-linux-2.12pre/login-utils/selinux_utils.h 2004-01-26 08:07:45.156687235 -0500
-@@ -0,0 +1,2 @@
-+extern int checkAccess(char *name,int access);
-+extern int setupDefaultContext(char *orig_file);
---- /dev/null 2004-01-20 06:10:08.000000000 -0500
-+++ util-linux-2.12pre/login-utils/selinux_utils.c 2004-01-26 08:09:11.190745364 -0500
-@@ -0,0 +1,55 @@
-+#ifdef WITH_SELINUX
-+#include <sys/types.h>
-+#include <stdio.h>
-+#include <selinux/selinux.h>
-+#include <selinux/flask.h>
-+#include <selinux/av_permissions.h>
-+#include <selinux/context.h>
-+#include "selinux_utils.h"
-+
-+int checkAccess(char *chuser, int access) {
-+ int status=-1;
-+ security_context_t user_context;
-+ char *user=NULL;
-+ if( getprevcon(&user_context)==0 ) {
-+ context_t c=context_new(user_context);
-+ user=context_user_get(c);
-+ if (strcmp(chuser, user) == 0) {
-+ status=0;
-+ } else {
-+ struct av_decision avd;
-+ int retval = security_compute_av(user_context,
-+ user_context,
-+ SECCLASS_PASSWD,
-+ access,
-+ &avd);
-+
-+ if ((retval == 0) &&
-+ ((access & avd.allowed) == access)) {
-+ status=0;
-+ }
-+ }
-+ context_free(c);
-+ freecon(user_context);
-+ }
-+ return status;
-+}
-+
-+int setupDefaultContext(char *orig_file) {
-+ if (is_selinux_enabled()>0) {
-+ security_context_t scontext;
-+
-+ if (getfilecon(orig_file,&scontext)<0) {
-+ return 1;
-+ }
-+
-+ if (setfscreatecon(scontext) < 0)
-+ {
-+ freecon(scontext);
-+ return 1;
-+ }
-+ freecon(scontext);
-+ }
-+ return 0;
-+}
-+#endif
---- util-linux-2.12pre/MCONFIG.selinux 2004-01-26 08:07:44.006633133 -0500
-+++ util-linux-2.12pre/MCONFIG 2004-01-26 08:07:45.156687235 -0500
-@@ -18,6 +18,10 @@
- # installed as it is not PAM aware.
- HAVE_PAM=yes
-
-+# If HAVE_SELINUX is set to "yes", the login will make sure the user is
-+# logged into an appropriate security context
-+HAVE_SELINUX=yes
-+
- # If HAVE_SHADOW is set to "yes", then login, chfn, chsh, newgrp, passwd,
- # and vipw will not be built or installed from the login-utils
- # subdirectory.
+++ /dev/null
---- util-linux-2.12/MCONFIG~ 2004-05-23 12:26:51.792803744 +0200
-+++ util-linux-2.12/MCONFIG 2004-05-23 12:32:31.114219048 +0200
-@@ -48,13 +48,13 @@
- # be built or installed from the login-utils subdirectory. (The shutdown
- # and halt that come with the SysVinit package should be used with the init
- # found in that package.)
--HAVE_SYSVINIT=yes
-+HAVE_SYSVINIT=no
-
- # If HAVE_SYSVINIT_UTILS is set to "yes", then last, mesg, and wall will
- # not be built or installed from the login-utils subdirectory. (The
- # shutdown and init from the SysVinit package do not depend on the last,
- # mesg, and wall from that package.)
--HAVE_SYSVINIT_UTILS=yes
-+HAVE_SYSVINIT_UTILS=no
-
- # If HAVE_WRITE is set to "yes", then write will not be built or
- # installed from the misc-utils subdirectory.
+++ /dev/null
-diff -ur util-linux-2.11z.old/fdisk/Makefile util-linux-2.11z/fdisk/Makefile
---- util-linux-2.11z.old/fdisk/Makefile 2003-06-14 18:05:54.000000000 +0000
-+++ util-linux-2.11z/fdisk/Makefile 2003-06-14 18:06:10.000000000 +0000
-@@ -21,10 +21,8 @@
- SBIN:=$(SBIN) fdisk
- MAN8:=$(MAN8) fdisk.8
-
--ifneq "$(ARCH)" "sparc"
- SBIN:=$(SBIN) $(CFDISK) sfdisk
- MAN8:=$(MAN8) cfdisk.8 sfdisk.8
--endif
-
- all: $(SBIN) $(NOTMADE)
-
-Tylko w util-linux-2.11z/fdisk: Makefile~