Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 25192
Collapse All | Expand All

(-)mount/lomount.c.old (-10 / +27 lines)
Lines 247-253 Link Here
247
247
248
int
248
int
249
set_loop(const char *device, const char *file, int offset,
249
set_loop(const char *device, const char *file, int offset,
250
	 const char *encryption, int pfd, int *loopro) {
250
	 const char *encryption, int pfd, int keysz, int *loopro) {
251
	struct loop_info64 loopinfo64;
251
	struct loop_info64 loopinfo64;
252
	int fd, ffd, mode;
252
	int fd, ffd, mode;
253
	char *pass;
253
	char *pass;
Lines 308-315 Link Here
308
		break;
308
		break;
309
	default:
309
	default:
310
		pass = xgetpass(pfd, _("Password: "));
310
		pass = xgetpass(pfd, _("Password: "));
311
		xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
311
		if (keysz) {
312
		loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
312
		  loopinfo64.lo_encrypt_key_size = keysz;
313
		} else {
314
		  xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
315
		  loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
316
		}
313
	}
317
	}
314
318
315
	if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
319
	if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
Lines 337-344 Link Here
337
341
338
	close (fd);
342
	close (fd);
339
	if (verbose > 1)
343
	if (verbose > 1)
340
		printf(_("set_loop(%s,%s,%d): success\n"),
344
		printf(_("set_loop(%s,%s,%d,%d): success\n"),
341
		       device, file, offset);
345
		       device, file, keysz, offset);
342
	return 0;
346
	return 0;
343
347
344
 fail:
348
 fail:
Lines 377-383 Link Here
377
381
378
int
382
int
379
set_loop (const char *device, const char *file, int offset,
383
set_loop (const char *device, const char *file, int offset,
380
	  const char *encryption, int *loopro) {
384
	  const char *encryption, int keysz, int *loopro) {
381
	mutter();
385
	mutter();
382
	return 1;
386
	return 1;
383
}
387
}
Lines 411-417 Link Here
411
	fprintf(stderr, _("usage:\n\
415
	fprintf(stderr, _("usage:\n\
412
  %s loop_device                                      # give info\n\
416
  %s loop_device                                      # give info\n\
413
  %s -d loop_device                                   # delete\n\
417
  %s -d loop_device                                   # delete\n\
414
  %s [ -e encryption ] [ -o offset ] loop_device file # setup\n"),
418
  %s [ options ] loop_device file                     # setup\n\
419
  OPTIONS \n\
420
  -e <cipher>  \n\
421
    encryption, encrypt with <cipher>\n\
422
  -k <number>  \n\
423
    specify the number of bits in the key give to\n\
424
    the cipher. Key sizes < 128 are generally not\n\
425
    recommended\n"),
415
		progname, progname, progname);
426
		progname, progname, progname);
416
	exit(1);
427
	exit(1);
417
}
428
}
Lines 445-455 Link Here
445
457
446
int
458
int
447
main(int argc, char **argv) {
459
main(int argc, char **argv) {
448
	char *offset, *encryption, *passfd;
460
	char *offset, *encryption, *passfd, *keysize = 0;
449
	int delete, off, c;
461
	int delete, off, c;
450
	int res = 0;
462
	int res = 0;
451
	int ro = 0;
463
	int ro = 0;
452
	int pfd = -1;
464
	int pfd = -1;
465
	int keysz = 0;
453
466
454
	setlocale(LC_ALL, "");
467
	setlocale(LC_ALL, "");
455
	bindtextdomain(PACKAGE, LOCALEDIR);
468
	bindtextdomain(PACKAGE, LOCALEDIR);
Lines 458-464 Link Here
458
	delete = off = 0;
471
	delete = off = 0;
459
	offset = encryption = passfd = NULL;
472
	offset = encryption = passfd = NULL;
460
	progname = argv[0];
473
	progname = argv[0];
461
	while ((c = getopt(argc,argv,"de:E:o:p:v")) != -1) {
474
	while ((c = getopt(argc,argv,"de:E:k:o:p:v")) != -1) {
462
		switch (c) {
475
		switch (c) {
463
		case 'd':
476
		case 'd':
464
			delete = 1;
477
			delete = 1;
Lines 467-472 Link Here
467
		case 'e':
480
		case 'e':
468
			encryption = optarg;
481
			encryption = optarg;
469
			break;
482
			break;
483
		case 'k':
484
			keysize = optarg;
485
			break;
470
		case 'o':
486
		case 'o':
471
			offset = optarg;
487
			offset = optarg;
472
			break;
488
			break;
Lines 494-501 Link Here
494
			usage();
510
			usage();
495
		if (passfd && sscanf(passfd,"%d",&pfd) != 1)
511
		if (passfd && sscanf(passfd,"%d",&pfd) != 1)
496
			usage();
512
			usage();
513
		if (keysize && sscanf(keysize,"%d",&keysz) != 1)
514
			usage();
497
		res = set_loop(argv[optind], argv[optind+1], off,
515
		res = set_loop(argv[optind], argv[optind+1], off,
498
			       encryption, pfd, &ro);
516
			       encryption, pfd, keysz, &ro);
499
	}
517
	}
500
	return res;
518
	return res;
501
}
519
}
(-)mount/lomount.h.old (-1 / +1 lines)
Lines 1-6 Link Here
1
extern int verbose;
1
extern int verbose;
2
extern int set_loop(const char *, const char *, int, const char *,
2
extern int set_loop(const char *, const char *, int, const char *,
3
		    int, int *);
3
		    int, int, int *);
4
extern int del_loop(const char *);
4
extern int del_loop(const char *);
5
extern int is_loop_device(const char *);
5
extern int is_loop_device(const char *);
6
extern char * find_unused_loop_device(void);
6
extern char * find_unused_loop_device(void);
(-)mount/mount.c.old (-3 / +5 lines)
Lines 195-201 Link Here
195
};
195
};
196
196
197
static char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption,
197
static char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption,
198
  *opt_speed;
198
  *opt_speed, *opt_keybits;
199
199
200
static struct string_opt_map {
200
static struct string_opt_map {
201
  char *tag;
201
  char *tag;
Lines 207-212 Link Here
207
  { "offset=",	0, &opt_offset },
207
  { "offset=",	0, &opt_offset },
208
  { "encryption=", 0, &opt_encryption },
208
  { "encryption=", 0, &opt_encryption },
209
  { "speed=", 0, &opt_speed },
209
  { "speed=", 0, &opt_speed },
210
  { "keybits=", 0, &opt_keybits },
210
  { NULL, 0, NULL }
211
  { NULL, 0, NULL }
211
};
212
};
212
213
Lines 561-567 Link Here
561
static int
562
static int
562
loop_check(char **spec, char **type, int *flags,
563
loop_check(char **spec, char **type, int *flags,
563
	   int *loop, char **loopdev, char **loopfile) {
564
	   int *loop, char **loopdev, char **loopfile) {
564
  int looptype, offset;
565
  int looptype, offset, keybits;
565
566
566
  /*
567
  /*
567
   * In the case of a loop mount, either type is of the form lo@/dev/loop5
568
   * In the case of a loop mount, either type is of the form lo@/dev/loop5
Lines 604-611 Link Here
604
      if (verbose)
605
      if (verbose)
605
	printf(_("mount: going to use the loop device %s\n"), *loopdev);
606
	printf(_("mount: going to use the loop device %s\n"), *loopdev);
606
      offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0;
607
      offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0;
608
      keybits = opt_keybits ? strtoul(opt_keybits, NULL, 0) : 0;
607
      if (set_loop(*loopdev, *loopfile, offset,
609
      if (set_loop(*loopdev, *loopfile, offset,
608
		   opt_encryption, pfd, &loopro)) {
610
		   opt_encryption, pfd, keybits, &loopro)) {
609
	if (verbose)
611
	if (verbose)
610
	  printf(_("mount: failed setting up loop device\n"));
612
	  printf(_("mount: failed setting up loop device\n"));
611
	return EX_FAIL;
613
	return EX_FAIL;

Return to bug 25192