10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * Copyright (c) 2000 Markus Friedl. All rights reserved. 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 50Sstevel@tonic-gate * modification, are permitted provided that the following conditions 60Sstevel@tonic-gate * are met: 70Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 80Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 90Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 100Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 110Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 140Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 150Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 160Sstevel@tonic-gate * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 170Sstevel@tonic-gate * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 180Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 190Sstevel@tonic-gate * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 200Sstevel@tonic-gate * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 210Sstevel@tonic-gate * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 220Sstevel@tonic-gate * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 230Sstevel@tonic-gate */ 24*9845SJan.Pechanec@Sun.COM /* 25*9845SJan.Pechanec@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 26*9845SJan.Pechanec@Sun.COM * Use is subject to license terms. 27*9845SJan.Pechanec@Sun.COM */ 28*9845SJan.Pechanec@Sun.COM 29*9845SJan.Pechanec@Sun.COM /* $OpenBSD: sshconnect.h,v 1.17 2002/06/19 00:27:55 deraadt Exp $ */ 30*9845SJan.Pechanec@Sun.COM 31*9845SJan.Pechanec@Sun.COM #ifndef _SSHCONNECT_H 32*9845SJan.Pechanec@Sun.COM #define _SSHCONNECT_H 33*9845SJan.Pechanec@Sun.COM 34*9845SJan.Pechanec@Sun.COM #ifdef __cplusplus 35*9845SJan.Pechanec@Sun.COM extern "C" { 36*9845SJan.Pechanec@Sun.COM #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate typedef struct Sensitive Sensitive; 390Sstevel@tonic-gate struct Sensitive { 400Sstevel@tonic-gate Key **keys; 410Sstevel@tonic-gate int nkeys; 420Sstevel@tonic-gate int external_keysign; 430Sstevel@tonic-gate }; 440Sstevel@tonic-gate 450Sstevel@tonic-gate int 46*9845SJan.Pechanec@Sun.COM ssh_connect(const char *, struct sockaddr_storage *, ushort_t, int, int, 470Sstevel@tonic-gate int, const char *); 480Sstevel@tonic-gate 490Sstevel@tonic-gate void 50*9845SJan.Pechanec@Sun.COM ssh_login(Sensitive *, const char *, struct sockaddr *, char *); 510Sstevel@tonic-gate 520Sstevel@tonic-gate int verify_host_key(char *, struct sockaddr *, Key *); 530Sstevel@tonic-gate int accept_host_key(char *, struct sockaddr *, Key *); 540Sstevel@tonic-gate 550Sstevel@tonic-gate void ssh_kex(char *, struct sockaddr *); 560Sstevel@tonic-gate void ssh_kex2(char *, struct sockaddr *); 570Sstevel@tonic-gate 580Sstevel@tonic-gate void ssh_userauth1(const char *, const char *, char *, Sensitive *); 590Sstevel@tonic-gate void ssh_userauth2(const char *, const char *, char *, Sensitive *); 600Sstevel@tonic-gate 610Sstevel@tonic-gate void ssh_put_password(char *); 620Sstevel@tonic-gate 630Sstevel@tonic-gate 640Sstevel@tonic-gate /* 650Sstevel@tonic-gate * Macros to raise/lower permissions. 660Sstevel@tonic-gate */ 67*9845SJan.Pechanec@Sun.COM #define PRIV_START do { \ 680Sstevel@tonic-gate int save_errno = errno; \ 69*9845SJan.Pechanec@Sun.COM (void) seteuid(original_effective_uid); \ 700Sstevel@tonic-gate errno = save_errno; \ 710Sstevel@tonic-gate } while (0) 720Sstevel@tonic-gate 73*9845SJan.Pechanec@Sun.COM #define PRIV_END do { \ 740Sstevel@tonic-gate int save_errno = errno; \ 75*9845SJan.Pechanec@Sun.COM (void) seteuid(original_real_uid); \ 760Sstevel@tonic-gate errno = save_errno; \ 770Sstevel@tonic-gate } while (0) 780Sstevel@tonic-gate 790Sstevel@tonic-gate #ifdef __cplusplus 800Sstevel@tonic-gate } 810Sstevel@tonic-gate #endif 820Sstevel@tonic-gate 830Sstevel@tonic-gate #endif /* _SSHCONNECT_H */ 84