]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
allow OpenSSL DLLs' C runtime version to differ from ntpq's and ntpdc's
authorDave Hart <hart@ntp.org>
Thu, 23 Apr 2009 07:31:41 +0000 (07:31 +0000)
committerDave Hart <hart@ntp.org>
Thu, 23 Apr 2009 07:31:41 +0000 (07:31 +0000)
[Bug 833] ignore whitespace at end of remote configuration lines
[Bug 1033] ntpdc/ntpq crash prompting for keyid on Windows

bk: 49f0195dVKMhLVBiEf6Cz97Fav0FWw

ChangeLog
ntpd/ntp_scanner.c
ntpdc/ntpdc.c
ntpq/ntpq.c

index 05c99b7175526144adcbeed8180619e95ce36fda..abd00ae8478988c69e984ca0fd76fdb8b8ea972b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* [Bug 833] ignore whitespace at end of remote configuration lines
+* [Bug 1033] ntpdc/ntpq crash prompting for keyid on Windows
 * [Bug 1028] Support for W32Time authentication via Samba.
 * Mitigation and PPS/PPSAPI cleanup from Dave Mills.
 * Documentation updates from Dave Mills.
index b723a99c2615a894975dd4c668c3d5897b7315ae..4652947e2e631b30a703952f8fd000df4198c78b 100644 (file)
@@ -485,9 +485,20 @@ create_string_token(
        char *lexeme
        )
 {
-       errno = 0;
-       if ((yylval.String = strdup(lexeme)) == NULL &&
-           errno == ENOMEM) {
+       char *pch;
+
+       /*
+        * ignore end of line whitespace
+        */
+       pch = lexeme;
+       while (*pch && isspace(*pch))
+               pch++;
+
+       if (!*pch)
+               return T_EOC;
+
+       yylval.String = strdup(lexeme);
+       if (!yylval.String) {
                fprintf(stderr, "Could not allocate memory for: %s\n",
                        lexeme);
                exit(1);
index 9c2282ae87f92744d698bb18b69d756fa5a584f0..74cd12a1183b06c38df3689a954a3a093e0e7be9 100644 (file)
 #ifdef SYS_WINNT
 # include <Mswsock.h>
 # include <io.h>
+# ifdef OPENSSL
+#  pragma warning(push)
+#  pragma warning(disable: 4152)
+#  include <openssl/applink.c>
+#  pragma warning(pop)
+# endif /* OPENSSL */
 #endif /* SYS_WINNT */
 
 #if defined(HAVE_LIBREADLINE)
@@ -1976,7 +1982,7 @@ getkeyid(
 #ifndef SYS_WINNT
        if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
 #else
-           if ((fi = _fdopen((int)GetStdHandle(STD_INPUT_HANDLE), "r")) == NULL)
+       if ((fi = _fdopen(open("CONIN$", _O_TEXT), "r")) == NULL)
 #endif /* SYS_WINNT */
                fi = stdin;
            else
index 11e2a460fd0707eefd7169fa7720deb0e818d2f0..389ddffa305906f1d540c41d1151023a10d2fe3a 100644 (file)
 #ifdef SYS_WINNT
 # include <Mswsock.h>
 # include <io.h>
+# ifdef OPENSSL
+#  pragma warning(push)
+#  pragma warning(disable: 4152)
+#  include <openssl/applink.c>
+#  pragma warning(pop)
+# endif /* OPENSSL */
 #endif /* SYS_WINNT */
 
 #if defined(HAVE_LIBREADLINE)
@@ -2657,7 +2663,7 @@ getkeyid(
 #ifndef SYS_WINNT
        if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
 #else
-           if ((fi = _fdopen((int)GetStdHandle(STD_INPUT_HANDLE), "r")) == NULL)
+       if ((fi = _fdopen(open("CONIN$", _O_TEXT), "r")) == NULL)
 #endif /* SYS_WINNT */
                fi = stdin;
            else