Show
Ignore:
Timestamp:
08/08/08 15:54:36 (5 years ago)
Author:
ahu
Message:

hook up dns urandom for auth server too

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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)