Changeset 1256

Show
Ignore:
Timestamp:
08/08/08 15:54:36 (19 months ago)
Author:
ahu
Message:

hook up dns urandom for auth server too

Location:
trunk/pdns/pdns
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/Makefile.am

    r1177 r1256  
    1 AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ 
     1AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ # -I/usr/include/lua5.1 
    22AM_CPPFLAGS=-Ibackends/bind @THREADFLAGS@ 
    33 
     
    4141rcpgenerator.cc dnsparser.cc dns_random.hh aes/aescpp.h \ 
    4242aes/aescrypt.c aes/aes.h aes/aeskey.c aes/aes_modes.c aes/aesopt.h \ 
    43 aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h aes/dns_random.cc 
     43aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h aes/dns_random.cc \ 
     44randomhelper.cc 
    4445 
    4546# 
     
    121122base64.cc base64.hh zoneparser-tng.cc zoneparser-tng.hh rec_channel.cc rec_channel.hh \ 
    122123rec_channel_rec.cc selectmplexer.cc epollmplexer.cc sillyrecords.cc htimer.cc htimer.hh \ 
    123 aes/dns_random.cc aes/aescrypt.c aes/aeskey.c aes/aestab.c aes/aes_modes.c 
     124aes/dns_random.cc aes/aescrypt.c aes/aeskey.c aes/aestab.c aes/aes_modes.c \ 
     125lua-pdns-recursor.cc lua-pdns-recursor.hh randomhelper.cc 
    124126 
    125127if NEDMALLOC 
     
    129131#../modules/gmysqlbackend/smysql.cc  
    130132 
    131 pdns_recursor_LDFLAGS= 
     133pdns_recursor_LDFLAGS=  # -llua5.1  
    132134pdns_recursor_LDADD= 
    133135 
  • trunk/pdns/pdns/common_startup.cc

    r1246 r1256  
    126126 
    127127  ::arg().set("max-cache-entries", "Maximum number of cache entries")="1000000"; 
     128  ::arg().set("entropy-source", "If set, read entropy from this file")="/dev/urandom"; 
    128129} 
    129130 
  • trunk/pdns/pdns/misc.hh

    r1246 r1256  
    384384 
    385385string stripDot(const string& dom); 
    386  
     386void seedRandom(const string& source); 
    387387#endif 
  • trunk/pdns/pdns/pdns_recursor.cc

    r1252 r1256  
    16561656} 
    16571657 
    1658 void seedRandom(const string& source); 
     1658 
    16591659 
    16601660int serviceMain(int argc, char*argv[]) 
     
    19111911#endif 
    19121912 
    1913 void seedRandom(const string& source) 
    1914 { 
    1915   L<<Logger::Warning<<"Reading random entropy from '"<<source<<"'"<<endl; 
    1916  
    1917   int fd=open(source.c_str(), O_RDONLY); 
    1918   if(fd < 0) { 
    1919     L<<Logger::Error<<"Unable to open source of random '"<<source<<"': "<<stringerror()<<endl; 
    1920     exit(EXIT_FAILURE); 
    1921   } 
    1922   char seed[16]; 
    1923   int ret; 
    1924   int pos=0; 
    1925   while(pos!=sizeof(seed)) { 
    1926     ret = read(fd, seed+pos, sizeof(seed)-pos); 
    1927     if(ret < 0) {  
    1928       L<<Logger::Error<<"Unable to read random seed from "<<source<<": "<<stringerror()<<endl; 
    1929       close(fd); 
    1930       exit(EXIT_FAILURE); 
    1931     } 
    1932     if(!ret) { 
    1933       L<<Logger::Error<<"Unable to read random seed from "<<source<<": end of file"<<endl; 
    1934       close(fd); 
    1935       exit(EXIT_FAILURE); 
    1936     } 
    1937     pos+=ret; 
    1938   } 
    1939   close(fd); 
    1940   dns_random_init(seed); 
    1941 } 
    19421913 
    19431914int main(int argc, char **argv)  
  • trunk/pdns/pdns/receiver.cc

    r1246 r1256  
    459459    // we really need to do work - either standalone or as an instance 
    460460     
     461    seedRandom(::arg()["entropy-source"]); 
     462     
    461463    loadModules(); 
    462464    BackendMakers().launch(::arg()["launch"]); // vrooooom!