aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-01-14 19:45:11 +0000
committerJoursoir <chat@joursoir.net>2021-01-14 19:45:11 +0000
commitc99acd1211e967a87ab7a0de3fb8a569b19fd0b2 (patch)
treeff6e0659c7df3bdf02738b981f11eb0187cbfec1
parent96b8793a09ccc9f8fa92444d540d77d037475dfe (diff)
downloadlock-password-c99acd1211e967a87ab7a0de3fb8a569b19fd0b2.tar.gz
lock-password-c99acd1211e967a87ab7a0de3fb8a569b19fd0b2.tar.bz2
lock-password-c99acd1211e967a87ab7a0de3fb8a569b19fd0b2.zip
correct typos, change vars namev1.0c
-rw-r--r--man/lpass.12
-rw-r--r--src/implementation.c26
-rw-r--r--src/main.c30
3 files changed, 28 insertions, 30 deletions
diff --git a/man/lpass.1 b/man/lpass.1
index 171c35f..febc865 100644
--- a/man/lpass.1
+++ b/man/lpass.1
@@ -1,4 +1,4 @@
-.TH "LPASS" "1" "30\ \&OCTOBER\ \&2020" "LPASS v1.0" "LockPassword"
+.TH "LPASS" "1" "14\ \&JANUARY\ \&2021" "LPASS v1.0c" "LockPassword"
.SH "NAME"
LockPassword - a password manager.
diff --git a/src/implementation.c b/src/implementation.c
index d2f71ea..863b755 100644
--- a/src/implementation.c
+++ b/src/implementation.c
@@ -11,9 +11,7 @@
#include "implementation.h"
/* define in implementation.h */
-// GPG_PUBLICKEY_MAXLENGTH 1025
-
-#define BASH_EXEC_COPY "lpass_copy.sh"
+// GPG_PUBLICKEY_MAXLENGTH NNNN
// == global var ==
extern char *gPath_rootdir; // /home/[username]/.lockpassword/
@@ -84,10 +82,10 @@ char *getGPGKey(char *dest, size_t size)
char* getPassword(char *path_pass, char *password, size_t size, int flag_copy)
{
int size_gpgkey = sizeof(char) * GPG_PUBLICKEY_MAXLENGTH;
- char *secret_gpgkey = (char *) malloc(size_gpgkey);
- getGPGKey(secret_gpgkey, size_gpgkey);
+ char *public_gpgkey = (char *) malloc(size_gpgkey);
+ getGPGKey(public_gpgkey, size_gpgkey);
- char *arguments[] = {"gpg", "-d", "--quiet", "-r", secret_gpgkey, "-o", path_pass, gPath_pass, NULL};
+ char *arguments[] = {"gpg", "-d", "--quiet", "-r", public_gpgkey, "-o", path_pass, gPath_pass, NULL};
easyFork("gpg", arguments);
FILE *filePass = fopen(path_pass, "r");
@@ -101,7 +99,7 @@ char* getPassword(char *path_pass, char *password, size_t size, int flag_copy)
if(flag_copy) copyText(password);
remove(path_pass);
- free(secret_gpgkey);
+ free(public_gpgkey);
return password;
}
@@ -126,11 +124,11 @@ void insertPass(char *add_path, char *password, int flag_copy)
gPath_subdir = banks/france */
int size_gpgkey = sizeof(char) * GPG_PUBLICKEY_MAXLENGTH;
- char *secret_gpgkey = (char *) malloc(size_gpgkey);
- getGPGKey(secret_gpgkey, size_gpgkey);
+ char *public_gpgkey = (char *) malloc(size_gpgkey);
+ getGPGKey(public_gpgkey, size_gpgkey);
- char *arguments1[] = {"mkdir", "-p", gPath_subdir, NULL};
- easyFork("mkdir", arguments1);
+ char *mkdir_arg[] = {"mkdir", "-p", gPath_subdir, NULL};
+ easyFork("mkdir", mkdir_arg);
// create file, copy password there
FILE *filePass;
@@ -144,11 +142,11 @@ void insertPass(char *add_path, char *password, int flag_copy)
if(flag_copy) copyText(password);
// encryption
- char *arguments2[] = {"gpg", "--quiet", "--yes", "-r", secret_gpgkey, "-e", add_path, NULL};
- easyFork("gpg", arguments2);
+ char *encrypt_arg[] = {"gpg", "--quiet", "--yes", "-r", public_gpgkey, "-e", add_path, NULL};
+ easyFork("gpg", encrypt_arg);
remove(add_path);
- free(secret_gpgkey);
+ free(public_gpgkey);
}
char *typePass(char *text, char *dest, int minlen, int maxlen)
diff --git a/src/main.c b/src/main.c
index 8639597..7d7ba13 100644
--- a/src/main.c
+++ b/src/main.c
@@ -9,7 +9,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <sys/wait.h>
#include <getopt.h>
#include <dirent.h>
#include <libgen.h>
@@ -70,8 +69,8 @@ static void globalSplitPath(char *source)
dirname(gPath_subdir);
#if defined(DEBUG)
- printf("dir: %s\n", gPath_subdir);
- printf("pass: %s\n", gPath_pass);
+ printf("g_suddir: %s\n", gPath_subdir);
+ printf("g_pass: %s\n", gPath_pass);
#endif
}
@@ -159,21 +158,21 @@ static void cmd_edit(int argc, char *argv[])
fclose(f_texteditor);
#if defined(DEBUG)
- printf("using text editor: %s\n", text_editor);
+ printf("text editor: %s\n", text_editor);
#endif
// end configure
// decryption
int size_gpgkey = sizeof(char) * GPG_PUBLICKEY_MAXLENGTH;
- char *secret_gpgkey = (char *) malloc(size_gpgkey);
- getGPGKey(secret_gpgkey, size_gpgkey);
+ char *public_gpgkey = (char *) malloc(size_gpgkey);
+ getGPGKey(public_gpgkey, size_gpgkey);
- char *decryp_arg[] = {"gpg", "-d", "--quiet", "-r", secret_gpgkey, "-o", path_to_password, gPath_pass, NULL};
- easyFork("gpg", decryp_arg);
+ char *decrypt_arg[] = {"gpg", "-d", "--quiet", "-r", public_gpgkey, "-o", path_to_password, gPath_pass, NULL};
+ easyFork("gpg", decrypt_arg);
// start vim/etc for edit passowrd
- char *texte_arg[] = {text_editor, path_to_password, NULL};
- easyFork(text_editor, texte_arg);
+ char *editor_arg[] = {text_editor, path_to_password, NULL};
+ easyFork(text_editor, editor_arg);
// delete '\n' and paste good pass
char password[MAXLEN_PASSWORD];
@@ -185,11 +184,11 @@ static void cmd_edit(int argc, char *argv[])
fclose(file);
// encryption
- char *encryp_arg[] = {"gpg", "--quiet", "--yes", "-r", secret_gpgkey, "-e", path_to_password, NULL};
- easyFork("gpg", encryp_arg);
+ char *encrypt_arg[] = {"gpg", "--quiet", "--yes", "-r", public_gpgkey, "-e", path_to_password, NULL};
+ easyFork("gpg", encrypt_arg);
remove(path_to_password);
- free(secret_gpgkey);
+ free(public_gpgkey);
}
static void cmd_move(int argc, char *argv[])
@@ -470,7 +469,7 @@ static void cmd_version()
int main(int argc, char *argv[])
{
if(!isatty(0)) { // stdin
- printError("lpass: Please, use a terminal to run this program\n");
+ printError("lpass: Please, use a terminal to run this application\n");
}
/* init global path to root directory */
@@ -512,5 +511,6 @@ int main(int argc, char *argv[])
free(gPath_pass);
}
free(gPath_rootdir);
- return EXIT_SUCCESS;
+
+ return 0;
} \ No newline at end of file