not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kdm / backend / greet.h
blob5fb6eaa8385df52fca5e6de64bc6726508f8e96e
1 /*
3 Copyright 2001-2005 Oswald Buddenhagen <ossi@kde.org>
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of a copyright holder shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
25 from the copyright holder.
30 * xdm - display manager daemon
31 * Author: Keith Packard, MIT X Consortium
33 * interface to xdm's external greeter and config reader
36 #ifndef GREET_H
37 #define GREET_H
39 #include <config-workspace.h>
40 #include <config-unix.h>
41 #include <config-kdm.h>
43 #if defined(__sun) && !defined(__sun__)
44 # define __sun__
45 #endif
47 #ifdef HAVE_PAM
48 # define USE_PAM
49 #elif defined(HAVE_GETSPNAM)
50 # define USESHADOW
51 #endif
52 #ifdef HAVE_VSYSLOG
53 # define USE_SYSLOG
54 #endif
56 #ifdef __linux__
57 /* This needs to be run-time configurable, additionally. */
58 # define HAVE_VTS
59 #endif
61 #define DEBUG_CORE 0x01
62 #define DEBUG_CONFIG 0x02
63 #define DEBUG_GREET 0x04
64 #define DEBUG_HLPCON 0x08
65 #define DEBUG_WSESS 0x10
66 #define DEBUG_WCONFIG 0x20
67 #define DEBUG_WGREET 0x40
68 #define DEBUG_NOSYSLOG 0x80
69 #define DEBUG_AUTH 0x100
70 #define DEBUG_THEMING 0x200
71 #define DEBUG_VALGRIND 0x400
72 #define DEBUG_STRACE 0x800
74 #ifndef True
75 # define True 1
76 # define False 0
77 #endif
79 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
80 # define ATTR_UNUSED __attribute__((unused))
81 # define ATTR_NORETURN __attribute__((noreturn))
82 # define ATTR_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
83 #else
84 # define ATTR_UNUSED
85 # define ATTR_NORETURN
86 # define ATTR_PRINTFLIKE(fmt,var)
87 #endif
89 #ifndef offsetof
90 # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
91 #endif
93 #define as(ar) ((int)(sizeof(ar)/sizeof(ar[0])))
95 #define __stringify(x) #x
96 #define stringify(x) __stringify(x)
99 * Exit codes for fork()ed session process, greeter, and config reader
101 #define EX_NORMAL 30 /* do whatever seems appropriate */
102 #define EX_REMANAGE_DPY 31 /* force remanage; same as EX_NORMAL, but cannot return to reserve mode immediately */
103 #define EX_UNMANAGE_DPY 32 /* force deletion */
104 #define EX_RESERVER_DPY 33 /* force server termination */
105 #define EX_AL_RESERVER_DPY 34 /* reserver; maybe, auto-(re-)login */
106 #define EX_OPENFAILED_DPY 35 /* XOpenDisplay failed, retry */
107 #define EX_RESERVE 37 /* put in reserve mode */
108 #ifdef XDMCP
109 #define EX_REMOTE 38 /* start -query-ing X-server */
110 #define EX_MAX EX_REMOTE
111 #else
112 #define EX_MAX EX_RESERVE
113 #endif
116 * Command codes core -> greeter
118 #define G_Greet 1 /* get login; bidi */
119 #define G_ErrorGreet 2 /* print failed auto-login */
120 #ifdef XDMCP
121 #define G_Choose 3 /* run chooser; bidi */
122 # define G_Ch_AddHost 301
123 # define G_Ch_ChangeHost 302
124 # define G_Ch_RemoveHost 303
125 # define G_Ch_BadHost 304
126 # define G_Ch_Exit 305
127 #endif
128 #define G_SessMan 4 /* start "session manager" */
129 #define G_ConfShutdown 5 /* confirm forced shutdown */
130 #define G_GreetTimed 6 /* get login; timed login permitted */
132 #ifdef XDMCP
133 #define G_Ch_Refresh 10 /* XXX change */
134 #define G_Ch_RegisterHost 11 /* str name XXX change */
135 #define G_Ch_DirectChoice 12 /* str name XXX change */
136 #endif
139 * Status/command codes greeter -> core
141 #define G_Ready 0 /* nop */
142 #define G_Cancel 1 /* abort login, etc. */
144 #define G_DGreet 2 /* get login */
145 #ifdef XDMCP
146 #define G_DChoose 3 /* run chooser */
147 #endif
149 #define G_Shutdown 101 /* 5*int, string; async */
150 # define SHUT_REBOOT 1 /* how */
151 # define SHUT_HALT 2
152 # define SHUT_CONSOLE -1 /* pseudo-code */
153 # define SHUT_SCHEDULE 0 /* when; config only */
154 # define SHUT_TRYNOW 1
155 # define SHUT_FORCENOW 2
156 # define SHUT_CANCEL 0 /* force */
157 # define SHUT_FORCEMY 1
158 # define SHUT_FORCE 2
159 # define SHUT_ASK 3
160 # define TO_INF 0x7fffffff
161 #define G_SessionExit 102 /* int code; async */
162 #define G_GetCfg 103 /* int what; int sts, <variable> */
163 #define G_SetupDpy 104 /* ; int <syncer> */
164 #define G_ReadDmrc 105 /* str user; int sts - curdmrc */
165 #define G_GetDmrc 106 /* str key; str value - curdmrc */
166 /*#define G_ResetDmrc 107*/ /* ; async - newdmrc */
167 #define G_PutDmrc 108 /* str key, str value; async - newdmrc */
168 #define G_Verify 109 /* str type; ..., int V_ret */
169 #define G_VerifyRootOK 110 /* str type; ..., int V_ret */
170 #define G_List 111 /* int flags; ?*(str,str,[int,]str,str,int), int 0 */
171 # define lstRemote 1
172 # define lstPassive 2
173 # define lstTTY 4
174 # define isSelf 1
175 # define isTTY 2
176 #define G_QueryShutdown 112 /* ; 5*int; string */
177 #define G_Activate 113 /* int vt; async */
178 #define G_ListBootOpts 114 /* ; int sts, [argv opts, int dflt, int cur] */
179 # define BO_OK 0
180 # define BO_NOMAN -1
181 # define BO_NOENT -2
182 # define BO_IO -3
183 #define G_Console 116 /* ; async */
184 #define G_AutoLogin 117 /* ; async */
185 #define G_QryDpyShutdown 118 /* ; int, int, str */
188 * Command codes core -> config reader
190 #define GC_Files 1 /* get file list */
191 #define GC_GetConf 2 /* get a config group */
192 # define GC_gGlobal 1 /* get global config array */
193 #ifdef XDMCP
194 # define GC_gXaccess 3 /* get Xaccess equivalent */
195 #endif
196 # define GC_gDisplay 4 /* get per-display config array */
199 * Error code core -> greeter
201 #define GE_Ok 0
202 #define GE_NoFkt 1 /* no such function (only for extensions!) */
203 #define GE_Error 2 /* internal error, like OOM */
204 /* for config reading */
205 #define GE_NoEnt 10 /* no such config entry */
206 #define GE_BadType 11 /* unknown config entry type */
207 /* for dmrc reading */
208 #define GE_NoUser 20 /* no such user */
209 #define GE_NoFile 21 /* no such file */
210 #define GE_Denied 22 /* permission denied */
213 * Log levels.
214 * Used independently in core, greeter & config reader.
216 #define DM_DEBUG 0
217 #define DM_INFO 1
218 #define DM_WARN 2
219 #define DM_ERR 3
220 #define DM_PANIC 4
223 * Status codes from verify
225 /* terminal status codes */
226 #define V_OK 0
227 #define V_FAIL 10 /* whatever, already reported with V_MSG_* */
228 #define V_AUTH 11 /* authentication failed */
229 /* non-terminal status codes */
230 #define V_MSG_INFO 110 /* info message attached; 0 return */
231 #define V_MSG_ERR 111 /* error message attached (null for generic); 0 return */
232 #define V_PUT_USER 112 /* user name attached; only with pam & no user send */
233 #define V_CHTOK 113 /* password expired; change now */
234 #define V_CHTOK_AUTH 114 /* password expired; change now, but authenticate first */
235 #define V_PRE_OK 115 /* authentication succeeded, continue with password change */
236 #define V_MSG_INFO_AUTH 116 /* info message during auth attached; 0 return */
237 /* queries */
238 #define V_GET_TEXT 200 /* str prompt, int echo, int ndelay; str return, int tag */
239 # define V_IS_SECRET 1
240 # define V_IS_USER 2
241 # define V_IS_PASSWORD 4
242 # define V_IS_OLDPASSWORD 8
243 # define V_IS_NEWPASSWORD 16
244 #define V_GET_BINARY 201 /* array prompt, int ndelay; array return */
247 * Config/Runtime data keys
249 #define C_WHO_MASK 0x00ff0000 /* Non-zero for proprietary extensions (see manufacturer table [to be written]) */
250 #define C_TYPE_MASK 0x0f000000 /* Type of the value */
251 # define C_TYPE_INT 0x00000000 /* Integer */
252 # define C_TYPE_STR 0x01000000 /* String */
253 # define C_TYPE_ARGV 0x02000000 /* 0-terminated Array of Strings */
254 # define C_TYPE_ARR 0x03000000 /* Array (only when XDCMP is enabled) */
255 #define C_PRIVATE 0xf0000000 /* Private, don't make it visible to interfaces! */
257 /* display variables */
258 #define C_isLocal (C_TYPE_INT | 0x200)
259 #define C_hasConsole (C_TYPE_INT | 0x201)
260 #define C_isAuthorized (C_TYPE_INT | 0x202)
261 #define C_isReserve (C_TYPE_INT | 0x203)
263 #ifdef XDMCP
265 ** for xdmcp acls
269 * flags in acl entries
271 #define a_notAllowed 1 /* both direct and indirect */
272 #define a_notBroadcast 2 /* only direct */
273 #define a_useChooser 2 /* only indirect */
276 * type of host entries
278 #define HOST_ALIAS 0
279 #define HOST_ADDRESS 1
280 #define HOST_PATTERN 2
281 #define HOST_BROADCAST 3
283 #endif
285 #endif /* GREET_H */