tech-crypto archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pwhash - added -x option
from the /usr/src/usr.bin/pwhash directory I ran `cvs diff -up` and
this is the output.
Index: pwhash.c
===================================================================
RCS file: /cvsroot/src/usr.bin/pwhash/pwhash.c,v
retrieving revision 1.15
diff -u -p -r1.15 pwhash.c
--- pwhash.c 16 Sep 2011 15:39:28 -0000 1.15
+++ pwhash.c 28 Nov 2018 20:45:47 -0000
@@ -54,13 +54,14 @@ __RCSID("$NetBSD: pwhash.c,v 1.15 2011/0
#define DO_MD5 2
#define DO_BLF 3
#define DO_SHA1 4
+#define DO_CRYPT 5
__dead static void
usage(void)
{
(void)fprintf(stderr,
- "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-p | string]\n",
+ "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-x setting]
[-p | string]\n",
getprogname());
exit(1);
}
@@ -116,6 +117,7 @@ print_passwd(char *string, int operation
break;
case DO_DES:
+ case DO_CRYPT:
salt = extra;
break;
@@ -146,7 +148,7 @@ main(int argc, char **argv)
if (strcmp(getprogname(), "makekey") == 0)
operation = DO_MAKEKEY;
- while ((opt = getopt(argc, argv, "kmpS:s:b:")) != -1) {
+ while ((opt = getopt(argc, argv, "kmpS:s:b:x:")) != -1) {
switch (opt) {
case 'k': /* Stdin/Stdout Unix crypt */
if (operation != -1 || prompt)
@@ -177,6 +179,7 @@ main(int argc, char **argv)
case 's': /* Unix crypt (DES) */
if (operation != -1 || optarg[0] == '$')
usage();
+ case 'x':
operation = DO_DES;
extra = optarg;
break;
On Wed, Nov 28, 2018 at 3:34 PM matthew green <mrg%eterna.com.au@localhost> wrote:
>
> hi JP.
>
> can you use "cvs diff -up"? (unified diff and likely function
> name options.) you can put "diff -up" in ~/.cvsrc.
>
> i think i'd rather this didn't try to be tricky and re-use 2
> lines, but have the case 'x' be its own chunk, and perhaps it
> should grow a "DO_CHECK" that is set instead of DO_SED, and
> that print_passwd() considers the same as DO_SED. this should
> only total less than 10 extra lines without conflating options.
>
> thanks!
>
>
> .mrg.
>
> > I have the need to check against hashes generated by pwhash (I have a CGI
> > script doing logins). I'd like an option in pwhash to explicitly specify
> > the setting for crypt() (rather than create a whole separate binary). The
> > -s option almost does this except that it verifies that there is no $ in
> > the optarg (to ensure DES), so the changes to the source are minimal (5
> > lines). I added a -x, the option argument explicitly specifies the crypt()
> > setting.
> >
> > Anyway, just thought someone else might be interested.
> >
> > JP
> >
> > P.S. I'm not sure how to submit patches, but I ran `cvs diff` in
> > /usr/src/usr.bin/pwhash and this is the output
> >
> > Index: pwhash.c
> > ===================================================================
> > RCS file: /cvsroot/src/usr.bin/pwhash/pwhash.c,v
> > retrieving revision 1.15
> > diff -r1.15 pwhash.c
> > 56a57
> > > #define DO_CRYPT 5
> > 63c64
> > < "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-p | string]\n",
> > ---
> > > "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-x setting] [-p | string]\n",
> > 118a120
> > > case DO_CRYPT:
> > 149c151
> > < while ((opt = getopt(argc, argv, "kmpS:s:b:")) != -1) {
> > ---
> > > while ((opt = getopt(argc, argv, "kmpS:s:b:x:")) != -1) {
> > 179a182
> > > case 'x':
> >
> > --0000000000008971a4057b9321c2
> > Content-Type: text/html; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > <div dir=3D"ltr"><div>I have the need to check against hashes generated by =
> > pwhash (I have a CGI script doing logins).=C2=A0 I'd like an option in =
> > pwhash to explicitly specify the setting for crypt() (rather than create a =
> > whole separate binary).=C2=A0 The -s option almost does this except that it=
> > verifies that there is no $ in the optarg (to ensure DES), so the changes =
> > to the source are minimal (5 lines).=C2=A0 I added a -x, the option argumen=
> > t explicitly specifies the crypt() setting.<br></div><div><br></div><div>An=
> > yway, just thought someone else might be interested.</div><div><br></div><d=
> > iv>JP<br></div><div><br></div><div>P.S.=C2=A0 I'm not sure how to submi=
> > t patches, but I ran `cvs diff` in /usr/src/usr.bin/pwhash and this is the =
> > output</div><div><br></div><div>
> > <pre>Index: pwhash.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: /cvsroot/src/usr.bin/pwhash/pwhash.c,v
> > retrieving revision 1.15
> > diff -r1.15 pwhash.c
> > 56a57
> > > #define DO_CRYPT 5
> > 63c64
> > < "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-p | str=
> > ing]\n",
> > ---
> > > "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-x setti=
> > ng] [-p | string]\n",
> > 118a120
> > > case DO_CRYPT:
> > 149c151
> > < while ((opt =3D getopt(argc, argv, "kmpS:s:b:")) !=3D -1) {
> > ---
> > > while ((opt =3D getopt(argc, argv, "kmpS:s:b:x:")) !=3D -1)=
> > {
> > 179a182
> > > case 'x':</pre>
> >
> > </div></div>
> >
> > --0000000000008971a4057b9321c2--
> >
Home |
Main Index |
Thread Index |
Old Index