#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "pdns/utility.hh"
#include "pdns/dnsbackend.hh"
#include "pdns/dns.hh"
#include "pdns/dnsbackend.hh"
#include "pdns/dnspacket.hh"
+#include "pdns/dns_random.hh"
#include "pdns/pdnsexception.hh"
#include "pdns/logger.hh"
#include "pdns/version.hh"
} else if (qdomain == d_ourname) {
if(type.getCode() == QType::A || type.getCode() == QType::ANY) {
ostringstream os;
- os<<Utility::random()%256<<"."<<Utility::random()%256<<"."<<Utility::random()%256<<"."<<Utility::random()%256;
+ os<<dns_random(256)<<"."<<dns_random(256)<<"."<<dns_random(256)<<"."<<dns_random(256);
d_answer=os.str(); // our random ip address
} else {
d_answer="";
void mainthread()
{
- Utility::srandom(time(0) ^ getpid());
-
- int newgid=0;
+ int newgid=0;
if(!::arg()["setgid"].empty())
newgid=Utility::makeGidNumeric(::arg()["setgid"]);
int newuid=0;
}
-// Returns a random number.
-long int Utility::random( void )
-{
- return rand();
-}
-
-// Sets the random seed.
-void Utility::srandom( unsigned int seed )
-{
- ::srandom(seed);
-}
-
-
// Writes a vector.
int Utility::writev(int socket, const iovec *vector, size_t count )
{
//! Writes a vector.
static int writev( Utility::sock_t socket, const iovec *vector, size_t count );
- //! Returns a random number.
- static long int random( void );
-
- //! Sets the random seed.
- static void srandom( unsigned int seed );
//! Drops the program's group privileges.
static void dropGroupPrivs( int uid, int gid );