summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-29 16:20:02 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-29 16:20:02 -0500
commit1e9b6837271818706c284f8819cc0db733e738b4 (patch)
tree2a6ea6dcbd1210aaf5632abb5b98a1d0c1264b67
parentf101efbd4d4dbe7725bc2a1848ab2aa12d0de1d7 (diff)
downloadlibtdeldap-1e9b6837271818706c284f8819cc0db733e738b4.tar.gz
libtdeldap-1e9b6837271818706c284f8819cc0db733e738b4.zip
Set proper permissions on root certificate files
-rw-r--r--src/libtdeldap.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 8ff91f3..5ba2676 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -2643,7 +2643,7 @@ LDAPTDEBuiltinsInfo LDAPManager::getTDEBuiltinMappings(TQString *errstr) {
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
builtininfo = parseLDAPTDEBuiltinsRecord(entry);
}
-
+
// clean up
ldap_msgfree(msg);
@@ -2695,7 +2695,14 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQString fileName,
TQByteArray ba;
ba.duplicate(vals[i]->bv_val, vals[i]->bv_len);
file.writeBlock(ba);
- returncode = 0;
+ file.close();
+ if (chmod(fileName.ascii(), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
+ if (errstr) *errstr = i18n("Unable to change permissions of \"%1\"").arg(fileName.ascii());
+ returncode = -1;
+ }
+ else {
+ returncode = 0;
+ }
}
}
ldap_value_free_len(vals);
@@ -2707,7 +2714,7 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQString fileName,
ber_free(ber, 0);
}
}
-
+
// clean up
ldap_msgfree(msg);