summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2016-09-21 18:35:58 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2016-09-21 18:35:58 -0500
commit1ccfd00cd4c07513aeccf73c082d7ef4f3c0c35a (patch)
treeb46134d3e55c9aeb103c80c7abcefad360d32c9c
parente7fe109b399e0350aa592c5300ee6bbd329fd21a (diff)
downloadlibtdeldap-1ccfd00c.tar.gz
libtdeldap-1ccfd00c.zip
Create the PKCS#11 configuration directory if it does not exist before attempting to write the configuration file into it
-rw-r--r--src/libtdeldap.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 2ba3923..759b341 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -5136,6 +5136,14 @@ int LDAPManager::writePAMFiles(LDAPPamConfig pamConfig, TQString *errstr) {
}
if (pamConfig.enable_pkcs11_login) {
+ TQDir pkcs11dir(PAMD_PKCS11_CONFIG_DIRECTORY);
+ if (!pkcs11dir.exists()) {
+ if (mkdir(PAMD_PKCS11_CONFIG_DIRECTORY, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) < 0) {
+ if (errstr) {
+ *errstr = i18n("Could not create directoy '%1'").arg(PAMD_PKCS11_CONFIG_DIRECTORY);
+ }
+ }
+ }
TQFile file4(PAMD_PKCS11_CONFIG_DIRECTORY PAMD_PKCS11_CONFIG_FILE);
if (file4.open(IO_WriteOnly)) {
TQTextStream stream( &file4 );