[2384] in Kerberos-V5-bugs
Re: telnet/57: -S support for systems without gettosbyname()
daemon@ATHENA.MIT.EDU (John Hawkinson)
Thu Oct 31 23:58:31 1996
Date: Fri, 1 Nov 1996 04:58:04 GMT
To: krb5-bugs@MIT.EDU
Cc: krb5-prs@RT-11.MIT.EDU
In-Reply-To: "[2289] in Kerberos-V5-bugs"
From: John Hawkinson <jhawk@bbnplanet.com>
Sam and I had a discussion about some of the issues with regards to
the patches previously submitted.
I've updated them to be a bit more sane and no longer incompatible
with UNICOS (hey! I didn't write the original code).
Here we go, relative to beta7 and not the previous patches.
Previous patches should be ignored :-)
--jhawk
*** libtelnet/configure.in 1996/11/01 04:30:38 1.1
--- libtelnet/configure.in 1996/11/01 04:44:25 1.2
***************
*** 3,9 ****
AC_PROG_ARCHIVE
AC_PROG_ARCHIVE_ADD
AC_PROG_RANLIB
! AC_REPLACE_FUNCS([strcasecmp strdup setenv setsid strerror strftime getopt herror])
AC_FUNC_CHECK(cgetent,AC_DEFINE(HAS_CGETENT))
AC_CHECK_HEADERS(stdlib.h string.h)
LIBOBJS="$LIBOBJS getent.o"
--- 3,9 ----
AC_PROG_ARCHIVE
AC_PROG_ARCHIVE_ADD
AC_PROG_RANLIB
! AC_REPLACE_FUNCS([strcasecmp strdup setenv setsid strerror strftime getopt herror parsetos])
AC_FUNC_CHECK(cgetent,AC_DEFINE(HAS_CGETENT))
AC_CHECK_HEADERS(stdlib.h string.h)
LIBOBJS="$LIBOBJS getent.o"
*** libtelnet/Makefile.in 1996/11/01 04:22:51 1.1
--- libtelnet/Makefile.in 1996/11/01 04:44:25 1.2
***************
*** 40,45 ****
--- 40,46 ----
$(srcdir)/read_password.c \
$(srcdir)/setenv.c \
$(srcdir)/getent.c \
+ $(scrdir)/parsetos.c \
$(srcdir)/strdup.c \
$(srcdir)/strcasecmp.c \
$(srcdir)/strchr.c \
*** libtelnet/parsetos.c 1996/11/01 04:00:17 1.1
--- libtelnet/parsetos.c 1996/11/01 04:44:25 1.2
***************
*** 1,8 ****
/*
! * The routine parsetos() for UNICOS 6.0/6.1 systems. This
! * is part of UNICOS 7.0 and later.
*/
#include <stdio.h>
#include <sys/types.h>
#include <netdb.h>
--- 1,9 ----
/*
! * The routine parsetos() for UNICOS 6.0/6.1, as well as more traditional
! * Unix systems. This is part of UNICOS 7.0 and later.
*/
+
#include <stdio.h>
#include <sys/types.h>
#include <netdb.h>
***************
*** 19,40 ****
{
register char *c;
int tos;
struct tosent *tosp;
tosp = gettosbyname(name, proto);
! if (tosp) {
tos = tosp->t_tos;
! } else {
! for (c = name; *c; c++) {
! if (*c < '0' || *c > '9') {
! errno = EINVAL;
! return (-1);
! }
! }
tos = (int)strtol(name, (char **)NULL, 0);
! }
if (tos < MIN_TOS || tos > MAX_TOS) {
- errno = ERANGE;
return (-1);
}
return (tos);
--- 20,37 ----
{
register char *c;
int tos;
+
+ #ifdef HAS_GETTOS
struct tosent *tosp;
tosp = gettosbyname(name, proto);
! if (tosp)
tos = tosp->t_tos;
! else
! #endif
tos = (int)strtol(name, (char **)NULL, 0);
!
if (tos < MIN_TOS || tos > MAX_TOS) {
return (-1);
}
return (tos);
*** telnet/telnet.1 1996/10/04 08:24:13 1.1
--- telnet/telnet.1 1996/11/01 04:43:37 1.3
***************
*** 82,88 ****
Set the IP type-of-service (TOS) option for the telnet connection to the
value
.I tos,
! which can be a numeric TOS value or, on systems that support it, a
symbolic TOS name found in the /etc/iptos file.
.TP
\fB\-X\fP \fIatype\fP
--- 82,89 ----
Set the IP type-of-service (TOS) option for the telnet connection to the
value
.I tos,
! which can be a numeric TOS value (in decimal, or a hex value preceded
! by 0x, or an octal value preceded by a leading 0) or, on systems that support it, a
symbolic TOS name found in the /etc/iptos file.
.TP
\fB\-X\fP \fIatype\fP
*** telnet/main.c 1996/10/04 08:17:50 1.1
--- telnet/main.c 1996/11/01 04:43:04 1.3
***************
*** 41,46 ****
--- 41,50 ----
#include <sys/types.h>
+ #ifdef unix
+ # include <netinet/in.h>
+ #endif
+
#include "ring.h"
#include "externs.h"
#include "defines.h"
***************
*** 160,166 ****
break;
case 'S':
{
! #ifdef HAS_GETTOS
extern int tos;
if ((tos = parsetos(optarg, "tcp")) < 0)
--- 164,170 ----
break;
case 'S':
{
! #if defined(HAS_GETTOS) || (defined(IPPROTO_IP) && defined(IP_TOS))
extern int tos;
if ((tos = parsetos(optarg, "tcp")) < 0)
***************
*** 168,173 ****
--- 172,179 ----
prompt, ": Bad TOS argument '",
optarg,
"; will try to use default TOS");
+
+ fprintf(stderr, "Setting TOS to 0x%x\n", tos);
#else
fprintf(stderr,
"%s: Warning: -S ignored, no parsetos() support.\n",