diff options
author | Timothy Pearson <[email protected]> | 2013-03-23 01:02:41 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-03-23 01:02:41 -0500 |
commit | 54f609f3da51af4c074b9694e7ea2dcc7ff78c63 (patch) | |
tree | eeed2c0a8187395683122fa4c78409d1f362e678 /src | |
parent | d1764a4dae8b02738435cce0f8688bd301ccce5e (diff) | |
parent | 42072e938ee5c08c9582a56d75dbf2b41c946bc4 (diff) | |
download | libtdeldap-54f609f3da51af4c074b9694e7ea2dcc7ff78c63.tar.gz libtdeldap-54f609f3da51af4c074b9694e7ea2dcc7ff78c63.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/libtdeldap
Diffstat (limited to 'src')
-rw-r--r-- | src/libtdeldap.cpp | 26 | ||||
-rw-r--r-- | src/libtdeldap.h | 2 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp index 2088d2e..e3bb252 100644 --- a/src/libtdeldap.cpp +++ b/src/libtdeldap.cpp @@ -2648,6 +2648,15 @@ int LDAPManager::writeClientCronFiles(TQString *errstr) { stream << CRON_UPDATE_NSS_COMMAND << "\n"; file.close(); + + if (chmod(CRON_UPDATE_NSS_FILE, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) < 0) { + if (errstr) *errstr = TQString("Unable to change permissions of \"%1\"").arg(CRON_UPDATE_NSS_FILE); + return -1; + } + } + else { + if (errstr) *errstr = TQString("Unable to write file \"%1\"").arg(CRON_UPDATE_NSS_FILE); + return -1; } if (system(CRON_UPDATE_NSS_COMMAND) < 0) { @@ -2658,7 +2667,7 @@ int LDAPManager::writeClientCronFiles(TQString *errstr) { return 0; } -void LDAPManager::writePrimaryRealmCertificateUpdateCronFile() { +int LDAPManager::writePrimaryRealmCertificateUpdateCronFile(TQString *errstr) { TQFile file(CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_FILE); if (file.open(IO_WriteOnly)) { TQTextStream stream( &file ); @@ -2670,12 +2679,23 @@ void LDAPManager::writePrimaryRealmCertificateUpdateCronFile() { stream << CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_COMMAND << "\n"; file.close(); + + if (chmod(CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_FILE, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) < 0) { + if (errstr) *errstr = TQString("Unable to change permissions of \"%1\"").arg(CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_FILE); + return -1; + } + } + else { + if (errstr) *errstr = TQString("Unable to write file \"%1\"").arg(CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_FILE); + return -1; } if (system(CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_COMMAND) < 0) { - printf("ERROR: Execution of \"%s\" failed!\n\r", CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_COMMAND); - return; + if (errstr) *errstr = TQString("Execution of \"%s\" failed").arg(CRON_UPDATE_PRIMARY_REALM_CERTIFICATES_COMMAND); + return -1; } + + return 0; } LDAPRealmConfigList LDAPManager::readTDERealmList(KSimpleConfig* config, bool disableAllBonds) { diff --git a/src/libtdeldap.h b/src/libtdeldap.h index f6b5e54..08dbb65 100644 --- a/src/libtdeldap.h +++ b/src/libtdeldap.h @@ -430,7 +430,7 @@ class LDAPManager : public TQObject { int getTDECertificate(TQString certificateName, TQString fileName, TQString *errstr=0); int setPasswordForUser(LDAPUserInfo user, TQString *errstr); - static void writePrimaryRealmCertificateUpdateCronFile(); + static int writePrimaryRealmCertificateUpdateCronFile(TQString *errstr=0); static TQString getMachineFQDN(); static int writeTDERealmList(LDAPRealmConfigList realms, KSimpleConfig* config, TQString *errstr=0); static LDAPRealmConfigList readTDERealmList(KSimpleConfig* config, bool disableAllBonds=false); |