From: Ezra Peisach Date: Fri, 15 Nov 2002 20:21:51 +0000 (+0000) Subject: * configure.in: Test for speed_t being present X-Git-Tag: krb5-1.3-alpha1~262 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff78c5ff83d5993d265150d23da1c4694f722eea;p=krb5.git * configure.in: Test for speed_t being present * sys_term.c (addarg): When reallocing memory, ensure in size of pointer. Use speed_t instead of int for termspeeds. * authenc.c, ext.h, state.c, utility.c: Unsigned/signed cleanup. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15012 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/telnet/telnetd/ChangeLog b/src/appl/telnet/telnetd/ChangeLog index 11b7b9516..64d44c949 100644 --- a/src/appl/telnet/telnetd/ChangeLog +++ b/src/appl/telnet/telnetd/ChangeLog @@ -1,3 +1,12 @@ +2002-11-15 Ezra Peisach + + * configure.in: Test for speed_t being present. + + * sys_term.c (addarg): When reallocing memory, ensure in size of + pointer. Use speed_t instead of int for termspeeds. + + * authenc.c, ext.h, state.c, utility.c: Unsigned/signed cleanup. + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/appl/telnet/telnetd/authenc.c b/src/appl/telnet/telnetd/authenc.c index 448895400..6d8b04ced 100644 --- a/src/appl/telnet/telnetd/authenc.c +++ b/src/appl/telnet/telnetd/authenc.c @@ -44,7 +44,7 @@ net_write(str, len) { if (len < 0) return 0; - return netwrite(str, len); + return netwrite(str, (size_t) len); } void diff --git a/src/appl/telnet/telnetd/configure.in b/src/appl/telnet/telnetd/configure.in index e64292e59..7e5780d3a 100644 --- a/src/appl/telnet/telnetd/configure.in +++ b/src/appl/telnet/telnetd/configure.in @@ -25,6 +25,30 @@ AC_HEADER_TIME AC_CHECK_HEADERS(string.h arpa/nameser.h utmp.h sys/time.h sys/tty.h sac.h sys/ptyvar.h sys/filio.h sys/stream.h sys/utsname.h memory.h) AC_CHECK_FUNCS(gettosbyname vsnprintf) KRB5_AC_INET6 +dnl +dnl Test if speed_t needs to be defined +AC_CACHE_CHECK([if speed_t is defined], krb5_cv_type_speed_t, +[AC_TRY_COMPILE(dnl +[#include +#if STDC_HEADERS +#include +#include +#endif +#ifndef USE_TERMIO +#include +#else +# ifdef SYSV_TERMIO +# include +# else +# include +# endif +#endif +],[speed_t termspeed],krb5_cv_type_speed_t=yes, krb5_cv_type_speed_t=no)]) +if test $krb5_cv_type_speed_t = no; then + AC_DEFINE(speed_t, int) +fi; +dnl +dnl dnl Make our operating system-specific security checks and definitions for dnl login. dnl diff --git a/src/appl/telnet/telnetd/ext.h b/src/appl/telnet/telnetd/ext.h index 445fb9b96..9fe38ef8b 100644 --- a/src/appl/telnet/telnetd/ext.h +++ b/src/appl/telnet/telnetd/ext.h @@ -180,7 +180,7 @@ extern void extern void netprintf (const char *, ...); extern void netprintf_urg (const char *fmt, ...); extern void netprintf_noflush (const char *fmt, ...); -extern int netwrite (const char *, size_t); +extern int netwrite (const unsigned char *, size_t); extern void netputs (const char *); #ifdef ENCRYPTION diff --git a/src/appl/telnet/telnetd/state.c b/src/appl/telnet/telnetd/state.c index 104af6943..b01842f00 100644 --- a/src/appl/telnet/telnetd/state.c +++ b/src/appl/telnet/telnetd/state.c @@ -1633,7 +1633,7 @@ send_status() ADD(IAC); ADD(SE); - netwrite(statusbuf, ncp - statusbuf); + netwrite(statusbuf, (unsigned) (ncp - statusbuf)); netflush(); /* Send it on its way */ DIAG(TD_OPTIONS, diff --git a/src/appl/telnet/telnetd/sys_term.c b/src/appl/telnet/telnetd/sys_term.c index 05b57ffb6..bfd1f81af 100644 --- a/src/appl/telnet/telnetd/sys_term.c +++ b/src/appl/telnet/telnetd/sys_term.c @@ -855,7 +855,7 @@ tty_iscrnl() */ struct termspeeds { int speed; - int value; + speed_t value; } termspeeds[] = { { 0, B0 }, { 50, B50 }, { 75, B75 }, { 110, B110 }, { 134, B134 }, { 150, B150 }, @@ -1437,7 +1437,7 @@ addarg(argv, val) if (cpp == &argv[(long)argv[-1]]) { --argv; *argv = (char *)((long)(*argv) + 10); - argv = (char **)realloc(argv, (long)(*argv) + 2); + argv = (char **)realloc(argv, sizeof(*argv) * ((long)(*argv) + 2)); if (argv == NULL) return(NULL); argv++; diff --git a/src/appl/telnet/telnetd/utility.c b/src/appl/telnet/telnetd/utility.c index 106dc69e3..fc8ff7601 100644 --- a/src/appl/telnet/telnetd/utility.c +++ b/src/appl/telnet/telnetd/utility.c @@ -126,7 +126,7 @@ ptyflush() DIAG((TD_REPORT | TD_PTYDATA), netprintf("td: ptyflush %d chars\r\n", n)); DIAG(TD_PTYDATA, printdata("pd", pbackp, n)); - n = write(pty, pbackp, n); + n = write(pty, pbackp, (unsigned) n); } if (n < 0) { if (errno == EWOULDBLOCK || errno == EINTR) @@ -224,7 +224,7 @@ netclear() while (nfrontp > thisitem) { if (wewant(thisitem)) { - int length; + unsigned int length; next = thisitem; do { @@ -273,7 +273,7 @@ netflush() * write the entire buffer in non-OOB mode. */ if ((neturg == 0) || (not42 == 0)) { - n = write(net, nbackp, n); /* normal write */ + n = write(net, nbackp, (unsigned) n); /* normal write */ } else { n = neturg - nbackp; /* @@ -330,7 +330,7 @@ netflush() * Thou shalt not call this with a "%s" format; use netputs instead. * We also don't deal with floating point widths in here. */ -void +static void netprintf_ext(int noflush, int seturg, const char *fmt, va_list args) { size_t remain; @@ -413,7 +413,7 @@ netprintf_noflush(const char *fmt, ...) * netflush() if needed. */ int -netwrite(const char *buf, size_t len) +netwrite(const unsigned char *buf, size_t len) { size_t remain; @@ -437,7 +437,7 @@ netwrite(const char *buf, size_t len) void netputs(const char *s) { - netwrite(s, strlen(s)); + netwrite((const unsigned char *) s, strlen(s)); } /* @@ -463,7 +463,7 @@ fatal(f, msg) netflush(); } #endif /* ENCRYPTION */ - (void) write(f, buf, (int)strlen(buf)); + (void) write(f, buf, strlen(buf)); sleep(1); /*XXX*/ exit(1); } @@ -693,7 +693,7 @@ printsub(direction, pointer, length) switch (pointer[1]) { case TELQUAL_IS: netputs("IS \""); - netwrite((char *)pointer + 2, (size_t)(length - 2)); + netwrite(pointer + 2, (size_t)(length - 2)); netputs("\""); break; case TELQUAL_SEND: @@ -713,7 +713,7 @@ printsub(direction, pointer, length) switch (pointer[1]) { case TELQUAL_IS: netputs("IS "); - netwrite((char *)pointer + 2, (size_t)(length - 2)); + netwrite(pointer + 2, (size_t)(length - 2)); break; default: if (pointer[1] == 1) @@ -962,7 +962,7 @@ do { \ switch (pointer[1]) { case TELQUAL_IS: netputs("IS \""); - netwrite((char *)pointer + 2, (size_t)(length - 2)); + netwrite(pointer + 2, (size_t)(length - 2)); netputs("\""); break; case TELQUAL_SEND: @@ -1063,7 +1063,8 @@ do { \ netputs(((pointer[3] & AUTH_ENCRYPT_MASK) == AUTH_ENCRYPT_ON) ? "|ENCRYPT" : ""); - auth_printsub(&pointer[1], length - 1, buf, sizeof(buf)); + auth_printsub(&pointer[1], length - 1, (unsigned char *)buf, + sizeof(buf)); netputs(buf); break; @@ -1150,7 +1151,8 @@ do { \ netprintf("%d (unknown)", pointer[2]); netputs(" "); - encrypt_printsub(&pointer[1], length - 1, buf, sizeof(buf)); + encrypt_printsub(&pointer[1], length - 1, + (unsigned char *) buf, sizeof(buf)); netputs(buf); break;