summaryrefslogtreecommitdiff
path: root/xc/programs/xdm/greet.h
blob: 5f74f4d99623bfac4cd36e0e106c07c93ffe7edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* $XConsortium: greet.h,v 1.3 94/04/17 20:03:39 gildea Exp converse $ */
/*

Copyright (c) 1994  X Consortium

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.

*/

/*
 * greet.h - interface to xdm's dynamically-loadable modular greeter
 */

#include <X11/Xlib.h>

struct dlfuncs {
    int (*_PingServer)();
    int (*_SessionPingFailed)();
    int (*_Debug)();
    int (*_RegisterCloseOnFork)();
    int (*_SecureDisplay)();
    int (*_UnsecureDisplay)();
    int (*_ClearCloseOnFork)();
    int (*_SetupDisplay)();
    int (*_LogError)();
    int (*_SessionExit)();
    int (*_DeleteXloginResources)();
    int (*_source)();
    char **(*_defaultEnv)();
    char **(*_setEnv)();
    char **(*_parseArgs)();
    int (*_printEnv)();
    char **(*_systemEnv)();
    int (*_LogOutOfMem)();
    void (*_setgrent)();		/* no longer used */
    struct group *(*_getgrent)();	/* no longer used */
    void (*_endgrent)();		/* no longer used */
#ifdef USESHADOW
    struct spwd *(*_getspnam)();
    void (*_endspent)();
#endif
    struct passwd *(*_getpwnam)();
    char *(*_crypt)();
};

/*
 * Return values for GreetUser();
 * Values must be explictly defined because the greet library
 * may come from a different vendor.
 * Negative values indicate an error.
 */
typedef enum {
    Greet_Session_Over = 0,	/* session managed and over */
    Greet_Success = 1,		/* greet succeeded, session not managed */
    Greet_Failure = -1		/* greet failed */
} greet_user_rtn;

/*
 * GreetUser can either handle the user's session or allow xdm to do it.
 * The return or exit status of GreetUser indicates to xdm whether it
 * should start a session.
 * 
 * GreetUser is passed the xdm struct display pointer, a pointer to a
 * Display, and pointers to greet and verify structs.  If it expectes xdm
 * to run the session, it fills in the Display pointer and the fields
 * of the greet and verify structs.
 * 
 * The verify struct includes the uid, gid, arguments to run the session,
 * environment for the session, and environment for startup/reset.
 * 
 * The greet struct includes the user's name and password but these are
 * really only needed if xdm is compiled with a user-based authorization
 * option such as SECURE_RPC or K5AUTH.
 */

extern greet_user_rtn GreetUser(
#if NeedFunctionPrototypes
    struct display *d,
    Display **dpy,
    struct verify_info *verify,
    struct greet_info *greet,
    struct dlfuncs *dlfcns
#endif
);

typedef greet_user_rtn (*GreetUserProc)(
#if NeedFunctionPrototypes
    struct display *,
    Display **,
    struct verify_info *,
    struct greet_info *,
    struct dlfuncs *dlfcns
#endif
);

#ifdef GREET_LIB
/*
 * The greeter uses some symbols from the main xdm executable.  Since some
 * dynamic linkers are broken, we need to fix things up so that the symbols
 * are referenced indirectly through function pointers.  The definitions
 * here, are used to hold the pointers to the functions in the main xdm
 * executable.  The pointers are filled in when the GreetUser function is
 * called, with the pointer values passed as a paramter.
 */

extern	int     (*__xdm_PingServer)();
extern	int     (*__xdm_SessionPingFailed)();
extern	int     (*__xdm_Debug)();
extern	int     (*__xdm_RegisterCloseOnFork)();
extern	int     (*__xdm_SecureDisplay)();
extern	int     (*__xdm_UnsecureDisplay)();
extern	int     (*__xdm_ClearCloseOnFork)();
extern	int     (*__xdm_SetupDisplay)();
extern	int     (*__xdm_LogError)();
extern	int     (*__xdm_SessionExit)();
extern	int     (*__xdm_DeleteXloginResources)();
extern	int     (*__xdm_source)();
extern	char    **(*__xdm_defaultEnv)();
extern	char    **(*__xdm_setEnv)();
extern	char    **(*__xdm_parseArgs)();
extern	int     (*__xdm_printEnv)();
extern	char    **(*__xdm_systemEnv)();
extern	int     (*__xdm_LogOutOfMem)();
extern	void    (*__xdm_setgrent)();
extern	struct group    *(*__xdm_getgrent)();
extern	void    (*__xdm_endgrent)();
#ifdef USESHADOW
extern	struct spwd   *(*__xdm_getspnam)();
extern	void   (*__xdm_endspent)();
#endif
extern	struct passwd   *(*__xdm_getpwnam)();
extern	char     *(*__xdm_crypt)();

/*
 * Force the shared library to call through the function pointer
 * initialized during the initial call into the library.
 */

#define	PingServer	(*__xdm_PingServer)
#define	SessionPingFailed	(*__xdm_SessionPingFailed)
#define	Debug	(*__xdm_Debug)
#define	RegisterCloseOnFork	(*__xdm_RegisterCloseOnFork)
#define	SecureDisplay	(*__xdm_SecureDisplay)
#define	UnsecureDisplay	(*__xdm_UnsecureDisplay)
#define	ClearCloseOnFork	(*__xdm_ClearCloseOnFork)
#define	SetupDisplay	(*__xdm_SetupDisplay)
#define	LogError	(*__xdm_LogError)
#define	SessionExit	(*__xdm_SessionExit)
#define	DeleteXloginResources	(*__xdm_DeleteXloginResources)
#define	source	(*__xdm_source)
#define	defaultEnv	(*__xdm_defaultEnv)
#define	setEnv	(*__xdm_setEnv)
#define	parseArgs	(*__xdm_parseArgs)
#define	printEnv	(*__xdm_printEnv)
#define	systemEnv	(*__xdm_systemEnv)
#define	LogOutOfMem	(*__xdm_LogOutOfMem)
#define	setgrent	(*__xdm_setgrent)
#define	getgrent	(*__xdm_getgrent)
#define	endgrent	(*__xdm_endgrent)
#ifdef USESHADOW
#define	getspnam	(*__xdm_getspnam)
#define	endspent	(*__xdm_endspent)
#endif
#define	getpwnam	(*__xdm_getpwnam)
#define	crypt		(*__xdm_crypt)

#endif /* GREET_LIB */