Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Jul 2004 20:31:05 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        current@FreeBSD.org
Subject:   Patch for gbde(8)
Message-ID:  <20040707173105.GA70913@ip.net.ua>

next in thread | raw e-mail | index | archive | help

--dc+cDN39EJAMEtIO
Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1"
Content-Disposition: inline


--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p
Content-Transfer-Encoding: quoted-printable

Index: gbde.8
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 secto=
rs
-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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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
=20
 static void __dead2
-usage(const char *reason)
+usage(void)
 {
-	const char *p;
=20
-	p =3D 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);
 }
=20
@@ -720,12 +720,12 @@ main(int argc, char **argv)
 	struct g_bde_softc sc;
=20
 	if (argc < 3)
-		usage("Too few arguments\n");
+		usage();
=20
        if ((i =3D 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 =3D 0;
@@ -752,7 +752,7 @@ main(int argc, char **argv)
 		doopen =3D 1;
 		opts =3D "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 =3D 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();
 		}
=20
 	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");
 	}
=20
 	memset(&sc, 0, sizeof sc);
@@ -860,7 +861,7 @@ main(int argc, char **argv)
 		}
 		break;
 	default:
-		usage("Internal error\n");
+		err(1, "internal error");
 	}
=20
 	return(0);

--n8g4imXOkfNTN/H1--

--dc+cDN39EJAMEtIO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFA7DNZqRfpzJluFF4RAmKbAKCYs5Ul/m4zV1uF98k/E52JJjiuhQCeJAGH
y2fuHoBQ/EjU0LifXGsr+U8=
=yyQe
-----END PGP SIGNATURE-----

--dc+cDN39EJAMEtIO--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040707173105.GA70913>