summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-10-27 22:59:25 +0400
committerMatthieu Patou <mat@samba.org>2010-10-27 20:08:54 +0000
commitf8d49958b2a5c55e837ebe903dd5207a92d19d63 (patch)
tree972d82043b49d5c992b9efe1af49d72783890a9d /source4
parent0bc94c21e5fe1eab59029e99dec4fef6f378fbb1 (diff)
downloadsamba-f8d49958b2a5c55e837ebe903dd5207a92d19d63.tar.gz
samba-f8d49958b2a5c55e837ebe903dd5207a92d19d63.tar.xz
samba-f8d49958b2a5c55e837ebe903dd5207a92d19d63.zip
tls: Inform the user if the cert/ca/private key can't be saved
Most of the time this problem is due to a missing <private>/tls dir. Should close bug 7640. Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Wed Oct 27 20:08:54 UTC 2010 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/tls/tlscert.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/lib/tls/tlscert.c b/source4/lib/tls/tlscert.c
index 62e7a72240d..bef634803a6 100644
--- a/source4/lib/tls/tlscert.c
+++ b/source4/lib/tls/tlscert.c
@@ -138,15 +138,24 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
bufsize = sizeof(buf);
TLSCHECK(gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM, buf, &bufsize));
- file_save(certfile, buf, bufsize);
+ if (!file_save(certfile, buf, bufsize)) {
+ DEBUG(0,("Unable to save certificate in %s parent dir exists ?\n", certfile));
+ goto failed;
+ }
bufsize = sizeof(buf);
TLSCHECK(gnutls_x509_crt_export(cacrt, GNUTLS_X509_FMT_PEM, buf, &bufsize));
- file_save(cafile, buf, bufsize);
+ if (!file_save(cafile, buf, bufsize)) {
+ DEBUG(0,("Unable to save ca cert in %s parent dir exists ?\n", cafile));
+ goto failed;
+ }
bufsize = sizeof(buf);
TLSCHECK(gnutls_x509_privkey_export(key, GNUTLS_X509_FMT_PEM, buf, &bufsize));
- file_save(keyfile, buf, bufsize);
+ if (!file_save(keyfile, buf, bufsize)) {
+ DEBUG(0,("Unable to save privatekey in %s parent dir exists ?\n", keyfile));
+ goto failed;
+ }
gnutls_x509_privkey_deinit(key);
gnutls_x509_privkey_deinit(cakey);