xref: /titanic_44/usr/src/cmd/ssh/include/session.h (revision d8a94255794826f3bfbe8bc4d12e3d19e711a0ac)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
57c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
67c478bd9Sstevel@tonic-gate  * are met:
77c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
87c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
97c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
107c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
117c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
147c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
157c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
167c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
177c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
187c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
197c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
207c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
217c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
227c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate /*
25*d8a94255SErik Trauschke  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef	_SESSION_H
307c478bd9Sstevel@tonic-gate #define	_SESSION_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef __cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*	$OpenBSD: session.h,v 1.19 2002/06/30 21:59:45 deraadt Exp $	*/
377c478bd9Sstevel@tonic-gate #define TTYSZ 64
387c478bd9Sstevel@tonic-gate typedef struct Session Session;
397c478bd9Sstevel@tonic-gate struct Session {
407c478bd9Sstevel@tonic-gate 	int	used;
417c478bd9Sstevel@tonic-gate 	int	self;
427c478bd9Sstevel@tonic-gate 	struct passwd *pw;
437c478bd9Sstevel@tonic-gate 	Authctxt *authctxt;
447c478bd9Sstevel@tonic-gate 	pid_t	pid;
457c478bd9Sstevel@tonic-gate 	/* tty */
467c478bd9Sstevel@tonic-gate 	char	*term;
477c478bd9Sstevel@tonic-gate 	int	ptyfd, ttyfd, ptymaster;
487c478bd9Sstevel@tonic-gate 	u_int	row, col, xpixel, ypixel;
497c478bd9Sstevel@tonic-gate 	char	tty[TTYSZ];
507c478bd9Sstevel@tonic-gate 	/* last login */
517c478bd9Sstevel@tonic-gate 	char	hostname[MAXHOSTNAMELEN];
527c478bd9Sstevel@tonic-gate 	time_t	last_login_time;
537c478bd9Sstevel@tonic-gate 	/* X11 */
547c478bd9Sstevel@tonic-gate 	u_int	display_number;
557c478bd9Sstevel@tonic-gate 	char	*display;
567c478bd9Sstevel@tonic-gate 	u_int	screen;
577c478bd9Sstevel@tonic-gate 	char	*auth_display;
587c478bd9Sstevel@tonic-gate 	char	*auth_proto;
597c478bd9Sstevel@tonic-gate 	char	*auth_data;
60a6e0e77dSjp161948 	char	*auth_file;			/* xauth(1) authority file */
617c478bd9Sstevel@tonic-gate 	int	single_connection;
627c478bd9Sstevel@tonic-gate 	/* proto 2 */
637c478bd9Sstevel@tonic-gate 	int	chanid;
647c478bd9Sstevel@tonic-gate 	int	is_subsystem;
657c478bd9Sstevel@tonic-gate 	char	*command;
667c478bd9Sstevel@tonic-gate 	char	**env;
677c478bd9Sstevel@tonic-gate };
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate void	 do_authenticated(Authctxt *);
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate int	 session_open(Authctxt *, int);
727c478bd9Sstevel@tonic-gate int	 session_input_channel_req(Channel *, const char *);
737c478bd9Sstevel@tonic-gate void	 session_close_by_pid(pid_t, int);
747c478bd9Sstevel@tonic-gate void	 session_close_by_channel(int, void *);
757c478bd9Sstevel@tonic-gate void	 session_destroy_all(void (*)(Session *));
767c478bd9Sstevel@tonic-gate void	 session_pty_cleanup2(void *);
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate Session	*session_new(void);
797c478bd9Sstevel@tonic-gate Session	*session_by_tty(char *);
807c478bd9Sstevel@tonic-gate void	 session_close(Session *);
817c478bd9Sstevel@tonic-gate void	 do_setusercontext(struct passwd *);
827c478bd9Sstevel@tonic-gate void	 child_set_env(char ***envp, u_int *envsizep, const char *name,
837c478bd9Sstevel@tonic-gate 		       const char *value);
84*d8a94255SErik Trauschke void	 child_set_env_silent(char ***envp, u_int *envsizep, const char *name,
85*d8a94255SErik Trauschke 		       const char *value);
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #ifdef __cplusplus
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #endif /* _SESSION_H */
93