* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#pragma once
+
#include <exception>
#include <stdexcept>
#include <string>
-#ifndef LDAPEXCEPTIONS_HH
-#define LDAPEXCEPTIONS_HH
-
class LDAPException : public std::runtime_error
{
public:
explicit LDAPNoSuchObject() : LDAPException( "No such object" ) {}
};
-#endif // LDAPEXCEPTIONS_HH
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#pragma once
+
#include <ldap.h>
#include <string>
#include <config.h>
#endif
-#ifndef LDAPAUTHENTICATOR_HH
-#define LDAPAUTHENTICATOR_HH
-
class LdapAuthenticator
{
public:
virtual std::string getError() const = 0;
};
-#endif // LDAPAUTHENTICATOR_HH
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#pragma once
+
#include <krb5.h>
#include "ldapauthenticator.hh"
-#ifndef LDAPAUTHENTICATOR_P_HH
-#define LDAPAUTHENTICATOR_P_HH
-
#ifndef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS
#define krb5_get_init_creds_opt_set_default_flags( a, b, c, d ) /* This does not exist with MIT Kerberos */
#endif
virtual std::string getError() const;
};
-#endif // LDAPAUTHENTICATOR_P_HH
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
+#pragma once
+
#include <algorithm>
#include <sstream>
#include <utility>
#include "utils.hh"
-
-#ifndef LDAPBACKEND_HH
-#define LDAPBACKEND_HH
-
using std::string;
using std::vector;
void setNotified( uint32_t id, uint32_t serial ) override;
};
-#endif /* LDAPBACKEND_HH */
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#pragma once
+
#include "exceptions.hh"
#include <ldap.h>
#include <string>
-#ifndef LDAPUTILS_HH
-#define LDAPUTILS_HH
-
void ldapSetOption( LDAP *conn, int option, void *value );
void ldapGetOption( LDAP *conn, int option, void *value );
int ldapWaitResult( LDAP *conn, int msgid, int timeout, LDAPMessage** result = NULL );
-#endif // LDAPUTILS_HH
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#pragma once
+
#include <list>
#include <map>
#include <memory>
#include <lber.h>
#include <ldap.h>
-
-
-
-#ifndef POWERLDAP_HH
-#define POWERLDAP_HH
-
using std::list;
using std::map;
using std::string;
static const string escape( const string& tobe );
};
-
-
-#endif
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
+#pragma once
+
#include <string>
#include <vector>
#include <time.h>
#include "pdns/misc.hh"
#include "pdns/utility.hh"
-
-#ifndef LDAPBACKEND_UTILS_HH
-#define LDAPBACKEND_UTILS_HH
-
using std::string;
using std::vector;
return 0;
}
-#endif
string nowTime()
{
time_t now = time(nullptr);
- struct tm* tm = localtime(&now);
+ struct tm tm;
+ localtime_r(&now, &tm);
char buffer[30];
// YYYY-mm-dd HH:MM:SS TZOFF
- strftime(buffer, sizeof(buffer), "%F %T %z", tm);
+ strftime(buffer, sizeof(buffer), "%F %T %z", &tm);
buffer[sizeof(buffer)-1] = '\0';
return string(buffer);
}
fprintf(fp.get(),"; edns from thread follows\n;\n");
for(const auto& eds : t_sstorage.ednsstatus) {
count++;
- fprintf(fp.get(), "%s\t%d\t%s", eds.first.toString().c_str(), (int)eds.second.mode, ctime(&eds.second.modeSetAt));
+ char tmp[26];
+ fprintf(fp.get(), "%s\t%d\t%s", eds.first.toString().c_str(), (int)eds.second.mode, ctime_r(&eds.second.modeSetAt, tmp));
}
return count;
}
for(const auto& i : throttleMap)
{
count++;
+ char tmp[26];
// remote IP, dns name, qtype, count, ttd
- fprintf(fp.get(), "%s\t%s\t%d\t%u\t%s", i.first.get<0>().toString().c_str(), i.first.get<1>().toLogString().c_str(), i.first.get<2>(), i.second.count, ctime(&i.second.ttd));
+ fprintf(fp.get(), "%s\t%s\t%d\t%u\t%s", i.first.get<0>().toString().c_str(), i.first.get<1>().toLogString().c_str(), i.first.get<2>(), i.second.count, ctime_r(&i.second.ttd, tmp));
}
return count;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#pragma once
+
#include "dnsname.hh"
#include <string>
std::string makeTSIGKey(const DNSName& algorithm);
+