xref: /csrg-svn/lib/libtelnet/misc.c (revision 57214)
146806Sdab /*-
246806Sdab  * Copyright (c) 1991 The Regents of the University of California.
346806Sdab  * All rights reserved.
446806Sdab  *
546806Sdab  * %sccs.include.redist.c%
646806Sdab  */
746806Sdab 
846806Sdab #ifndef lint
9*57214Sdab static char sccsid[] = "@(#)misc.c	5.2 (Berkeley) 12/18/92";
1046806Sdab #endif /* not lint */
1146806Sdab 
1246806Sdab /*
1346806Sdab  * Copyright (c) 1988, 1990 Regents of the University of California.
1446806Sdab  * All rights reserved.
1546806Sdab  *
1646806Sdab  * Redistribution and use in source and binary forms are permitted provided
1746806Sdab  * that: (1) source distributions retain this entire copyright notice and
1846806Sdab  * comment, and (2) distributions including binaries display the following
1946806Sdab  * acknowledgement:  ``This product includes software developed by the
2046806Sdab  * University of California, Berkeley and its contributors'' in the
2146806Sdab  * documentation or other materials provided with the distribution and in
2246806Sdab  * all advertising materials mentioning features or use of this software.
2346806Sdab  * Neither the name of the University nor the names of its contributors may
2446806Sdab  * be used to endorse or promote products derived from this software without
2546806Sdab  * specific prior written permission.
2646806Sdab  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
2746806Sdab  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
2846806Sdab  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2946806Sdab  */
3046806Sdab 
3146806Sdab #include "misc.h"
3246806Sdab 
3346806Sdab char *RemoteHostName;
3446806Sdab char *LocalHostName;
3546806Sdab char *UserNameRequested = 0;
3646806Sdab int ConnectedCount = 0;
3746806Sdab 
3846806Sdab 	void
3946806Sdab auth_encrypt_init(local, remote, name, server)
4046806Sdab 	char *local;
4146806Sdab 	char *remote;
4246806Sdab 	char *name;
4346806Sdab 	int server;
4446806Sdab {
4546806Sdab 	RemoteHostName = remote;
4646806Sdab 	LocalHostName = local;
47*57214Sdab #if	defined(AUTHENTICATION)
4846806Sdab 	auth_init(name, server);
4946806Sdab #endif
50*57214Sdab #if	defined(ENCRYPTION)
5146806Sdab 	encrypt_init(name, server);
5246806Sdab #endif
5346806Sdab 	if (UserNameRequested) {
5446806Sdab 		free(UserNameRequested);
5546806Sdab 		UserNameRequested = 0;
5646806Sdab 	}
5746806Sdab }
5846806Sdab 
5946806Sdab 	void
6046806Sdab auth_encrypt_user(name)
6146806Sdab 	char *name;
6246806Sdab {
6346806Sdab 	extern char *strdup();
6446806Sdab 
6546806Sdab 	if (UserNameRequested)
6646806Sdab 		free(UserNameRequested);
6746806Sdab 	UserNameRequested = name ? strdup(name) : 0;
6846806Sdab }
6946806Sdab 
7046806Sdab 	void
7146806Sdab auth_encrypt_connect(cnt)
7246806Sdab 	int cnt;
7346806Sdab {
7446806Sdab }
7546806Sdab 
7646806Sdab 	void
7746806Sdab printd(data, cnt)
7846806Sdab 	unsigned char *data;
7946806Sdab 	int cnt;
8046806Sdab {
8146806Sdab 	if (cnt > 16)
8246806Sdab 		cnt = 16;
8346806Sdab 	while (cnt-- > 0) {
8446806Sdab 		printf(" %02x", *data);
8546806Sdab 		++data;
8646806Sdab 	}
8746806Sdab }
88