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