add -P',
-v', and `-L' flags
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5715 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1998 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997-1999 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -49,6 +49,16 @@ des_cblock iv;
|
|||||||
|
|
||||||
int do_encrypt = 0;
|
int do_encrypt = 0;
|
||||||
|
|
||||||
|
static int do_inetd = 1;
|
||||||
|
static char *port_str;
|
||||||
|
static int do_rhosts;
|
||||||
|
static int do_kerberos = 0;
|
||||||
|
static int do_vacuous = 0;
|
||||||
|
static int do_log = 1;
|
||||||
|
static int do_newpag = 1;
|
||||||
|
static int do_version;
|
||||||
|
static int do_help = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
syslog_and_die (const char *m, ...)
|
syslog_and_die (const char *m, ...)
|
||||||
{
|
{
|
||||||
@@ -346,11 +356,12 @@ loop (int from0, int to0,
|
|||||||
char buf[RSH_BUFSIZ];
|
char buf[RSH_BUFSIZ];
|
||||||
|
|
||||||
ret = select (max_fd, &readset, NULL, NULL, NULL);
|
ret = select (max_fd, &readset, NULL, NULL, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
syslog_and_die ("select: %m");
|
syslog_and_die ("select: %m");
|
||||||
|
}
|
||||||
if (FD_ISSET(from0, &readset)) {
|
if (FD_ISSET(from0, &readset)) {
|
||||||
ret = do_read (from0, buf, sizeof(buf));
|
ret = do_read (from0, buf, sizeof(buf));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -522,9 +533,13 @@ doit (int do_kerberos, int check_rhosts)
|
|||||||
if(recv_bsd_auth (s, buf, thisaddr, thataddr,
|
if(recv_bsd_auth (s, buf, thisaddr, thataddr,
|
||||||
client_user,
|
client_user,
|
||||||
server_user,
|
server_user,
|
||||||
cmd) == 0)
|
cmd) == 0) {
|
||||||
auth_method = AUTH_BROKEN;
|
auth_method = AUTH_BROKEN;
|
||||||
else
|
if(do_vacuous) {
|
||||||
|
printf("Remote host requires Kerberos authentication\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
} else
|
||||||
syslog_and_die("recv_bsd_auth failed");
|
syslog_and_die("recv_bsd_auth failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,54 +590,51 @@ doit (int do_kerberos, int check_rhosts)
|
|||||||
fatal (s, "write failed");
|
fatal (s, "write failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef KRB4
|
||||||
|
if(k_hasafs()) {
|
||||||
|
if(do_newpag)
|
||||||
|
k_setpag();
|
||||||
|
krb_afslog(NULL, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
execle (pwd->pw_shell, pwd->pw_shell, "-c", cmd, NULL, env);
|
execle (pwd->pw_shell, pwd->pw_shell, "-c", cmd, NULL, env);
|
||||||
err(1, "exec %s", pwd->pw_shell);
|
err(1, "exec %s", pwd->pw_shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
usage (int ret)
|
|
||||||
{
|
|
||||||
syslog (LOG_ERR, "Usage: %s [-ixkl] [-p port]", __progname);
|
|
||||||
exit (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int do_inetd = 1;
|
|
||||||
static char *port_str;
|
|
||||||
static int do_rhosts;
|
|
||||||
static int do_kerberos = 0;
|
|
||||||
static int do_version;
|
|
||||||
static int do_help = 0;
|
|
||||||
|
|
||||||
struct getargs args[] = {
|
struct getargs args[] = {
|
||||||
{ "inetd", 'i', arg_negative_flag, &do_inetd,
|
{ "inetd", 'i', arg_negative_flag, &do_inetd,
|
||||||
"Expect to be started by inetd", NULL },
|
"Not started from inetd" },
|
||||||
{ "kerberos", 'k', arg_flag, &do_kerberos,
|
{ "kerberos", 'k', arg_flag, &do_kerberos,
|
||||||
"Implement kerberised services", NULL },
|
"Implement kerberised services" },
|
||||||
{ "encrypt", 'x', arg_flag, &do_encrypt,
|
{ "encrypt", 'x', arg_flag, &do_encrypt,
|
||||||
"Implement encrypted service", NULL },
|
"Implement encrypted service" },
|
||||||
{ "rhosts", 'l', arg_negative_flag, &do_rhosts,
|
{ "rhosts", 'l', arg_flag, &do_rhosts,
|
||||||
"Check users .rhosts", NULL },
|
"Check users .rhosts" },
|
||||||
{ "port", 'p', arg_string, &port_str, "Use this port",
|
{ "port", 'p', arg_string, &port_str, "Use this port",
|
||||||
"number-or-service" },
|
"port" },
|
||||||
{ "version", 0, arg_flag, &do_version, "Print version",
|
{ "vacuous", 'v', arg_flag, &do_vacuous,
|
||||||
NULL },
|
"Don't accept non-kerberised connections" },
|
||||||
{ "help", 0, arg_flag, &do_help, NULL,
|
{ NULL, 'P', arg_negative_flag, &do_newpag,
|
||||||
NULL }
|
"Don't put process in new PAG" },
|
||||||
|
/* compatibility flag: */
|
||||||
|
{ NULL, 'L', arg_flag, &do_log },
|
||||||
|
{ "version", 0, arg_flag, &do_version },
|
||||||
|
{ "help", 0, arg_flag, &do_help }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage (int ret)
|
usage (int ret)
|
||||||
{
|
{
|
||||||
arg_printusage (args,
|
if(isatty(STDIN_FILENO))
|
||||||
sizeof(args) / sizeof(args[0]),
|
arg_printusage (args,
|
||||||
NULL,
|
sizeof(args) / sizeof(args[0]),
|
||||||
"host command");
|
NULL,
|
||||||
|
"host command");
|
||||||
|
else
|
||||||
|
syslog (LOG_ERR, "Usage: %s [-ixklv] [-p port]", __progname);
|
||||||
exit (ret);
|
exit (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@@ -641,8 +653,8 @@ main(int argc, char **argv)
|
|||||||
usage (0);
|
usage (0);
|
||||||
|
|
||||||
if (do_version) {
|
if (do_version) {
|
||||||
printf ("%s (%s-%s)\n", __progname, PACKAGE, VERSION);
|
print_version(NULL);
|
||||||
return 0;
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(port_str) {
|
if(port_str) {
|
||||||
|
Reference in New Issue
Block a user