1 /* Copyright (c) 2008, 2009
2  *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3  *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4  *      Micah Cowan (micah@cowan.name)
5  *      Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6  * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7  *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8  *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9  * Copyright (c) 1987 Oliver Laumann
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3, or (at your option)
14  * any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program (see the file COPYING); if not, see
23  * https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
25  *
26  ****************************************************************
27  */
28 
29 #ifdef MULTIUSER
30 
31 /* three known bits: */
32 #define ACL_EXEC 0
33 #define ACL_WRITE 1
34 #define ACL_READ 2
35 
36 #define ACL_BITS_PER_CMD 1	/* for comm.h */
37 #define ACL_BITS_PER_WIN 3	/* for window.h */
38 
39 #define USER_CHUNK 8
40 
41 #define ACLBYTE(data, w)   ((data)[(w) >> 3])
42 #define ACLBIT(w)   (0x80 >> ((w) & 7))
43 
44 typedef unsigned char * AclBits;
45 
46 /*
47  * How a user joins a group.
48  * Here is the node to construct one list per user.
49  */
50 struct aclusergroup
51 {
52   struct acluser *u;	/* the user who borrows us his rights */
53   struct aclusergroup *next;
54 };
55 #endif /* MULTIUSER */
56 
57 /***************
58  *  ==> user.h
59  */
60 
61 /*
62  * a copy buffer
63  */
64 struct plop
65 {
66   char *buf;
67   int len;
68 #ifdef ENCODINGS
69   int enc;
70 #endif
71 };
72 
73 /*
74  * A User has a list of groups, and points to other users.
75  * users is the User entry of the session owner (creator)
76  * and anchors all other users. Add/Delete users there.
77  */
78 typedef struct acluser
79 {
80   struct acluser *u_next;		/* continue the main user list */
81   char u_name[MAXLOGINLEN + 1];		/* login name how he showed up */
82   char *u_password;		/* his password (may be NullStr). */
83   int  u_checkpassword;		/* nonzero if this u_password is valid */
84   int  u_detachwin;		/* the window where he last detached */
85   int  u_detachotherwin;	/* window that was "other" when he detached */
86   int  u_Esc, u_MetaEsc;	/* the users screen escape character */
87 #ifdef COPY_PASTE
88   struct plop u_plop;
89 #endif
90 #ifdef MULTIUSER
91   int u_id;			/* a uniq index in the bitfields. */
92   AclBits u_umask_w_bits[ACL_BITS_PER_WIN];	/* his window create umask */
93   struct aclusergroup *u_group;	/* linked list of pointers to other users */
94 #endif
95 } User;
96 
97 extern int DefaultEsc, DefaultMetaEsc;
98 
99