misc.c revision 29088
1193326Sed/*- 2193326Sed * Copyright (c) 1991, 1993 3193326Sed * The Regents of the University of California. All rights reserved. 4193326Sed * 5193326Sed * Redistribution and use in source and binary forms, with or without 6193326Sed * modification, are permitted provided that the following conditions 7193326Sed * are met: 8193326Sed * 1. Redistributions of source code must retain the above copyright 9193326Sed * notice, this list of conditions and the following disclaimer. 10193326Sed * 2. Redistributions in binary form must reproduce the above copyright 11193326Sed * notice, this list of conditions and the following disclaimer in the 12212904Sdim * documentation and/or other materials provided with the distribution. 13212904Sdim * 3. All advertising materials mentioning features or use of this software 14212904Sdim * must display the following acknowledgement: 15212904Sdim * This product includes software developed by the University of 16212904Sdim * California, Berkeley and its contributors. 17198092Srdivacky * 4. Neither the name of the University nor the names of its contributors 18193326Sed * may be used to endorse or promote products derived from this software 19193326Sed * without specific prior written permission. 20193326Sed * 21205219Srdivacky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22193326Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23218893Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24218893Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25212904Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26212904Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27193326Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28198092Srdivacky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29234353Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30234353Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31198092Srdivacky * SUCH DAMAGE. 32193326Sed */ 33212904Sdim 34193326Sed#ifndef lint 35218893Sdimstatic char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/4/93"; 36218893Sdim#endif /* not lint */ 37218893Sdim 38218893Sdim#include "misc.h" 39218893Sdim 40218893Sdimchar *RemoteHostName; 41218893Sdimchar *LocalHostName; 42218893Sdimchar *UserNameRequested = 0; 43198092Srdivackyint ConnectedCount = 0; 44198092Srdivacky 45198092Srdivacky void 46210299Sedauth_encrypt_init(local, remote, name, server) 47234353Sdim char *local; 48234353Sdim char *remote; 49210299Sed char *name; 50193326Sed int server; 51234353Sdim{ 52234353Sdim RemoteHostName = remote; 53234353Sdim LocalHostName = local; 54234353Sdim#if defined(AUTHENTICATION) 55210299Sed auth_init(name, server); 56234353Sdim#endif 57193326Sed#ifdef ENCRYPTION 58198092Srdivacky encrypt_init(name, server); 59198092Srdivacky#endif /* ENCRYPTION */ 60198092Srdivacky if (UserNameRequested) { 61198092Srdivacky free(UserNameRequested); 62198092Srdivacky UserNameRequested = 0; 63198092Srdivacky } 64198092Srdivacky} 65198092Srdivacky 66198092Srdivacky void 67198092Srdivackyauth_encrypt_user(name) 68198092Srdivacky char *name; 69198092Srdivacky{ 70198092Srdivacky extern char *strdup(); 71198092Srdivacky 72198092Srdivacky if (UserNameRequested) 73198092Srdivacky free(UserNameRequested); 74198092Srdivacky UserNameRequested = name ? strdup(name) : 0; 75198092Srdivacky} 76198092Srdivacky 77198092Srdivacky void 78193326Sedauth_encrypt_connect(cnt) 79193326Sed int cnt; 80198092Srdivacky{ 81198092Srdivacky} 82198092Srdivacky 83199990Srdivacky void 84199990Srdivackyprintd(data, cnt) 85198092Srdivacky unsigned char *data; 86234353Sdim int cnt; 87234353Sdim{ 88207619Srdivacky if (cnt > 16) 89207619Srdivacky cnt = 16; 90199990Srdivacky while (cnt-- > 0) { 91199990Srdivacky printf(" %02x", *data); 92199990Srdivacky ++data; 93234353Sdim } 94234353Sdim} 95199990Srdivacky