diff --git a/libpcp/scrypt.c b/libpcp/scrypt.c index 58b4762..ccfcdb4 100644 --- a/libpcp/scrypt.c +++ b/libpcp/scrypt.c @@ -34,7 +34,7 @@ byte* pcp_scrypt(PCPCTX *ptx, char *passwd, size_t passwdlen, byte *nonce, size_ return dk; } else { - fatal(ptx, "crypto_scrypt() failed"); + fatal(ptx, "crypto_scrypt() failed\n"); return NULL; } diff --git a/libpcp/vault.c b/libpcp/vault.c index d056ccd..9133833 100644 --- a/libpcp/vault.c +++ b/libpcp/vault.c @@ -82,7 +82,7 @@ vault_t *pcpvault_new(PCPCTX *ptx, char *filename, int is_tmp) { vault->isnew = 1; mode_t old_mask = umask (S_IWGRP | S_IWOTH | S_IRGRP | S_IROTH); if((fd = fopen(vault->filename, "wb+")) == NULL) { - fatal(ptx, "Could not create vault file %s", vault->filename); + fatal(ptx, "Could not create vault file %s\n", vault->filename); umask (old_mask); goto errn; } @@ -90,7 +90,7 @@ vault_t *pcpvault_new(PCPCTX *ptx, char *filename, int is_tmp) { } else { if((fd = fopen(vault->filename, "rb+")) == NULL) { - fatal(ptx, "Could not open vault file %s", vault->filename); + fatal(ptx, "Could not open vault file %s\n", vault->filename); goto errn; } } diff --git a/libpcp/z85.c b/libpcp/z85.c index 7da79a4..91abd00 100644 --- a/libpcp/z85.c +++ b/libpcp/z85.c @@ -199,7 +199,7 @@ byte *pcp_z85_decode(PCPCTX *ptx, char *z85block, size_t *dstlen) { bin = ucmalloc(binlen); if(zmq_z85_decode(bin, z85block) == NULL) { - fatal(ptx, "zmq_z85_decode() failed, input size ! mod 5 (got %ld)", strlen(z85block)); + fatal(ptx, "zmq_z85_decode() failed, input size ! mod 5 (got %ld)\n", strlen(z85block)); return NULL; } @@ -287,7 +287,7 @@ char *pcp_readz85string(PCPCTX *ptx, unsigned char *input, size_t bufsize) { } if(_buffer_is_binary(input, bufsize) > 0) { - fatal(ptx, "input is not z85 encoded and contains pure binary data"); + fatal(ptx, "input is not z85 encoded and contains pure binary data\n"); return NULL; } @@ -339,7 +339,7 @@ char *pcp_readz85string(PCPCTX *ptx, unsigned char *input, size_t bufsize) { } if(buffer_size(z) == 0) { - fatal(ptx, "empty z85 encoded string"); + fatal(ptx, "empty z85 encoded string\n"); goto rferr; } diff --git a/src/keymgmt.c b/src/keymgmt.c index dadb328..f248ae1 100644 --- a/src/keymgmt.c +++ b/src/keymgmt.c @@ -30,14 +30,14 @@ char *pcp_getstdin(const char *prompt) { fprintf(stderr, "%s: ", prompt); if (fgets(line, 255, stdin) == NULL) { - fatal(ptx, "Cannot read from stdin"); + fatal(ptx, "Cannot read from stdin\n"); goto errgst; } line[strcspn(line, "\r\n")] = '\0'; if ((out = strdup(line)) == NULL) { - fatal(ptx, "Cannot allocate memory"); + fatal(ptx, "Cannot allocate memory\n"); goto errgst; } @@ -222,7 +222,7 @@ void pcp_exportsecret(char *keyid, int useid, char *outfile, int armor, char *pa } else { if((out = fopen(outfile, "wb+")) == NULL) { - fatal(ptx, "Could not create output file %s", outfile); + fatal(ptx, "Could not create output file %s\n", outfile); goto errexpse1; } } @@ -307,7 +307,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int } else { if((out = fopen(outfile, "wb+")) == NULL) { - fatal(ptx, "Could not create output file %s", outfile); + fatal(ptx, "Could not create output file %s\n", outfile); goto errpcpexpu1; } } @@ -381,7 +381,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int } else { /* FIXME: export foreign keys unsupported yet */ - fatal(ptx, "Exporting foreign public keys in native format unsupported yet"); + fatal(ptx, "Exporting foreign public keys in native format unsupported yet\n"); goto errpcpexpu1; } } @@ -399,7 +399,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int } } else { - fatal(ptx, "Exporting foreign public keys in PBP format not possible"); + fatal(ptx, "Exporting foreign public keys in PBP format not possible\n"); goto errpcpexpu1; } } @@ -615,6 +615,8 @@ int pcp_import (vault_t *vault, FILE *in, char *passwd) { } else { /* it's not public key, so let's try to interpret it as secret key */ + if(ptx->verbose) + fatals_ifany(ptx); if(passwd != NULL) { sk = pcp_import_secret(ptx, buf, bufsize, passwd); } diff --git a/src/keyprint.c b/src/keyprint.c index b6c1463..b34177d 100644 --- a/src/keyprint.c +++ b/src/keyprint.c @@ -305,7 +305,7 @@ void pcpexport_yaml(char *outfile) { } else { if((out = fopen(outfile, "wb+")) == NULL) { - fatal(ptx, "Could not create output file %s", outfile); + fatal(ptx, "Could not create output file %s\n", outfile); out = NULL; } } diff --git a/src/readpass.c b/src/readpass.c index 610a9bf..717cb70 100644 --- a/src/readpass.c +++ b/src/readpass.c @@ -58,13 +58,13 @@ pcp_readpass(char ** passwd, const char * prompt, /* If we're reading from a terminal, try to disable echo. */ if ((usingtty = isatty(fileno(readfrom))) != 0) { if (tcgetattr(fileno(readfrom), &term_old)) { - fatal(ptx, "Cannot read terminal settings"); + fatal(ptx, "Cannot read terminal settings\n"); goto err1; } memcpy(&term, &term_old, sizeof(struct termios)); term.c_lflag = (term.c_lflag & ~ECHO) | ECHONL; if (tcsetattr(fileno(readfrom), TCSANOW, &term)) { - fatal(ptx, "Cannot set terminal settings"); + fatal(ptx, "Cannot set terminal settings\n"); goto err1; } } @@ -76,7 +76,7 @@ retry: /* Read the password. */ if (fgets(passbuf, MAXPASSLEN, readfrom) == NULL) { - fatal(ptx, "Cannot read password"); + fatal(ptx, "Cannot read password\n"); goto err2; } @@ -85,7 +85,7 @@ retry: if (usingtty) fprintf(stderr, "%s: ", confirmprompt); if (fgets(confpassbuf, MAXPASSLEN, readfrom) == NULL) { - fatal(ptx, "Cannot read password"); + fatal(ptx, "Cannot read password\n"); goto err2; } if (strcmp(passbuf, confpassbuf)) { @@ -108,7 +108,7 @@ retry: /* Copy the password out. */ if ((*passwd = strdup(passbuf)) == NULL) { - fatal(ptx, "Cannot allocate memory"); + fatal(ptx, "Cannot allocate memory\n"); goto err1; }