]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1773] openssl not detected during ./configure.
authorDave Hart <hart@ntp.org>
Thu, 6 Jan 2011 04:02:24 +0000 (04:02 +0000)
committerDave Hart <hart@ntp.org>
Thu, 6 Jan 2011 04:02:24 +0000 (04:02 +0000)
[Bug 1774] Segfaults if cryptostats enabled and built without OpenSSL.

bk: 4d253ed0A400LyhRQIV0u23NJwuGAA

ChangeLog
m4/ntp_openssl.m4
ntpd/ntp_config.c
ntpd/ntp_util.c

index 6896b34fd87a1a719737681a110e52ff0512d78f..e56e8999858d1d603b789950c3c5a37b445b7188 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* [Bug 1773] openssl not detected during ./configure.
+* [Bug 1774] Segfaults if cryptostats enabled and built without OpenSSL.
 (4.2.7p111) 2011/01/05 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1772] refclock_open() return value check wrong for ACTS.
 * Default --with-openssl-libdir and --with-openssl-incdir to the values
index a57c55c03f97c3b0d510d8976b9823419db4c21a..192538964f79e4c9a08dc97eb7ca64ecc33dbd2b 100644 (file)
@@ -31,23 +31,20 @@ case "$ans" in
      '')
        ;;
      *)
-       pkgans=`$PKG_CONFIG --libs-only-L openssl | sed -e 's/^-L//'`
-       case "$pkgans" in
-        '')
-           # Look in:
-           ans="/usr/lib /usr/lib/openssl /usr/sfw/lib"
-           ans="$ans /usr/local/lib /usr/local/ssl/lib /lib"
-           ;;
-        *)
-           ans="$pkgans"
-           ;;
-       esac
+       pkgans="`$PKG_CONFIG --libs-only-L openssl | sed -e 's/^-L//'`" 2>/dev/null
+       test -f "${pkgans}/pkgconfig/openssl.pc" && ans="$pkgans"
        ;;
     esac
     ;;
  *) # Look where they said
     ;;
 esac
+case "$ans" in
+ yes)
+    # Look in:
+    ans="/usr/lib /usr/lib/openssl /usr/sfw/lib"
+    ans="$ans /usr/local/lib /usr/local/ssl/lib /lib"
+esac
 case "$ans" in
  no)
     ;;
@@ -100,23 +97,20 @@ case "$ans" in
      '')
        ;;
      *)
-       pkgans=`$PKG_CONFIG --cflags-only-I openssl | sed -e 's/^-I//'`
-       case "$pkgans" in
-        '')
-           # Look in:
-           ans="/usr/include /usr/sfw/include /usr/local/include"
-           ans="$ans /usr/local/ssl/include"
-           ;;
-        *)
-           ans="$pkgans"
-           ;;
-       esac
+       pkgans="`$PKG_CONFIG --cflags-only-I openssl | sed -e 's/^-I//'`" 2>/dev/null
+       test -f "${pkgans}/pkgconfig/openssl.pc" && ans="$pkgans"
        ;;
     esac
     ;;
  *) # Look where they said
     ;;
 esac
+case "$ans" in
+ yes)
+    # Look in:
+    ans="/usr/include /usr/sfw/include /usr/local/include"
+    ans="$ans /usr/local/ssl/include"
+esac
 case "$ans" in
  no)
     ;;
index ca17b39ae1418e0e64bfa7a096d6304361ced7a1..e6a61f083295ae39896b10e1d2d2b67b48783112 100644 (file)
@@ -2015,6 +2015,12 @@ config_monitor(
        for (; pfilegen_token != NULL; pfilegen_token = pfilegen_token->link) {
                filegen_string = keyword(pfilegen_token->i);
                filegen = filegen_get(filegen_string);
+               if (NULL == filegen) {
+                       msyslog(LOG_ERR,
+                               "stats %s unrecognized",
+                               filegen_string);
+                       continue;
+               }
                DPRINTF(4, ("enabling filegen for %s statistics '%s%s'\n",
                            filegen_string, filegen->prefix, 
                            filegen->basename));
@@ -2026,6 +2032,12 @@ config_monitor(
        for (; my_node != NULL; my_node = my_node->link) {
                filegen_file = keyword(my_node->filegen_token);
                filegen = filegen_get(filegen_file);
+               if (NULL == filegen) {
+                       msyslog(LOG_ERR,
+                               "filegen category '%s' unrecognized",
+                               filegen_file);
+                       continue;
+               }
 
                /* Initialize the filegen variables to their pre-configuration states */
                filegen_flag = filegen->flag;
index db8bf80f61429c7e8446e7206266c31900531d9f..d63156d11bd605b9baf070e2394148e41186ace4 100644 (file)
@@ -80,12 +80,6 @@ double       wander_threshold = 1e-7;        /* initial frequency threshold */
 # define MAXPATHLEN 256
 #endif
 
-#ifdef DEBUG_TIMING
-static FILEGEN timingstats;
-#endif
-#ifdef AUTOKEY
-static FILEGEN cryptostats;
-#endif /* AUTOKEY */
 
 static char statsdir[MAXPATHLEN] = NTP_VAR;
 static FILEGEN peerstats;
@@ -94,6 +88,8 @@ static FILEGEN clockstats;
 static FILEGEN rawstats;
 static FILEGEN sysstats;
 static FILEGEN protostats;
+static FILEGEN cryptostats;
+static FILEGEN timingstats;
 
 /*
  * This controls whether stats are written to the fileset. Provided
@@ -173,12 +169,8 @@ init_util(void)
        filegen_register(statsdir, "rawstats",    &rawstats);
        filegen_register(statsdir, "sysstats",    &sysstats);
        filegen_register(statsdir, "protostats",  &protostats);
-#ifdef AUTOKEY
        filegen_register(statsdir, "cryptostats", &cryptostats);
-#endif /* AUTOKEY */
-#ifdef DEBUG_TIMING
        filegen_register(statsdir, "timingstats", &timingstats);
-#endif /* DEBUG_TIMING */
        /*
         * register with libntp ntp_set_tod() to call us back
         * when time is stepped.