1*e6440d8dSdjm /* $OpenBSD: session.h,v 1.22 2004/04/27 09:46:37 djm Exp $ */ 2d4e7c603Sniklas 3607fba6cSderaadt /* 4a4d26d98Smarkus * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 5607fba6cSderaadt * 6607fba6cSderaadt * Redistribution and use in source and binary forms, with or without 7607fba6cSderaadt * modification, are permitted provided that the following conditions 8607fba6cSderaadt * are met: 9607fba6cSderaadt * 1. Redistributions of source code must retain the above copyright 10607fba6cSderaadt * notice, this list of conditions and the following disclaimer. 11607fba6cSderaadt * 2. Redistributions in binary form must reproduce the above copyright 12607fba6cSderaadt * notice, this list of conditions and the following disclaimer in the 13607fba6cSderaadt * documentation and/or other materials provided with the distribution. 14607fba6cSderaadt * 15607fba6cSderaadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16607fba6cSderaadt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17607fba6cSderaadt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18607fba6cSderaadt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19607fba6cSderaadt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20607fba6cSderaadt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21607fba6cSderaadt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22607fba6cSderaadt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23607fba6cSderaadt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24607fba6cSderaadt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25607fba6cSderaadt */ 26133a7928Smarkus #ifndef SESSION_H 27133a7928Smarkus #define SESSION_H 28133a7928Smarkus 2950c32c83Sprovos #define TTYSZ 64 3050c32c83Sprovos typedef struct Session Session; 3150c32c83Sprovos struct Session { 3250c32c83Sprovos int used; 3350c32c83Sprovos int self; 3450c32c83Sprovos struct passwd *pw; 3550c32c83Sprovos Authctxt *authctxt; 3650c32c83Sprovos pid_t pid; 3750c32c83Sprovos /* tty */ 3850c32c83Sprovos char *term; 3950c32c83Sprovos int ptyfd, ttyfd, ptymaster; 406c28c6bcSderaadt u_int row, col, xpixel, ypixel; 4150c32c83Sprovos char tty[TTYSZ]; 4247ec601fSmarkus /* last login */ 4347ec601fSmarkus char hostname[MAXHOSTNAMELEN]; 4447ec601fSmarkus time_t last_login_time; 4550c32c83Sprovos /* X11 */ 466c28c6bcSderaadt u_int display_number; 4750c32c83Sprovos char *display; 486c28c6bcSderaadt u_int screen; 4950c32c83Sprovos char *auth_display; 5050c32c83Sprovos char *auth_proto; 5150c32c83Sprovos char *auth_data; 5250c32c83Sprovos int single_connection; 5350c32c83Sprovos /* proto 2 */ 5450c32c83Sprovos int chanid; 5550c32c83Sprovos int is_subsystem; 56*e6440d8dSdjm int num_env; 57*e6440d8dSdjm struct { 58*e6440d8dSdjm char *name; 59*e6440d8dSdjm char *val; 60*e6440d8dSdjm } *env; 6150c32c83Sprovos }; 6250c32c83Sprovos 6308d1172dSitojun void do_authenticated(Authctxt *); 64b8b8936dSmarkus void do_cleanup(Authctxt *); 65133a7928Smarkus 661b9280a0Smarkus int session_open(Authctxt *, int); 67e07b5efdSmarkus int session_input_channel_req(Channel *, const char *); 6808d1172dSitojun void session_close_by_pid(pid_t, int); 6908d1172dSitojun void session_close_by_channel(int, void *); 7050c32c83Sprovos void session_destroy_all(void (*)(Session *)); 71b8b8936dSmarkus void session_pty_cleanup2(Session *); 724f9037ccSmarkus 7350c32c83Sprovos Session *session_new(void); 7450c32c83Sprovos Session *session_by_tty(char *); 7550c32c83Sprovos void session_close(Session *); 7650c32c83Sprovos void do_setusercontext(struct passwd *); 77c9017d5dSmarkus void child_set_env(char ***envp, u_int *envsizep, const char *name, 78c9017d5dSmarkus const char *value); 79c9017d5dSmarkus 80133a7928Smarkus #endif 81