diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 2e4cd4a..9faaecd 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -740,7 +740,7 @@ void add_multiple_attributes_operation(LDAPMod **mods, int *i, TQString attr, TQ
(*i)++;
}
-int LDAPManager::updateUserInfo(LDAPUserInfo user) {
+int LDAPManager::updateUserInfo(LDAPUserInfo user, TQString *errstr) {
int retcode;
int i;
LDAPUserInfo userinfo;
@@ -842,7 +842,12 @@ int LDAPManager::updateUserInfo(LDAPUserInfo user) {
}
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP modification failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP modification failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP modification failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1322,7 +1327,7 @@ int LDAPManager::destroyKerberosTicket(TQString principal, TQString *errstr) {
return 0;
}
-int LDAPManager::updateGroupInfo(LDAPGroupInfo group) {
+int LDAPManager::updateGroupInfo(LDAPGroupInfo group, TQString *errstr) {
int retcode;
int i;
LDAPGroupInfo groupinfo;
@@ -1387,7 +1392,12 @@ int LDAPManager::updateGroupInfo(LDAPGroupInfo group) {
}
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP modification failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP modification failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP modification failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1396,7 +1406,7 @@ int LDAPManager::updateGroupInfo(LDAPGroupInfo group) {
}
}
-int LDAPManager::addUserInfo(LDAPUserInfo user) {
+int LDAPManager::addUserInfo(LDAPUserInfo user, TQString *errstr) {
int retcode;
int i;
LDAPUserInfo userinfo;
@@ -1457,7 +1467,12 @@ int LDAPManager::addUserInfo(LDAPUserInfo user) {
}
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP addition failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP addition failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP addition failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1466,7 +1481,7 @@ int LDAPManager::addUserInfo(LDAPUserInfo user) {
}
}
-int LDAPManager::addGroupInfo(LDAPGroupInfo group) {
+int LDAPManager::addGroupInfo(LDAPGroupInfo group, TQString *errstr) {
int retcode;
int i;
LDAPGroupInfo groupinfo;
@@ -1520,7 +1535,12 @@ int LDAPManager::addGroupInfo(LDAPGroupInfo group) {
}
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP addition failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP addition failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP addition failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1644,7 +1664,7 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
}
}
-int LDAPManager::deleteUserInfo(LDAPUserInfo user) {
+int LDAPManager::deleteUserInfo(LDAPUserInfo user, TQString *errstr) {
int retcode;
LDAPUserInfo userinfo;
@@ -1655,7 +1675,12 @@ int LDAPManager::deleteUserInfo(LDAPUserInfo user) {
// Delete the base DN entry
retcode = ldap_delete_ext_s(m_ldap, user.distinguishedName.ascii(), NULL, NULL);
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1664,7 +1689,7 @@ int LDAPManager::deleteUserInfo(LDAPUserInfo user) {
}
}
-int LDAPManager::deleteGroupInfo(LDAPGroupInfo group) {
+int LDAPManager::deleteGroupInfo(LDAPGroupInfo group, TQString *errstr) {
int retcode;
LDAPGroupInfo groupinfo;
@@ -1675,7 +1700,12 @@ int LDAPManager::deleteGroupInfo(LDAPGroupInfo group) {
// Delete the base DN entry
retcode = ldap_delete_ext_s(m_ldap, group.distinguishedName.ascii(), NULL, NULL);
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1684,7 +1714,7 @@ int LDAPManager::deleteGroupInfo(LDAPGroupInfo group) {
}
}
-int LDAPManager::deleteMachineInfo(LDAPMachineInfo machine) {
+int LDAPManager::deleteMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
int retcode;
LDAPMachineInfo machineinfo;
@@ -1695,7 +1725,12 @@ int LDAPManager::deleteMachineInfo(LDAPMachineInfo machine) {
// Delete the base DN entry
retcode = ldap_delete_ext_s(m_ldap, machine.distinguishedName.ascii(), NULL, NULL);
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
@@ -1704,7 +1739,7 @@ int LDAPManager::deleteMachineInfo(LDAPMachineInfo machine) {
}
}
-int LDAPManager::deleteServiceInfo(LDAPServiceInfo service) {
+int LDAPManager::deleteServiceInfo(LDAPServiceInfo service, TQString *errstr) {
int retcode;
LDAPServiceInfo serviceinfo;
@@ -1715,7 +1750,12 @@ int LDAPManager::deleteServiceInfo(LDAPServiceInfo service) {
// Delete the base DN entry
retcode = ldap_delete_ext_s(m_ldap, service.distinguishedName.ascii(), NULL, NULL);
if (retcode != LDAP_SUCCESS) {
- KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ if (errstr) {
+ *errstr = i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("LDAP deletion failureReason: [%3] %4
").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
return -2;
}
else {
diff --git a/src/libtdeldap.h b/src/libtdeldap.h
index 1bad94d..d6ea2d5 100644
--- a/src/libtdeldap.h
+++ b/src/libtdeldap.h
@@ -382,15 +382,15 @@ class LDAPManager : public TQObject {
LDAPServiceInfoList services(int* retcode=0);
LDAPUserInfo getUserByDistinguishedName(TQString dn);
LDAPGroupInfo getGroupByDistinguishedName(TQString dn, TQString *errstr=0);
- int updateUserInfo(LDAPUserInfo user);
- int updateGroupInfo(LDAPGroupInfo group);
- int addUserInfo(LDAPUserInfo user);
- int addGroupInfo(LDAPGroupInfo group);
+ int updateUserInfo(LDAPUserInfo user, TQString *errstr=0);
+ int updateGroupInfo(LDAPGroupInfo group, TQString *errstr=0);
+ int addUserInfo(LDAPUserInfo user, TQString *errstr=0);
+ int addGroupInfo(LDAPGroupInfo group, TQString *errstr=0);
int addServiceInfo(LDAPServiceInfo service, TQString *errstr=0);
- int deleteUserInfo(LDAPUserInfo user);
- int deleteGroupInfo(LDAPGroupInfo group);
- int deleteMachineInfo(LDAPMachineInfo machine);
- int deleteServiceInfo(LDAPServiceInfo service);
+ int deleteUserInfo(LDAPUserInfo user, TQString *errstr=0);
+ int deleteGroupInfo(LDAPGroupInfo group, TQString *errstr=0);
+ int deleteMachineInfo(LDAPMachineInfo machine, TQString *errstr=0);
+ int deleteServiceInfo(LDAPServiceInfo service, TQString *errstr=0);
LDAPCredentials currentLDAPCredentials();