]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Many files:
authorHarlan Stenn <stenn@ntp.org>
Fri, 30 Jun 2000 07:43:14 +0000 (07:43 -0000)
committerHarlan Stenn <stenn@ntp.org>
Fri, 30 Jun 2000 07:43:14 +0000 (07:43 -0000)
  * ntpd/ntp_request.c (dns_a): Don't call crypto_public for now...
  * ntpd/ntp_proto.c (receive): Follow the TEST wiggles
  (peer_xmit): TAI support
  * ntpd/ntp_crypto.c: TAI support
  * ntpd/ntp_control.c: CS_VERSION  and CS_TAI support
  * include/ntp_crypto.h (CRYPTO_FLAG_TAI): Added.
  * include/ntp_control.h (CS_VERSION): Added.
  * include/ntp.h (TEST4,TEST5,TEST8,TEST9): Wiggle.
  From: Dave Mills
  * ntpd/Makefile.am (ntpd_SOURCES): Lose refclock_ulink331.c
  because the new refclock_ulink.c handles it.
Makefile.in:
  Rerun automake
ChangeLog, configure, configure.in:
  * configure.in: 4.0.99j3

bk: 395c4f92WjHL5C9yYTMGABiO-tOANg

14 files changed:
ChangeLog
configure
configure.in
include/ntp.h
include/ntp_control.h
include/ntp_crypto.h
ntpd/Makefile.am
ntpd/ntp_control.c
ntpd/ntp_crypto.c
ntpd/ntp_proto.c
ntpd/ntp_request.c
ntpdate/Makefile.in
ntpdc/Makefile.in
ntpq/Makefile.in

index db5923c1324ff4b9a01737897777e3ca9a955db3..c9bcbd6afae2028308ddd0cee8b294d6d9083e1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-06-30  Harlan Stenn  <stenn@whimsy.udel.edu>
+
+       * configure.in: 4.0.99j3
+
+       * ntpd/ntp_request.c (dns_a): Don't call crypto_public for now...
+       * ntpd/ntp_proto.c (receive): Follow the TEST wiggles
+       (peer_xmit): TAI support
+       * ntpd/ntp_crypto.c: TAI support
+       * ntpd/ntp_control.c: CS_VERSION  and CS_TAI support
+       * include/ntp_crypto.h (CRYPTO_FLAG_TAI): Added.
+       * include/ntp_control.h (CS_VERSION): Added.
+       * include/ntp.h (TEST4,TEST5,TEST8,TEST9): Wiggle.
+       From: Dave Mills
+
+       * ntpd/Makefile.am (ntpd_SOURCES): Lose refclock_ulink331.c
+       because the new refclock_ulink.c handles it.
+
 2000-06-28  Harlan Stenn  <stenn@whimsy.udel.edu>
 
        * ntpd/ntp_config.c (getconfig): Sanity check the right variable
index 3e1047badc9cafd549778dcc34f72dda8b1e72cf..67f065fb2adb87408dbb7c8f37817783c20ecf89 100755 (executable)
--- a/configure
+++ b/configure
@@ -1089,7 +1089,7 @@ fi
 
 PACKAGE=ntp
 
-VERSION=4.0.99j2
+VERSION=4.0.99j3
 
 if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" &&
    test -f $srcdir/config.status; then
index cab4f361ca2d06699dc567bbafbf379978d2d18a..daf1e1aa4bdef0875621990cca7171e45ebdad08 100644 (file)
@@ -5,7 +5,7 @@ AC_CANONICAL_SYSTEM
 AC_DEFINE_UNQUOTED(STR_SYSTEM, "$target")
 AM_CONFIG_HEADER(config.h)
 AC_ARG_PROGRAM
-AM_INIT_AUTOMAKE(ntp, 4.0.99j2)
+AM_INIT_AUTOMAKE(ntp, 4.0.99j3)
 AC_PREREQ(2.14)
 
 ac_cv_var_oncore_ok=no
index fbdfc94cd4af0e48152de647e1b5a8ff84cc9280..4d0b46f539ef1661072419f3343fec554a0ccae5 100644 (file)
@@ -224,12 +224,12 @@ struct interface {
 #define TEST1          0x0001  /* duplicate packet received */
 #define TEST2          0x0002  /* bogus packet received */
 #define TEST3          0x0004  /* protocol unsynchronized */
-#define TEST4          0x0008  /* peer delay/dispersion bounds check */
-#define TEST5          0x0010  /* peer authentication failed */
+#define TEST4          0x0008  /* access denied */
+#define TEST5          0x0010  /* authentication failed */
 #define TEST6          0x0020  /* peer clock unsynchronized */
 #define TEST7          0x0040  /* peer stratum out of bounds */
-#define TEST8          0x0080  /* root delay/dispersion bounds check */
-#define TEST9          0x0100  /* access denied */
+#define TEST8          0x0080  /* root delay/dispersion bounds check */
+#define TEST9          0x0100  /* peer delay/dispersion bounds check */
 #define TEST10         0x0200  /* autokey not authentic */
 #define TEST11         0x0400  /* autokey not confirmed */
 
index b2084c8bbf09c870ee868406eb9f8fe2af618ab7..ad2829a3bd58f438dddb1275d06548bfa0c709f2 100644 (file)
@@ -161,15 +161,17 @@ struct ntp_control {
 #define        CS_CLOCK        14
 #define        CS_PROCESSOR    15
 #define        CS_SYSTEM       16
-#define        CS_STABIL       17
-#define CS_VARLIST     18
+#define CS_VERSION     17
+#define        CS_STABIL       18
+#define CS_VARLIST     19
 #ifdef PUBKEY
-#define        CS_PRIVATE      19
-#define CS_PUBLIC      20
-#define CS_DHPARAMS    21
-#define        CS_HOSTNAM      22
-#define        CS_REVTIME      23
-#define        CS_MAXCODE      CS_REVTIME
+#define        CS_PRIVATE      20
+#define CS_PUBLIC      21
+#define CS_DHPARAMS    22
+#define        CS_HOSTNAM      23
+#define        CS_REVTIME      24
+#define CS_TAI         25
+#define        CS_MAXCODE      CS_TAI
 #else
 #define        CS_MAXCODE      CS_VARLIST
 #endif /* PUBKEY */
index 65415ee5ef010393742c1df3eb625334d1b7f597..ef226ad88480442cdded26299c2ac48636b49ba4 100644 (file)
  * Cryptoflags
  */
 #define CRYPTO_FLAG_ENAB  0x01 /* enable public key */
+#define CRYPTO_FLAG_TAI          0x02  /* request TAI leapseconds */
 
 #ifdef PUBKEY
-
-#define MAX_DH_LEN (DH_PRIME_LEN(1024)) /* max agreed key length */
-
 /*
  * Configuration codes
  */
@@ -74,5 +72,6 @@ extern        char *  public_key_file;
 extern u_int   public_key_fstamp;
 extern char *  dh_params_file;
 extern u_int   dh_params_fstamp;
+extern u_int   sys_tai;
 #endif /* PUBKEY */
 #endif /* AUTOKEY */
index cb45ca47ab0719923609513ea85df39cd01f9aa2..8ca77971d9d23cb7a6688393775dd0eecac86859 100644 (file)
@@ -34,8 +34,7 @@ ntpd_SOURCES = jupiter.h map_vme.c ntp_config.c ntp_control.c ntp_crypto.c \
        refclock_oncore.c refclock_palisade.c refclock_palisade.h \
        refclock_parse.c refclock_pcf.c refclock_pst.c refclock_ptbacts.c \
        refclock_shm.c refclock_tpro.c refclock_trak.c refclock_true.c \
-       refclock_ulink.c refclock_ulink331.c refclock_usno.c refclock_wwv.c \
-       refclock_wwvb.c
+       refclock_ulink.c refclock_usno.c refclock_wwv.c refclock_wwvb.c
 
 $(PROGRAMS): $(LDADD)
 
index 123108515d52713446fb3bb3449af3c9d27885bf..567ad4eb864d43428e301f45b79ae5193b12da2c 100644 (file)
@@ -110,14 +110,16 @@ static struct ctl_var sys_var[] = {
        { CS_CLOCK,     RO, "clock" },          /* 14 */
        { CS_PROCESSOR, RO, "processor" },      /* 15 */
        { CS_SYSTEM,    RO, "system" },         /* 16 */
-       { CS_STABIL,    RO, "stability" },      /* 17 */
-       { CS_VARLIST,   RO, "sys_var_list" },   /* 18 */
+       { CS_VERSION,   RO, "version" },        /* 17 */
+       { CS_STABIL,    RO, "stability" },      /* 18 */
+       { CS_VARLIST,   RO, "sys_var_list" },   /* 19 */
 #ifdef PUBKEY
-       { CS_PRIVATE,   RO, "privatekey" },     /* 19 */
-       { CS_PUBLIC,    RO, "publickey" },      /* 20 */
-       { CS_DHPARAMS,  RO, "dhparams" },       /* 21 */
-       { CS_HOSTNAM,   RO, "hostname" },       /* 22 */
-       { CS_REVTIME,   RO, "revoketime"},      /* 23 */
+       { CS_PRIVATE,   RO, "privatekey" },     /* 120 */
+       { CS_PUBLIC,    RO, "publickey" },      /* 21 */
+       { CS_DHPARAMS,  RO, "dhparams" },       /* 22 */
+       { CS_HOSTNAM,   RO, "hostname" },       /* 23 */
+       { CS_REVTIME,   RO, "revoketime"},      /* 24 */
+       { CS_TAI,       RO, "tai"},             /* 25 */
 #endif /* PUBKEY */
        { 0,            EOV,    ""  }
 };
@@ -129,6 +131,7 @@ static struct ctl_var *ext_sys_var = (struct ctl_var *)0;
  * more-or-less)
  */
 static u_char def_sys_var[] = {
+       CS_VERSION,
        CS_PROCESSOR,
        CS_SYSTEM,
        CS_LEAP,
@@ -152,6 +155,7 @@ static      u_char def_sys_var[] = {
        CS_DHPARAMS,
        CS_HOSTNAM,
        CS_REVTIME,
+       CS_TAI,
 #endif /* PUBKEY */
        0
 };
@@ -1242,6 +1246,11 @@ ctl_putsys(
 #endif /* HAVE_UNAME */
                break;
 
+       case CS_VERSION:
+               ctl_putstr(sys_var[CS_VERSION].text, Version,
+                   strlen(Version));
+               break;
+
        case CS_STABIL:
                ctl_putdbl(sys_var[CS_STABIL].text, clock_stability *
                    1e6);
@@ -1335,7 +1344,8 @@ ctl_putsys(
                strcpy(str1, dh_params_file);
                if (dh_params_fstamp != 0)
                        sprintf(str1, "%s.%u", str1, dh_params_fstamp);
-               ctl_putstr(sys_var[CS_DHPARAMS].text, str1, strlen(str1));
+               ctl_putstr(sys_var[CS_DHPARAMS].text, str1,
+                   strlen(str1));
                break;
 
        case CS_HOSTNAM:
@@ -1346,7 +1356,16 @@ ctl_putsys(
                break;
 
        case CS_REVTIME:
-               ctl_putts(sys_var[CS_REVTIME].text, &sys_revoketime);
+               if (sys_revoketime.l_ui == 0)
+                       break;
+               ctl_putuint(sys_var[CS_REVTIME].text,
+                   sys_revoketime.l_ui);
+               break;
+
+       case CS_TAI:
+               if (sys_tai == 0)
+                       break;
+               ctl_putuint(sys_var[CS_TAI].text, sys_tai);
                break;
 #endif /* PUBKEY */
        }
index 5238e96fd77b237b2a6e7310d5c127efb40ec528..c26331fe52c774b88dbd912deabade8111c8d812 100644 (file)
@@ -50,7 +50,7 @@
  *   CRYPTO_DHPAR 5  DH parameters
  *   CRYPTO_DH    6  DH public value
  *   CRYPTO_NAME  7  host name/public key
- *   CRYPTO_TAI   8  TAI offset
+ *   CRYPTO_TAI   8  TAI leapsecond table
  *
  *   Note: requests carry the association ID of the receiver; responses
  *   carry the association ID of the sender.
 /*
  * Cryptodefines
  */
-#define MAX_KEYLEN     1024    /* maximum key length */
+#define TAI_1972       10      /* initial TAI offset */
+#define MAX_LEAP       100     /* max UTC leapseconds */
+#define MAX_LINLEN     1024    /* max line */
+#define MAX_KEYLEN     1024    /* max key */
+#define MAX_ENCLEN     (ENCODED_CONTENT_LEN(1024)) /* max enc key */
 
 /*
  * Autokey protocol status codes
@@ -83,6 +87,7 @@ static R_RSA_PUBLIC_KEY public_key; /* RSA public key */
 static struct value host;      /* host name/public key */
 static struct value dhparam;   /* Diffie_Hellman parameters */
 static struct value dhpub;     /* Diffie_Hellman public value */
+static struct value tai_leap;  /* TAI leapseconds table */
 static u_char *dh_private;     /* DH private value */
 static u_int dh_keyLen;                /* DH private value length */
 
@@ -98,12 +103,16 @@ u_int      public_key_fstamp;      /* RSA public key filestamp */
 char   *dh_params_file = NULL; /* DH parameters file */
 u_int  dh_params_fstamp;       /* DH parameters filestamp */
 char   *keysdir = "/usr/local/etc/"; /* crypto keys directory */
+u_int  tai_leap_fstamp;        /* TAI leapseconds filestamp */
+char   *tai_leap_file = NULL;  /* TAI leapseconds file */
+u_int  sys_tai;                /* current UTC offset from TAI */
 
 /*
  * Cryptotypes
  */
 static void    crypto_rsa      P((char *, u_int *, u_char *, u_int));
 static void    crypto_dh       P((char *, u_int *));
+static void    crypto_tai      P((char *, u_int *));
 #endif /* PUBKEY */
 
 
@@ -265,7 +274,7 @@ make_keylist(
        R_SignUpdate(&ctx, (u_char *)ap, 12);
        rval = R_SignFinal(&ctx, ap->sig, &len, &private_key);
        if (rval != RV_OK)
-               msyslog(LOG_ERR, "make_keylist: signature fails %x",
+               msyslog(LOG_ERR, "keylist signature fails %x",
                    rval);
        else
                ap->siglen = htonl(len);
@@ -300,7 +309,7 @@ crypto_recv(
        u_int temp;
 #ifdef PUBKEY
        R_SIGNATURE_CTX ctx;    /* signature context */
-       u_char dh_key[MAX_DH_LEN]; /* Diffie-Hellman agreed key */
+       u_char dh_key[MAX_KEYLEN]; /* Diffie-Hellman agreed key */
        R_RSA_PUBLIC_KEY *kp;   /* temporary public key pointer */
        u_int32 *pp;            /* packet pointer */
        u_int rsalen = sizeof(R_RSA_PUBLIC_KEY) - sizeof(u_int) + 4;
@@ -619,6 +628,59 @@ crypto_recv(
                                    rval, (char *)&pkt[i + 5 + rsalen /
                                    4], tstamp, ntohl(vp->fstamp));
 #endif
+                       break;
+               /*
+                * Install TAI leapsecond table.
+                */
+               case CRYPTO_TAI | CRYPTO_RESP:
+                       vp = (struct value *)&pkt[i + 2];
+                       temp = ntohl(vp->vallen);
+                       kp = (R_RSA_PUBLIC_KEY *)peer->pubkey;
+                       j = i + 5 + temp / 4;
+                       if (tstamp <= tai_leap.tstamp) {
+                               rval = RV_TSP;
+                       } else if (kp == NULL) {
+                               rval = RV_PUB;
+                       } else if (ntohl(pkt[j]) != kp->bits / 8) {
+                               rval = RV_SIG;
+                       } else {
+                               R_VerifyInit(&ctx, DA_MD5);
+                               R_VerifyUpdate(&ctx, (u_char *)vp,
+                                   temp + 12);
+                               rval = R_VerifyFinal(&ctx,
+                                   (u_char *)&pkt[j + 1],
+                                   ntohl(pkt[j]), kp);
+                       }
+#ifdef DEBUG
+                       if (debug)
+                               printf(
+                                   "crypto_recv: verify %x TAI %u ts %u fs %u\n",
+                                   rval, temp, tstamp,
+                                   ntohl(vp->fstamp));
+#endif
+                       if (rval != RV_OK)
+                               break;
+
+                       /*
+                        * Initialize TAI leapsecond table and extension
+                        * field in network byte order.
+                        */
+                       tai_leap.fstamp = htonl(vp->fstamp);
+                       tai_leap.vallen = vp->vallen;
+                       if (tai_leap.val == NULL)
+                               free(tai_leap.val);
+                       tai_leap.val = emalloc(temp);
+                       if (tai_leap.sig == NULL)
+                               tai_leap.sig =
+                                   emalloc(private_key.bits / 8);
+                       pp = (u_int32 *)tai_leap.val;
+                       memcpy(pp, &vp->val, temp);
+                       sys_tai = temp / 4 + TAI_1972;
+                       crypto_agree();
+
+for (i = 0; i < temp / 4; i++)
+       printf("xxx %u %u\n", i, ntohl(*pp++));
+
                        break;
 #endif /* PUBKEY */
 
@@ -729,8 +791,7 @@ crypto_xmit(
                rval = R_SignFinal(&ctx, (u_char *)&cp->sig, &temp,
                    &private_key);
                if (rval != RV_OK) {
-                       msyslog(LOG_ERR,
-                           "crypto_xmit: cookie signature fails %x",
+                       msyslog(LOG_ERR, "cookie signature fails %x",
                            rval);
                        break;
                }
@@ -750,7 +811,7 @@ crypto_xmit(
                vp->vallen = 0;
                len += 12;
                temp = ntohl(dhparam.vallen);
-               if (dhparam.val == NULL)
+               if (temp == 0)
                        break;
                vp->vallen = htonl(temp);
                memcpy(&vp->val, dhparam.val, temp);
@@ -773,7 +834,7 @@ crypto_xmit(
                vp->vallen = 0;
                len += 12;
                temp = ntohl(dhpub.vallen);
-               if (dhpub.val == NULL)
+               if (temp == 0)
                        break;
                vp->vallen = htonl(temp);
                memcpy(&vp->val, dhpub.val, temp);
@@ -795,7 +856,7 @@ crypto_xmit(
                vp->vallen = 0;
                len += 12;
                temp = ntohl(host.vallen);
-               if (host.val == NULL)
+               if (temp == 0)
                        break;
                vp->vallen = htonl(temp);
                memcpy(&vp->val, host.val, temp);
@@ -806,6 +867,27 @@ crypto_xmit(
                memcpy(&xpkt[j], host.sig, temp);
                len += temp + 4;
                break;
+       /*
+        * Send TAI leapsecond table, timestamp and signature.
+        */
+       case CRYPTO_TAI | CRYPTO_RESP:
+               vp = (struct value *)&xpkt[i + 2];
+               vp->tstamp = tai_leap.tstamp;
+               vp->fstamp = tai_leap.fstamp;
+               vp->vallen = 0;
+               len += 12;
+               temp = ntohl(tai_leap.vallen);
+               if (temp == 0)
+                       break;
+               vp->vallen = htonl(temp);
+               memcpy(&vp->val, tai_leap.val, temp);
+               len += temp;
+               j = i + 5 + temp / 4;
+               temp = public_key.bits / 8;
+               xpkt[j++] = htonl(temp);
+               memcpy(&xpkt[j], tai_leap.sig, temp);
+               len += temp + 4;
+               break;
 #endif /* PUBKEY */
 
        /*
@@ -866,7 +948,7 @@ crypto_setup(void)
            (u_char *)&private_key, sizeof(R_RSA_PRIVATE_KEY));
        if (private_key.bits == 0) {
                msyslog(LOG_ERR,
-                   "crypto_setup: required RSA private key missing or corrupted");
+                   "crypto_setup: required RSA private key file missing or corrupted");
                exit;
        }
 
@@ -885,7 +967,7 @@ crypto_setup(void)
            (u_char *)&public_key, sizeof(R_RSA_PUBLIC_KEY));
        if (public_key.bits == 0) {
                msyslog(LOG_ERR,
-                   "crypto_setup: required RSA public key missing or corrupted");
+                   "crypto_setup: required RSA public key file missing or corrupted");
                exit;
        }
        if (strstr(public_key_file, sys_hostname) == NULL) {
@@ -919,20 +1001,22 @@ crypto_setup(void)
        /*
         * Load optional Diffie-Hellman key agreement parameters from
         * file, default "ntpkey_dh". If the file is missing or
-        * defective, the parameters can later be retrieved from a
+        * defective, the values can later be retrieved from a
         * server.
         */
        if (dh_params_file == NULL)
                dh_params_file = "ntpkey_dh";
        crypto_dh(dh_params_file, &dh_params_fstamp);
-       temp = dh_params.primeLen;
-       if (temp == 0)
-               return;
-       dhparam.fstamp = htonl(dh_params_fstamp);
-       dhpub.fstamp = htonl(dh_params_fstamp);
-       dhpub.vallen = htonl(temp);
-       dhpub.val = emalloc(temp);
-       dhpub.sig = emalloc(private_key.bits / 8);
+
+       /*
+        * Load optional TAI leapseconds file, default "leap-second". If
+        * the file is missing or defective, the values can later be
+        * retrieved from a
+        * server.
+        */
+       if (tai_leap_file == NULL)
+               tai_leap_file = "leap-seconds";
+       crypto_tai(tai_leap_file, &tai_leap_fstamp);
 }
 
 
@@ -955,34 +1039,30 @@ crypto_agree(void)
        R_SignInit(&ctx, DA_MD5);
        R_SignUpdate(&ctx, (u_char *)&host, 12);
        R_SignUpdate(&ctx, host.val, ntohl(host.vallen));
-       rval = R_SignFinal(&ctx, host.sig, &temp, &private_key);
-       if (rval != RV_OK) {
-               msyslog(LOG_ERR,
-                   "crypto_agree: host signature fails %x", rval);
+       rval = R_SignFinal(&ctx, host.sig, &len, &private_key);
+       if (rval != RV_OK || len != private_key.bits / 8) {
+               msyslog(LOG_ERR, "host signature fails %x", rval);
                exit(1);
        }
-       host.siglen = ntohl(temp);
+       host.siglen = ntohl(len);
 
        /*
         * Sign Diffie-Hellman parameters and timestamps.
         */
-       if (dh_params.primeLen == 0) {
-               msyslog(LOG_ERR,
-                   "crypto_agree: unavailable DH parameters");
-               return;
-       }
-       dhparam.tstamp = htonl(sys_revoketime.l_ui);
-       R_SignInit(&ctx, DA_MD5);
-       R_SignUpdate(&ctx, (u_char *)&dhparam, 12);
-       R_SignUpdate(&ctx, dhparam.val, ntohl(dhparam.vallen));
-       rval = R_SignFinal(&ctx, dhparam.sig, &temp, &private_key);
-       if (rval != RV_OK) {
-               msyslog(LOG_ERR,
-                   "crypto_agree: DH parameters signature fails %x",
-                   rval);
-               exit(1);
+       if (dhparam.vallen > 0) {
+               dhparam.tstamp = htonl(sys_revoketime.l_ui);
+               R_SignInit(&ctx, DA_MD5);
+               R_SignUpdate(&ctx, (u_char *)&dhparam, 12);
+               R_SignUpdate(&ctx, dhparam.val, ntohl(dhparam.vallen));
+               rval = R_SignFinal(&ctx, dhparam.sig, &len,
+                   &private_key);
+               if (rval != RV_OK || len != private_key.bits / 8) {
+                       msyslog(LOG_ERR,
+                           "DH parameters signature fails %x", rval);
+                       exit(1);
+               }
+               dhparam.siglen = ntohl(len);
        }
-       dhparam.siglen = ntohl(temp);
 
        /*
         * Compute Diffie-Hellman public value.
@@ -996,30 +1076,51 @@ crypto_agree(void)
        rval = R_SetupDHAgreement(dhpub.val, dh_private, dh_keyLen,
            &dh_params, &randomstr);
        if (rval != RV_OK) {
-               msyslog(LOG_ERR, "crypto_agree: invalid DH parameters");
+               msyslog(LOG_ERR, "invalid DH parameters");
                exit(1);
        }
 
        /*
         * Sign Diffie-Hellman public value and timestamps.
         */
-       dhpub.tstamp = htonl(sys_revoketime.l_ui);
-       R_SignInit(&ctx, DA_MD5);
-       R_SignUpdate(&ctx, (u_char *)&dhpub, 12);
-       R_SignUpdate(&ctx, dhpub.val, ntohl(dhpub.vallen));
-       rval = R_SignFinal(&ctx, dhpub.sig, &temp, &private_key);
-       if (rval != RV_OK) {
-               msyslog(LOG_ERR,
-                   "crypto_agree: DH public value signature fails %x",
-                   rval);
-               exit(1);
+       if (dhpub.vallen > 0) {
+               dhpub.tstamp = htonl(sys_revoketime.l_ui);
+               R_SignInit(&ctx, DA_MD5);
+               R_SignUpdate(&ctx, (u_char *)&dhpub, 12);
+               R_SignUpdate(&ctx, dhpub.val, ntohl(dhpub.vallen));
+               rval = R_SignFinal(&ctx, dhpub.sig, &len,
+                   &private_key);
+               if (rval != RV_OK || len != private_key.bits / 8) {
+                       msyslog(LOG_ERR,
+                           "DH public value signature fails %x", rval);
+                       exit(1);
+               }
+               dhpub.siglen = ntohl(len);
+       }
+
+       /*
+        * Sign TAI leapsecond table and timestamps.
+        */
+       if (tai_leap.vallen > 0) {
+               tai_leap.tstamp = htonl(sys_revoketime.l_ui);
+               R_SignInit(&ctx, DA_MD5);
+               R_SignUpdate(&ctx, (u_char *)&tai_leap, 12);
+               R_SignUpdate(&ctx, tai_leap.val,
+                   ntohl(tai_leap.vallen));
+               rval = R_SignFinal(&ctx, tai_leap.sig, &len,
+                   &private_key);
+               if (rval != RV_OK || len != private_key.bits / 8) {
+                       msyslog(LOG_ERR,
+                           "TAI leapseconds signature fails %x", rval);
+                       exit(1);
+               }
+               tai_leap.siglen = ntohl(len);
        }
-       dhpub.siglen = ntohl(temp);
 #ifdef DEBUG
        if (debug)
                printf(
                    "cypto_agree: host %s ts %u pubval %d\n",
-                   sys_hostname, ntohl(host.tstamp),
+                   sys_hostname, sys_revoketime.l_ui,
                    ntohl(dhpub.vallen));
 #endif
 }
@@ -1037,8 +1138,8 @@ crypto_rsa(
        )
 {
        FILE *str;              /* file handle */
-       u_char buf[MAX_KEYLEN]; /* file line buffer */
-       u_char encoded_key[MAX_KEYLEN]; /* encoded key buffer */
+       u_char buf[MAX_LINLEN]; /* file line buffer */
+       u_char encoded_key[MAX_ENCLEN]; /* encoded key buffer */
        char filename[MAXFILENAME]; /* name of parameter file */
        char linkname[MAXFILENAME]; /* file link (for filestamp) */
        u_int bits, len;
@@ -1056,14 +1157,14 @@ crypto_rsa(
                snprintf(filename, MAXFILENAME, "%s%s", keysdir, cp);
        str = fopen(filename, "r");
        if (str == NULL) {
-               msyslog(LOG_ERR, "RSA key file %s not found", filename);
+               msyslog(LOG_ERR, "RSA file %s not found", filename);
                return;
        }
 
        /*
         * Ignore initial comments and empty lines.
         */
-       while ((rptr = fgets(buf, MAX_KEYLEN - 1, str)) != NULL) {
+       while ((rptr = fgets(buf, MAX_LINLEN - 1, str)) != NULL) {
                len = strlen(buf);
                if (len < 1)
                        continue;
@@ -1094,9 +1195,7 @@ crypto_rsa(
                rval = RV_OK;
        if (rval != RV_OK) {
                fclose(str);
-               msyslog(LOG_ERR,
-                   "crypto_dh: RSA key file %s error %x",
-                   cp, rval);
+               msyslog(LOG_ERR, "RSA file %s error %x", cp, rval);
                return;
        }
        fclose(str);
@@ -1118,7 +1217,7 @@ crypto_rsa(
 #ifdef DEBUG
        if (debug)
                printf(
-                   "crypto_rsa: RSA key file %s link %d fs %u modulus %d\n",
+                   "crypto_rsa: RSA file %s link %d fs %u modulus %d\n",
                    cp, rval, *fstamp, bits);
 #endif
        return;
@@ -1135,8 +1234,8 @@ crypto_dh(
        )
 {
        FILE *str;              /* file handle */
-       u_char buf[MAX_KEYLEN]; /* file line buffer */
-       u_char encoded_key[MAX_KEYLEN]; /* encoded key buffer */
+       u_char buf[MAX_LINLEN]; /* file line buffer */
+       u_char encoded_key[MAX_ENCLEN]; /* encoded key buffer */
        u_char prime[MAX_KEYLEN]; /* decoded prime */
        u_char generator[MAX_KEYLEN]; /* decode generator */
        u_int primelen;         /* prime length (octets) */
@@ -1153,7 +1252,6 @@ crypto_dh(
         * character of the file name is not '/', prepend the keys
         * directory string. 
         */
-       *fstamp = 0;
        if (*cp == '/')
                strcpy(filename, cp);
        else
@@ -1161,15 +1259,14 @@ crypto_dh(
        str = fopen(filename, "r");
        if (str == NULL) {
                msyslog(LOG_ERR,
-                   "crypto_dh: DH parameter file %s not found",
-                   filename);
+                   "crypto_dh: DH file %s not found", filename);
                return;
        }
 
        /*
         * Ignore initial comments and empty lines.
         */
-       while ((rptr = fgets(buf, MAX_KEYLEN - 1, str)) != NULL) {
+       while ((rptr = fgets(buf, MAX_LINLEN - 1, str)) != NULL) {
                if (strlen(buf) < 1)
                        continue;
                if (*buf == '#' || *buf == '\r' || *buf == '\0')
@@ -1187,7 +1284,7 @@ crypto_dh(
                rval = RV_DAT;
        else if (sscanf(buf, "%u %s", &primelen, encoded_key) != 2)
                rval = RV_DAT;
-       else if (primelen > MAX_DH_LEN)
+       else if (primelen > MAX_KEYLEN)
                rval = RV_KEY;
        else if (R_DecodePEMBlock(prime, &len, encoded_key,
            strlen(encoded_key)))
@@ -1200,8 +1297,7 @@ crypto_dh(
        if (rval != RV_OK) {
                fclose(str);
                msyslog(LOG_ERR,
-                   "crypto_dh: DH parameter file %s prime error %x",
-                   cp, rval);
+                   "crypto_dh: DH file %s prime error %x", cp, rval);
                return;
        }
 
@@ -1210,7 +1306,7 @@ crypto_dh(
         */
        if (fscanf(str, "%u %s", &generatorlen, encoded_key) != 2)
                rval = RV_DAT;
-       else if (generatorlen > MAX_DH_LEN)
+       else if (generatorlen > MAX_KEYLEN)
                rval = RV_KEY;
        else if (R_DecodePEMBlock(generator, &len, encoded_key,
            strlen(encoded_key)))
@@ -1222,8 +1318,8 @@ crypto_dh(
                rval = RV_OK;
        if (rval != RV_OK) {
                msyslog(LOG_ERR,
-                   "crypto_dh: DH parameter file %s generator error %x",
-                   cp, rval);
+                   "crypto_dh: DH file %s generator error %x", cp,
+                   rval);
                return;
        }
        fclose(str);
@@ -1233,7 +1329,6 @@ crypto_dh(
         * network byte order. Note the private key length is set
         * arbitrarily at half the prime length.
         */
-       dhparam.fstamp = htonl(dh_params_fstamp);
        len = 4 + primelen + 4 + generatorlen;
        dhparam.vallen = htonl(len);
        dhparam.val = emalloc(len);
@@ -1254,7 +1349,6 @@ crypto_dh(
        /*
         * Initialize Diffie-Hellman public value extension field.
         */
-       dhpub.fstamp = htonl(dh_params_fstamp);
        dhpub.vallen = htonl(dh_params.primeLen);
        dhpub.val = emalloc(dh_params.primeLen);
        dhpub.sig = emalloc(private_key.bits / 8);
@@ -1269,18 +1363,120 @@ crypto_dh(
        } else {
                rptr = strrchr(filename, '.');
        }
-       if (rptr != NULL)
+       if (rptr != NULL) {
                sscanf(++rptr, "%u", fstamp);
+               dhparam.fstamp = htonl(*fstamp);
+               dhpub.fstamp = htonl(*fstamp);
+       }
 #ifdef DEBUG
        if (debug)
                printf(
-                   "crypto_dh: DH parameter file link %d %s fs %u prime %u gen %u\n",
-                   rval, dh_params_file, dh_params_fstamp,
+                   "crypto_dh: DH file %s link %d fs %u prime %u gen %u\n",
+                   dh_params_file, rval, dh_params_fstamp,
                    dh_params.primeLen, dh_params.generatorLen);
 #endif
 }
 
 
+/*
+ * crypto_tai - read TAI offset table and check for errors.
+ */
+static void
+crypto_tai(
+       char *cp,               /* file name */
+       u_int *fstamp           /* filestamp */
+       )
+{
+       FILE *str;              /* file handle */
+       u_char buf[MAX_LINLEN]; /* file line buffer */
+       u_int leapsec[MAX_LEAP]; /* NTP time at leaps */
+       u_int offset;           /* offset at leap (s) */
+       char filename[MAXFILENAME]; /* name of parameter file */
+       char linkname[MAXFILENAME]; /* file link (for filestamp) */
+       u_int32 *pp;
+       u_int len;
+       char *rptr;
+       int rval, i;
+
+       /*
+        * Open the key file and discard comment lines. If the first
+        * character of the file name is not '/', prepend the keys
+        * directory string. 
+        */
+       if (*cp == '/')
+               strcpy(filename, cp);
+       else
+               snprintf(filename, MAXFILENAME, "%s%s", keysdir, cp);
+       str = fopen(filename, "r");
+       if (str == NULL) {
+               msyslog(LOG_ERR, "TAI file %s not found", filename);
+               return;
+       }
+
+       /*
+        * We are rather paranoid here, since an intruder might cause a
+        * coredump by infiltrating a naughty key. The line must contain
+        * a single integer followed by a PEM encoded, null-terminated
+        * string.
+        */
+       i = 0;
+       rval = RV_OK;
+       while (i < MAX_LEAP) {
+               rptr = fgets(buf, MAX_LINLEN - 1, str);
+               if (rptr == NULL)
+                       break;
+               if (strlen(buf) < 1)
+                       continue;
+               if (*buf == '#')
+                       continue;
+               if (sscanf(buf, "%u %u", &leapsec[i], &offset) != 2)
+                       continue;
+               if (i != offset - TAI_1972) { 
+                       rval = RV_DAT;
+                       break;
+               }
+               i++;
+       }
+       fclose(str);
+       if (rval != RV_OK || i == 0) {
+               msyslog(LOG_ERR, "TAI file %s error %d", cp, rval);
+               return;
+       }
+       len = --i * sizeof(u_int32);
+       tai_leap.vallen = htonl(len);
+       tai_leap.val = emalloc(len);
+       tai_leap.sig = emalloc(private_key.bits / 8);
+       pp = (u_int32 *)tai_leap.val;
+       sys_tai = len / 4 + TAI_1972;
+       for (; i >= 0; i--) {
+               *pp++ = htonl(leapsec[i]);
+       }
+       tai_leap.sig = emalloc(private_key.bits / 8);
+
+       /*
+        * Extract filestamp if present.
+        */
+       rval = readlink(filename, linkname, MAXFILENAME - 1);
+       if (rval > 0) {
+               linkname[rval] = '\0';
+               rptr = strrchr(linkname, '.');
+       } else {
+               rptr = strrchr(filename, '.');
+       }
+       if (rptr != NULL) {
+               sscanf(++rptr, "%u", fstamp);
+               tai_leap.fstamp = htonl(*fstamp);
+       }
+#ifdef DEBUG
+       if (debug)
+               printf(
+                   "crypto_tai: TAI file %s link %d fs %u offset %u\n",
+                   tai_leap_file, rval, tai_leap_fstamp,
+                   ntohl(tai_leap.vallen) / 4 + TAI_1972);
+#endif
+}
+
+#if 0
 /*
  * crypto_public - read and install the public key from the public key
  * file. The name of the file is in the form "ntpkey_host", where host
@@ -1324,6 +1520,7 @@ crypto_public(
        memcpy(peer->pubkey, (char *)&keybuf, keylen);
        return (1);
 }
+#endif
 
 
 /*
index e40273e68f953fb3dd9bc339654e0daa72421351..9b5af41c0d3f79816a4eeff79827a0acdcbcc5b6 100644 (file)
@@ -690,8 +690,8 @@ receive(
                peer->flags &= ~FLAG_AUTHENTIC;
        }
        if (peer->hmode == MODE_BROADCAST &&
-           (restrict_mask & RES_DONTTRUST))    /* test 9 */
-               peer->flash |= TEST9;           /* access denied */
+           (restrict_mask & RES_DONTTRUST))    /* test 4 */
+               peer->flash |= TEST4;           /* access denied */
        if (peer->flags & FLAG_AUTHENABLE) {
                if (!(peer->flags & FLAG_AUTHENTIC)) /* test 5 */
                        peer->flash |= TEST5;   /* auth failed */
@@ -824,7 +824,8 @@ process_packet(
        pmode = PKT_MODE(pkt->li_vn_mode);
 
        /*
-        * Test for old or duplicate packets (tests 1 through 3).
+        * Test for old, duplicate or unsynchronized packets (tests 1
+        * through 3).
         */
        if (L_ISHIS(&peer->org, &p_xmt))        /* count old packets */
                peer->oldpkt++;
@@ -841,7 +842,7 @@ process_packet(
        peer->org = p_xmt;
 
        /*
-        * Test for valid packet header (tests 6 through 8)
+        * Test for valid peer data (tests 6 through 8)
         */
        ci = p_xmt;
        L_SUB(&ci, &p_reftime);
@@ -852,19 +853,21 @@ process_packet(
                peer->flash |= TEST6;   /* peer clock unsynchronized */
        if (!(peer->flags & FLAG_CONFIG) && sys_peer != 0) { /* test 7 */
                if (PKT_TO_STRATUM(pkt->stratum) > sys_stratum) {
-                       peer->flash |= TEST7;   /* peer stratum too high */
+                       peer->flash |= TEST7; /* peer stratum too high */
                        sys_badstratum++;
                }
        }
        if (fabs(p_del) >= MAXDISPERSE          /* test 8 */
            || p_disp >= MAXDISPERSE)
-               peer->flash |= TEST8;           /* delay/dispersion too high */
+               peer->flash |= TEST8;           /* root data */
 
        /*
-        * If the packet header is invalid, abandon ship. Otherwise
+        * If the packet is denied access, declared not authentic or has
+        * invalid timestamps, stuff it in the compactor. Otherwise,
         * capture the header data.
         */
-       if (peer->flash & ~(u_int)(TEST1 | TEST2 | TEST3 | TEST4)) {
+       if (peer->flash & ~(u_int)(TEST1 | TEST2 | TEST3 | TEST4 |
+           TEST5 | TEST10 | TEST11)) {
 #ifdef DEBUG
                if (debug)
                        printf("packet: bad header %03x\n",
@@ -877,10 +880,8 @@ process_packet(
         * The header is valid. Capture the remaining header values and
         * mark as reachable.
         */
-/*
        record_raw_stats(&peer->srcadr, &peer->dstadr->sin,
            &p_org, &p_rec, &p_xmt, &peer->rec);
-*/
        peer->leap = PKT_LEAP(pkt->li_vn_mode);
        peer->pmode = pmode;            /* unspec */
        peer->stratum = PKT_TO_STRATUM(pkt->stratum);
@@ -958,11 +959,11 @@ process_packet(
                LFPTOD(&t23, p_del);
        }
        LFPTOD(&ci, p_offset);
-       if (fabs(p_del) >= MAXDISPERSE || p_disp >= MAXDISPERSE) /* test 4 */
-               peer->flash |= TEST4;   /* delay/dispersion too big */
+       if (fabs(p_del) >= MAXDISPERSE || p_disp >= MAXDISPERSE) /* test 9 */
+               peer->flash |= TEST9;   /* delay/dispersion too big */
 
        /*
-        * If the packet data are invalid (tests 1 through 4), abandon
+        * If the packet data are invalid (tests 6 through 9), abandon
         * ship. Otherwise, forward to the clock filter.
         */
        if (peer->flash) {
@@ -1957,10 +1958,15 @@ peer_xmit(
                                    sendlen, (peer->cmmd >> 16) |
                                    CRYPTO_RESP, peer->pcookie.key,
                                    peer->associd);
-                       if (crypto_flags  && peer->pubkey == NULL)
+                       if (crypto_flags && peer->pubkey == NULL)
                                sendlen += crypto_xmit((u_int32 *)&xpkt,
                                    sendlen, CRYPTO_NAME,
                                    peer->pcookie.key, peer->assoc);
+                       else if (crypto_flags & CRYPTO_FLAG_TAI &&
+                           sys_tai == 0)
+                               sendlen += crypto_xmit((u_int32 *)&xpkt,
+                                   sendlen, CRYPTO_TAI,
+                                   peer->pcookie.key, peer->assoc);
                        else if (crypto_flags && dh_params.prime ==
                            NULL)
                                sendlen += crypto_xmit((u_int32 *)&xpkt,
index dcb5d86c515aa3ebd196bc55e3798e48982c79a2..452d7e1cae0577f78868734bdf86b815ed45ecc3 100644 (file)
@@ -1301,9 +1301,11 @@ dns_a(
                        req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA);
                        return;
                } else {
+#if 0
 #ifdef PUBKEY
                        crypto_public(peer, dp->hostname);
 #endif /* PUBKEY */
+#endif
                }
                
                dp++;
index 77b54cf6accacdfe56803f08a35e3d9ec8ff2977..d5883700ce43e7680bdbf5c3a393aef05e2612da 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -10,9 +10,6 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
-
-
 SHELL = @SHELL@
 
 srcdir = @srcdir@
@@ -48,9 +45,10 @@ AUTOMAKE = @AUTOMAKE@
 AUTOHEADER = @AUTOHEADER@
 
 INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -59,6 +57,8 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+
+@SET_MAKE@
 build_alias = @build_alias@
 build_triplet = @build@
 host_alias = @host_alias@
@@ -103,6 +103,9 @@ U = @U@
 VERSION = @VERSION@
 install_sh = @install_sh@
 
+#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
+
+
 AUTOMAKE_OPTIONS = ../util/ansi2knr
 bin_PROGRAMS = ntpdate ntptimeset
 ntptimeset_SOURCES = ntptimeset.c ntptime_config.c
@@ -113,6 +116,7 @@ DISTCLEANFILES = .version stamp-v
 noinst_HEADERS = ntpdate.h
 #EXTRA_DIST = ntpdate.mak
 ETAGS_ARGS = Makefile.am
+subdir = ntpdate
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -128,29 +132,32 @@ ntpdate_OBJECTS =  ntpdate$U.o
 ntpdate_LDADD = $(LDADD)
 ntpdate_DEPENDENCIES =  version.o ../libntp/libntp.a
 ntpdate_LDFLAGS = 
-ntptimeset_OBJECTS =  ntptimeset$U.o ntptime_config$U.o
+am_ntptimeset_OBJECTS =  ntptimeset$U.o ntptime_config$U.o
+ntptimeset_OBJECTS =  $(am_ntptimeset_OBJECTS)
 ntptimeset_LDADD = $(LDADD)
 ntptimeset_DEPENDENCIES =  version.o ../libntp/libntp.a
 ntptimeset_LDFLAGS = 
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES =  ntpdate.c $(ntptimeset_SOURCES)
 HEADERS =  $(noinst_HEADERS)
 
-DIST_COMMON =  README Makefile.am Makefile.in
+DIST_COMMON =  README $(noinst_HEADERS) Makefile.am Makefile.in
 
 
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
 GZIP_ENV = --best
-DEP_FILES =  .deps/ntpdate.P .deps/ntptime_config.P .deps/ntptimeset.P
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+DEP_FILES =  @AMDEP@ $(DEPDIR)/ntpdate$U.Po \
+$(DEPDIR)/ntptime_config$U.Po $(DEPDIR)/ntptimeset$U.Po
 SOURCES = ntpdate.c $(ntptimeset_SOURCES)
-OBJECTS = ntpdate$U.o $(ntptimeset_OBJECTS)
+OBJECTS = ntpdate$U.o $(am_ntptimeset_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
-.SUFFIXES: .S .c .o .s
+.SUFFIXES: .c .o
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpdate/Makefile
 
@@ -173,23 +180,20 @@ install-binPROGRAMS: $(bin_PROGRAMS)
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        @list='$(bin_PROGRAMS)'; for p in $$list; do \
          if test -f $$p; then \
-           echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-            $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+           f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+           echo "  $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \
+            $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \
          else :; fi; \
        done
 
 uninstall-binPROGRAMS:
        @$(NORMAL_UNINSTALL)
-       list='$(bin_PROGRAMS)'; for p in $$list; do \
-         rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+         echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+         rm -f $(DESTDIR)$(bindir)/$$f; \
        done
 
-.s.o:
-       $(COMPILE) -c $<
-
-.S.o:
-       $(COMPILE) -c $<
-
 mostlyclean-compile:
        -rm -f *.o core *.core
 
@@ -232,23 +236,27 @@ ntpdate_.o ntptime_config_.o ntptimeset_.o : $(ANSI2KNR)
 
 tags: TAGS
 
-ID: $(HEADERS) $(SOURCES) $(LISP)
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
               END { for (i in files) print i; }'`; \
-       here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $$unique $(LISP)
+       mkid -fID $$unique $(LISP)
 
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
+       list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
               END { for (i in files) print i; }'`; \
        test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
-         || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
+         || etags $(ETAGS_ARGS) $$tags  $$unique $(LISP)
 
 mostlyclean-tags:
 
@@ -261,18 +269,11 @@ maintainer-clean-tags:
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
-subdir = ntpdate
-
 distdir: $(DISTFILES)
-       here=`cd $(top_builddir) && pwd`; \
-       top_distdir=`cd $(top_distdir) && pwd`; \
-       distdir=`cd $(distdir) && pwd`; \
-       cd $(top_srcdir) \
-         && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntpdate/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
          if test -d $$d/$$file; then \
-           cp -pr $$/$$file $(distdir)/$$file; \
+           cp -pR $$d/$$file $(distdir); \
          else \
            test -f $(distdir)/$$file \
            || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -280,37 +281,27 @@ distdir: $(DISTFILES)
          fi; \
        done
 
-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-
--include $(DEP_FILES)
+@AMDEP@include $(DEPDIR)/ntpdate$U.Po
+@AMDEP@include $(DEPDIR)/ntptime_config$U.Po
+@AMDEP@include $(DEPDIR)/ntptimeset$U.Po
 
 mostlyclean-depend:
 
 clean-depend:
 
 distclean-depend:
-       -rm -rf .deps
+       -rm -rf $(DEPDIR)
 
 maintainer-clean-depend:
 
-%.o: %.c
-       @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
-       @-cp .deps/$(*F).pp .deps/$(*F).P; \
-       tr ' ' '\012' < .deps/$(*F).pp \
-         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
-           >> .deps/$(*F).P; \
-       rm .deps/$(*F).pp
-
-%.lo: %.c
-       @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
-       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
-         < .deps/$(*F).pp > .deps/$(*F).P; \
-       tr ' ' '\012' < .deps/$(*F).pp \
-         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
-           >> .deps/$(*F).P; \
-       rm -f .deps/$(*F).pp
+@AMDEP@CCDEPMODE = @CCDEPMODE@
+
+.c.o:
+@AMDEP@        source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP@        depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP@        $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+       $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
 info-am:
 info: info-am
 dvi-am:
@@ -333,7 +324,7 @@ uninstall: uninstall-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 all-redirect: all-am
 install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
        $(mkinstalldirs)  $(DESTDIR)$(bindir)
 
@@ -348,6 +339,7 @@ distclean-generic:
        -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
+       -rm -f Makefile.in
 mostlyclean-am:  mostlyclean-binPROGRAMS mostlyclean-compile \
                mostlyclean-kr mostlyclean-tags mostlyclean-depend \
                mostlyclean-generic
@@ -383,7 +375,7 @@ maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
 clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
 check-am installcheck-am installcheck install-exec-am install-exec \
 install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
+all-redirect all-am all install-strip installdirs mostlyclean-generic \
 distclean-generic clean-generic maintainer-clean-generic clean \
 mostlyclean distclean maintainer-clean
 
index 1b7263fd7f2a83c67e1c361fee41d7456415b3a8..325b4b8c4e8461f3dec426b5d8b563d56b07d219 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -10,9 +10,6 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
-
-
 SHELL = @SHELL@
 
 srcdir = @srcdir@
@@ -48,9 +45,10 @@ AUTOMAKE = @AUTOMAKE@
 AUTOHEADER = @AUTOHEADER@
 
 INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -59,6 +57,8 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+
+@SET_MAKE@
 build_alias = @build_alias@
 build_triplet = @build@
 host_alias = @host_alias@
@@ -103,6 +103,9 @@ U = @U@
 VERSION = @VERSION@
 install_sh = @install_sh@
 
+#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
+
+
 AUTOMAKE_OPTIONS = ../util/ansi2knr
 bin_PROGRAMS = ntpdc
 INCLUDES = -I$(top_srcdir)/include
@@ -114,6 +117,7 @@ noinst_HEADERS = ntpdc.h
 ETAGS_ARGS = Makefile.am
 
 ntpdc_SOURCES = ntpdc.c ntpdc_ops.c
+subdir = ntpdc
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -124,29 +128,31 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
 CPPFLAGS = @CPPFLAGS@
 LIBS = @LIBS@
 ANSI2KNR = ../util/ansi2knr
-ntpdc_OBJECTS =  ntpdc$U.o ntpdc_ops$U.o
+am_ntpdc_OBJECTS =  ntpdc$U.o ntpdc_ops$U.o
+ntpdc_OBJECTS =  $(am_ntpdc_OBJECTS)
 ntpdc_LDADD = $(LDADD)
 ntpdc_DEPENDENCIES =  version.o ../libntp/libntp.a
 ntpdc_LDFLAGS = 
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES =  $(ntpdc_SOURCES)
 HEADERS =  $(noinst_HEADERS)
 
-DIST_COMMON =  README Makefile.am Makefile.in
+DIST_COMMON =  README $(noinst_HEADERS) Makefile.am Makefile.in
 
 
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
 GZIP_ENV = --best
-DEP_FILES =  .deps/ntpdc.P .deps/ntpdc_ops.P
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+DEP_FILES =  @AMDEP@ $(DEPDIR)/ntpdc$U.Po $(DEPDIR)/ntpdc_ops$U.Po
 SOURCES = $(ntpdc_SOURCES)
-OBJECTS = $(ntpdc_OBJECTS)
+OBJECTS = $(am_ntpdc_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
-.SUFFIXES: .S .c .o .s
+.SUFFIXES: .c .o
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpdc/Makefile
 
@@ -169,23 +175,20 @@ install-binPROGRAMS: $(bin_PROGRAMS)
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        @list='$(bin_PROGRAMS)'; for p in $$list; do \
          if test -f $$p; then \
-           echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-            $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+           f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+           echo "  $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \
+            $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \
          else :; fi; \
        done
 
 uninstall-binPROGRAMS:
        @$(NORMAL_UNINSTALL)
-       list='$(bin_PROGRAMS)'; for p in $$list; do \
-         rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+         echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+         rm -f $(DESTDIR)$(bindir)/$$f; \
        done
 
-.s.o:
-       $(COMPILE) -c $<
-
-.S.o:
-       $(COMPILE) -c $<
-
 mostlyclean-compile:
        -rm -f *.o core *.core
 
@@ -222,23 +225,27 @@ ntpdc_.o ntpdc_ops_.o : $(ANSI2KNR)
 
 tags: TAGS
 
-ID: $(HEADERS) $(SOURCES) $(LISP)
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
               END { for (i in files) print i; }'`; \
-       here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $$unique $(LISP)
+       mkid -fID $$unique $(LISP)
 
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
+       list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
               END { for (i in files) print i; }'`; \
        test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
-         || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
+         || etags $(ETAGS_ARGS) $$tags  $$unique $(LISP)
 
 mostlyclean-tags:
 
@@ -251,18 +258,11 @@ maintainer-clean-tags:
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
-subdir = ntpdc
-
 distdir: $(DISTFILES)
-       here=`cd $(top_builddir) && pwd`; \
-       top_distdir=`cd $(top_distdir) && pwd`; \
-       distdir=`cd $(distdir) && pwd`; \
-       cd $(top_srcdir) \
-         && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntpdc/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
          if test -d $$d/$$file; then \
-           cp -pr $$/$$file $(distdir)/$$file; \
+           cp -pR $$d/$$file $(distdir); \
          else \
            test -f $(distdir)/$$file \
            || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -270,37 +270,26 @@ distdir: $(DISTFILES)
          fi; \
        done
 
-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-
--include $(DEP_FILES)
+@AMDEP@include $(DEPDIR)/ntpdc$U.Po
+@AMDEP@include $(DEPDIR)/ntpdc_ops$U.Po
 
 mostlyclean-depend:
 
 clean-depend:
 
 distclean-depend:
-       -rm -rf .deps
+       -rm -rf $(DEPDIR)
 
 maintainer-clean-depend:
 
-%.o: %.c
-       @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
-       @-cp .deps/$(*F).pp .deps/$(*F).P; \
-       tr ' ' '\012' < .deps/$(*F).pp \
-         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
-           >> .deps/$(*F).P; \
-       rm .deps/$(*F).pp
-
-%.lo: %.c
-       @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
-       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
-         < .deps/$(*F).pp > .deps/$(*F).P; \
-       tr ' ' '\012' < .deps/$(*F).pp \
-         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
-           >> .deps/$(*F).P; \
-       rm -f .deps/$(*F).pp
+@AMDEP@CCDEPMODE = @CCDEPMODE@
+
+.c.o:
+@AMDEP@        source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP@        depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP@        $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+       $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
 info-am:
 info: info-am
 dvi-am:
@@ -323,7 +312,7 @@ uninstall: uninstall-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 all-redirect: all-am
 install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
        $(mkinstalldirs)  $(DESTDIR)$(bindir)
 
@@ -338,6 +327,7 @@ distclean-generic:
        -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
+       -rm -f Makefile.in
 mostlyclean-am:  mostlyclean-binPROGRAMS mostlyclean-compile \
                mostlyclean-kr mostlyclean-tags mostlyclean-depend \
                mostlyclean-generic
@@ -373,7 +363,7 @@ maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
 clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
 check-am installcheck-am installcheck install-exec-am install-exec \
 install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
+all-redirect all-am all install-strip installdirs mostlyclean-generic \
 distclean-generic clean-generic maintainer-clean-generic clean \
 mostlyclean distclean maintainer-clean
 
index 7fd88f42e1a347880481b35f740b9f138c2ebfee..277b8078a4a02531fb449cc177d00b93106adf01 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -10,9 +10,6 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
-
-
 SHELL = @SHELL@
 
 srcdir = @srcdir@
@@ -48,9 +45,10 @@ AUTOMAKE = @AUTOMAKE@
 AUTOHEADER = @AUTOHEADER@
 
 INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -59,6 +57,8 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+
+@SET_MAKE@
 build_alias = @build_alias@
 build_triplet = @build@
 host_alias = @host_alias@
@@ -103,6 +103,9 @@ U = @U@
 VERSION = @VERSION@
 install_sh = @install_sh@
 
+#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
+
+
 AUTOMAKE_OPTIONS = ../util/ansi2knr
 bin_PROGRAMS = ntpq
 INCLUDES = -I$(top_srcdir)/include
@@ -114,6 +117,7 @@ noinst_HEADERS = ntpq.h
 ETAGS_ARGS = Makefile.am
 
 ntpq_SOURCES = ntpq.c ntpq_ops.c
+subdir = ntpq
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -124,29 +128,31 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
 CPPFLAGS = @CPPFLAGS@
 LIBS = @LIBS@
 ANSI2KNR = ../util/ansi2knr
-ntpq_OBJECTS =  ntpq$U.o ntpq_ops$U.o
+am_ntpq_OBJECTS =  ntpq$U.o ntpq_ops$U.o
+ntpq_OBJECTS =  $(am_ntpq_OBJECTS)
 ntpq_LDADD = $(LDADD)
 ntpq_DEPENDENCIES =  version.o ../libntp/libntp.a
 ntpq_LDFLAGS = 
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES =  $(ntpq_SOURCES)
 HEADERS =  $(noinst_HEADERS)
 
-DIST_COMMON =  README Makefile.am Makefile.in
+DIST_COMMON =  README $(noinst_HEADERS) Makefile.am Makefile.in
 
 
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
 GZIP_ENV = --best
-DEP_FILES =  .deps/ntpq.P .deps/ntpq_ops.P
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+DEP_FILES =  @AMDEP@ $(DEPDIR)/ntpq$U.Po $(DEPDIR)/ntpq_ops$U.Po
 SOURCES = $(ntpq_SOURCES)
-OBJECTS = $(ntpq_OBJECTS)
+OBJECTS = $(am_ntpq_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
-.SUFFIXES: .S .c .o .s
+.SUFFIXES: .c .o
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpq/Makefile
 
@@ -169,23 +175,20 @@ install-binPROGRAMS: $(bin_PROGRAMS)
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        @list='$(bin_PROGRAMS)'; for p in $$list; do \
          if test -f $$p; then \
-           echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-            $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+           f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+           echo "  $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \
+            $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \
          else :; fi; \
        done
 
 uninstall-binPROGRAMS:
        @$(NORMAL_UNINSTALL)
-       list='$(bin_PROGRAMS)'; for p in $$list; do \
-         rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+         echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+         rm -f $(DESTDIR)$(bindir)/$$f; \
        done
 
-.s.o:
-       $(COMPILE) -c $<
-
-.S.o:
-       $(COMPILE) -c $<
-
 mostlyclean-compile:
        -rm -f *.o core *.core
 
@@ -222,23 +225,27 @@ ntpq_.o ntpq_ops_.o : $(ANSI2KNR)
 
 tags: TAGS
 
-ID: $(HEADERS) $(SOURCES) $(LISP)
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
               END { for (i in files) print i; }'`; \
-       here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $$unique $(LISP)
+       mkid -fID $$unique $(LISP)
 
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
+       list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
               END { for (i in files) print i; }'`; \
        test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
-         || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
+         || etags $(ETAGS_ARGS) $$tags  $$unique $(LISP)
 
 mostlyclean-tags:
 
@@ -251,18 +258,11 @@ maintainer-clean-tags:
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
-subdir = ntpq
-
 distdir: $(DISTFILES)
-       here=`cd $(top_builddir) && pwd`; \
-       top_distdir=`cd $(top_distdir) && pwd`; \
-       distdir=`cd $(distdir) && pwd`; \
-       cd $(top_srcdir) \
-         && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntpq/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
          if test -d $$d/$$file; then \
-           cp -pr $$/$$file $(distdir)/$$file; \
+           cp -pR $$d/$$file $(distdir); \
          else \
            test -f $(distdir)/$$file \
            || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -270,37 +270,26 @@ distdir: $(DISTFILES)
          fi; \
        done
 
-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-
--include $(DEP_FILES)
+@AMDEP@include $(DEPDIR)/ntpq$U.Po
+@AMDEP@include $(DEPDIR)/ntpq_ops$U.Po
 
 mostlyclean-depend:
 
 clean-depend:
 
 distclean-depend:
-       -rm -rf .deps
+       -rm -rf $(DEPDIR)
 
 maintainer-clean-depend:
 
-%.o: %.c
-       @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
-       @-cp .deps/$(*F).pp .deps/$(*F).P; \
-       tr ' ' '\012' < .deps/$(*F).pp \
-         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
-           >> .deps/$(*F).P; \
-       rm .deps/$(*F).pp
-
-%.lo: %.c
-       @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
-       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
-         < .deps/$(*F).pp > .deps/$(*F).P; \
-       tr ' ' '\012' < .deps/$(*F).pp \
-         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
-           >> .deps/$(*F).P; \
-       rm -f .deps/$(*F).pp
+@AMDEP@CCDEPMODE = @CCDEPMODE@
+
+.c.o:
+@AMDEP@        source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP@        depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP@        $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+       $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
 info-am:
 info: info-am
 dvi-am:
@@ -323,7 +312,7 @@ uninstall: uninstall-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 all-redirect: all-am
 install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
        $(mkinstalldirs)  $(DESTDIR)$(bindir)
 
@@ -338,6 +327,7 @@ distclean-generic:
        -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
+       -rm -f Makefile.in
 mostlyclean-am:  mostlyclean-binPROGRAMS mostlyclean-compile \
                mostlyclean-kr mostlyclean-tags mostlyclean-depend \
                mostlyclean-generic
@@ -373,7 +363,7 @@ maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
 clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
 check-am installcheck-am installcheck install-exec-am install-exec \
 install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
+all-redirect all-am all install-strip installdirs mostlyclean-generic \
 distclean-generic clean-generic maintainer-clean-generic clean \
 mostlyclean distclean maintainer-clean