summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@kodafritt.se>2012-10-10 18:23:40 +0200
committerSamuel Lidén Borell <samuel@kodafritt.se>2012-10-10 18:23:40 +0200
commit3df8588976dbfa6683d8bc0b377e724cbf71a6e9 (patch)
treeebb488b0ae9cb05687560d8f7e1e7d653aa64ba3
parent0ac406cd4458b01bebd90bafa6ac37e3808b50d4 (diff)
downloadfribid-3df8588976dbfa6683d8bc0b377e724cbf71a6e9.tar.gz
fribid-3df8588976dbfa6683d8bc0b377e724cbf71a6e9.tar.bz2
fribid-3df8588976dbfa6683d8bc0b377e724cbf71a6e9.zip
New error message when P12 file can be created, but is not writable
-rw-r--r--client/backend.h1
-rw-r--r--client/gtk.c2
-rw-r--r--client/pkcs12.c9
-rw-r--r--translations/sv.po4
4 files changed, 14 insertions, 2 deletions
diff --git a/client/backend.h b/client/backend.h
index 2c9193a..8850a5a 100644
--- a/client/backend.h
+++ b/client/backend.h
@@ -61,6 +61,7 @@ typedef enum {
// File errors
TokenError_FileNotReadable,
TokenError_CantCreateFile,
+ TokenError_CantWriteToFile,
TokenError_BadFile,
TokenError_BadPassword,
// Smart card errors
diff --git a/client/gtk.c b/client/gtk.c
index 8dbde5d..03335bb 100644
--- a/client/gtk.c
+++ b/client/gtk.c
@@ -64,6 +64,8 @@ static const char *const errorStrings[] = {
translatable("The file could not be read"),
// TokenError_CantCreateFile
translatable("The file could not be saved"),
+ // TokenError_CantWriteToFile
+ translatable("The file could not be written to, even though it could be opened"),
// TokenError_BadFile
translatable("Invalid file format"),
// TokenError_BadPassword,
diff --git a/client/pkcs12.c b/client/pkcs12.c
index 59ae11f..8b55be1 100644
--- a/client/pkcs12.c
+++ b/client/pkcs12.c
@@ -473,10 +473,15 @@ static TokenError saveKeys(const CertReq *reqs, const char *hostname,
PKCS12_set_mac(p12, (char*)password, -1, NULL, 0, MAC_ITER, NULL);
// Save file
- if (i2d_PKCS12_fp(file, p12)) {
- error = TokenError_Success;
+ if (!i2d_PKCS12_fp(file, p12)) {
+ certutil_updateErrorString();
+ error = TokenError_CantWriteToFile;
+ goto end;
}
+ // Done!
+ error = TokenError_Success;
+
end:
sk_PKCS7_pop_free(authsafes, PKCS7_free);
PKCS12_free(p12);
diff --git a/translations/sv.po b/translations/sv.po
index 6b84636..a8d9369 100644
--- a/translations/sv.po
+++ b/translations/sv.po
@@ -58,6 +58,10 @@ msgstr "Det gick inte att öppna filen"
msgid "The file could not be saved"
msgstr "Det gick inte att spara filen"
+#: ../client/gtk.c:68
+msgid "The file could not be written to, even though it could be opened"
+msgstr "Det gick inte att skriva till filen, trots att den kunde öppnas"
+
#: ../client/gtk.c:62
msgid "Invalid file format"
msgstr "Felaktigt filformat"