]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add a modify() method to PowerLDAP
authorGrégory Oestreicher <greg@kamago.net>
Wed, 14 Sep 2016 21:17:50 +0000 (23:17 +0200)
committerGrégory Oestreicher <greg@kamago.net>
Tue, 28 Feb 2017 21:38:32 +0000 (22:38 +0100)
modules/ldapbackend/powerldap.cc
modules/ldapbackend/powerldap.hh

index 8fb82eeac7303b022183109049bef853749e4403..e7f6cc3cb7050c8da820bf67213ad290cee3606f 100644 (file)
@@ -167,6 +167,18 @@ void PowerLDAP::simpleBind( const string& ldapbinddn, const string& ldapsecret )
 }
 
 
+void PowerLDAP::modify( const string &dn, LDAPMod *mods[], LDAPControl **scontrols, LDAPControl **ccontrols )
+{
+  int rc;
+
+  rc = ldap_modify_ext_s( d_ld, dn.c_str(), mods, scontrols, ccontrols );
+  if ( rc == LDAP_SERVER_DOWN || rc == LDAP_CONNECT_ERROR )
+    throw LDAPNoConnection();
+  else if ( rc != LDAP_SUCCESS )
+    throw LDAPException( "Error modifying LDAP entry " + dn + ": " + getError( rc ) );
+}
+
+
 int PowerLDAP::search( const string& base, int scope, const string& filter, const char** attr )
 {
   int msgid, rc;
index ed5351f33cb0c8bbc5bb09aa3361765c77cf53d4..27e2f032c0700aee949586d471da8796970d1cb9 100644 (file)
@@ -68,6 +68,7 @@ class PowerLDAP
     void bind( const string& ldapbinddn = "", const string& ldapsecret = "", int method = LDAP_AUTH_SIMPLE, int timeout = 5 );
     void simpleBind( const string& ldapbinddn = "", const string& ldapsecret = "" );
     int search( const string& base, int scope, const string& filter, const char** attr = 0 );
+    void modify( const string& dn, LDAPMod *mods[], LDAPControl **scontrols = 0, LDAPControl **ccontrols = 0 );
   
     bool getSearchEntry( int msgid, sentry_t& entry, bool dn = false, int timeout = 5 );
     void getSearchResults( int msgid, sresult_t& result, bool dn = false, int timeout = 5 );