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