Path: blob/main/crypto/heimdal/appl/rsh/rsh_locl.h
34889 views
/*1* Copyright (c) 1997 - 2004 Kungliga Tekniska Högskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8*9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11*12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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/* $Id$ */3435#ifdef HAVE_CONFIG_H36#include <config.h>37#endif3839#include <stdio.h>40#include <assert.h>41#include <stdarg.h>42#include <ctype.h>43#ifdef HAVE_SYS_TYPES_H44#include <sys/types.h>45#endif46#ifdef HAVE_UNISTD_H47#include <unistd.h>48#endif49#ifdef HAVE_SYS_WAIT_H50#include <sys/wait.h>51#endif52#ifdef HAVE_SYS_SELECT_H53#include <sys/select.h>54#endif55#ifdef HAVE_SYS_SOCKET_H56#include <sys/socket.h>57#endif58#ifdef HAVE_NETINET_IN_H59#include <netinet/in.h>60#endif61#ifdef HAVE_NETINET_IN6_H62#include <netinet/in6.h>63#endif64#ifdef HAVE_NETINET6_IN6_H65#include <netinet6/in6.h>66#endif67#ifdef HAVE_ARPA_INET_H68#include <arpa/inet.h>69#endif7071#ifdef HAVE_PWD_H72#include <pwd.h>73#endif74#ifdef HAVE_SHADOW_H75#include <shadow.h>76#endif77#ifdef HAVE_NETDB_H78#include <netdb.h>79#endif80#ifdef HAVE_LIMITS_H81#include <limits.h>82#endif83#include <errno.h>8485#ifdef HAVE_SYS_PARAM_H86#include <sys/param.h>87#endif8889#ifdef HAVE_SYSLOG_H90#include <syslog.h>91#endif92#ifdef HAVE_PATHS_H93#include <paths.h>94#endif95#include <err.h>96#include <roken.h>97#include <getarg.h>98#ifdef KRB599#include <krb5.h>100/* XXX */101struct hx509_certs_data;102struct krb5_pk_identity;103struct krb5_pk_cert;104struct ContentInfo;105struct AlgorithmIdentifier;106struct _krb5_krb_auth_data;107struct krb5_dh_moduli;108struct _krb5_key_data;109struct _krb5_encryption_type;110struct _krb5_key_type;111#include "crypto-headers.h"112#include <krb5-private.h> /* for _krb5_{get,put}_int */113#endif114#if defined(KRB5)115#include <kafs.h>116#endif117118#ifndef _PATH_BSHELL119#define _PATH_BSHELL "/bin/sh"120#endif121122#ifndef _PATH_DEFPATH123#define _PATH_DEFPATH "/usr/bin:/bin"124#endif125126#include "loginpaths.h"127128/*129*130*/131132enum auth_method { AUTH_KRB5, AUTH_BROKEN };133134extern enum auth_method auth_method;135extern int do_encrypt;136#ifdef KRB5137extern krb5_context context;138extern krb5_keyblock *keyblock;139extern krb5_crypto crypto;140extern int key_usage;141extern void *ivec_in[2];142extern void *ivec_out[2];143void init_ivecs(int, int);144#endif145146#define KCMD_OLD_VERSION "KCMDV0.1"147#define KCMD_NEW_VERSION "KCMDV0.2"148149#define USERNAME_SZ 16150#ifndef ARG_MAX151#define ARG_MAX 8192152#endif153154#define RSH_BUFSIZ (5 * 1024) /* MIT kcmd can't handle larger buffers */155#define RSHD_BUFSIZ (16 * 1024) /* Old maxize for Heimdal 0.4 rsh */156157#define PATH_RSH BINDIR "/rsh"158159#if defined(KRB5)160ssize_t do_read (int, void*, size_t, void*);161ssize_t do_write (int, void*, size_t, void*);162#else163#define do_write(F, B, L, I) write((F), (B), (L))164#define do_read(F, B, L, I) read((F), (B), (L))165#endif166167168