Home | History | Annotate | Line # | Download | only in dist
session.h revision 1.5
      1  1.1  christos /*	$NetBSD: session.h,v 1.5 2016/08/02 13:45:12 christos Exp $	*/
      2  1.5  christos /* $OpenBSD: session.h,v 1.32 2016/03/07 19:02:43 djm Exp $ */
      3  1.1  christos 
      4  1.1  christos /*
      5  1.1  christos  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
      6  1.1  christos  *
      7  1.1  christos  * Redistribution and use in source and binary forms, with or without
      8  1.1  christos  * modification, are permitted provided that the following conditions
      9  1.1  christos  * are met:
     10  1.1  christos  * 1. Redistributions of source code must retain the above copyright
     11  1.1  christos  *    notice, this list of conditions and the following disclaimer.
     12  1.1  christos  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  christos  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  christos  *    documentation and/or other materials provided with the distribution.
     15  1.1  christos  *
     16  1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  christos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  christos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1  christos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  christos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  1.1  christos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  1.1  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  1.1  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  1.1  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  1.1  christos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  1.1  christos  */
     27  1.1  christos #ifndef SESSION_H
     28  1.1  christos #define SESSION_H
     29  1.1  christos 
     30  1.2  christos #include <tzfile.h>
     31  1.2  christos 
     32  1.1  christos #define TTYSZ 64
     33  1.1  christos typedef struct Session Session;
     34  1.1  christos struct Session {
     35  1.1  christos 	int	used;
     36  1.1  christos 	int	self;
     37  1.1  christos 	int	next_unused;
     38  1.1  christos 	struct passwd *pw;
     39  1.1  christos 	Authctxt *authctxt;
     40  1.1  christos 	pid_t	pid;
     41  1.1  christos 
     42  1.1  christos 	/* tty */
     43  1.1  christos 	char	*term;
     44  1.1  christos 	int	ptyfd, ttyfd, ptymaster;
     45  1.1  christos 	u_int	row, col, xpixel, ypixel;
     46  1.1  christos 	char	tty[TTYSZ];
     47  1.1  christos 
     48  1.1  christos 	/* X11 */
     49  1.1  christos 	u_int	display_number;
     50  1.1  christos 	char	*display;
     51  1.1  christos 	u_int	screen;
     52  1.1  christos 	char	*auth_display;
     53  1.1  christos 	char	*auth_proto;
     54  1.1  christos 	char	*auth_data;
     55  1.1  christos 	int	single_connection;
     56  1.1  christos 
     57  1.1  christos 	/* proto 2 */
     58  1.1  christos 	int	chanid;
     59  1.1  christos 	int	*x11_chanids;
     60  1.1  christos 	int	is_subsystem;
     61  1.3  christos 	char	*subsys;
     62  1.1  christos 	u_int	num_env;
     63  1.1  christos 	struct {
     64  1.1  christos 		char	*name;
     65  1.1  christos 		char	*val;
     66  1.1  christos 	} *env;
     67  1.1  christos };
     68  1.1  christos 
     69  1.1  christos void	 do_authenticated(Authctxt *);
     70  1.1  christos void	 do_cleanup(Authctxt *);
     71  1.1  christos 
     72  1.1  christos int	 session_open(Authctxt *, int);
     73  1.1  christos void	 session_unused(int);
     74  1.1  christos int	 session_input_channel_req(Channel *, const char *);
     75  1.1  christos void	 session_close_by_pid(pid_t, int);
     76  1.1  christos void	 session_close_by_channel(int, void *);
     77  1.1  christos void	 session_destroy_all(void (*)(Session *));
     78  1.1  christos void	 session_pty_cleanup2(Session *);
     79  1.1  christos 
     80  1.1  christos Session	*session_new(void);
     81  1.1  christos Session	*session_by_tty(char *);
     82  1.1  christos void	 session_close(Session *);
     83  1.1  christos void	 do_setusercontext(struct passwd *);
     84  1.1  christos void	 child_set_env(char ***envp, u_int *envsizep, const char *name,
     85  1.1  christos 		       const char *value);
     86  1.1  christos 
     87  1.5  christos const char	*session_get_remote_name_or_ip(struct ssh *, u_int, int);
     88  1.5  christos 
     89  1.1  christos #endif
     90