]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 357] Fixed and additional improvements from Dave Mills
authorHarlan Stenn <stenn@ntp.org>
Mon, 6 Dec 2004 02:06:26 +0000 (21:06 -0500)
committerHarlan Stenn <stenn@ntp.org>
Mon, 6 Dec 2004 02:06:26 +0000 (21:06 -0500)
bk: 41b3bea2Ir5c_uhXmTn3v2UmPqiLsA

include/ntpd.h
ntpd/ntp_config.c
ntpd/refclock_acts.c

index 3c66f9161c412a6f5d81d63ce853c5a0d191ce75..f2444f883dd4a3778ba10bf9ce5e729539dd1111 100644 (file)
@@ -220,7 +220,7 @@ extern  int sock_hash P((struct sockaddr_storage *));
 
 /* ntp_config.c */
 extern char const *    progname;
-extern char    sys_phone[][MAXDIAL];   /* ACTS phone numbers */
+extern char    *sys_phone[];           /* ACTS phone numbers */
 #if defined(HAVE_SCHED_SETSCHEDULER)
 extern int     config_priority_override;
 extern int     config_priority;
index 8f657868cc7aa0df7a275199d8739db7035d4a4c..169881eb375dffd7c341c77caaddb702f75af549 100644 (file)
@@ -309,7 +309,7 @@ static struct masks logcfg_item[] = {
  */
 #define MAXTOKENS      20      /* 20 tokens on line */
 #define MAXLINE                1024    /* maximum length of line */
-#define MAXPHONE             /* maximum number of phone strings */
+#define MAXPHONE       10      /* maximum number of phone strings */
 #define MAXPPS         20      /* maximum length of PPS device string */
 #define MAXINCLUDELEVEL        5       /* maximum include file levels */
 
@@ -340,7 +340,7 @@ static char res_file[MAX_PATH];
  * Definitions of things either imported from or exported to outside
  */
 char const *progname;
-char   sys_phone[MAXPHONE][MAXDIAL]; /* ACTS phone numbers */
+char   *sys_phone[MAXPHONE] = {NULL}; /* ACTS phone numbers */
 char   *keysdir = NTP_KEYSDIR; /* crypto keys directory */
 #if defined(HAVE_SCHED_SETSCHEDULER)
 int    config_priority_override = 0;
@@ -528,7 +528,6 @@ getconfig(
 #endif /* SYS_WINNT */
        progname = argv[0];
        res_fp = NULL;
-       memset((char *)sys_phone, 0, sizeof(sys_phone));
        ntp_syslogmask = NLOG_SYNCMASK; /* set more via logconfig */
 
        /*
@@ -1761,11 +1760,12 @@ getconfig(
                        break;
 
                    case CONFIG_PHONE:
-                       for (i = 1; i < ntokens && i < MAXPHONE; i++) {
-                               (void)strncpy(sys_phone[i - 1],
-                                             tokens[i], MAXDIAL);
+                       for (i = 1; i < ntokens && i < MAXPHONE - 1; i++) {
+                               sys_phone[i - 1] =
+                                   emalloc(strlen(tokens[i]) + 1);
+                               strcpy(sys_phone[i - 1], tokens[i]);
                        }
-                       sys_phone[i - 1][0] = '\0';
+                       sys_phone[i] = NULL;
                        break;
 
                    case CONFIG_ADJ: {
index addf87bfd0a3eacc09fc05acd2109e2c000f5c8a..a0b00394586fd8730fb650a56acaab9bbd8c5a5a 100644 (file)
  *
  * The calling program is initiated by setting fudge flag1, either
  * manually or automatically. When flag1 is set, the calling program
- * dials each number listed in the phones command of the configuration
- * file in turn. The number is specified by the Hayes ATDT prefix
- * followed by the number itself, including the prefix and long-distance
- * digits and delay code, if necessary. The flag1 is reset and the
- * calling program terminated if (a) a valid clock update has been
- * determined, (b) no more numbers remain in the list, (c) a device
- * fault or timeout occurs or (d) fudge flag1 is reset manually.
+ * dials the first number in the phone command of the configuration
+ * file. If that call fails, the calling program dials the second number
+ * and so on. The number is specified by the Hayes ATDT prefix followed
+ * by the number itself, including the prefix and long-distance digits
+ * and delay code, if necessary. The flag1 is reset and the calling
+ * program terminated if (a) a valid clock update has been determined,
+ * (b) no more numbers remain in the list, (c) a device fault or timeout
+ * occurs or (d) fudge flag1 is reset manually.
  *
  * The driver is transparent to each of the modem time services and
  * Spectracom radios. It selects the parsing algorithm depending on the
@@ -385,7 +386,7 @@ acts_message(
 
        /*
         * We are waiting for the OK response to the modem setup
-        * command. When this happens dial the number.
+        * command. When this happens dial the number followed by a \r.
         */
        case S_OK:
                if (strcmp(pp->a_lastcode, "OK") != 0) {
@@ -406,6 +407,7 @@ acts_message(
                        acts_disc(peer);
                        return;
                }
+               write(pp->io.fd, "\r", 1);
                up->state = S_CONNECT;
                up->timer = ANSWER;
                return;
@@ -437,7 +439,7 @@ acts_message(
 
        /*
         * For USNO format on-time character '*', which is on a line by
-        * itself. By sure a timecode has been received.
+        * itself. Be sure a timecode has been received.
         */
        case 1:
                if (*pp->a_lastcode == '*' && up->state == S_MSG)