aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-12 11:10:58 -0400
committerKen Moore <ken@ixsystems.com>2017-10-12 11:10:58 -0400
commit221c57a127579d6ad4849b475e107d7b60369db3 (patch)
treecd1a15c4663730cc6d5a7e253fb9035467d1ebf6 /src-qt5
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-221c57a127579d6ad4849b475e107d7b60369db3.tar.gz
lumina-221c57a127579d6ad4849b475e107d7b60369db3.tar.bz2
lumina-221c57a127579d6ad4849b475e107d7b60369db3.zip
Remove the plaintext input option for lumina-checkpass, and add more usage reporting/output if the first input flag is invalid.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/lumina-checkpass/main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src-qt5/core/lumina-checkpass/main.c b/src-qt5/core/lumina-checkpass/main.c
index 481cce33..2f54c8e6 100644
--- a/src-qt5/core/lumina-checkpass/main.c
+++ b/src-qt5/core/lumina-checkpass/main.c
@@ -27,7 +27,7 @@
void showUsage(){
puts("lumina-checkpass: Simple user-level check for password validity (for screen unlockers and such).");
puts("Usage:");
- puts(" lumina-checkpass <password>");
+ //puts(" lumina-checkpass <password>");
puts(" lumina-checkpass -fd <file descriptor>");
puts(" lumina-checkpass -f <file path>");
puts("Returns: 0 for a valid password, 1 for invalid");
@@ -35,14 +35,13 @@ void showUsage(){
int main(int argc, char** argv){
//Check the inputs
- if(argc<2){
+ if(argc!=3){
//Invalid inputs - show the help text
showUsage();
return 1;
}
char*pass = 0;
- if(argc==2){ pass = argv[1]; }
- else if(argc==3 && 0==strcmp(argv[1],"-fd") ){
+ if(argc==3 && 0==strcmp(argv[1],"-fd") ){
FILE *fp = fdopen(atoi(argv[2]), "r");
size_t len;
if(fp!=0){
@@ -56,6 +55,11 @@ int main(int argc, char** argv){
if(fp!=0){
ssize_t slen = getline(&pass, &len, fp);
if(pass[slen-1]=='\n'){ pass[slen-1] = '\0'; }
+ }else{
+ puts("[ERROR] Unknown option provided");
+ puts("----------------");
+ showUsage();
+ return 1;
}
fclose(fp);
}
bgstack15