int
set_loop(const char *device, const char *file, unsigned long long offset,
- const char *encryption, int pfd, int *loopro, int keysz, int hash_pass) {
- const char *encryption, int pfd, int *options) {
++ const char *encryption, int pfd, int *options, int keysz, int hash_pass) {
struct loop_info64 loopinfo64;
int fd, ffd, mode, i;
char *pass;
int
set_loop (const char *device, const char *file, unsigned long long offset,
-- const char *encryption, int *loopro) {
++ const char *encryption, int pfd, int *options, int keysz, int hash_pass) {
mutter();
return 1;
}
int
main(int argc, char **argv) {
- char *p, *offset, *encryption, *passfd, *device, *file;
+ char *p, *offset, *encryption, *passfd, *device, *file, *assoc;
+ char *keysize;
int delete, find, c, all;
int res = 0;
int showdev = 0;
{ "encryption", 1, 0, 'e' },
{ "find", 0, 0, 'f' },
{ "help", 0, 0, 'h' },
+ { "keybits", 1, 0, 'k' },
+ { "nopasshash", 0, 0, 'N' },
+ { "nohashpass", 0, 0, 'N' },
+ { "associated", 1, 0, 'j' },
{ "offset", 1, 0, 'o' },
{ "pass-fd", 1, 0, 'p' },
{ "read-only", 0, 0, 'r' },
delete = find = all = 0;
off = 0;
+ offset = encryption = passfd = NULL;
+ assoc = offset = encryption = passfd = NULL;
+ keysize = NULL;
progname = argv[0];
if ((p = strrchr(progname, '/')) != NULL)
progname = p+1;
- while ((c = getopt_long(argc, argv, "ade:E:fhk:No:p:rsv",
- while ((c = getopt_long(argc, argv, "ade:E:fhj:o:p:rsv",
++ while ((c = getopt_long(argc, argv, "ade:E:fhj:k:No:p:rsv",
longopts, NULL)) != -1) {
switch (c) {
case 'a':
case 'f':
find = 1;
break;
+ case 'j':
+ assoc = optarg;
+ case 'k':
+ keysize = optarg;
+ break;
+ case 'N':
+ hash_pass = 0;
break;
case 'o':
offset = optarg;
else if (file == NULL)
res = show_loop(device);
else {
- if (offset && sscanf(offset, "%llu", &off) != 1)
- usage();
if (passfd && sscanf(passfd, "%d", &pfd) != 1)
usage();
+ if (keysize && sscanf(keysize,"%d",&keysz) != 1)
+ usage();
do {
- res = set_loop(device, file, off, encryption, pfd, &ro);
+ res = set_loop(device, file, off, encryption, pfd, &ro, keysz, hash_pass);
if (res == 2 && find) {
if (verbose)
printf("stolen loop=%s...trying again\n",
.IP "\fB\-f, \-\-find\fP"
find the first unused loop device. If a
.I file
- argument is present, use this device. Otherwise, print its name.
+ argument is present, use this device. Otherwise, print its name
.IP "\fB\-h, \-\-help\fP"
print help
+ .IP "\fB\-j, \-\-associated \fIfile\fP"
+ show status of all loop devices associated with given
+ .I file
+.IP "\fB\-k, \-\-keybits \fInum\fP"
+set the number of bits to use in key to \fInum\fP.
+.IP "\fB\-N, \-\-nohashpass\fP"
+Do not hash the password. By default, Debian systems run the password through a
+hash function, non-Debian systems tend not to.
.IP "\fB\-o, \-\-offset \fIoffset\fP"
- The data start is moved \fIoffset\fP bytes into the specified file or
- device.
+ the data start is moved \fIoffset\fP bytes into the specified file or
+ device
.IP "\fB\-p, \-\-pass-fd \fInum\fP"
- Read the passphrase from file descriptor with number
+ read the passphrase from file descriptor with number
.I num
instead of from the terminal
.IP "\fB\-r, \-\-read-only\fP"
return EX_SYSERR; /* no more loop devices */
if (verbose)
printf(_("mount: going to use the loop device %s\n"), *loopdev);
-
+ if (!keysz && opt_keybits)
+ keysz = strtoul(opt_keybits, NULL, 0);
+ if (opt_nohashpass)
+ hash_pass=0;
if ((res = set_loop(*loopdev, *loopfile, offset,
- opt_encryption, pfd, &loopro, keysz, hash_pass))) {
- opt_encryption, pfd, &loop_opts))) {
++ opt_encryption, pfd, &loop_opts, keysz, hash_pass))) {
if (res == 2) {
/* loop dev has been grabbed by some other process,
try again, if not given explicitly */
die (EX_USAGE, _("mount: only root can do that"));
}
- if (!nomtab && mtab_does_not_exist()) {
- if (verbose > 1)
- printf(_("mount: no %s found - creating it..\n"),
- _PATH_MOUNTED);
- create_mtab ();
- }
-
+ if (keysize && sscanf(keysize,"%d",&keysz) != 1)
+ die (EX_USAGE, _("mount: argument to --keybits or -k must be a number"));
++
atexit(unlock_mtab);
switch (argc+specseen) {