~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kdm/backend/greet.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Copyright 2001-2005 Oswald Buddenhagen <ossi@kde.org>
 
4
 
 
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.
 
10
 
 
11
The above copyright notice and this permission notice shall be included
 
12
in all copies or substantial portions of the Software.
 
13
 
 
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.
 
21
 
 
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.
 
26
 
 
27
*/
 
28
 
 
29
/*
 
30
 * xdm - display manager daemon
 
31
 * Author: Keith Packard, MIT X Consortium
 
32
 *
 
33
 * interface to xdm's external greeter and config reader
 
34
 */
 
35
 
 
36
#ifndef GREET_H
 
37
#define GREET_H
 
38
 
 
39
#include <config-workspace.h>
 
40
#include <config-unix.h>
 
41
#include <config-kdm.h>
 
42
 
 
43
#if defined(__sun) && !defined(__sun__)
 
44
# define __sun__
 
45
#endif
 
46
 
 
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
 
55
 
 
56
#ifdef __linux__
 
57
/* This needs to be run-time configurable, additionally. */
 
58
# define HAVE_VTS
 
59
#endif
 
60
 
 
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
 
73
 
 
74
#ifndef True
 
75
# define True  1
 
76
# define False 0
 
77
#endif
 
78
 
 
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
 
88
 
 
89
#ifndef offsetof
 
90
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
91
#endif
 
92
 
 
93
#define as(ar) ((int)(sizeof(ar)/sizeof(ar[0])))
 
94
 
 
95
#define __stringify(x) #x
 
96
#define stringify(x) __stringify(x)
 
97
 
 
98
/*
 
99
 * Exit codes for fork()ed session process, greeter, and config reader
 
100
 */
 
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
 
114
 
 
115
/*
 
116
 * Command codes core -> greeter
 
117
 */
 
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 */
 
131
 
 
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
 
137
 
 
138
/*
 
139
 * Status/command codes greeter -> core
 
140
 */
 
141
#define G_Ready    0    /* nop */
 
142
#define G_Cancel   1    /* abort login, etc. */
 
143
 
 
144
#define G_DGreet   2    /* get login */
 
145
#ifdef XDMCP
 
146
#define G_DChoose  3    /* run chooser */
 
147
#endif
 
148
 
 
149
#define G_Interact 4    /* greeter got user input. possible crash is probably not spontaneous. */
 
150
 
 
151
#define G_Shutdown      101 /* 5*int, string; async */
 
152
# define SHUT_REBOOT      1     /* how */
 
153
# define SHUT_HALT        2
 
154
# define SHUT_CONSOLE     -1 /* pseudo-code */
 
155
# define SHUT_SCHEDULE    0     /* when; config only */
 
156
# define SHUT_TRYNOW      1
 
157
# define SHUT_FORCENOW    2
 
158
# define SHUT_CANCEL      0     /* force */
 
159
# define SHUT_FORCEMY     1
 
160
# define SHUT_FORCE       2
 
161
# define SHUT_ASK         3
 
162
# define TO_INF           0x7fffffff
 
163
#define G_SessionExit   102 /* int code; async */
 
164
#define G_GetCfg        103 /* int what; int sts, <variable>  */
 
165
#define G_SetupDpy      104 /* ; int <syncer> */
 
166
#define G_ReadDmrc      105 /* str user; int sts - curdmrc */
 
167
#define G_GetDmrc       106 /* str key; str value - curdmrc */
 
168
/*#define G_ResetDmrc   107*/ /* ; async - newdmrc */
 
169
#define G_PutDmrc       108 /* str key, str value; async - newdmrc */
 
170
#define G_Verify        109 /* str type; ..., int V_ret */
 
171
#define G_VerifyRootOK  110 /* str type; ..., int V_ret */
 
172
#define G_List          111 /* int flags; ?*(str,str,[int,]str,str,int), int 0 */
 
173
# define lstRemote        1
 
174
# define lstPassive       2
 
175
# define lstTTY           4
 
176
# define isSelf           1
 
177
# define isTTY            2
 
178
#define G_QueryShutdown 112 /* ; 5*int; string */
 
179
#define G_Activate      113 /* int vt; async */
 
180
#define G_ListBootOpts  114 /* ; int sts, [argv opts, int dflt, int cur] */
 
181
# define BO_OK      0
 
182
# define BO_NOMAN  -1
 
183
# define BO_NOENT  -2
 
184
# define BO_IO     -3
 
185
#define G_Console       116 /* ; async */
 
186
#define G_AutoLogin     117 /* ; async */
 
187
#define G_QryDpyShutdown 118 /* ; int, int, str */
 
188
 
 
189
/*
 
190
 * Command codes core -> config reader
 
191
 */
 
192
#define GC_Files        1       /* get file list */
 
193
#define GC_GetConf      2       /* get a config group */
 
194
# define GC_gGlobal       1     /* get global config array */
 
195
#ifdef XDMCP
 
196
# define GC_gXaccess      3     /* get Xaccess equivalent */
 
197
#endif
 
198
# define GC_gDisplay      4     /* get per-display config array */
 
199
 
 
200
/*
 
201
 * Error code core -> greeter
 
202
 */
 
203
#define GE_Ok       0
 
204
#define GE_NoFkt    1   /* no such function (only for extensions!) */
 
205
#define GE_Error    2   /* internal error, like OOM */
 
206
/* for config reading */
 
207
#define GE_NoEnt   10   /* no such config entry */
 
208
#define GE_BadType 11   /* unknown config entry type */
 
209
/* for dmrc reading */
 
210
#define GE_NoUser  20   /* no such user */
 
211
#define GE_NoFile  21   /* no such file */
 
212
#define GE_Denied  22   /* permission denied */
 
213
 
 
214
/*
 
215
 * Log levels.
 
216
 * Used independently in core, greeter & config reader.
 
217
 */
 
218
#define DM_DEBUG  0
 
219
#define DM_INFO   1
 
220
#define DM_WARN   2
 
221
#define DM_ERR    3
 
222
#define DM_PANIC  4
 
223
 
 
224
/*
 
225
 * Status codes from verify
 
226
 */
 
227
/* terminal status codes */
 
228
#define V_OK              0
 
229
#define V_FAIL           10     /* whatever, already reported with V_MSG_* */
 
230
#define V_AUTH           11     /* authentication failed */
 
231
/* non-terminal status codes */
 
232
#define V_MSG_INFO      110 /* info message attached; 0 return */
 
233
#define V_MSG_ERR       111 /* error message attached (null for generic); 0 return */
 
234
#define V_PUT_USER      112 /* user name attached; only with pam & no user send */
 
235
#define V_CHTOK         113 /* password expired; change now */
 
236
#define V_CHTOK_AUTH    114 /* password expired; change now, but authenticate first */
 
237
#define V_PRE_OK        115 /* authentication succeeded, continue with password change */
 
238
#define V_MSG_INFO_AUTH 116 /* info message during auth attached; 0 return */
 
239
/* queries */
 
240
#define V_GET_TEXT      200 /* str prompt, int echo, int ndelay; str return, int tag */
 
241
# define V_IS_SECRET        1
 
242
# define V_IS_USER          2
 
243
# define V_IS_PASSWORD      4
 
244
# define V_IS_OLDPASSWORD   8
 
245
# define V_IS_NEWPASSWORD  16
 
246
#define V_GET_BINARY    201 /* array prompt, int ndelay; array return */
 
247
 
 
248
/*
 
249
 * Config/Runtime data keys
 
250
 */
 
251
#define C_WHO_MASK    0x00ff0000        /* Non-zero for proprietary extensions (see manufacturer table [to be written]) */
 
252
#define C_TYPE_MASK   0x0f000000        /* Type of the value */
 
253
# define C_TYPE_INT      0x00000000     /*   Integer */
 
254
# define C_TYPE_STR      0x01000000     /*   String */
 
255
# define C_TYPE_ARGV     0x02000000     /*   0-terminated Array of Strings */
 
256
# define C_TYPE_ARR      0x03000000     /*   Array (only when XDCMP is enabled) */
 
257
#define C_PRIVATE     0xf0000000        /* Private, don't make it visible to interfaces! */
 
258
 
 
259
/* display variables */
 
260
#define C_isLocal       (C_TYPE_INT | 0x200)
 
261
#define C_hasConsole    (C_TYPE_INT | 0x201)
 
262
#define C_isAuthorized  (C_TYPE_INT | 0x202)
 
263
#define C_isReserve     (C_TYPE_INT | 0x203)
 
264
 
 
265
#ifdef XDMCP
 
266
/**
 
267
 ** for xdmcp acls
 
268
 **/
 
269
 
 
270
/*
 
271
 * flags in acl entries
 
272
 */
 
273
#define a_notAllowed    1       /* both direct and indirect */
 
274
#define a_notBroadcast  2       /* only direct */
 
275
#define a_useChooser    2       /* only indirect */
 
276
 
 
277
/*
 
278
 * type of host entries
 
279
 */
 
280
#define HOST_ALIAS      0
 
281
#define HOST_ADDRESS    1
 
282
#define HOST_PATTERN    2
 
283
#define HOST_BROADCAST  3
 
284
 
 
285
#endif
 
286
 
 
287
#endif /* GREET_H */