From 1433e651cd24e088fa9d767d143ace41fc89813f Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Sat, 3 Oct 2026 17:47:50 -0300
Subject: Replace NULL pointer constants with nullptr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 src/libtdeldap.cpp | 468 ++++++++++++++++++++++++++---------------------------
 src/libtdeldap.h   |   2 +-
 2 files changed, 235 insertions(+), 235 deletions(-)

diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index a497927..d2f24de 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -67,14 +67,14 @@ extern "C" {
 	  do {                                                         \
 	    (BL) = length_##T((S));                                    \
 	    (B) = (unsigned char*)malloc((BL));                        \
-	    if((B) == NULL) {                                          \
+	    if((B)) {                                          \
 	      (R) = ENOMEM;                                            \
 	    } else {                                                   \
 	      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
 	                       (S), (L));                              \
 	      if((R) != 0) {                                           \
 	        free((B));                                             \
-	        (B) = NULL;                                            \
+	        (B) = nullptr;                                            \
 	      }                                                        \
 	    }                                                          \
 	  } while (0)
@@ -158,7 +158,7 @@ static kadm5_ret_t kadm5_get_default_principal_info(krb5_context context, void*
 	kadm5_ret_t ret;
 	krb5_principal def_principal;
 	krb5_const_realm realm = krb5_principal_get_realm(context, princ);
-	ret = krb5_make_principal(context, &def_principal, realm, "default", NULL);
+	ret = krb5_make_principal(context, &def_principal, realm, "default", nullptr);
 	if (ret) {
 		return ret;
 	}
@@ -354,7 +354,7 @@ int LDAPManager::bind(TQString* errstr) {
 
 	TQString errorString;
 	if (havepass == true) {
-		char* mechanism = NULL;
+		char* mechanism = nullptr;
 		struct berval cred;
 		TQString ldap_dn = m_creds->username;
 		TQCString pass = m_creds->password.utf8();
@@ -394,23 +394,23 @@ int LDAPManager::bind(TQString* errstr) {
 				TQCString anonpass = "";
 				anoncred.bv_val = anonpass.data();
 				anoncred.bv_len = anonpass.length();
-				retcode = ldap_sasl_bind_s(ldapconn, "", mechanism, &anoncred, NULL, NULL, NULL);
+				retcode = ldap_sasl_bind_s(ldapconn, "", mechanism, &anoncred, nullptr, nullptr, nullptr);
 				if (retcode == LDAP_SUCCESS ) {
 					// Look for the DN for the specified user
 					LDAPMessage* msg;
 					TQString ldap_base_dn = m_basedc;
 					TQString ldap_filter = TQString("(&(objectclass=posixAccount)(uid=%1))").arg(m_creds->username);
-					retcode = ldap_search_ext_s(ldapconn, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), NULL, 0, NULL, NULL, NULL, 0, &msg);
+					retcode = ldap_search_ext_s(ldapconn, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), nullptr, 0, nullptr, nullptr, nullptr, 0, &msg);
 					if (retcode != LDAP_SUCCESS) {
 						if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 						else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
 					}
 					else {
 						// Iterate through the returned entries
-						char* dn = NULL;
+						char* dn = nullptr;
 						LDAPMessage* entry;
-						for(entry = ldap_first_entry(ldapconn, msg); entry != NULL; entry = ldap_next_entry(ldapconn, entry)) {
-							if((dn = ldap_get_dn(ldapconn, entry)) != NULL) {
+						for(entry = ldap_first_entry(ldapconn, msg); entry; entry = ldap_next_entry(ldapconn, entry)) {
+							if((dn = ldap_get_dn(ldapconn, entry))) {
 								ldap_dn = dn;
 								ldap_memfree(dn);
 							}
@@ -420,32 +420,32 @@ int LDAPManager::bind(TQString* errstr) {
 					ldap_msgfree(msg);
 
 					// All done!
-					ldap_unbind_ext_s(ldapconn, NULL, NULL);
+					ldap_unbind_ext_s(ldapconn, nullptr, nullptr);
 				}
 				else {
 					// Clean up
-					ldap_unbind_ext_s(ldapconn, NULL, NULL);
+					ldap_unbind_ext_s(ldapconn, nullptr, nullptr);
 				}
 			}
 		}
 
 		if (m_creds->use_gssapi) {
 #if LDAP_VENDOR_VERSION < 20425
-			retcode = ldap_sasl_interactive_bind_s(m_ldap, "", "GSSAPI", NULL, NULL, LDAP_SASL_AUTOMATIC, sasl_bind_interact_callback, NULL);
+			retcode = ldap_sasl_interactive_bind_s(m_ldap, "", "GSSAPI", nullptr, nullptr, LDAP_SASL_AUTOMATIC, sasl_bind_interact_callback, nullptr);
 #else // LDAP_VENDOR_VERSION
-			const char* rmech = NULL;
-			LDAPMessage* result = NULL;
+			const char* rmech = nullptr;
+			LDAPMessage* result = nullptr;
 			int msgid;
 			retcode = LDAP_SASL_BIND_IN_PROGRESS;
 			while (retcode == LDAP_SASL_BIND_IN_PROGRESS) {
-				retcode = ldap_sasl_interactive_bind(m_ldap, "", "GSSAPI", NULL, NULL, LDAP_SASL_AUTOMATIC, sasl_bind_interact_callback, NULL, result, &rmech, &msgid);
+				retcode = ldap_sasl_interactive_bind(m_ldap, "", "GSSAPI", nullptr, nullptr, LDAP_SASL_AUTOMATIC, sasl_bind_interact_callback, nullptr, result, &rmech, &msgid);
 				ldap_msgfree(result);
 
 				if (retcode != LDAP_SASL_BIND_IN_PROGRESS) {
 					break;
 				}
 
-				if ((ldap_result(m_ldap, msgid, LDAP_MSG_ALL, NULL, &result) == -1) || (!result)) {
+				if ((ldap_result(m_ldap, msgid, LDAP_MSG_ALL, nullptr, &result) == -1) || (!result)) {
 					retcode = LDAP_INVALID_CREDENTIALS;
 				}
 			}
@@ -465,7 +465,7 @@ int LDAPManager::bind(TQString* errstr) {
 #endif // LDAP_VENDOR_VERSION
 		}
 		else {
-			retcode = ldap_sasl_bind_s(m_ldap, ldap_dn.ascii(), mechanism, &cred, NULL, NULL, NULL);
+			retcode = ldap_sasl_bind_s(m_ldap, ldap_dn.ascii(), mechanism, &cred, nullptr, nullptr, nullptr);
 		}
 
 		if (retcode != LDAP_SUCCESS ) {
@@ -492,7 +492,7 @@ int LDAPManager::unbind(bool force, TQString* errstr) {
 		return 0;
 	}
 
-	int retcode = ldap_unbind_ext_s(m_ldap, NULL, NULL);
+	int retcode = ldap_unbind_ext_s(m_ldap, nullptr, nullptr);
 	if ((retcode < 0) && (force == false)) {
 		if (errstr) *errstr = i18n("<qt>Unable to disconnect from LDAP server %1 on port %2<p>Reason: [%3] %4</qt>").arg(m_host).arg(m_port).arg(retcode).arg(ldap_err2string(retcode));
 		else KMessageBox::error(0, i18n("<qt>Unable to disconnect from LDAP server %1 on port %2<p>Reason: [%3] %4</qt>").arg(m_host).arg(m_port).arg(retcode).arg(ldap_err2string(retcode)), i18n("Unable to disconnect from server!"));
@@ -506,14 +506,14 @@ int LDAPManager::unbind(bool force, TQString* errstr) {
 
 LDAPUserInfo LDAPManager::parseLDAPUserRecord(LDAPMessage* entry) {
 	int i;
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
 
 	LDAPUserInfo userinfo;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		userinfo.distinguishedName = dn;
 		TQStringList dnParts = TQStringList::split(",", dn);
 		TQString id = dnParts[0];
@@ -524,8 +524,8 @@ LDAPUserInfo LDAPManager::parseLDAPUserRecord(LDAPMessage* entry) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			userinfo.informationValid = true;
 			TQString ldap_field = attr;
 			i=0;
@@ -742,7 +742,7 @@ LDAPUserInfo LDAPManager::parseLDAPUserRecord(LDAPMessage* entry) {
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -763,7 +763,7 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
 		TQString ldap_base_dn = m_basedc;
 		TQString ldap_filter = "(objectClass=posixAccount)";
 
-		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if ((retcode != LDAP_SUCCESS) && (retcode != LDAP_SIZELIMIT_EXCEEDED)) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -777,7 +777,7 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
 		else if (retcode == LDAP_SUCCESS) {
 			// Iterate through the returned entries
 			LDAPMessage* entry;
-			for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+			for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 				users.append(parseLDAPUserRecord(entry));
 			}
 
@@ -791,11 +791,11 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
 			// Try paged access
 			bool morePages = false;
 			unsigned long pageSize = 100;
-			struct berval cookie = {0, NULL};
+			struct berval cookie = {0, nullptr};
 			char pagingCriticality = 'T';
-			LDAPControl* pageControl = NULL;
-			LDAPControl* serverControls[2] = { NULL, NULL };
-			LDAPControl** returnedControls = NULL;
+			LDAPControl* pageControl = nullptr;
+			LDAPControl* serverControls[2] = { nullptr, nullptr };
+			LDAPControl** returnedControls = nullptr;
 
 			do {
 				retcode = ldap_create_page_control(m_ldap, pageSize, &cookie, pagingCriticality, &pageControl);
@@ -810,7 +810,7 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
 					return LDAPUserInfoList();
 				}
 				serverControls[0] = pageControl;
-				retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, serverControls, NULL, NULL, 0, &msg);
+				retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, serverControls, nullptr, nullptr, 0, &msg);
 				if ((retcode != LDAP_SUCCESS) && (retcode != LDAP_PARTIAL_RESULTS)) {
 					if (errstr) {
 						*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -821,7 +821,7 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
 					if (mretcode) *mretcode = -1;
 					return LDAPUserInfoList();
 				}
-				retcode = ldap_parse_result(m_ldap, msg, &errcode, NULL, NULL, NULL, &returnedControls, false);
+				retcode = ldap_parse_result(m_ldap, msg, &errcode, nullptr, nullptr, nullptr, &returnedControls, false);
 				if (retcode != LDAP_SUCCESS) {
 					if (errstr) {
 						*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -832,30 +832,30 @@ LDAPUserInfoList LDAPManager::users(int* mretcode, TQString *errstr) {
 					if (mretcode) *mretcode = -1;
 					return LDAPUserInfoList();
 				}
-				if (cookie.bv_val != NULL) {
+				if (cookie.bv_val) {
 					ber_memfree(cookie.bv_val);
-					cookie.bv_val = NULL;
+					cookie.bv_val = nullptr;
 					cookie.bv_len = 0;
 				}
 				if (!!returnedControls) {
-					retcode = ldap_parse_pageresponse_control(m_ldap, returnedControls[0], NULL, &cookie);
+					retcode = ldap_parse_pageresponse_control(m_ldap, returnedControls[0], nullptr, &cookie);
 					morePages = (cookie.bv_val && (strlen(cookie.bv_val) > 0));
 				}
 				else {
 					morePages = false;
 				}
 
-				if (returnedControls != NULL) {
+				if (returnedControls) {
 					ldap_controls_free(returnedControls);
-					returnedControls = NULL;
+					returnedControls = nullptr;
 				}
-				serverControls[0] = NULL;
+				serverControls[0] = nullptr;
 				ldap_control_free(pageControl);
-				pageControl = NULL;
+				pageControl = nullptr;
 
 				// Iterate through the returned entries
 				LDAPMessage* entry;
-				for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+				for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 					users.append(parseLDAPUserRecord(entry));
 				}
 
@@ -880,7 +880,7 @@ LDAPUserInfo LDAPManager::getUserByDistinguishedName(TQString dn) {
 	}
 	else {
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
 			return LDAPUserInfo();
@@ -888,7 +888,7 @@ LDAPUserInfo LDAPManager::getUserByDistinguishedName(TQString dn) {
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			userinfo = parseLDAPUserRecord(entry);
 		}
 
@@ -910,7 +910,7 @@ LDAPGroupInfo LDAPManager::getGroupByDistinguishedName(TQString dn, TQString *er
 	}
 	else {
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -919,7 +919,7 @@ LDAPGroupInfo LDAPManager::getGroupByDistinguishedName(TQString dn, TQString *er
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			groupinfo = parseLDAPGroupRecord(entry);
 		}
 
@@ -936,7 +936,7 @@ void create_single_attribute_operation(LDAPMod **mods, int *i, TQString attr, TQ
 	if (value != "") {
 		char **values = (char**)malloc(2*sizeof(char*));
 		values[0] = strdup(value.ascii());
-		values[1] = NULL;
+		values[1] = nullptr;
 		mods[*i]->mod_op = LDAP_MOD_ADD;
 		mods[*i]->mod_type = strdup(attr.ascii());
 		mods[*i]->mod_values = values;
@@ -953,7 +953,7 @@ void create_multiple_attributes_operation(LDAPMod **mods, int *i, TQString attr,
 			j++;
 		}
 	}
-	values[j] = NULL;
+	values[j] = nullptr;
 	mods[*i]->mod_op = LDAP_MOD_ADD;
 	mods[*i]->mod_type = strdup(attr.ascii());
 	mods[*i]->mod_values = values;
@@ -964,7 +964,7 @@ void add_single_attribute_operation(LDAPMod **mods, int *i, TQString attr, TQStr
 	if (value != "") {
 		char **values = (char**)malloc(2*sizeof(char*));
 		values[0] = strdup(value.ascii());
-		values[1] = NULL;
+		values[1] = nullptr;
 		mods[*i]->mod_op = LDAP_MOD_REPLACE;
 		mods[*i]->mod_type = strdup(attr.ascii());
 		mods[*i]->mod_values = values;
@@ -972,7 +972,7 @@ void add_single_attribute_operation(LDAPMod **mods, int *i, TQString attr, TQStr
 	}
 	else {
 		char **values = (char**)malloc(sizeof(char*));
-		values[0] = NULL;
+		values[0] = nullptr;
 		mods[*i]->mod_op = LDAP_MOD_REPLACE;
 		mods[*i]->mod_type = strdup(attr.ascii());
 		mods[*i]->mod_values = values;
@@ -986,7 +986,7 @@ void add_single_binary_attribute_operation(LDAPMod **mods, int *i, TQString attr
 		values[0] = new berval;
 		values[0]->bv_len = ba.size();
 		values[0]->bv_val = ba.data();
-		values[1] = NULL;
+		values[1] = nullptr;
 		mods[*i]->mod_op = LDAP_MOD_REPLACE|LDAP_MOD_BVALUES;
 		mods[*i]->mod_type = strdup(attr.ascii());
 		mods[*i]->mod_bvalues = values;
@@ -994,7 +994,7 @@ void add_single_binary_attribute_operation(LDAPMod **mods, int *i, TQString attr
 	}
 	else {
 		char **values = (char**)malloc(sizeof(char*));
-		values[0] = NULL;
+		values[0] = nullptr;
 		mods[*i]->mod_op = LDAP_MOD_REPLACE;
 		mods[*i]->mod_type = strdup(attr.ascii());
 		mods[*i]->mod_values = values;
@@ -1011,7 +1011,7 @@ void add_multiple_attributes_operation(LDAPMod **mods, int *i, TQString attr, TQ
 			j++;
 		}
 	}
-	values[j] = NULL;
+	values[j] = nullptr;
 	mods[*i]->mod_op = LDAP_MOD_REPLACE;
 	mods[*i]->mod_type = strdup(attr.ascii());
 	mods[*i]->mod_values = values;
@@ -1029,7 +1029,7 @@ void add_multiple_binary_attributes_operation(LDAPMod **mods, int *i, TQString a
 			j++;
 		}
 	}
-	values[j] = NULL;
+	values[j] = nullptr;
 	mods[*i]->mod_op = LDAP_MOD_REPLACE|LDAP_MOD_BVALUES;
 	mods[*i]->mod_type = strdup(attr.ascii());
 	mods[*i]->mod_bvalues = values;
@@ -1046,21 +1046,21 @@ void set_up_attribute_operations(LDAPMod **mods, int number_of_parameters) {
 	int i;
 	for (i=0;i<number_of_parameters;i++) {
 		mods[i] = new LDAPMod;
-		mods[i]->mod_type = NULL;
-		mods[i]->mod_values = NULL;
+		mods[i]->mod_type = nullptr;
+		mods[i]->mod_values = nullptr;
 	}
-	mods[number_of_parameters] = NULL;
+	mods[number_of_parameters] = nullptr;
 }
 
 void clean_up_attribute_operations(int i, LDAPMod **mods, LDAPMod *prevterm, int number_of_parameters) {
 	mods[i] = prevterm;
 	for (i=0;i<number_of_parameters;i++) {
-		if (mods[i]->mod_type != NULL) {
+		if (mods[i]->mod_type) {
 			free(mods[i]->mod_type);
 		}
-		if (mods[i]->mod_values != NULL) {
+		if (mods[i]->mod_values) {
 			int j = 0;
-			while (mods[i]->mod_values[j] != NULL) {
+			while (mods[i]->mod_values[j]) {
 				free(mods[i]->mod_values[j]);
 				j++;
 			}
@@ -1129,8 +1129,8 @@ int LDAPManager::updateUserInfo(LDAPUserInfo user, TQString *errstr) {
 			pkinit_acl->val = (HDB_Ext_PKINIT_acl::HDB_Ext_PKINIT_acl_val*)malloc(sizeof(pkinit_acl->val[0]));
 			pkinit_acl->len = 1;
 			pkinit_acl->val->subject = const_cast<char*>(pkinit_acl_subject.ascii());
-			pkinit_acl->val->issuer = NULL;
-			pkinit_acl->val->anchor = NULL;
+			pkinit_acl->val->issuer = nullptr;
+			pkinit_acl->val->anchor = nullptr;
 			unsigned char *asn1_encoding_buf;
 			size_t initial_size = 0;
 			size_t resultant_size = 0;
@@ -1211,10 +1211,10 @@ int LDAPManager::updateUserInfo(LDAPUserInfo user, TQString *errstr) {
 		add_single_attribute_operation(mods, &i, "notes", user.notes);
 		add_single_binary_attribute_operation(mods, &i, "krb5ExtendedAttributes", acl_asn1_data);
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Perform LDAP update
-		retcode = ldap_modify_ext_s(m_ldap, user.distinguishedName.ascii(), mods, NULL, NULL);
+		retcode = ldap_modify_ext_s(m_ldap, user.distinguishedName.ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -1352,14 +1352,14 @@ int LDAPManager::bindKAdmin(LDAPCredentials *administrativeCredentials, TQString
 			}
 
 			// Bypass password quality checks
-			kadm5_setup_passwd_quality_check(m_krb5admContext, NULL, NULL);
-			krb5adm_ret = kadm5_add_passwd_quality_verifier(m_krb5admContext, NULL);
+			kadm5_setup_passwd_quality_check(m_krb5admContext, nullptr, nullptr);
+			krb5adm_ret = kadm5_add_passwd_quality_verifier(m_krb5admContext, nullptr);
 			if (krb5adm_ret) {
 				if (errstr) *errstr = i18n("%1<p>Details:<br>Failed to execute kadm5_add_passwd_quality_verifier (code %2)").arg(krb5_get_error_message(m_krb5admContext, krb5adm_ret)).arg(krb5adm_ret);
 			}
 
 			// Initialize context
-			krb5adm_ret = kadm5_s_init_with_password_ctx(m_krb5admContext, KADM5_ADMIN_SERVICE, NULL, KADM5_ADMIN_SERVICE, &params, KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, &m_krb5admHandle);
+			krb5adm_ret = kadm5_s_init_with_password_ctx(m_krb5admContext, KADM5_ADMIN_SERVICE, nullptr, KADM5_ADMIN_SERVICE, &params, KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, &m_krb5admHandle);
 			if (krb5adm_ret) {
 				if (errstr) *errstr = i18n("%1<p>Details:<br>Failed to execute kadm5_s_init_with_password_ctx (code %2)").arg(krb5_get_error_message(m_krb5admContext, krb5adm_ret)).arg(krb5adm_ret);
 			}
@@ -1396,17 +1396,17 @@ int LDAPManager::bindKAdmin(LDAPCredentials *administrativeCredentials, TQString
 int LDAPManager::unbindKAdmin(TQString *errstr) {
 	if (m_krb5admKeytabFilename) {
 		free(m_krb5admKeytabFilename);
-		m_krb5admKeytabFilename = NULL;
+		m_krb5admKeytabFilename = nullptr;
 	}
 	if (m_krb5admRealmName) {
 		free(m_krb5admRealmName);
-		m_krb5admRealmName = NULL;
+		m_krb5admRealmName = nullptr;
 	}
 
 	kadm5_destroy(m_krb5admHandle);
 	krb5_free_context(m_krb5admContext);
 
-	m_krb5admHandle = NULL;
+	m_krb5admHandle = nullptr;
 
 	return 0;
 }
@@ -1424,12 +1424,12 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
 		retcode = 0;
 	}
 	else {
-		retcode = bindKAdmin(NULL, errstr);
+		retcode = bindKAdmin(nullptr, errstr);
 		kadmin_unbind_needed = true;
 	}
 	if (retcode == 0) {
 		retcode = 1;
-		krb5_principal user_kadm5_principal = NULL;
+		krb5_principal user_kadm5_principal = nullptr;
 		krb5adm_ret = krb5_parse_name(m_krb5admContext, user.name.ascii(), &user_kadm5_principal);
 		if (krb5adm_ret) {
 			if (errstr) *errstr = i18n("%1<p>Details:<br>Failed to execute krb5_parse_name for user '%2' (code %3)").arg(krb5_get_error_message(m_krb5admContext, krb5adm_ret)).arg(user.name).arg(krb5adm_ret);
@@ -1681,8 +1681,8 @@ KerberosTicketInfoList LDAPManager::getKerberosTicketList(TQString cache, TQStri
 LDAPRealmConfigList LDAPManager::fetchAndReadTDERealmList(TQString *defaultRealm)
 {
 	TDESimpleConfig* systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
-	systemconfig->setGroup(NULL);
-	if (defaultRealm != NULL) {
+	systemconfig->setGroup(nullptr);
+	if (defaultRealm) {
 		*defaultRealm = systemconfig->readEntry("DefaultRealm", TQString::null);
 	}
 	LDAPRealmConfigList realms = LDAPManager::readTDERealmList(systemconfig, false);
@@ -1793,7 +1793,7 @@ int LDAPManager::obtainKerberosTicket(LDAPCredentials creds, TQString principal,
 	if (creds.use_smartcard) {
 		// Get PKCS#11 slot number from the LDAP configuration file
 		TDESimpleConfig* systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
-		systemconfig->setGroup(NULL);
+		systemconfig->setGroup(nullptr);
 		int pkcs11_login_card_slot = systemconfig->readNumEntry("PKCS11LoginCardSlot", 0);
 		delete systemconfig;
 
@@ -1814,7 +1814,7 @@ int LDAPManager::obtainKerberosTicket(LDAPCredentials creds, TQString principal,
 			X509CertificatePtrList certList = cdevice->cardX509Certificates();
 			if (certList.count() > 0) {
 				TQStringList::Iterator it;
-				KSSLCertificate* card_cert = NULL;
+				KSSLCertificate* card_cert = nullptr;
 				card_cert = KSSLCertificate::fromX509(certList[0]);
 				TQStringList cert_subject_parts = TQStringList::split("/", card_cert->getSubject(), false);
 				TQStringList reversed_cert_subject_parts;
@@ -1924,7 +1924,7 @@ int LDAPManager::changeKerberosPassword(LDAPCredentials oldCreds, LDAPCredential
 	if (oldCreds.use_smartcard) {
 		// Get PKCS#11 slot number from the LDAP configuration file
 		TDESimpleConfig* systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
-		systemconfig->setGroup(NULL);
+		systemconfig->setGroup(nullptr);
 		int pkcs11_login_card_slot = systemconfig->readNumEntry("PKCS11LoginCardSlot", 0);
 		delete systemconfig;
 
@@ -1945,7 +1945,7 @@ int LDAPManager::changeKerberosPassword(LDAPCredentials oldCreds, LDAPCredential
 			X509CertificatePtrList certList = cdevice->cardX509Certificates();
 			if (certList.count() > 0) {
 				TQStringList::Iterator it;
-				KSSLCertificate* card_cert = NULL;
+				KSSLCertificate* card_cert = nullptr;
 				card_cert = KSSLCertificate::fromX509(certList[0]);
 				TQStringList cert_subject_parts = TQStringList::split("/", card_cert->getSubject(), false);
 				TQStringList reversed_cert_subject_parts;
@@ -2081,10 +2081,10 @@ int LDAPManager::updateGroupInfo(LDAPGroupInfo group, TQString *errstr) {
 		add_single_attribute_operation(mods, &i, "displayName", group.displayName);
 
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Perform LDAP update
-		retcode = ldap_modify_ext_s(m_ldap, group.distinguishedName.ascii(), mods, NULL, NULL);
+		retcode = ldap_modify_ext_s(m_ldap, group.distinguishedName.ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -2149,10 +2149,10 @@ int LDAPManager::addUserInfo(LDAPUserInfo user, TQString *errstr) {
 		create_single_attribute_operation(mods, &i, "emsprimarygroupdn", "None");
 		create_single_attribute_operation(mods, &i, "emstype", "UserEntry");
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Add new object
-		retcode = ldap_add_ext_s(m_ldap, user.distinguishedName.ascii(), mods, NULL, NULL);
+		retcode = ldap_add_ext_s(m_ldap, user.distinguishedName.ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -2199,10 +2199,10 @@ int LDAPManager::addGroupInfo(LDAPGroupInfo group, TQString *errstr) {
 		create_single_attribute_operation(mods, &i, "emsdescription", "None");
 		create_single_attribute_operation(mods, &i, "emstype", "GroupEntry");
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Add new object
-		retcode = ldap_add_ext_s(m_ldap, group.distinguishedName.ascii(), mods, NULL, NULL);
+		retcode = ldap_add_ext_s(m_ldap, group.distinguishedName.ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -2226,14 +2226,14 @@ int LDAPManager::kAdminAddNewPrincipal(TQString principalName, TQString newPassw
 	int retcode;
 	kadm5_ret_t krb5adm_ret;
 	int i;
-	char* password = NULL;
+	char* password = nullptr;
 
 	bool kadmin_unbind_needed = false;
 	if (m_krb5admHandle) {
 		retcode = 0;
 	}
 	else {
-		retcode = bindKAdmin(NULL, errstr);
+		retcode = bindKAdmin(nullptr, errstr);
 		kadmin_unbind_needed = true;
 	}
 	if (retcode == 0) {
@@ -2250,8 +2250,8 @@ int LDAPManager::kAdminAddNewPrincipal(TQString principalName, TQString newPassw
 		// Construct and add new principal record
 		kadm5_principal_ent_rec principal_record;
 		kadm5_principal_ent_rec default_record;
-		kadm5_principal_ent_rec *default_entry = NULL;
-		krb5_principal principal_entry = NULL;
+		kadm5_principal_ent_rec *default_entry = nullptr;
+		krb5_principal principal_entry = nullptr;
 		int mask = 0;
 
 		memset(&principal_record, 0, sizeof(principal_record));
@@ -2265,7 +2265,7 @@ int LDAPManager::kAdminAddNewPrincipal(TQString principalName, TQString newPassw
 		default_entry = &default_record;
 		krb5adm_ret = kadm5_get_default_principal_info(m_krb5admContext, m_krb5admHandle, principal_entry, default_entry);
 		if (krb5adm_ret) {
-			default_entry = NULL;
+			default_entry = nullptr;
 			if (errstr) *errstr = i18n("%1<p>Details:<br>Failed to execute kadm5_get_default_principal_info (code %2)").arg(krb5_get_error_message(m_krb5admContext, krb5adm_ret)).arg(krb5adm_ret);
 		}
 		else {
@@ -2290,7 +2290,7 @@ int LDAPManager::kAdminAddNewPrincipal(TQString principalName, TQString newPassw
 					if (password) {
 						if (randomNode.readBlock(password, KRB5_ANK_RANDOM_PASSWORD_LENGTH) < KRB5_ANK_RANDOM_PASSWORD_LENGTH) {
 							free(password);
-							password = NULL;
+							password = nullptr;
 						}
 						else {
 							for (i = 0; i < KRB5_ANK_RANDOM_PASSWORD_LENGTH - 1; i++) {
@@ -2379,12 +2379,12 @@ int LDAPManager::kAdminDeletePrincipal(TQString principalName, TQString *errstr)
 		retcode = 0;
 	}
 	else {
-		retcode = bindKAdmin(NULL, errstr);
+		retcode = bindKAdmin(nullptr, errstr);
 		kadmin_unbind_needed = true;
 	}
 	if (retcode == 0) {
 		retcode = 1;
-		krb5_principal principal_entry = NULL;
+		krb5_principal principal_entry = nullptr;
 		krb5adm_ret = krb5_parse_name(m_krb5admContext, principalName.ascii(), &principal_entry);
 		if (krb5adm_ret) {
 			if (errstr) *errstr = i18n("%1<p>Details:<br>Failed to execute krb5_parse_name for principal '%2' (code %3)").arg(krb5_get_error_message(m_krb5admContext, krb5adm_ret)).arg(principalName).arg(krb5adm_ret);
@@ -2446,7 +2446,7 @@ int LDAPManager::deleteUserInfo(LDAPUserInfo user, TQString *errstr) {
 		}
 
 		// Delete the base DN entry
-		retcode = ldap_delete_ext_s(m_ldap, user.distinguishedName.ascii(), NULL, NULL);
+		retcode = ldap_delete_ext_s(m_ldap, user.distinguishedName.ascii(), nullptr, nullptr);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP deletion failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2471,7 +2471,7 @@ int LDAPManager::deleteGroupInfo(LDAPGroupInfo group, TQString *errstr) {
 	}
 	else {
 		// Delete the base DN entry
-		retcode = ldap_delete_ext_s(m_ldap, group.distinguishedName.ascii(), NULL, NULL);
+		retcode = ldap_delete_ext_s(m_ldap, group.distinguishedName.ascii(), nullptr, nullptr);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP deletion failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2496,7 +2496,7 @@ int LDAPManager::deleteMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
 	}
 	else {
 		// Delete the base DN entry
-		retcode = ldap_delete_ext_s(m_ldap, machine.distinguishedName.ascii(), NULL, NULL);
+		retcode = ldap_delete_ext_s(m_ldap, machine.distinguishedName.ascii(), nullptr, nullptr);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP deletion failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2521,7 +2521,7 @@ int LDAPManager::deleteServiceInfo(LDAPServiceInfo service, TQString *errstr) {
 	}
 	else {
 		// Delete the base DN entry
-		retcode = ldap_delete_ext_s(m_ldap, service.distinguishedName.ascii(), NULL, NULL);
+		retcode = ldap_delete_ext_s(m_ldap, service.distinguishedName.ascii(), nullptr, nullptr);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP deletion failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2538,7 +2538,7 @@ int LDAPManager::deleteServiceInfo(LDAPServiceInfo service, TQString *errstr) {
 }
 
 LDAPGroupInfo LDAPManager::parseLDAPGroupRecord(LDAPMessage* entry) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
@@ -2546,7 +2546,7 @@ LDAPGroupInfo LDAPManager::parseLDAPGroupRecord(LDAPMessage* entry) {
 
 	LDAPGroupInfo groupinfo;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		groupinfo.distinguishedName = dn;
 		TQStringList dnParts = TQStringList::split(",", dn);
 		TQString id = dnParts[0];
@@ -2557,8 +2557,8 @@ LDAPGroupInfo LDAPManager::parseLDAPGroupRecord(LDAPMessage* entry) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			groupinfo.informationValid = true;
 			TQString ldap_field = attr;
 			i=0;
@@ -2567,7 +2567,7 @@ LDAPGroupInfo LDAPManager::parseLDAPGroupRecord(LDAPMessage* entry) {
 			}
 			else if (ldap_field == "member") {
 				TQStringList members;
-				for(i = 0; vals[i] != NULL; i++) {
+				for(i = 0; vals[i]; i++) {
 					TQString userdn = vals[i]->bv_val;
 					if (userdn.startsWith("cn=placeholder,dc=")) {
 						continue;
@@ -2590,7 +2590,7 @@ LDAPGroupInfo LDAPManager::parseLDAPGroupRecord(LDAPMessage* entry) {
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -2598,7 +2598,7 @@ LDAPGroupInfo LDAPManager::parseLDAPGroupRecord(LDAPMessage* entry) {
 }
 
 LDAPMachineInfo LDAPManager::parseLDAPMachineRecord(LDAPMessage* entry) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
@@ -2606,7 +2606,7 @@ LDAPMachineInfo LDAPManager::parseLDAPMachineRecord(LDAPMessage* entry) {
 
 	LDAPMachineInfo machineinfo;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		machineinfo.distinguishedName = dn;
 		TQStringList dnParts = TQStringList::split(",", dn);
 		TQString id = dnParts[0];
@@ -2618,8 +2618,8 @@ LDAPMachineInfo LDAPManager::parseLDAPMachineRecord(LDAPMessage* entry) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			machineinfo.informationValid = true;
 			TQString ldap_field = attr;
 			i=0;
@@ -2637,7 +2637,7 @@ LDAPMachineInfo LDAPManager::parseLDAPMachineRecord(LDAPMessage* entry) {
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -2645,7 +2645,7 @@ LDAPMachineInfo LDAPManager::parseLDAPMachineRecord(LDAPMessage* entry) {
 }
 
 LDAPServiceInfo LDAPManager::parseLDAPMachineServiceRecord(LDAPMessage* entry) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
@@ -2653,7 +2653,7 @@ LDAPServiceInfo LDAPManager::parseLDAPMachineServiceRecord(LDAPMessage* entry) {
 
 	LDAPServiceInfo machineserviceinfo;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		machineserviceinfo.distinguishedName = dn;
 		TQStringList dnParts = TQStringList::split(",", dn);
 		TQString id = dnParts[0];
@@ -2664,8 +2664,8 @@ LDAPServiceInfo LDAPManager::parseLDAPMachineServiceRecord(LDAPMessage* entry) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			machineserviceinfo.informationValid = true;
 			TQString ldap_field = attr;
 			i=0;
@@ -2683,7 +2683,7 @@ LDAPServiceInfo LDAPManager::parseLDAPMachineServiceRecord(LDAPMessage* entry) {
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -2703,7 +2703,7 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
 		LDAPMessage* msg;
 		TQString ldap_base_dn = m_basedc;
 		TQString ldap_filter = "(objectClass=posixGroup)";
-		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if ((retcode != LDAP_SUCCESS) && (retcode != LDAP_SIZELIMIT_EXCEEDED)) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2717,7 +2717,7 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
 		else if (retcode == LDAP_SUCCESS) {
 			// Iterate through the returned entries
 			LDAPMessage* entry;
-			for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+			for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 				groups.append(parseLDAPGroupRecord(entry));
 			}
 
@@ -2731,11 +2731,11 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
 			// Try paged access
 			bool morePages = false;
 			unsigned long pageSize = 100;
-			struct berval cookie = {0, NULL};
+			struct berval cookie = {0, nullptr};
 			char pagingCriticality = 'T';
-			LDAPControl* pageControl = NULL;
-			LDAPControl* serverControls[2] = { NULL, NULL };
-			LDAPControl** returnedControls = NULL;
+			LDAPControl* pageControl = nullptr;
+			LDAPControl* serverControls[2] = { nullptr, nullptr };
+			LDAPControl** returnedControls = nullptr;
 
 			do {
 				retcode = ldap_create_page_control(m_ldap, pageSize, &cookie, pagingCriticality, &pageControl);
@@ -2750,7 +2750,7 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
 					return LDAPGroupInfoList();
 				}
 				serverControls[0] = pageControl;
-				retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, serverControls, NULL, NULL, 0, &msg);
+				retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, serverControls, nullptr, nullptr, 0, &msg);
 				if ((retcode != LDAP_SUCCESS) && (retcode != LDAP_PARTIAL_RESULTS)) {
 					if (errstr) {
 						*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2761,7 +2761,7 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
 					if (mretcode) *mretcode = -1;
 					return LDAPGroupInfoList();
 				}
-				retcode = ldap_parse_result(m_ldap, msg, &errcode, NULL, NULL, NULL, &returnedControls, false);
+				retcode = ldap_parse_result(m_ldap, msg, &errcode, nullptr, nullptr, nullptr, &returnedControls, false);
 				if (retcode != LDAP_SUCCESS) {
 					if (errstr) {
 						*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2772,30 +2772,30 @@ LDAPGroupInfoList LDAPManager::groups(int* mretcode, TQString *errstr) {
 					if (mretcode) *mretcode = -1;
 					return LDAPGroupInfoList();
 				}
-				if (cookie.bv_val != NULL) {
+				if (cookie.bv_val) {
 					ber_memfree(cookie.bv_val);
-					cookie.bv_val = NULL;
+					cookie.bv_val = nullptr;
 					cookie.bv_len = 0;
 				}
 				if (!!returnedControls) {
-					retcode = ldap_parse_pageresponse_control(m_ldap, returnedControls[0], NULL, &cookie);
+					retcode = ldap_parse_pageresponse_control(m_ldap, returnedControls[0], nullptr, &cookie);
 					morePages = (cookie.bv_val && (strlen(cookie.bv_val) > 0));
 				}
 				else {
 					morePages = false;
 				}
 
-				if (returnedControls != NULL) {
+				if (returnedControls) {
 					ldap_controls_free(returnedControls);
-					returnedControls = NULL;
+					returnedControls = nullptr;
 				}
-				serverControls[0] = NULL;
+				serverControls[0] = nullptr;
 				ldap_control_free(pageControl);
-				pageControl = NULL;
+				pageControl = nullptr;
 
 				// Iterate through the returned entries
 				LDAPMessage* entry;
-				for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+				for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 					groups.append(parseLDAPGroupRecord(entry));
 				}
 
@@ -2824,7 +2824,7 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
 		LDAPMessage* msg;
 		TQString ldap_base_dn = m_basedc;
 		TQString ldap_filter = "(&(objectClass=krb5Principal)(uid=host/*))";
-		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if ((retcode != LDAP_SUCCESS) && (retcode != LDAP_SIZELIMIT_EXCEEDED)) {
 			if (errstr) {
 				*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2838,7 +2838,7 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
 		else if (retcode == LDAP_SUCCESS) {
 			// Iterate through the returned entries
 			LDAPMessage* entry;
-			for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+			for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 				machines.append(parseLDAPMachineRecord(entry));
 			}
 
@@ -2852,11 +2852,11 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
 			// Try paged access
 			bool morePages = false;
 			unsigned long pageSize = 100;
-			struct berval cookie = {0, NULL};
+			struct berval cookie = {0, nullptr};
 			char pagingCriticality = 'T';
-			LDAPControl* pageControl = NULL;
-			LDAPControl* serverControls[2] = { NULL, NULL };
-			LDAPControl** returnedControls = NULL;
+			LDAPControl* pageControl = nullptr;
+			LDAPControl* serverControls[2] = { nullptr, nullptr };
+			LDAPControl** returnedControls = nullptr;
 
 			do {
 				retcode = ldap_create_page_control(m_ldap, pageSize, &cookie, pagingCriticality, &pageControl);
@@ -2871,7 +2871,7 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
 					return LDAPMachineInfoList();
 				}
 				serverControls[0] = pageControl;
-				retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, serverControls, NULL, NULL, 0, &msg);
+				retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, serverControls, nullptr, nullptr, 0, &msg);
 				if ((retcode != LDAP_SUCCESS) && (retcode != LDAP_PARTIAL_RESULTS)) {
 					if (errstr) {
 						*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2882,7 +2882,7 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
 					if (mretcode) *mretcode = -1;
 					return LDAPMachineInfoList();
 				}
-				retcode = ldap_parse_result(m_ldap, msg, &errcode, NULL, NULL, NULL, &returnedControls, false);
+				retcode = ldap_parse_result(m_ldap, msg, &errcode, nullptr, nullptr, nullptr, &returnedControls, false);
 				if (retcode != LDAP_SUCCESS) {
 					if (errstr) {
 						*errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
@@ -2893,30 +2893,30 @@ LDAPMachineInfoList LDAPManager::machines(int* mretcode, TQString *errstr) {
 					if (mretcode) *mretcode = -1;
 					return LDAPMachineInfoList();
 				}
-				if (cookie.bv_val != NULL) {
+				if (cookie.bv_val) {
 					ber_memfree(cookie.bv_val);
-					cookie.bv_val = NULL;
+					cookie.bv_val = nullptr;
 					cookie.bv_len = 0;
 				}
 				if (!!returnedControls) {
-					retcode = ldap_parse_pageresponse_control(m_ldap, returnedControls[0], NULL, &cookie);
+					retcode = ldap_parse_pageresponse_control(m_ldap, returnedControls[0], nullptr, &cookie);
 					morePages = (cookie.bv_val && (strlen(cookie.bv_val) > 0));
 				}
 				else {
 					morePages = false;
 				}
 
-				if (returnedControls != NULL) {
+				if (returnedControls) {
 					ldap_controls_free(returnedControls);
-					returnedControls = NULL;
+					returnedControls = nullptr;
 				}
-				serverControls[0] = NULL;
+				serverControls[0] = nullptr;
 				ldap_control_free(pageControl);
-				pageControl = NULL;
+				pageControl = nullptr;
 
 				// Iterate through the returned entries
 				LDAPMessage* entry;
-				for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+				for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 					machines.append(parseLDAPMachineRecord(entry));
 				}
 
@@ -2984,7 +2984,7 @@ LDAPServiceInfoList LDAPManager::machineServices(TQString machine_dn, int* mretc
 		}
 
 		TQString ldap_filter = TQString("(&(objectClass=krb5Principal)(uid=*/%1))").arg(machine_name);
-		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
 			if (mretcode) *mretcode = -1;
@@ -2993,7 +2993,7 @@ LDAPServiceInfoList LDAPManager::machineServices(TQString machine_dn, int* mretc
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			LDAPServiceInfo sinfo = parseLDAPMachineServiceRecord(entry);
 			sinfo.machine_dn = machine_dn;
 			sinfo.machine = machine_name;
@@ -3022,7 +3022,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
 		retcode = 0;
 	}
 	else {
-		retcode = bindKAdmin(NULL, errstr);
+		retcode = bindKAdmin(nullptr, errstr);
 		kadmin_unbind_needed = true;
 	}
 	if (retcode == 0) {
@@ -3040,7 +3040,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
 		}
 		else {
 			kadm5_principal_ent_rec principal_record;
-			krb5_principal principal_entry = NULL;
+			krb5_principal principal_entry = nullptr;
 
 			memset(&principal_record, 0, sizeof(principal_record));
 			krb5adm_ret = krb5_parse_name(m_krb5admContext, principal.ascii(), &principal_entry);
@@ -3062,9 +3062,9 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
 					}
 					else {
 						// Extract keys
-						krb5_keytab_entry *keys = NULL;
+						krb5_keytab_entry *keys = nullptr;
 						keys = (krb5_keytab_entry*)calloc(sizeof(*keys), principal_record.n_key_data);
-						if (keys == NULL) {
+						if (!keys) {
 							if (errstr) *errstr = i18n("Out of memory");
 						}
 						else {
@@ -3077,7 +3077,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
 								keys[i].keyblock.keytype = kd->key_data_type[0];
 								keys[i].keyblock.keyvalue.length = kd->key_data_length[0];
 								keys[i].keyblock.keyvalue.data = kd->key_data_contents[0];
-								keys[i].timestamp = time(NULL);
+								keys[i].timestamp = time(nullptr);
 								key_count++;
 							}
 							if (key_count < 1) {
@@ -3123,7 +3123,7 @@ int LDAPManager::deleteKeytabEntriesForPrincipal(TQString principal, TQString fi
 		retcode = 0;
 	}
 	else {
-		retcode = bindKAdmin(NULL, errstr);
+		retcode = bindKAdmin(nullptr, errstr);
 		kadmin_unbind_needed = true;
 	}
 	if (retcode == 0) {
@@ -3140,7 +3140,7 @@ int LDAPManager::deleteKeytabEntriesForPrincipal(TQString principal, TQString fi
 			if (errstr) *errstr = i18n("%1<p>Details:<br>Failed to open keytab file '%2' (code %3)").arg(krb5_get_error_message(m_krb5admContext, krb5adm_ret)).arg(fileName).arg(krb5adm_ret);
 		}
 		else {
-			krb5_principal principal_entry = NULL;
+			krb5_principal principal_entry = nullptr;
 
 			krb5adm_ret = krb5_parse_name(m_krb5admContext, principal.ascii(), &principal_entry);
 			if (krb5adm_ret) {
@@ -3191,10 +3191,10 @@ int LDAPManager::writeCertificateFileIntoDirectory(TQByteArray cert, TQString at
 		i=0;
 		add_single_binary_attribute_operation(mods, &i, attr, cert);
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Perform LDAP update
-		retcode = ldap_modify_ext_s(m_ldap, TQString("cn=certificate store,o=tde,cn=tde realm data,ou=master services,ou=core,ou=realm,%1").arg(m_basedc).ascii(), mods, NULL, NULL);
+		retcode = ldap_modify_ext_s(m_ldap, TQString("cn=certificate store,o=tde,cn=tde realm data,ou=master services,ou=core,ou=realm,%1").arg(m_basedc).ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -3246,10 +3246,10 @@ int LDAPManager::writePKICertificateFilesIntoDirectory(LDAPUserInfo user, TQStri
 		i=0;
 		add_multiple_attributes_operation(mods, &i, attr, serializedCertificateList);
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Perform LDAP update
-		retcode = ldap_modify_ext_s(m_ldap, user.distinguishedName.ascii(), mods, NULL, NULL);
+		retcode = ldap_modify_ext_s(m_ldap, user.distinguishedName.ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -3280,7 +3280,7 @@ TQString LDAPManager::getRealmCAMaster(TQString* errstr) {
 	}
 	else {
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -3289,7 +3289,7 @@ TQString LDAPManager::getRealmCAMaster(TQString* errstr) {
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			TQString result;
 			if (parseLDAPTDEStringAttribute(entry, "publicRootCertificateOriginServer", result)) {
 				realmCAMaster = result;
@@ -3321,10 +3321,10 @@ int LDAPManager::setRealmCAMaster(TQString masterFQDN, TQString* errstr) {
 		i=0;
 		add_single_attribute_operation(mods, &i, "publicRootCertificateOriginServer", masterFQDN);
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Perform LDAP update
-		retcode = ldap_modify_ext_s(m_ldap, TQString("cn=certificate store,o=tde,cn=tde realm data,ou=master services,ou=core,ou=realm,%1").arg(m_basedc).ascii(), mods, NULL, NULL);
+		retcode = ldap_modify_ext_s(m_ldap, TQString("cn=certificate store,o=tde,cn=tde realm data,ou=master services,ou=core,ou=realm,%1").arg(m_basedc).ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -3357,7 +3357,7 @@ int LDAPManager::getLdapCertificateStoreAttribute(TQString attribute, TQString*
 	}
 	else {
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -3368,7 +3368,7 @@ int LDAPManager::getLdapCertificateStoreAttribute(TQString attribute, TQString*
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			char* attr;
 			struct berval **vals;
 			BerElement* ber;
@@ -3376,8 +3376,8 @@ int LDAPManager::getLdapCertificateStoreAttribute(TQString attribute, TQString*
 
 			LDAPTDEBuiltinsInfo builtininfo;
 
-			for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-				if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+			for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+				if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 					builtininfo.informationValid = true;
 					TQString ldap_field = attr;
 					i=0;
@@ -3394,7 +3394,7 @@ int LDAPManager::getLdapCertificateStoreAttribute(TQString attribute, TQString*
 				if (errstr) *errstr = i18n("Resource \"%s\" not found in LDAP certificate store").arg(attribute);
 			}
 
-			if (ber != NULL) {
+			if (ber) {
 				ber_free(ber, 0);
 			}
 		}
@@ -3426,10 +3426,10 @@ int LDAPManager::setLdapCertificateStoreAttribute(TQString attribute, TQString v
 		i=0;
 		add_single_attribute_operation(mods, &i, attribute, value);
 		LDAPMod *prevterm = mods[i];
-		mods[i] = NULL;
+		mods[i] = nullptr;
 
 		// Perform LDAP update
-		retcode = ldap_modify_ext_s(m_ldap, TQString("cn=certificate store,o=tde,cn=tde realm data,ou=master services,ou=core,ou=realm,%1").arg(m_basedc).ascii(), mods, NULL, NULL);
+		retcode = ldap_modify_ext_s(m_ldap, TQString("cn=certificate store,o=tde,cn=tde realm data,ou=master services,ou=core,ou=realm,%1").arg(m_basedc).ascii(), mods, nullptr, nullptr);
 
 		// Clean up
 		clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -3456,7 +3456,7 @@ int LDAPManager::moveKerberosEntries(TQString newSuffix, TQString* errstr) {
 		LDAPMessage* msg;
 		TQString ldap_base_dn = m_basedc;
 		TQString ldap_filter = "(&(objectClass=krb5Principal)(!(objectClass=posixAccount)))";
-		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
 			return -1;
@@ -3464,15 +3464,15 @@ int LDAPManager::moveKerberosEntries(TQString newSuffix, TQString* errstr) {
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
-			char* dn = NULL;
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
+			char* dn = nullptr;
 
 			LDAPMachineInfo machineinfo;
 
-			if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+			if((dn = ldap_get_dn(m_ldap, entry))) {
 				TQStringList dnParts = TQStringList::split(",", dn);
 				TQString id = dnParts[0];
-				retcode = ldap_rename_s(m_ldap, dn, id.utf8(), newSuffix.utf8(), 0, NULL, NULL);
+				retcode = ldap_rename_s(m_ldap, dn, id.utf8(), newSuffix.utf8(), 0, nullptr, nullptr);
 				if (retcode != LDAP_SUCCESS) {
 					if (errstr) *errstr = i18n("LDAP rename failure<p>Reason: [%3] %4").arg(retcode).arg(ldap_err2string(retcode));
 					return -1;
@@ -3501,7 +3501,7 @@ int LDAPManager::writeLDAPConfFile(LDAPRealmConfig realmcfg, LDAPMachineRole mac
 	TQCString command;
 
 	systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
-	systemconfig->setGroup(NULL);
+	systemconfig->setGroup(nullptr);
 	m_defaultRealm = systemconfig->readEntry("DefaultRealm", TQString::null);
 
 	m_ldapVersion = systemconfig->readNumEntry("ConnectionLDAPVersion", 3);
@@ -3622,7 +3622,7 @@ int LDAPManager::writeLDAPConfFile(LDAPRealmConfig realmcfg, LDAPMachineRole mac
 }
 
 LDAPTDEBuiltinsInfo LDAPManager::parseLDAPTDEBuiltinsRecord(LDAPMessage* entry) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
@@ -3630,12 +3630,12 @@ LDAPTDEBuiltinsInfo LDAPManager::parseLDAPTDEBuiltinsRecord(LDAPMessage* entry)
 
 	LDAPTDEBuiltinsInfo builtininfo;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			builtininfo.informationValid = true;
 			TQString ldap_field = attr;
 			i=0;
@@ -3656,7 +3656,7 @@ LDAPTDEBuiltinsInfo LDAPManager::parseLDAPTDEBuiltinsRecord(LDAPMessage* entry)
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -3664,7 +3664,7 @@ LDAPTDEBuiltinsInfo LDAPManager::parseLDAPTDEBuiltinsRecord(LDAPMessage* entry)
 }
 
 bool LDAPManager::parseLDAPTDEStringAttribute(LDAPMessage* entry, TQString attribute, TQString& retval) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
@@ -3673,12 +3673,12 @@ bool LDAPManager::parseLDAPTDEStringAttribute(LDAPMessage* entry, TQString attri
 
 	LDAPTDEBuiltinsInfo builtininfo;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			builtininfo.informationValid = true;
 			TQString ldap_field = attr;
 			i=0;
@@ -3691,7 +3691,7 @@ bool LDAPManager::parseLDAPTDEStringAttribute(LDAPMessage* entry, TQString attri
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -3699,22 +3699,22 @@ bool LDAPManager::parseLDAPTDEStringAttribute(LDAPMessage* entry, TQString attri
 }
 
 LDAPMasterReplicationInfo LDAPManager::parseLDAPMasterReplicationRecord(LDAPMasterReplicationInfo replicationinfo, LDAPMessage* entry) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
 	int i;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			TQString ldap_field = attr;
 			if (ldap_field == "olcServerID") {
 				i=0;
-				while (vals[i] != NULL) {
+				while (vals[i]) {
 					TQStringList serverIDMapping = TQStringList::split(" ", TQString(vals[i]->bv_val), false);
 					LDAPMasterReplicationMapping mapping;
 					mapping.id = serverIDMapping[0].toInt();
@@ -3742,7 +3742,7 @@ LDAPMasterReplicationInfo LDAPManager::parseLDAPMasterReplicationRecord(LDAPMast
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -3750,23 +3750,23 @@ LDAPMasterReplicationInfo LDAPManager::parseLDAPMasterReplicationRecord(LDAPMast
 }
 
 TQString LDAPManager::parseLDAPSyncProvOverlayConfigRecord(LDAPMessage* entry) {
-	char* dn = NULL;
+	char* dn = nullptr;
 	char* attr;
 	struct berval **vals;
 	BerElement* ber;
 	int i;
 	TQString syncProvEntry;
 
-	if((dn = ldap_get_dn(m_ldap, entry)) != NULL) {
+	if((dn = ldap_get_dn(m_ldap, entry))) {
 		ldap_memfree(dn);
 	}
 
-	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-		if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+	for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+		if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 			TQString ldap_field = attr;
 			if (ldap_field == "olcOverlay") {
 				i=0;
-				while (vals[i] != NULL) {
+				while (vals[i]) {
 					TQString value(vals[i]->bv_val);
 					if (value.endsWith("}syncprov")) {
 						syncProvEntry = value;
@@ -3779,7 +3779,7 @@ TQString LDAPManager::parseLDAPSyncProvOverlayConfigRecord(LDAPMessage* entry) {
 		ldap_memfree(attr);
 	}
 
-	if (ber != NULL) {
+	if (ber) {
 		ber_free(ber, 0);
 	}
 
@@ -3797,7 +3797,7 @@ LDAPTDEBuiltinsInfo LDAPManager::getTDEBuiltinMappings(TQString *errstr) {
 	}
 	else {
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -3806,7 +3806,7 @@ LDAPTDEBuiltinsInfo LDAPManager::getTDEBuiltinMappings(TQString *errstr) {
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			builtininfo = parseLDAPTDEBuiltinsRecord(entry);
 		}
 
@@ -3829,7 +3829,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
 	else {
 		// Check cn=config settings
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, "cn=config", LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, "cn=config", LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -3838,7 +3838,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			LDAPMasterReplicationInfo potentialReplicationInfo;
 			potentialReplicationInfo = parseLDAPMasterReplicationRecord(LDAPMasterReplicationInfo(), entry);
 			if (potentialReplicationInfo.informationValid) {
@@ -3853,7 +3853,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
 		replicationinfo.enabled = false;
 
 		// Check olcDatabase 0 configuration settings
-		retcode = ldap_search_ext_s(m_ldap, "olcDatabase={0}config,cn=config", LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, "olcDatabase={0}config,cn=config", LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -3861,7 +3861,7 @@ LDAPMasterReplicationInfo LDAPManager::getLDAPMasterReplicationSettings(TQString
 		}
 
 		// Iterate through the returned entries
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			replicationinfo = parseLDAPMasterReplicationRecord(replicationinfo, entry);
 		}
 
@@ -3940,10 +3940,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 			}
 			add_multiple_attributes_operation(mods, &i, "olcServerID", serverMappingList);
 			LDAPMod *prevterm = mods[i];
-			mods[i] = NULL;
+			mods[i] = nullptr;
 
 			// Perform LDAP update
-			retcode = ldap_modify_ext_s(m_ldap, "cn=config", mods, NULL, NULL);
+			retcode = ldap_modify_ext_s(m_ldap, "cn=config", mods, nullptr, nullptr);
 
 			// Clean up
 			clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -3965,10 +3965,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 				}
 				create_multiple_attributes_operation(mods, &i, "olcServerID", serverMappingList);
 				LDAPMod *prevterm = mods[i];
-				mods[i] = NULL;
+				mods[i] = nullptr;
 
 				// Perform LDAP update
-				retcode = ldap_add_ext_s(m_ldap, "cn=config", mods, NULL, NULL);
+				retcode = ldap_add_ext_s(m_ldap, "cn=config", mods, nullptr, nullptr);
 
 				// Clean up
 				clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -3991,10 +3991,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 			i=0;
 			delete_single_attribute_operation(mods, &i, "olcServerID");
 			LDAPMod *prevterm = mods[i];
-			mods[i] = NULL;
+			mods[i] = nullptr;
 
 			// Perform LDAP update
-			retcode = ldap_modify_ext_s(m_ldap, "cn=config", mods, NULL, NULL);
+			retcode = ldap_modify_ext_s(m_ldap, "cn=config", mods, nullptr, nullptr);
 
 			// Clean up
 			clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4040,10 +4040,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 					add_multiple_attributes_operation(mods, &i, "olcSyncRepl", syncReplServerList);
 					add_single_attribute_operation(mods, &i, "olcMirrorMode", "TRUE");
 					LDAPMod *prevterm = mods[i];
-					mods[i] = NULL;
+					mods[i] = nullptr;
 
 					// Perform LDAP update
-					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={0}config,cn=config", mods, NULL, NULL);
+					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={0}config,cn=config", mods, nullptr, nullptr);
 
 					// Clean up
 					clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4087,10 +4087,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 					add_multiple_attributes_operation(mods, &i, "olcSyncRepl", syncReplServerList);
 					add_single_attribute_operation(mods, &i, "olcMirrorMode", "TRUE");
 					LDAPMod *prevterm = mods[i];
-					mods[i] = NULL;
+					mods[i] = nullptr;
 
 					// Perform LDAP update
-					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={1}mdb,cn=config", mods, NULL, NULL);
+					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={1}mdb,cn=config", mods, nullptr, nullptr);
 
 					// Clean up
 					clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4117,10 +4117,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 					delete_single_attribute_operation(mods, &i, "olcSyncRepl");
 					delete_single_attribute_operation(mods, &i, "olcMirrorMode");
 					LDAPMod *prevterm = mods[i];
-					mods[i] = NULL;
+					mods[i] = nullptr;
 
 					// Perform LDAP update
-					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={1}mdb,cn=config", mods, NULL, NULL);
+					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={1}mdb,cn=config", mods, nullptr, nullptr);
 
 					// Clean up
 					clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4144,10 +4144,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 					delete_single_attribute_operation(mods, &i, "olcSyncRepl");
 					delete_single_attribute_operation(mods, &i, "olcMirrorMode");
 					LDAPMod *prevterm = mods[i];
-					mods[i] = NULL;
+					mods[i] = nullptr;
 
 					// Perform LDAP update
-					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={0}config,cn=config", mods, NULL, NULL);
+					retcode = ldap_modify_ext_s(m_ldap, "olcDatabase={0}config,cn=config", mods, nullptr, nullptr);
 
 					// Clean up
 					clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4161,7 +4161,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 			}
 
 			// Get current active replication settings
-			TQString* readOnlyErrorString = NULL;
+			TQString* readOnlyErrorString = nullptr;
 			LDAPMasterReplicationInfo currentReplicationInfo = getLDAPMasterReplicationSettings(readOnlyErrorString);
 			if (readOnlyErrorString) {
 				// Uh oh
@@ -4176,7 +4176,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 				// Check to see if the syncprov overlay entries already exist
 				bool haveOlcOverlaySyncProv = false;
 				LDAPMessage* msg;
-				retcode = ldap_search_ext_s(m_ldap, "olcDatabase={0}config,cn=config", LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+				retcode = ldap_search_ext_s(m_ldap, "olcDatabase={0}config,cn=config", LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 				if (retcode != LDAP_SUCCESS) {
 					if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 					else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -4185,7 +4185,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 
 				// Iterate through the returned entries
 				LDAPMessage* entry;
-				for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+				for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 					if (parseLDAPSyncProvOverlayConfigRecord(entry) != "") {
 						haveOlcOverlaySyncProv = true;
 					}
@@ -4207,10 +4207,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 					objectClassList.append("olcSyncProvConfig");
 					create_multiple_attributes_operation(mods, &i, "objectClass", objectClassList);
 					LDAPMod *prevterm = mods[i];
-					mods[i] = NULL;
+					mods[i] = nullptr;
 
 					// Add new object
-					retcode = ldap_add_ext_s(m_ldap, "olcOverlay=syncprov,olcDatabase={0}config,cn=config", mods, NULL, NULL);
+					retcode = ldap_add_ext_s(m_ldap, "olcOverlay=syncprov,olcDatabase={0}config,cn=config", mods, nullptr, nullptr);
 
 					// Clean up
 					clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4227,7 +4227,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 				}
 
 				haveOlcOverlaySyncProv = false;
-				retcode = ldap_search_ext_s(m_ldap, "olcDatabase={1}mdb,cn=config", LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+				retcode = ldap_search_ext_s(m_ldap, "olcDatabase={1}mdb,cn=config", LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 				if (retcode != LDAP_SUCCESS) {
 					if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 					else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -4235,7 +4235,7 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 				}
 
 				// Iterate through the returned entries
-				for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+				for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 					if (parseLDAPSyncProvOverlayConfigRecord(entry) != "") {
 						haveOlcOverlaySyncProv = true;
 					}
@@ -4257,10 +4257,10 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
 					objectClassList.append("olcSyncProvConfig");
 					create_multiple_attributes_operation(mods, &i, "objectClass", objectClassList);
 					LDAPMod *prevterm = mods[i];
-					mods[i] = NULL;
+					mods[i] = nullptr;
 
 					// Add new object
-					retcode = ldap_add_ext_s(m_ldap, "olcOverlay=syncprov,olcDatabase={1}mdb,cn=config", mods, NULL, NULL);
+					retcode = ldap_add_ext_s(m_ldap, "olcOverlay=syncprov,olcDatabase={1}mdb,cn=config", mods, nullptr, nullptr);
 
 					// Clean up
 					clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
@@ -4308,7 +4308,7 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQByteArray *certif
 	}
 	else {
 		LDAPMessage* msg;
-		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+		retcode = ldap_search_ext_s(m_ldap, dn.ascii(), LDAP_SCOPE_SUBTREE, nullptr, ldap_user_and_operational_attributes, 0, nullptr, nullptr, nullptr, 0, &msg);
 		if (retcode != LDAP_SUCCESS) {
 			if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
 			else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@@ -4319,7 +4319,7 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQByteArray *certif
 
 		// Iterate through the returned entries
 		LDAPMessage* entry;
-		for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
+		for(entry = ldap_first_entry(m_ldap, msg); entry; entry = ldap_next_entry(m_ldap, entry)) {
 			char* attr;
 			struct berval **vals;
 			BerElement* ber;
@@ -4327,8 +4327,8 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQByteArray *certif
 
 			LDAPTDEBuiltinsInfo builtininfo;
 
-			for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr != NULL; attr = ldap_next_attribute(m_ldap, entry, ber)) {
-				if ((vals = ldap_get_values_len(m_ldap, entry, attr)) != NULL)  {
+			for( attr = ldap_first_attribute(m_ldap, entry, &ber); attr; attr = ldap_next_attribute(m_ldap, entry, ber)) {
+				if ((vals = ldap_get_values_len(m_ldap, entry, attr)))  {
 					builtininfo.informationValid = true;
 					TQString ldap_field = attr;
 					i=0;
@@ -4345,7 +4345,7 @@ int LDAPManager::getTDECertificate(TQString certificateName, TQByteArray *certif
 				if (errstr) *errstr = i18n("Resource \"%1\" not found in LDAP database").arg(certificateName);
 			}
 
-			if (ber != NULL) {
+			if (ber) {
 				ber_free(ber, 0);
 			}
 		}
@@ -4647,7 +4647,7 @@ int LDAPManager::writeTDERealmList(LDAPRealmConfigList realms, TDESimpleConfig*
 TQDateTime LDAPManager::getCertificateExpiration(TQByteArray certfileContents) {
 	TQDateTime ret;
 
-	KSSLCertificate* cert = NULL;
+	KSSLCertificate* cert = nullptr;
 	TQCString ssldata(certfileContents);
 	if (certfileContents.size() > 0) {
 		ssldata[certfileContents.size()] = 0;
@@ -5077,11 +5077,11 @@ TQString LDAPManager::getMachineFQDN() {
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_flags = AI_CANONNAME;
 
-	if ((gai_result = getaddrinfo(hostname, NULL, &hints, &info)) != 0) {
+	if ((gai_result = getaddrinfo(hostname, nullptr, &hints, &info)) != 0) {
 		return TQString(hostname);
 	}
 	TQString fqdn = TQString(hostname);
-	for (p=info; p!=NULL; p=p->ai_next) {
+	for (p=info; p; p=p->ai_next) {
 		fqdn = TQString(p->ai_canonname);
 	}
 	freeaddrinfo(info);
@@ -5094,7 +5094,7 @@ LDAPClientRealmConfig LDAPManager::loadClientRealmConfig(TDESimpleConfig* config
 
 	config->setReadDefaults(useDefaults);
 
-	config->setGroup(NULL);
+	config->setGroup(nullptr);
 	clientRealmConfig.enable_bonding = config->readBoolEntry("EnableLDAP", false);
 	clientRealmConfig.defaultRealm = config->readEntry("DefaultRealm", TQString::null);
 	clientRealmConfig.ticketLifetime = config->readNumEntry("TicketLifetime", 86400);
@@ -5126,7 +5126,7 @@ LDAPClientRealmConfig LDAPManager::loadClientRealmConfig(TDESimpleConfig* config
 int LDAPManager::saveClientRealmConfig(LDAPClientRealmConfig clientRealmConfig, TDESimpleConfig* config, TQString *errstr) {
 	Q_UNUSED(errstr)
 
-	config->setGroup(NULL);
+	config->setGroup(nullptr);
 	config->writeEntry("EnableLDAP", clientRealmConfig.enable_bonding);
 	config->writeEntry("HostFQDN", clientRealmConfig.hostFQDN);
 
@@ -5166,7 +5166,7 @@ int LDAPManager::writeClientKrb5ConfFile(LDAPClientRealmConfig clientRealmConfig
 
 		// Get PKCS#11 slot number from the LDAP configuration file
 		TDESimpleConfig* systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
-		systemconfig->setGroup(NULL);
+		systemconfig->setGroup(nullptr);
 		int pkcs11_login_card_slot = systemconfig->readNumEntry("PKCS11LoginCardSlot", 0);
 		delete systemconfig;
 
@@ -5791,7 +5791,7 @@ bool LDAPManager::pkcsLoginEnabled() {
 	bool enabled;
 
 	TDESimpleConfig* systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" ));
-	systemconfig->setGroup(NULL);
+	systemconfig->setGroup(nullptr);
 	enabled = systemconfig->readBoolEntry("EnablePKCS11Login", false);
 	delete systemconfig;
 
diff --git a/src/libtdeldap.h b/src/libtdeldap.h
index 050e1cf..921273b 100644
--- a/src/libtdeldap.h
+++ b/src/libtdeldap.h
@@ -600,7 +600,7 @@ class TDE_EXPORT LDAPManager : public TQObject {
 					const TQString &adminPassword, const TQString &adminRealm, TQString *errstr=0);
 
 	private:
-		int bindKAdmin(LDAPCredentials *administrativeCredentials=NULL, TQString *errstr=0);
+		int bindKAdmin(LDAPCredentials *administrativeCredentials=nullptr, TQString *errstr=0);
 		int unbindKAdmin(TQString *errstr=0);
 		int kAdminAddNewPrincipal(TQString principalName, TQString newPassword, TQString *errstr=0);
 		int kAdminDeletePrincipal(TQString principalName, TQString *errstr=0);
-- 
cgit v1.2.3

