From 65662db674cb3529331dc5db83be9bd9220f072d Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 10 Dec 2019 13:41:57 -0600 Subject: Read password from stdin --- configure.in | 2 +- src/hashpwd.cpp | 43 ++++++++++++++++++++++++++++++++++++++----- src/ubpasswd.sh | 23 ++++++++++++++++++++--- 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/configure.in b/configure.in index c1f2416..ed7e154 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT([src/eeprom_main.c]) -AM_INIT_AUTOMAKE([mts-id-eeprom], [0.4.7]) +AM_INIT_AUTOMAKE([mts-id-eeprom], [0.5.0]) AM_CONFIG_HEADER([config.h]) AC_PROG_CC diff --git a/src/hashpwd.cpp b/src/hashpwd.cpp index 6bc322c..1ea3e2c 100644 --- a/src/hashpwd.cpp +++ b/src/hashpwd.cpp @@ -153,6 +153,7 @@ void usage(void) " -V version" << endl << " -v verbose" << endl << " -d did Device ID (serial #)" << endl << + " -i Read password from standard input" << endl << " -m mac Ethernet mac address" << endl << " -p password" << endl << " -u uuid UUID (base 16)" << endl << @@ -163,17 +164,20 @@ void usage(void) } int main(int argc, char **argv) { - int opt = 0, p = 0, d = 0, m = 0, u=0; + int opt = 0, p = 0, d = 0, m = 0, u=0, iopt = 0; + char c; unsigned long long fudge = 0; short unsigned int prefix; string did, mac, pwd, salt, uuid; + int supplied_password = 0; - while ((opt = getopt(argc,argv,"Vd:m:p:u:v")) != EOF) + while ((opt = getopt(argc,argv,"Vd:im:p:u:v")) != EOF) switch(opt) { case 'V': cout << MYVERSION << endl; exit(0); case 'v': v = 1; cout << " verbose" <