+---
+
+* [Bug 1561] ntpq, ntpdc "passwd" prompts for MD5 password w/SHA1.
+* Windows port: do not exit in ntp_timestamp_from_counter() without
+ first logging the reason.
+* Support "passwd blah" syntax in ntpq.
+
---
(4.2.6p2-RC4) 2010/05/19 Released by Harlan Stenn <stenn@ntp.org>
#endif
extern int keytype_from_text (const char *, size_t *);
extern const char *keytype_name (int);
+extern char * getpass_keytype (int);
/* lib/isc/win32/strerror.c
return name;
}
+
+/*
+ * Use getpassphrase() if configure.ac detected it, as Suns that
+ * have it truncate the password in getpass() to 8 characters.
+ */
+#ifdef HAVE_GETPASSPHRASE
+# define getpass(str) getpassphrase(str)
+#endif
+
+/*
+ * getpass_keytype() -- shared between ntpq and ntpdc, only vaguely
+ * related to the rest of ssl_init.c.
+ */
+char *
+getpass_keytype(
+ int keytype
+ )
+{
+ char pass_prompt[64 + 11 + 1]; /* 11 for " Password: " */
+
+ snprintf(pass_prompt, sizeof(pass_prompt),
+ "%.64s Password: ", keytype_name(keytype));
+
+ return getpass(pass_prompt);
+}
*/
s_char sys_precision; /* local clock precision (log2 s) */
-/*
- * Use getpassphrase() if configure.ac detected it, as Suns that
- * have it truncate the password in getpass() to 8 characters.
- */
-#ifdef HAVE_GETPASSPHRASE
-# define getpass(str) getpassphrase(str)
-#endif
-
int ntpdcmain (int, char **);
/*
* Built in command handler declarations
l_fp ts;
l_fp * ptstamp;
int maclen;
- char pass_prompt[32];
char * pass;
memset(&qpkt, 0, sizeof(qpkt));
info_auth_keyid = key_id;
}
if (!authistrusted(info_auth_keyid)) {
- snprintf(pass_prompt, sizeof(pass_prompt),
- "%s Password: ",
- keytype_name(info_auth_keytype));
- pass = getpass(pass_prompt);
+ pass = getpass_keytype(info_auth_keytype);
if ('\0' == pass[0]) {
fprintf(stderr, "Invalid password\n");
return 1;
(u_char *)pcmd->argval[0].string);
authtrust(info_auth_keyid, 1);
} else {
- pass = getpass("MD5 Password: ");
+ pass = getpass_keytype(info_auth_keytype);
if (*pass == '\0')
(void) fprintf(fp, "Password unchanged\n");
else {
};
-/*
- * Use getpassphrase() if configure.ac detected it, as Suns that
- * have it truncate the password in getpass() to 8 characters.
- */
-#ifdef HAVE_GETPASSPHRASE
-# define getpass(str) getpassphrase(str)
-#endif
-
int ntpqmain (int, char **);
/*
* Built in command handler declarations
struct ntp_control qpkt;
int pktsize;
u_long key_id;
- char pass_prompt[32];
char * pass;
int maclen;
info_auth_keyid = key_id;
}
if (!authistrusted(info_auth_keyid)) {
- snprintf(pass_prompt, sizeof(pass_prompt),
- "%s Password: ",
- keytype_name(info_auth_keytype));
- pass = getpass(pass_prompt);
+ pass = getpass_keytype(info_auth_keytype);
if ('\0' == pass[0]) {
fprintf(stderr, "Invalid password\n");
return 1;
}
info_auth_keyid = u_keyid;
}
- pass = getpass("MD5 Password: ");
- if (*pass == '\0')
- (void) fprintf(fp, "Password unchanged\n");
+ if (pcmd->nargs >= 1)
+ pass = pcmd->argval[0].string;
else {
- authusekey(info_auth_keyid, info_auth_keytype, (u_char *)pass);
- authtrust(info_auth_keyid, 1);
+ pass = getpass_keytype(info_auth_keytype);
+ if ('\0' == pass[0]) {
+ fprintf(fp, "Password unchanged\n");
+ return;
+ }
}
+ authusekey(info_auth_keyid, info_auth_keytype, (u_char *)pass);
+ authtrust(info_auth_keyid, 1);
}
FILE *fp
)
{
- register u_char *cp;
- register int c;
+ const u_char *data_u_char;
+ const u_char *cp;
+ int c;
+
+ data_u_char = (const u_char *)data;
- for (cp = (u_char *)data; cp < (u_char *)data + length; cp++) {
+ for (cp = data_u_char; cp < data_u_char + length; cp++) {
c = (int)*cp;
if (c & 0x80) {
putc('M', fp);
/* sanity check timestamp is within 1 minute of now */
GetSystemTimeAsFileTime(&Now.ft);
Now.ll -= InterpTimestamp;
- if (Now.ll > 60 * HECTONANOSECONDS ||
+ if (debug &&
+ Now.ll > 60 * HECTONANOSECONDS ||
Now.ll < -60 * (LONGLONG) HECTONANOSECONDS) {
- DPRINTF(1, ("ntp_timestamp_from_counter interpolated "
- "time %.6fs from current\n",
+ DPRINTF(1, ("ntp_timestamp_from_counter interpolated time %.6fs from current\n",
Now.ll / (double)LL_HNS));
DPRINTF(1, ("interpol time %llx from %llx\n",
InterpTimestamp,
Counterstamp));
+ msyslog(LOG_ERR,
+ "ntp_timestamp_from_counter interpolated time %.6fs from current\n",
+ Now.ll / (double)LL_HNS);
exit(-1);
}
#endif