xref: /csrg-svn/lib/libtelnet/misc.c (revision 46806)
1*46806Sdab /*-
2*46806Sdab  * Copyright (c) 1991 The Regents of the University of California.
3*46806Sdab  * All rights reserved.
4*46806Sdab  *
5*46806Sdab  * %sccs.include.redist.c%
6*46806Sdab  */
7*46806Sdab 
8*46806Sdab #ifndef lint
9*46806Sdab static char sccsid[] = "@(#)misc.c	5.1 (Berkeley) 02/28/91";
10*46806Sdab #endif /* not lint */
11*46806Sdab 
12*46806Sdab /*
13*46806Sdab  * Copyright (c) 1988, 1990 Regents of the University of California.
14*46806Sdab  * All rights reserved.
15*46806Sdab  *
16*46806Sdab  * Redistribution and use in source and binary forms are permitted provided
17*46806Sdab  * that: (1) source distributions retain this entire copyright notice and
18*46806Sdab  * comment, and (2) distributions including binaries display the following
19*46806Sdab  * acknowledgement:  ``This product includes software developed by the
20*46806Sdab  * University of California, Berkeley and its contributors'' in the
21*46806Sdab  * documentation or other materials provided with the distribution and in
22*46806Sdab  * all advertising materials mentioning features or use of this software.
23*46806Sdab  * Neither the name of the University nor the names of its contributors may
24*46806Sdab  * be used to endorse or promote products derived from this software without
25*46806Sdab  * specific prior written permission.
26*46806Sdab  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
27*46806Sdab  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
28*46806Sdab  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29*46806Sdab  */
30*46806Sdab 
31*46806Sdab #include "misc.h"
32*46806Sdab 
33*46806Sdab char *RemoteHostName;
34*46806Sdab char *LocalHostName;
35*46806Sdab char *UserNameRequested = 0;
36*46806Sdab int ConnectedCount = 0;
37*46806Sdab 
38*46806Sdab 	void
39*46806Sdab auth_encrypt_init(local, remote, name, server)
40*46806Sdab 	char *local;
41*46806Sdab 	char *remote;
42*46806Sdab 	char *name;
43*46806Sdab 	int server;
44*46806Sdab {
45*46806Sdab 	RemoteHostName = remote;
46*46806Sdab 	LocalHostName = local;
47*46806Sdab #if	defined(AUTHENTICATE)
48*46806Sdab 	auth_init(name, server);
49*46806Sdab #endif
50*46806Sdab #if	defined(ENCRYPT)
51*46806Sdab 	encrypt_init(name, server);
52*46806Sdab #endif
53*46806Sdab 	if (UserNameRequested) {
54*46806Sdab 		free(UserNameRequested);
55*46806Sdab 		UserNameRequested = 0;
56*46806Sdab 	}
57*46806Sdab }
58*46806Sdab 
59*46806Sdab 	void
60*46806Sdab auth_encrypt_user(name)
61*46806Sdab 	char *name;
62*46806Sdab {
63*46806Sdab 	extern char *strdup();
64*46806Sdab 
65*46806Sdab 	if (UserNameRequested)
66*46806Sdab 		free(UserNameRequested);
67*46806Sdab 	UserNameRequested = name ? strdup(name) : 0;
68*46806Sdab }
69*46806Sdab 
70*46806Sdab 	void
71*46806Sdab auth_encrypt_connect(cnt)
72*46806Sdab 	int cnt;
73*46806Sdab {
74*46806Sdab }
75*46806Sdab 
76*46806Sdab 	void
77*46806Sdab printd(data, cnt)
78*46806Sdab 	unsigned char *data;
79*46806Sdab 	int cnt;
80*46806Sdab {
81*46806Sdab 	if (cnt > 16)
82*46806Sdab 		cnt = 16;
83*46806Sdab 	while (cnt-- > 0) {
84*46806Sdab 		printf(" %02x", *data);
85*46806Sdab 		++data;
86*46806Sdab 	}
87*46806Sdab }
88