+* [Bug 1312] ntpq/ntpdc MD5 passwords truncated to 8 chars on Suns.
(4.2.5p215) 2009/09/18 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1292] Workaround last VC6 unsigned __int64 kink.
(4.2.5p214) 2009/09/17 Released by Harlan Stenn <stenn@ntp.org>
AC_CHECK_HEADERS(memory.h netdb.h poll.h)
AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h)
AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h)
+
case "$host" in
*-*-aix*)
AC_CHECK_HEADERS(utmpx.h)
;;
*) AC_CHECK_HEADERS(utmp.h utmpx.h) ;;
esac
+
+#
+# On Suns only (so far) getpass() truncates the typed password to 8
+# characters, but getpassphrase() allows up to 257. Most systems'
+# getpass() does not truncate, at least not so as to affect ntpq and
+# ntpdc password prompts.
+#
+# So check for getpassphrase(), but only on Sun operating systems.
+#
+
+case "$host" in
+ *-*-sunos*|*-*-solaris*)
+ AC_CHECK_FUNCS(getpassphrase)
+esac
+
AC_CHECK_HEADERS(arpa/nameser.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(net/if.h, [], [],
*/
#include <sys/types.h>
#include <sys/socket.h>
-#include "ntp_rfc2553.h"
+#include "l_stdlib.h"
+#include "ntp_rfc2553.h"
#include "ntp_types.h"
#include "ntp_string.h"
#include "ntp_net.h"
-#include "l_stdlib.h"
+#include "ntp_syslog.h"
+
/*
* Handle gcc __attribute__ if available.
# endif
#endif
-# include <stdarg.h>
extern void msyslog (int, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
*/
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
} else {
l_fp ts;
int maclen = 0;
- const char *pass = "\0";
+ char *pass = "\0";
struct req_pkt_tail *qpktail;
qpktail = (struct req_pkt_tail *)((char *)&qpkt + req_pkt_size
"Invalid password\n");
return (1);
}
+ authusekey(info_auth_keyid, info_auth_keytype,
+ (const u_char *)pass);
+ authtrust(info_auth_keyid, 1);
}
- authusekey(info_auth_keyid, info_auth_keytype, (const u_char *)pass);
- authtrust(info_auth_keyid, 1);
qpkt.auth_seq = AUTH_SEQ(1, 0);
- qpktail->keyid = htonl(info_auth_keyid);
get_systime(&ts);
L_ADD(&ts, &delay_time);
HTONL_FP(&ts, &qpktail->tstamp);
};
+/*
+ * 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
int s_port = 0;
struct servent *server_entry = NULL; /* server entry for ntp */
-#ifdef SYS_WINNT
-DWORD NumberOfBytesWritten;
-
-HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */
-void timer(void) { ; }; /* 1998/06/03 - Used in ntplib/machines.c */
-
-#endif /* SYS_WINNT */
/*
* Sequence number used for requests. It is incremented before
if (!auth && !always_auth) {
return sendpkt((char *)&qpkt, pktsize);
} else {
- const char *pass = "\0";
- int maclen = 0;
- u_long my_keyid;
+ char * pass = "\0";
+ int maclen = 0;
/*
* Pad out packet to a multiple of 8 octets to be sure
"Invalid password\n");
return (1);
}
+ authusekey(info_auth_keyid, info_auth_keytype, (const u_char *)pass);
+ authtrust(info_auth_keyid, 1);
}
- authusekey(info_auth_keyid, info_auth_keytype, (const u_char *)pass);
- authtrust(info_auth_keyid, 1);
/*
- * Stick the keyid in the packet where
- * cp currently points. Cp should be aligned
- * properly. Then do the encryptions.
+ * Do the encryption.
*/
- my_keyid = htonl(info_auth_keyid);
- memcpy(&qpkt.data[qsize], &my_keyid, sizeof my_keyid);
maclen = authencrypt(info_auth_keyid, (u_int32 *)&qpkt,
pktsize);
if (maclen == 0) {