1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 5*7c478bd9Sstevel@tonic-gate * modification, are permitted provided that the following conditions 6*7c478bd9Sstevel@tonic-gate * are met: 7*7c478bd9Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 8*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 9*7c478bd9Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 10*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 11*7c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 12*7c478bd9Sstevel@tonic-gate * 13*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15*7c478bd9Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16*7c478bd9Sstevel@tonic-gate * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17*7c478bd9Sstevel@tonic-gate * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18*7c478bd9Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19*7c478bd9Sstevel@tonic-gate * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20*7c478bd9Sstevel@tonic-gate * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21*7c478bd9Sstevel@tonic-gate * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23*7c478bd9Sstevel@tonic-gate */ 24*7c478bd9Sstevel@tonic-gate /* 25*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 26*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 27*7c478bd9Sstevel@tonic-gate */ 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #ifndef _SESSION_H 30*7c478bd9Sstevel@tonic-gate #define _SESSION_H 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 35*7c478bd9Sstevel@tonic-gate extern "C" { 36*7c478bd9Sstevel@tonic-gate #endif 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate /* $OpenBSD: session.h,v 1.19 2002/06/30 21:59:45 deraadt Exp $ */ 39*7c478bd9Sstevel@tonic-gate #define TTYSZ 64 40*7c478bd9Sstevel@tonic-gate typedef struct Session Session; 41*7c478bd9Sstevel@tonic-gate struct Session { 42*7c478bd9Sstevel@tonic-gate int used; 43*7c478bd9Sstevel@tonic-gate int self; 44*7c478bd9Sstevel@tonic-gate struct passwd *pw; 45*7c478bd9Sstevel@tonic-gate Authctxt *authctxt; 46*7c478bd9Sstevel@tonic-gate pid_t pid; 47*7c478bd9Sstevel@tonic-gate /* tty */ 48*7c478bd9Sstevel@tonic-gate char *term; 49*7c478bd9Sstevel@tonic-gate int ptyfd, ttyfd, ptymaster; 50*7c478bd9Sstevel@tonic-gate u_int row, col, xpixel, ypixel; 51*7c478bd9Sstevel@tonic-gate char tty[TTYSZ]; 52*7c478bd9Sstevel@tonic-gate /* last login */ 53*7c478bd9Sstevel@tonic-gate char hostname[MAXHOSTNAMELEN]; 54*7c478bd9Sstevel@tonic-gate time_t last_login_time; 55*7c478bd9Sstevel@tonic-gate /* X11 */ 56*7c478bd9Sstevel@tonic-gate u_int display_number; 57*7c478bd9Sstevel@tonic-gate char *display; 58*7c478bd9Sstevel@tonic-gate u_int screen; 59*7c478bd9Sstevel@tonic-gate char *auth_display; 60*7c478bd9Sstevel@tonic-gate char *auth_proto; 61*7c478bd9Sstevel@tonic-gate char *auth_data; 62*7c478bd9Sstevel@tonic-gate int single_connection; 63*7c478bd9Sstevel@tonic-gate /* proto 2 */ 64*7c478bd9Sstevel@tonic-gate int chanid; 65*7c478bd9Sstevel@tonic-gate int is_subsystem; 66*7c478bd9Sstevel@tonic-gate char *command; 67*7c478bd9Sstevel@tonic-gate char **env; 68*7c478bd9Sstevel@tonic-gate }; 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate void do_authenticated(Authctxt *); 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate int session_open(Authctxt *, int); 73*7c478bd9Sstevel@tonic-gate int session_input_channel_req(Channel *, const char *); 74*7c478bd9Sstevel@tonic-gate void session_close_by_pid(pid_t, int); 75*7c478bd9Sstevel@tonic-gate void session_close_by_channel(int, void *); 76*7c478bd9Sstevel@tonic-gate void session_destroy_all(void (*)(Session *)); 77*7c478bd9Sstevel@tonic-gate void session_pty_cleanup2(void *); 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate Session *session_new(void); 80*7c478bd9Sstevel@tonic-gate Session *session_by_tty(char *); 81*7c478bd9Sstevel@tonic-gate void session_close(Session *); 82*7c478bd9Sstevel@tonic-gate void do_setusercontext(struct passwd *); 83*7c478bd9Sstevel@tonic-gate void child_set_env(char ***envp, u_int *envsizep, const char *name, 84*7c478bd9Sstevel@tonic-gate const char *value); 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 88*7c478bd9Sstevel@tonic-gate } 89*7c478bd9Sstevel@tonic-gate #endif 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate #endif /* _SESSION_H */ 92