Patch for gbde(8)
Ruslan Ermilov
ru at FreeBSD.org
Wed Jul 7 10:31:08 PDT 2004
Hi there,
I have some old patch for gbde(8). It fixes some omissions
in the utility usage (and its style) and in the manpage.
Can someone using this utility please double-check that this
patch is still correct (it's been a while since I developed
it), and possibly commit it (if you have commit privilege).
Cheers,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
Index: gbde.8
===================================================================
RCS file: /home/ncvs/src/sbin/gbde/gbde.8,v
retrieving revision 1.12
diff -u -p -r1.12 gbde.8
--- gbde.8 23 May 2004 08:40:52 -0000 1.12
+++ gbde.8 1 Jun 2004 15:25:02 -0000
@@ -51,8 +51,8 @@
.Ar destination
.Op Fl i
.Op Fl f Ar filename
-.Op Fl L Ar lockfile
-.Op Fl P Ar pass-phrase
+.Op Fl L Ar new-lockfile
+.Op Fl P Ar new-pass-phrase
.Nm
.Cm setkey
.Ar destination
@@ -62,12 +62,16 @@
.Op Fl L Ar new-lockfile
.Op Fl P Ar new-pass-phrase
.Nm
-.Cm destroy
+.Cm nuke
.Ar destination
.Op Fl n Ar key
.Op Fl l Ar lockfile
.Op Fl p Ar pass-phrase
-.Op Fl L Ar lockfile
+.Nm
+.Cm destroy
+.Ar destination
+.Op Fl l Ar lockfile
+.Op Fl p Ar pass-phrase
.Sh DESCRIPTION
.Bf -symbolic
NOTICE:
@@ -97,12 +101,21 @@ The operational aspect consists of two s
one to open and attach
a device to the in-kernel cryptographic
.Nm
-module,
-and one to close and detach a device.
+module
+.Pq Cm attach ,
+and one to close and detach a device
+.Pq Cm detach .
.Pp
The management part allows initialization of the master key and lock sectors
-on a device, initialization and replacement of pass-phrases and
-key invalidation and blackening functions.
+on a device
+.Pq Cm init ,
+initialization and replacement of pass-phrases
+.Pq Cm setkey ,
+and key invalidation
+.Pq Cm nuke
+and blackening
+.Pq Cm destroy
+functions.
.Pp
The
.Fl l Ar lockfile
@@ -114,7 +127,11 @@ option is specified, the first sector is
The
.Fl L Ar new-lockfile
argument
-specifies the lock selector file for the key modified with the
+specifies the lock selector file for the key
+initialized with the
+.Cm init
+subcommand
+or modified with the
.Cm setkey
subcommand.
.Pp
Index: gbde.c
===================================================================
RCS file: /home/ncvs/src/sbin/gbde/gbde.c,v
retrieving revision 1.23
diff -u -p -r1.23 gbde.c
--- gbde.c 25 Jun 2004 13:04:49 -0000 1.23
+++ gbde.c 7 Jul 2004 17:25:06 -0000
@@ -130,18 +130,18 @@ g_hexdump(void *ptr, int length)
#endif
static void __dead2
-usage(const char *reason)
+usage(void)
{
- const char *p;
- p = getprogname();
- fprintf(stderr, "Usage error: %s", reason);
- fprintf(stderr, "Usage:\n");
- fprintf(stderr, "\t%s attach dest [-l lockfile]\n", p);
- fprintf(stderr, "\t%s detach dest\n", p);
- fprintf(stderr, "\t%s init /dev/dest [-i] [-f filename] [-L lockfile]\n", p);
- fprintf(stderr, "\t%s setkey dest [-n key] [-l lockfile] [-L lockfile]\n", p);
- fprintf(stderr, "\t%s destroy dest [-n key] [-l lockfile] [-L lockfile]\n", p);
+ fprintf(stderr,
+"usage: gbde attach destination [-l lockfile] [-p pass-phrase]\n"
+" gbde detach destination\n"
+" gbde init destination [-i] [-f filename] [-L new-lockfile]\n"
+" [-P new-pass-phrase]\n"
+" gbde setkey destination [-n key] [-l lockfile] [-p pass-phrase]\n"
+" [-L new-lockfile] [-P new-pass-phrase]\n"
+" gbde nuke destination [-n key] [-l lockfile] [-p pass-phrase]\n"
+" gbde destroy destination [-l lockfile] [-p pass-phrase]\n");
exit (1);
}
@@ -720,12 +720,12 @@ main(int argc, char **argv)
struct g_bde_softc sc;
if (argc < 3)
- usage("Too few arguments\n");
+ usage();
if ((i = modfind("g_bde")) < 0) {
/* need to load the gbde module */
if (kldload(GBDEMOD) < 0 || modfind("g_bde") < 0) {
- usage(GBDEMOD ": Kernel module not available\n");
+ err(1, GBDEMOD ": Kernel module not available");
}
}
doopen = 0;
@@ -752,7 +752,7 @@ main(int argc, char **argv)
doopen = 1;
opts = "l:p:n:";
} else {
- usage("Unknown sub command\n");
+ usage();
}
argc--;
argv++;
@@ -791,11 +791,12 @@ main(int argc, char **argv)
case 'n':
n_opt = strtoul(optarg, &q, 0);
if (!*optarg || *q)
- usage("-n argument not numeric\n");
+ err(1, "-n argument not numeric");
if (n_opt < -1 || n_opt > G_BDE_MAXKEYS)
- usage("-n argument out of range\n"); break;
+ err(1, "-n argument out of range");
+ break;
default:
- usage("Invalid option\n");
+ usage();
}
if (doopen) {
@@ -813,7 +814,7 @@ main(int argc, char **argv)
if (!memcmp(dest, _PATH_DEV, strlen(_PATH_DEV)))
strcpy(dest, dest + strlen(_PATH_DEV));
if (strchr(dest, '/'))
- usage("\"dest\" argument must be geom-name\n");
+ err(1, "\"destination\" argument must be geom-name");
}
memset(&sc, 0, sizeof sc);
@@ -860,7 +861,7 @@ main(int argc, char **argv)
}
break;
default:
- usage("Internal error\n");
+ err(1, "internal error");
}
return(0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040707/a25f17b8/attachment.bin
More information about the freebsd-current
mailing list