1068e7061SPeter Avalos /*-
2068e7061SPeter Avalos * Copyright (c) 1991, 1993
3068e7061SPeter Avalos * The Regents of the University of California. All rights reserved.
4068e7061SPeter Avalos *
5068e7061SPeter Avalos * Redistribution and use in source and binary forms, with or without
6068e7061SPeter Avalos * modification, are permitted provided that the following conditions
7068e7061SPeter Avalos * are met:
8068e7061SPeter Avalos * 1. Redistributions of source code must retain the above copyright
9068e7061SPeter Avalos * notice, this list of conditions and the following disclaimer.
10068e7061SPeter Avalos * 2. Redistributions in binary form must reproduce the above copyright
11068e7061SPeter Avalos * notice, this list of conditions and the following disclaimer in the
12068e7061SPeter Avalos * documentation and/or other materials provided with the distribution.
13dc71b7abSJustin C. Sherrill * 3. Neither the name of the University nor the names of its contributors
14068e7061SPeter Avalos * may be used to endorse or promote products derived from this software
15068e7061SPeter Avalos * without specific prior written permission.
16068e7061SPeter Avalos *
17068e7061SPeter Avalos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18068e7061SPeter Avalos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19068e7061SPeter Avalos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20068e7061SPeter Avalos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21068e7061SPeter Avalos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22068e7061SPeter Avalos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23068e7061SPeter Avalos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24068e7061SPeter Avalos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25068e7061SPeter Avalos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26068e7061SPeter Avalos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27068e7061SPeter Avalos * SUCH DAMAGE.
28068e7061SPeter Avalos *
29068e7061SPeter Avalos * @(#)authenc.c 8.2 (Berkeley) 5/30/95
30068e7061SPeter Avalos * $FreeBSD: src/crypto/telnet/telnetd/authenc.c,v 1.4.2.2 2002/04/13 10:59:08 markm Exp $
31068e7061SPeter Avalos */
32068e7061SPeter Avalos
33068e7061SPeter Avalos #ifdef AUTHENTICATION
34068e7061SPeter Avalos #ifdef ENCRYPTION
35068e7061SPeter Avalos /* Above "#ifdef"s actually "or"'ed together. XXX MarkM
36068e7061SPeter Avalos */
37068e7061SPeter Avalos #include "telnetd.h"
38068e7061SPeter Avalos #include <libtelnet/misc.h>
39068e7061SPeter Avalos
40*006ebf4fSSascha Wildner extern void (*encrypt_output)(unsigned char *, int);
41*006ebf4fSSascha Wildner
42068e7061SPeter Avalos int
net_write(unsigned char * str,int len)43068e7061SPeter Avalos net_write(unsigned char *str, int len)
44068e7061SPeter Avalos {
45068e7061SPeter Avalos if (nfrontp + len < netobuf + BUFSIZ) {
46068e7061SPeter Avalos output_datalen(str, len);
47068e7061SPeter Avalos return(len);
48068e7061SPeter Avalos }
49068e7061SPeter Avalos return(0);
50068e7061SPeter Avalos }
51068e7061SPeter Avalos
52068e7061SPeter Avalos void
net_encrypt(void)53068e7061SPeter Avalos net_encrypt(void)
54068e7061SPeter Avalos {
55068e7061SPeter Avalos #ifdef ENCRYPTION
56068e7061SPeter Avalos char *s = (nclearto > nbackp) ? nclearto : nbackp;
57068e7061SPeter Avalos if (s < nfrontp && encrypt_output) {
58068e7061SPeter Avalos (*encrypt_output)((unsigned char *)s, nfrontp - s);
59068e7061SPeter Avalos }
60068e7061SPeter Avalos nclearto = nfrontp;
61068e7061SPeter Avalos #endif /* ENCRYPTION */
62068e7061SPeter Avalos }
63068e7061SPeter Avalos
64068e7061SPeter Avalos int
telnet_spin(void)65068e7061SPeter Avalos telnet_spin(void)
66068e7061SPeter Avalos {
67068e7061SPeter Avalos ttloop();
68068e7061SPeter Avalos return(0);
69068e7061SPeter Avalos }
70068e7061SPeter Avalos
71068e7061SPeter Avalos char *
telnet_getenv(char * val)72068e7061SPeter Avalos telnet_getenv(char *val)
73068e7061SPeter Avalos {
74068e7061SPeter Avalos return(getenv(val));
75068e7061SPeter Avalos }
76068e7061SPeter Avalos
77068e7061SPeter Avalos char *
telnet_gets(const char * prompt __unused,char * result __unused,int length __unused,int echo __unused)78068e7061SPeter Avalos telnet_gets(const char *prompt __unused, char *result __unused, int length __unused, int echo __unused)
79068e7061SPeter Avalos {
80068e7061SPeter Avalos return(NULL);
81068e7061SPeter Avalos }
82068e7061SPeter Avalos #endif /* ENCRYPTION */
83068e7061SPeter Avalos #endif /* AUTHENTICATION */
84