Add -p option to rsh and rlogin to allow specifying a non-standard port
number.
This commit is contained in:
parent
09b326de30
commit
fa337680d6
@ -1,4 +1,4 @@
|
||||
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.136 $>
|
||||
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.137 $>
|
||||
|
||||
|
||||
[Note: This file does not mention every change made to the NetBSD source tree.
|
||||
@ -353,3 +353,5 @@ Changes from NetBSD 1.6 to NetBSD 2.0:
|
||||
wm(4): add support for i82540EP. [kent 20030405]
|
||||
scsi: Add a MI driver for the Symbios/NCR 53c700 SCSI controller
|
||||
written by Shuichiro URATA. [tsutsui 20030406]
|
||||
rsh(1), rlogin(1): Add -p flag to allow specifying a non-standard
|
||||
port number. [hubertf 20030407]
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: rlogin.1,v 1.14 2003/02/25 10:35:52 wiz Exp $
|
||||
.\" $NetBSD: rlogin.1,v 1.15 2003/04/07 01:46:42 hubertf Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -33,7 +33,7 @@
|
||||
.\"
|
||||
.\" @(#)rlogin.1 8.2 (Berkeley) 4/29/95
|
||||
.\"
|
||||
.Dd April 29, 1995
|
||||
.Dd March 29, 2003
|
||||
.Dt RLOGIN 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,11 +45,14 @@
|
||||
.Op Fl e Ar char
|
||||
.Op Fl k Ar realm
|
||||
.Op Fl l Ar username
|
||||
.Op Fl p Ar port
|
||||
.Ar host
|
||||
|
||||
.Nm
|
||||
.Op Fl 8EKLdx
|
||||
.Op Fl e Ar char
|
||||
.Op Fl k Ar realm
|
||||
.Op Fl p Ar port
|
||||
.Ar username@host
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
@ -115,6 +118,11 @@ option specifies an alternate
|
||||
.Ar username
|
||||
for the remote login.
|
||||
If this option is not specified, your local username will be used.
|
||||
.It Fl p
|
||||
Uses the given
|
||||
.Pa port
|
||||
instead of the one assigned to the service "login".
|
||||
May be given either as symbolic name or as number.
|
||||
.It Fl x
|
||||
The
|
||||
.Fl x
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rlogin.c,v 1.27 2002/11/16 04:42:26 itojun Exp $ */
|
||||
/* $NetBSD: rlogin.c,v 1.28 2003/04/07 01:46:42 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1990, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1990, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)rlogin.c 8.4 (Berkeley) 4/29/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: rlogin.c,v 1.27 2002/11/16 04:42:26 itojun Exp $");
|
||||
__RCSID("$NetBSD: rlogin.c,v 1.28 2003/04/07 01:46:42 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -160,6 +160,7 @@ main(int argc, char *argv[])
|
||||
char *host, *p, *user, *name, term[1024] = "network";
|
||||
speed_t ospeed;
|
||||
struct sigaction sa;
|
||||
char *service=NULL;
|
||||
struct rlimit rlim;
|
||||
#ifdef KERBEROS
|
||||
KTEXT_ST ticket;
|
||||
@ -173,6 +174,7 @@ main(int argc, char *argv[])
|
||||
argoff = dflag = 0;
|
||||
one = 1;
|
||||
host = user = NULL;
|
||||
sp = NULL;
|
||||
|
||||
if (strcmp(getprogname(), "rlogin") != 0) {
|
||||
host = strdup(getprogname());
|
||||
@ -187,9 +189,9 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#ifdef KERBEROS
|
||||
#define OPTIONS "8EKLde:k:l:x"
|
||||
#define OPTIONS "8EKLde:p:k:l:x"
|
||||
#else
|
||||
#define OPTIONS "8EKLde:l:"
|
||||
#define OPTIONS "8EKLde:p:l:"
|
||||
#endif
|
||||
while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
|
||||
switch(ch) {
|
||||
@ -222,6 +224,19 @@ main(int argc, char *argv[])
|
||||
case 'l':
|
||||
user = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
/*HF*/
|
||||
service = optarg;
|
||||
sp = getservbyname(service, "tcp");
|
||||
if (sp == NULL) { /* number given, no name */
|
||||
sp = malloc(sizeof(*sp));
|
||||
memset(sp, 0, sizeof(*sp));
|
||||
sp->s_name = service;
|
||||
sp->s_port = atoi(service);
|
||||
if (sp->s_port <= 0 || sp->s_port > IPPORT_ANONMAX)
|
||||
errx(1,"port must be between 1 and %d", IPPORT_ANONMAX);
|
||||
}
|
||||
break;
|
||||
#ifdef CRYPT
|
||||
#ifdef KERBEROS
|
||||
case 'x':
|
||||
@ -262,17 +277,18 @@ main(int argc, char *argv[])
|
||||
user = name;
|
||||
|
||||
#ifdef KERBEROS
|
||||
sp = NULL;
|
||||
if (use_kerberos) {
|
||||
sp = getservbyname((doencrypt ? "eklogin" : "klogin"), "tcp");
|
||||
if (sp == NULL) {
|
||||
sp = getservbyname((doencrypt ? "eklogin" : "klogin"), "tcp");
|
||||
}
|
||||
if (sp == NULL) {
|
||||
use_kerberos = 0;
|
||||
warning("can't get entry for %s/tcp service",
|
||||
doencrypt ? "eklogin" : "klogin");
|
||||
}
|
||||
}
|
||||
if (sp == NULL)
|
||||
#endif
|
||||
if (sp == NULL)
|
||||
sp = getservbyname("login", "tcp");
|
||||
if (sp == NULL)
|
||||
errx(1, "login/tcp: unknown service.");
|
||||
@ -340,7 +356,8 @@ try_connect:
|
||||
if (!(dest_realm = krb_realmofhost (host))) {
|
||||
warnx("Unknown realm for host %s.", host);
|
||||
use_kerberos = 0;
|
||||
sp = getservbyname("login", "tcp");
|
||||
if (service != NULL)
|
||||
sp = getservbyname("login", "tcp");
|
||||
goto try_connect;
|
||||
}
|
||||
}
|
||||
@ -357,12 +374,14 @@ try_connect:
|
||||
warnx("Host %s not registered for %s",
|
||||
host, "Kerberos rlogin service");
|
||||
use_kerberos = 0;
|
||||
sp = getservbyname("login", "tcp");
|
||||
if (service != NULL)
|
||||
sp = getservbyname("login", "tcp");
|
||||
goto try_connect;
|
||||
case NO_TKT_FIL:
|
||||
if (through_once++) {
|
||||
use_kerberos = 0;
|
||||
sp = getservbyname("login", "tcp");
|
||||
if (service != NULL)
|
||||
sp = getservbyname("login", "tcp");
|
||||
goto try_connect;
|
||||
}
|
||||
#ifdef notyet
|
||||
@ -376,7 +395,8 @@ try_connect:
|
||||
(rem == -1) ? "rcmd protocol failure" :
|
||||
krb_err_txt[rem]);
|
||||
use_kerberos = 0;
|
||||
sp = getservbyname("login", "tcp");
|
||||
if (service != NULL)
|
||||
sp = getservbyname("login", "tcp");
|
||||
goto try_connect;
|
||||
}
|
||||
}
|
||||
@ -956,7 +976,7 @@ void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: rlogin [ -%s]%s[-e char] [ -l username ] [username@]host\n",
|
||||
"usage: rlogin [ -%s]%s[-e char] [ -l username ] [-p port] [username@]host\n",
|
||||
#ifdef KERBEROS
|
||||
#ifdef CRYPT
|
||||
"8EKLdx", " [-k realm] ");
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: rsh.1,v 1.12 2003/02/25 10:35:53 wiz Exp $
|
||||
.\" $NetBSD: rsh.1,v 1.13 2003/04/07 01:46:41 hubertf Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -33,7 +33,7 @@
|
||||
.\"
|
||||
.\" @(#)rsh.1 8.2 (Berkeley) 4/29/95
|
||||
.\"
|
||||
.Dd April 29, 1995
|
||||
.Dd March 29, 2003
|
||||
.Dt RSH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -44,11 +44,14 @@
|
||||
.Op Fl Kdnx
|
||||
.Op Fl k Ar realm
|
||||
.Op Fl l Ar username
|
||||
.Op Fl p Ar port
|
||||
.Ar host
|
||||
.Op command
|
||||
|
||||
.Nm
|
||||
.Op Fl Kdnx
|
||||
.Op Fl k Ar realm
|
||||
.Op Fl p Ar port
|
||||
.Ar username@host
|
||||
.Op command
|
||||
.Sh DESCRIPTION
|
||||
@ -107,6 +110,20 @@ option redirects input from the special device
|
||||
(see the
|
||||
.Sx BUGS
|
||||
section of this manual page).
|
||||
.It Fl p
|
||||
Uses the given
|
||||
.Pa port
|
||||
instead of the one assigned to the service "shell".
|
||||
May be given either as symbolic name or as number.
|
||||
If no command is given, note that
|
||||
.Nm rlogin
|
||||
is started, which may need a different daemon
|
||||
.Nm ( rlogind ,
|
||||
instead of
|
||||
.Nm rshd )
|
||||
running on the server; You want to pass the
|
||||
.Nm rshd 's
|
||||
port number in that case.
|
||||
.It Fl x
|
||||
The
|
||||
.Fl x
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rsh.c,v 1.16 2002/11/16 13:47:34 itojun Exp $ */
|
||||
/* $NetBSD: rsh.c,v 1.17 2003/04/07 01:46:41 hubertf Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1983, 1990, 1993, 1994
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1990, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)rsh.c 8.4 (Berkeley) 4/29/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: rsh.c,v 1.16 2002/11/16 13:47:34 itojun Exp $");
|
||||
__RCSID("$NetBSD: rsh.c,v 1.17 2003/04/07 01:46:41 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -114,10 +114,12 @@ main(int argc, char **argv)
|
||||
pid_t pid;
|
||||
uid_t uid;
|
||||
char *args, *host, *p, *user, *name;
|
||||
char *service=NULL;
|
||||
|
||||
argoff = asrsh = dflag = nflag = 0;
|
||||
one = 1;
|
||||
host = user = NULL;
|
||||
sp = NULL;
|
||||
|
||||
#ifndef IN_RCMD
|
||||
/*
|
||||
@ -147,24 +149,24 @@ main(int argc, char **argv)
|
||||
|
||||
# ifdef KERBEROS
|
||||
# ifdef CRYPT
|
||||
# define OPTIONS "8KLdek:l:nu:wx"
|
||||
# define OPTIONS "8KLdek:l:np:u:wx"
|
||||
# else
|
||||
# define OPTIONS "8KLdek:l:nu:w"
|
||||
# define OPTIONS "8KLdek:l:np:u:w"
|
||||
# endif
|
||||
# else
|
||||
# define OPTIONS "8KLdel:nu:w"
|
||||
# define OPTIONS "8KLdel:np:u:w"
|
||||
# endif
|
||||
|
||||
#else /* IN_RCMD */
|
||||
|
||||
# ifdef KERBEROS
|
||||
# ifdef CRYPT
|
||||
# define OPTIONS "8KLdek:l:nwx"
|
||||
# define OPTIONS "8KLdek:l:np:wx"
|
||||
# else
|
||||
# define OPTIONS "8KLdek:l:nw"
|
||||
# define OPTIONS "8KLdek:l:np:w"
|
||||
# endif
|
||||
# else
|
||||
# define OPTIONS "8KLdel:nw"
|
||||
# define OPTIONS "8KLdel:np:w"
|
||||
# endif
|
||||
|
||||
#endif /* IN_RCMD */
|
||||
@ -201,6 +203,18 @@ main(int argc, char **argv)
|
||||
case 'n':
|
||||
nflag = 1;
|
||||
break;
|
||||
case 'p':
|
||||
service = optarg;
|
||||
sp = getservbyname(service, "tcp");
|
||||
if (sp == NULL) { /* number given, no name */
|
||||
sp = malloc(sizeof(*sp));
|
||||
memset(sp, 0, sizeof(*sp));
|
||||
sp->s_name = service;
|
||||
sp->s_port = atoi(service);
|
||||
if (sp->s_port <= 0 || sp->s_port > IPPORT_ANONMAX)
|
||||
errx(1,"port must be between 1 and %d", IPPORT_ANONMAX);
|
||||
}
|
||||
break;
|
||||
#ifdef IN_RCMD
|
||||
case 'u':
|
||||
if (getuid() != 0 && optarg && name &&
|
||||
@ -265,10 +279,11 @@ main(int argc, char **argv)
|
||||
|
||||
args = copyargs(argv);
|
||||
|
||||
sp = NULL;
|
||||
#ifdef KERBEROS
|
||||
if (use_kerberos) {
|
||||
sp = getservbyname((doencrypt ? "ekshell" : "kshell"), "tcp");
|
||||
if (sp == NULL) {
|
||||
sp = getservbyname((doencrypt ? "ekshell" : "kshell"), "tcp");
|
||||
}
|
||||
if (sp == NULL) {
|
||||
use_kerberos = 0;
|
||||
warning("can't get entry for %s/tcp service",
|
||||
@ -578,7 +593,7 @@ usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr,
|
||||
"usage: %s [-nd%s]%s[-l login]%s [login@]host %s\n", getprogname(),
|
||||
"usage: %s [-nd%s]%s[-l login] [-p port]%s [login@]host %s\n", getprogname(),
|
||||
#ifdef KERBEROS
|
||||
#ifdef CRYPT
|
||||
"x", " [-k realm] ",
|
||||
|
Loading…
Reference in New Issue
Block a user