10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * Copyright (c) 2000, 2001 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 */ 240Sstevel@tonic-gate /* 25*11251SErik.Trauschke@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 260Sstevel@tonic-gate * Use is subject to license terms. 270Sstevel@tonic-gate */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _SESSION_H 300Sstevel@tonic-gate #define _SESSION_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* $OpenBSD: session.h,v 1.19 2002/06/30 21:59:45 deraadt Exp $ */ 370Sstevel@tonic-gate #define TTYSZ 64 380Sstevel@tonic-gate typedef struct Session Session; 390Sstevel@tonic-gate struct Session { 400Sstevel@tonic-gate int used; 410Sstevel@tonic-gate int self; 420Sstevel@tonic-gate struct passwd *pw; 430Sstevel@tonic-gate Authctxt *authctxt; 440Sstevel@tonic-gate pid_t pid; 450Sstevel@tonic-gate /* tty */ 460Sstevel@tonic-gate char *term; 470Sstevel@tonic-gate int ptyfd, ttyfd, ptymaster; 480Sstevel@tonic-gate u_int row, col, xpixel, ypixel; 490Sstevel@tonic-gate char tty[TTYSZ]; 500Sstevel@tonic-gate /* last login */ 510Sstevel@tonic-gate char hostname[MAXHOSTNAMELEN]; 520Sstevel@tonic-gate time_t last_login_time; 530Sstevel@tonic-gate /* X11 */ 540Sstevel@tonic-gate u_int display_number; 550Sstevel@tonic-gate char *display; 560Sstevel@tonic-gate u_int screen; 570Sstevel@tonic-gate char *auth_display; 580Sstevel@tonic-gate char *auth_proto; 590Sstevel@tonic-gate char *auth_data; 603109Sjp161948 char *auth_file; /* xauth(1) authority file */ 610Sstevel@tonic-gate int single_connection; 620Sstevel@tonic-gate /* proto 2 */ 630Sstevel@tonic-gate int chanid; 640Sstevel@tonic-gate int is_subsystem; 650Sstevel@tonic-gate char *command; 660Sstevel@tonic-gate char **env; 670Sstevel@tonic-gate }; 680Sstevel@tonic-gate 690Sstevel@tonic-gate void do_authenticated(Authctxt *); 700Sstevel@tonic-gate 710Sstevel@tonic-gate int session_open(Authctxt *, int); 720Sstevel@tonic-gate int session_input_channel_req(Channel *, const char *); 730Sstevel@tonic-gate void session_close_by_pid(pid_t, int); 740Sstevel@tonic-gate void session_close_by_channel(int, void *); 750Sstevel@tonic-gate void session_destroy_all(void (*)(Session *)); 760Sstevel@tonic-gate void session_pty_cleanup2(void *); 770Sstevel@tonic-gate 780Sstevel@tonic-gate Session *session_new(void); 790Sstevel@tonic-gate Session *session_by_tty(char *); 800Sstevel@tonic-gate void session_close(Session *); 810Sstevel@tonic-gate void do_setusercontext(struct passwd *); 820Sstevel@tonic-gate void child_set_env(char ***envp, u_int *envsizep, const char *name, 830Sstevel@tonic-gate const char *value); 84*11251SErik.Trauschke@Sun.COM void child_set_env_silent(char ***envp, u_int *envsizep, const char *name, 85*11251SErik.Trauschke@Sun.COM const char *value); 860Sstevel@tonic-gate 870Sstevel@tonic-gate 880Sstevel@tonic-gate #ifdef __cplusplus 890Sstevel@tonic-gate } 900Sstevel@tonic-gate #endif 910Sstevel@tonic-gate 920Sstevel@tonic-gate #endif /* _SESSION_H */ 93