Path: blob/main/crypto/heimdal/appl/telnet/libtelnet/misc.c
34878 views
/*-1* Copyright (c) 1991, 19932* The Regents of the University of California. All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. All advertising materials mentioning features or use of this software13* must display the following acknowledgement:14* This product includes software developed by the University of15* California, Berkeley and its contributors.16* 4. Neither the name of the University nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*/3233#include <config.h>3435RCSID("$Id$");3637#include <stdio.h>38#include <stdlib.h>39#include <string.h>40#include <roken.h>41#ifdef SOCKS42#include <socks.h>43#endif44#include "misc.h"45#include "auth.h"46#include "encrypt.h"474849const char *RemoteHostName;50const char *LocalHostName;51char *UserNameRequested = 0;52int ConnectedCount = 0;5354void55auth_encrypt_init(const char *local, const char *remote, const char *name,56int server)57{58RemoteHostName = remote;59LocalHostName = local;60#ifdef AUTHENTICATION61auth_init(name, server);62#endif63#ifdef ENCRYPTION64encrypt_init(name, server);65#endif66if (UserNameRequested) {67free(UserNameRequested);68UserNameRequested = 0;69}70}7172void73auth_encrypt_user(const char *name)74{75if (UserNameRequested)76free(UserNameRequested);77UserNameRequested = name ? strdup(name) : 0;78}7980void81auth_encrypt_connect(int cnt)82{83}8485void86printd(const unsigned char *data, int cnt)87{88if (cnt > 16)89cnt = 16;90while (cnt-- > 0) {91printf(" %02x", *data);92++data;93}94}959697