]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Remove long deprecated and/or unused code. 16226/head
authorMiod Vallat <miod.vallat@powerdns.com>
Thu, 9 Oct 2025 08:55:19 +0000 (10:55 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 9 Oct 2025 09:02:23 +0000 (11:02 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/ldapbackend/powerldap.cc
modules/ldapbackend/powerldap.hh

index edd97f0c5a7b3938f9f235779597bc9bc5764502..f1011555431aa8122eebfd8b0ed1588e9020b8b7 100644 (file)
@@ -214,49 +214,6 @@ void PowerLDAP::bind(LdapAuthenticator* authenticator)
     throw LDAPException("Failed to bind to LDAP server: " + authenticator->getError());
 }
 
-void PowerLDAP::bind(const string& ldapbinddn, const string& ldapsecret, int /* method */)
-{
-  int msgid;
-
-#ifdef HAVE_LDAP_SASL_BIND
-  int rc;
-  struct berval passwd;
-
-  passwd.bv_val = (char*)ldapsecret.c_str();
-  passwd.bv_len = strlen(passwd.bv_val);
-
-  if ((rc = ldap_sasl_bind(d_ld, ldapbinddn.c_str(), LDAP_SASL_SIMPLE, &passwd, NULL, NULL, &msgid)) != LDAP_SUCCESS) {
-    throw LDAPException("Failed to bind to LDAP server: " + getError(rc));
-  }
-#else
-  if ((msgid = ldap_bind(d_ld, ldapbinddn.c_str(), ldapsecret.c_str(), method)) == -1) {
-    throw LDAPException("Failed to bind to LDAP server: " + getError(msgid));
-  }
-#endif
-
-  ldapWaitResult(d_ld, msgid, d_timeout, NULL);
-}
-
-/**
- * Deprecated, use PowerLDAP::bind() instead
- */
-
-void PowerLDAP::simpleBind(const string& ldapbinddn, const string& ldapsecret)
-{
-  this->bind(ldapbinddn, ldapsecret, LDAP_AUTH_SIMPLE);
-}
-
-void PowerLDAP::add(const string& dn, LDAPMod* mods[])
-{
-  int rc;
-
-  rc = ldap_add_ext_s(d_ld, dn.c_str(), mods, NULL, NULL);
-  if (rc == LDAP_SERVER_DOWN || rc == LDAP_CONNECT_ERROR)
-    throw LDAPNoConnection();
-  else if (rc != LDAP_SUCCESS)
-    throw LDAPException("Error adding LDAP entry " + dn + ": " + getError(rc));
-}
-
 void PowerLDAP::modify(const string& dn, LDAPMod* mods[], LDAPControl** scontrols, LDAPControl** ccontrols)
 {
   int rc;
@@ -268,17 +225,6 @@ void PowerLDAP::modify(const string& dn, LDAPMod* mods[], LDAPControl** scontrol
     throw LDAPException("Error modifying LDAP entry " + dn + ": " + getError(rc));
 }
 
-void PowerLDAP::del(const string& dn)
-{
-  int rc;
-
-  rc = ldap_delete_ext_s(d_ld, dn.c_str(), NULL, NULL);
-  if (rc == LDAP_SERVER_DOWN || rc == LDAP_CONNECT_ERROR)
-    throw LDAPNoConnection();
-  else if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT)
-    throw LDAPException("Error deleting LDAP entry " + dn + ": " + getError(rc));
-}
-
 PowerLDAP::SearchResult::Ptr PowerLDAP::search(const string& base, int scope, const string& filter, const char** attr)
 {
   int msgid, rc;
@@ -377,16 +323,6 @@ bool PowerLDAP::getSearchEntry(int msgid, sentry_t& entry, bool dn)
   return true;
 }
 
-void PowerLDAP::getSearchResults(int msgid, sresult_t& result, bool dn)
-{
-  sentry_t entry;
-
-  result.clear();
-  while (getSearchEntry(msgid, entry, dn)) {
-    result.push_back(entry);
-  }
-}
-
 const string PowerLDAP::getError(int rc)
 {
   return ldapGetError(d_ld, rc);
index e8b030d78fb5b9c12e3623cc8f8377941c2b189c..1e2faa9dd7112b7115ebbcb4e29aff5f24bf6809 100644 (file)
@@ -84,15 +84,10 @@ public:
   void setOption(int option, int value);
 
   void bind(LdapAuthenticator* authenticator);
-  void bind(const string& ldapbinddn = "", const string& ldapsecret = "", int method = LDAP_AUTH_SIMPLE);
-  void simpleBind(const string& ldapbinddn = "", const string& ldapsecret = "");
   SearchResult::Ptr search(const string& base, int scope, const string& filter, const char** attr = 0);
-  void add(const string& dn, LDAPMod* mods[]);
   void modify(const string& dn, LDAPMod* mods[], LDAPControl** scontrols = 0, LDAPControl** ccontrols = 0);
-  void del(const string& dn);
 
   bool getSearchEntry(int msgid, sentry_t& entry, bool dn = false);
-  void getSearchResults(int msgid, sresult_t& result, bool dn = false);
 
   static const string escape(const string& tobe);
 };