/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 1988, 1990 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1988, 1990 Regents of the University of California.\n"
" All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#include <string.h>
#include "ring.h"
#include "externs.h"
#include "defines.h"
/* These values need to be the same as defined in libtelnet/kerberos5.c */
/* Either define them in both places, or put in some common header file. */
/*
* This flag is incremented, if any of the
* Kerberos command line options are used.
*/
int krb5auth_flag = 0;
/*
* Initialize variables.
*/
int
tninit()
{
init_network();
if (init_telnet() == 0)
return (0);
init_sys();
return (1);
}
#if defined(USE_TOS)
#else
#endif /* USE_TOS */
static void
usage()
{
" [-8] [-E] [-K] [-L] [-a] [-c] [-d] [-f/-F] [-r] [-x]"
"\n\t[-e char] [-k realm] [-l user] [-n tracefile] [-X atype]"
"\n\t[host-name [port]]");
exit(1);
}
/*
* main. Parse arguments, invoke the protocol or command parser.
*/
int
{
int ch;
char *user;
extern boolean_t auth_enable_encrypt;
extern int forward_flags;
/* Clear out things */
if (tninit() == 0)
return (EXIT_FAILURE);
}
}
++prompt;
else
autologin = -1;
switch (ch) {
case 'K':
autologin_set = 1;
autologin = 0;
break;
case 'X':
break;
case 'a':
autologin_set = 1;
autologin = 1;
break;
case 'f':
if (forward_flags & OPTS_FORWARD_CREDS) {
"%s: Only one of -f "
"and -F allowed.\n"), prompt);
usage();
}
forward_flag_set = 1;
break;
case 'F':
if (forward_flags & OPTS_FORWARD_CREDS) {
"%s: Only one of -f "
"and -F allowed.\n"), prompt);
usage();
}
forwardable_flag_set = 1;
forward_flag = 1;
break;
case 'k':
break;
case 'x':
if (krb5_privacy_allowed()) {
encrypt_auto(1);
decrypt_auto(1);
autologin = 1;
autologin_set = 1;
encrypt_flag_set = 1;
} else {
"%s: Encryption not supported.\n"),
prompt);
exit(1);
}
break;
/* begin common options */
case '8':
break;
case 'E':
break;
case 'L':
break;
#if USE_TOS
case 'S':
"%s: Warning: -S ignored, no parsetos() support.\n",
prompt);
break;
#endif /* USE_TOS */
case 'c':
skiprc = 1;
break;
case 'd':
debug = 1;
break;
case 'e':
break;
case 'l':
autologin_set = 1;
autologin = 1;
break;
case 'n':
break;
case 'r':
rlogin = '~';
break;
case 't':
"%s: Warning: -t ignored, no TN3270 support.\n",
prompt);
break;
default:
usage();
/* NOTREACHED */
}
}
if (autologin == -1)
if (argc) {
if (argc > 2)
usage();
if (user) {
*argp++ = "-l";
}
if (argc > 1)
*argp = 0;
return (EXIT_SUCCESS);
else
return (EXIT_FAILURE);
}
for (;;) {
command(1, 0, 0);
}
}