]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Fixes to support ntp_random on Windows and miscellaneous fixes for all platforms...
authorDanny Mayer <mayer@ntp.org>
Mon, 15 Aug 2005 23:41:00 +0000 (19:41 -0400)
committerDanny Mayer <mayer@ntp.org>
Mon, 15 Aug 2005 23:41:00 +0000 (19:41 -0400)
bk: 4301280cOczqjLDt683bzbpV6S5L8g

14 files changed:
include/ntp.h
include/ntp_random.h [new file with mode: 0644]
include/ntpd.h
libntp/Makefile.am
libntp/ntp_random.c [moved from libntp/random.c with 99% similarity]
ntpd/ntp_config.c
ntpd/ntp_crypto.c
ntpd/ntp_monitor.c
ntpd/ntp_peer.c
ntpd/ntpd.c
ports/winnt/include/config.h
ports/winnt/libntp/libntp.dsp
ports/winnt/ntp-keygen/ntpkeygen.dsp
ports/winnt/ntpd/ntpd.dsp

index 695f1794d7cb70a125b7646fd53a8e0ed3736964..036093812fcfa9e01ec790d5a6556be2c38d145d 100644 (file)
@@ -9,6 +9,7 @@
 #ifdef OPENSSL
 #include "ntp_crypto.h"
 #endif /* OPENSSL */
+#include <ntp_random.h>
 
 #include <isc/boolean.h>
 
diff --git a/include/ntp_random.h b/include/ntp_random.h
new file mode 100644 (file)
index 0000000..766dcc3
--- /dev/null
@@ -0,0 +1,14 @@
+
+#include <ntp_types.h>
+
+long ntp_random P((void));
+void ntp_srandom P((unsigned long));
+void ntp_srandomdev P((void));
+char * ntp_initstate P((unsigned long,         /* seed for R.N.G. */
+                       char *,         /* pointer to state array */
+                       long            /* # bytes of state info */
+                       ));
+char * ntp_setstate P((char *));       /* pointer to state array */
+
+
+
index 501238dd3b2b33d423fa85c92cfe4685ed9539c1..c009c577c965f6fa09253a0a68d4c87aea2cbeca 100644 (file)
 #ifdef SYS_WINNT
 #define exit ntservice_exit
 extern void    ntservice_exit  (int);
-/*     declare the service threads */
-void   service_main    (DWORD, LPTSTR *);
-void   service_ctrl    (DWORD);
-void   worker_thread   (void *);
 #define sleep(x) Sleep((DWORD) x * 1000 /* milliseconds */ );
 #endif /* SYS_WINNT */
 
-extern void    ntp_srandom     P((unsigned long));
-extern int     ntp_random      P((void));
-
 /* ntp_config.c */
 extern void    getconfig       P((int, char **));
 
index e2ddb76071e0949e569de6d42d0b9cda4a028e33..9047ea8e0f9885e67c20c6ac387238667690671f 100644 (file)
@@ -11,7 +11,7 @@ libntp_a_SRCS = a_md5encrypt.c adjtime.c atoint.c atolfp.c atouint.c \
        lib_strbuf.c machines.c md5c.c memmove.c mfptoa.c \
        mfptoms.c mktime.c modetoa.c mstolfp.c msutotsf.c msyslog.c netof.c \
        ntp_rfc2553.c numtoa.c numtohost.c octtoint.c prettydate.c \
-       random.c recvbuff.c refnumtoa.c snprintf.c socktoa.c socktohost.c \
+       ntp_random.c recvbuff.c refnumtoa.c snprintf.c socktoa.c socktohost.c \
        statestr.c strdup.c strerror.c strstr.c \
        syssignal.c tsftomsu.c tstotv.c tvtoa.c tvtots.c \
        uglydate.c uinttoa.c utvtoa.c ymd2yd.c \
similarity index 99%
rename from libntp/random.c
rename to libntp/ntp_random.c
index e59fc854ab136f3f98addbad0856fd4d0fd0e314..700b4ee651013b7f7691fed6d9ad02ab2afb935f 100644 (file)
@@ -48,6 +48,8 @@ static char sccsid[] = "@(#)random.c  8.2 (Berkeley) 5/19/95";
 #include <stdio.h>
 
 #include <ntp_types.h>
+#include <ntp_random.h>
+#include <ntp_unixtime.h>
 
 /*
  * random.c:
@@ -218,7 +220,6 @@ static long rand_sep = SEP_3;
 static long *end_ptr = &randtbl[DEG_3 + 1];
 
 static inline long good_rand P((long));
-long ntp_random P((void));
 
 static inline long
 good_rand (
@@ -295,16 +296,18 @@ ntp_srandom(
  * state buffer are no longer derived from the LC algorithm applied to
  * a fixed seed.
  */
+#ifdef NEED_SRANDOMDEV
 void
 ntp_srandomdev( void )
 {
        struct timeval tv;
        unsigned long junk;     /* Purposely used uninitialized */
 
-       gettimeofday(&tv, NULL);
+       GETTIMEOFDAY(&tv, NULL);
        ntp_srandom(getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk);
        return;
 }
+#endif
 
 /*
  * initstate:
index fe57f55793b10ae09f87958f7ba422e4dc421980..1ebba00b673e8c7bb01c35c833c12be793f9d6db 100644 (file)
@@ -17,6 +17,7 @@
 #include "ntp_stdlib.h"
 #include "ntp_config.h"
 #include "ntp_cmdargs.h"
+#include <ntp_random.h>
 #include <isc/net.h>
 #include <isc/result.h>
 
index 124887f6f7d96e831a7513853aaaa36dd635971e..affbeb2c4a345fd43e76600bfa45350163cd8d32 100644 (file)
@@ -16,6 +16,7 @@
 #include "ntp_stdlib.h"
 #include "ntp_unixtime.h"
 #include "ntp_string.h"
+#include <ntp_random.h>
 
 #include "openssl/asn1_mac.h"
 #include "openssl/bn.h"
index f998dcaba310245e1e91d752360dff4547287445..64188f0a8c13a5f0803bd650ff955e3ec4397948 100644 (file)
@@ -9,6 +9,7 @@
 #include "ntp_io.h"
 #include "ntp_if.h"
 #include "ntp_stdlib.h"
+#include <ntp_random.h>
 
 #include <stdio.h>
 #include <signal.h>
index 629c4bf6222b945237c5eb80ac2df23d43192bac..868ed1927a390123e0a7c9876ca48b1059767a58 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "ntpd.h"
 #include "ntp_stdlib.h"
+#include <ntp_random.h>
 #ifdef OPENSSL
 #include "openssl/rand.h"
 #endif /* OPENSSL */
index ac92df92b2a46b737cf77ea887a395550d270838..a4bb5b2bd1b1d5d2c61dcdaf0ae01806f17236bd 100644 (file)
@@ -10,6 +10,7 @@
 #include "ntpd.h"
 #include "ntp_io.h"
 #include "ntp_stdlib.h"
+#include <ntp_random.h>
 
 #ifdef SIM
 #include "ntpsim.h"
index 1ed7f877ac36010b2f1fd60f763ee61167eac140..8ecaf219564d5b5e34821d398c846d85652d9af6 100644 (file)
@@ -75,6 +75,7 @@
  * Miscellaneous functions that Microsoft maps
  * to other names
  */
+#define inline __inline
 #define vsnprintf _vsnprintf
 #define snprintf _snprintf
 #define stricmp _stricmp
index 9cd2cb97fda9a1527f9bd8abf64da69d9268a72d..9ecdbd3062a7cfad4268534ec42a93df743eb145 100644 (file)
@@ -122,10 +122,6 @@ SOURCE=..\..\..\libntp\authusekey.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\libntp\binio.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\..\libntp\buftvtots.c
 # End Source File
 # Begin Source File
@@ -190,10 +186,6 @@ SOURCE=..\..\..\libntp\getopt.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\libntp\gpstolfp.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\..\libntp\hextoint.c
 # End Source File
 # Begin Source File
@@ -206,10 +198,6 @@ SOURCE=..\..\..\libntp\humandate.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\libntp\ieee754io.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\..\libisc\inet_aton.c
 # End Source File
 # Begin Source File
@@ -262,10 +250,6 @@ SOURCE=..\..\..\libntp\memmove.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\libntp\mfp_mul.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\..\libntp\mfptoa.c
 # End Source File
 # Begin Source File
@@ -314,6 +298,10 @@ SOURCE=..\..\..\libisc\netscope.c
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\libntp\ntp_random.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\libntp\ntp_rfc2553.c
 # End Source File
 # Begin Source File
@@ -342,10 +330,6 @@ SOURCE=.\randfile.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\libntp\ranny.c
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\..\libntp\recvbuff.c
 # End Source File
 # Begin Source File
@@ -542,6 +526,10 @@ SOURCE=..\..\..\include\ntp_proto.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\include\ntp_random.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\include\ntp_refclock.h
 # End Source File
 # Begin Source File
index b45f7995dc8e3c8a6f62f98024e8df6298ea782f..1d800061be72c455899d0905f2749ae6f34a3fb2 100644 (file)
@@ -96,6 +96,10 @@ SOURCE="..\..\..\util\ntp-keygen.c"
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\libntp\ntp_random.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\libntp\randfile.c
 # End Source File
 # Begin Source File
index 43c8a27c305f925fcee961d4b3024d371084eacf..df476d3026f19534c7e9f60caecf5addd32e11cd 100644 (file)
@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /GX /O2 /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7d\inc32" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c
+# ADD CPP /nologo /MD /W4 /GX /O2 /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7d\inc32" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -280,6 +280,10 @@ SOURCE=..\..\..\include\ntp_proto.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\include\ntp_random.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\include\ntp_refclock.h
 # End Source File
 # Begin Source File