Login.h revision 629baa8c
1/*
2
3Copyright 1988, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26
27*/
28/*
29 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
30 *
31 * Permission is hereby granted, free of charge, to any person obtaining a
32 * copy of this software and associated documentation files (the "Software"),
33 * to deal in the Software without restriction, including without limitation
34 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
35 * and/or sell copies of the Software, and to permit persons to whom the
36 * Software is furnished to do so, subject to the following conditions:
37 *
38 * The above copyright notice and this permission notice (including the next
39 * paragraph) shall be included in all copies or substantial portions of the
40 * Software.
41 *
42 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
45 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
48 * DEALINGS IN THE SOFTWARE.
49 */
50
51/*
52 * xdm - display manager daemon
53 * Author:  Keith Packard, MIT X Consortium
54 */
55
56
57#ifndef _XtLogin_h
58# define _XtLogin_h
59
60/***********************************************************************
61 *
62 * Login Widget
63 *
64 ***********************************************************************/
65
66/* Parameters:
67
68 Name		     Class		RepType		Default Value
69 ----		     -----		-------		-------------
70 background	     Background		pixel		White
71 border		     BorderColor	pixel		Black
72 borderWidth	     BorderWidth	int		1
73 foreground	     Foreground		Pixel		Black
74 height		     Height		int		120
75 mappedWhenManaged   MappedWhenManaged	Boolean		True
76 width		     Width		int		120
77 x		     Position		int		0
78 y		     Position		int		0
79
80*/
81
82# define XtNgreeting		"greeting"
83# define XtNunsecureGreeting	"unsecureGreeting"
84# define XtNnamePrompt		"namePrompt"
85# define XtNpasswdPrompt	"passwdPrompt"
86# define XtNfail		"fail"
87# define XtNnotifyDone		"notifyDone"
88# define XtNpromptColor		"promptColor"
89# define XtNgreetColor		"greetColor"
90# define XtNfailColor		"failColor"
91# define XtNpromptFont		"promptFont"
92# define XtNgreetFont		"greetFont"
93# define XtNfailFont		"failFont"
94# define XtNpromptFace		"promptFace"
95# define XtNgreetFace		"greetFace"
96# define XtNfailFace		"failFace"
97# define XtNfailTimeout		"failTimeout"
98# define XtNsessionArgument	"sessionArgument"
99# define XtNsecureSession	"secureSession"
100# define XtNallowAccess		"allowAccess"
101# define XtNallowNullPasswd	"allowNullPasswd"
102# define XtNallowRootLogin	"allowRootLogin"
103# define XtNechoPasswd		"echoPasswd"
104# define XtNechoPasswdChar	"echoPasswdChar"
105
106# define XtNface 		"face"
107# define XtCFace		"Face"
108# define XtRXftFont		"XftFont"
109# define XtRXftColor		"XftColor"
110
111/* added by Amit Margalit Oct 1996 */
112# define XtNhiColor		"hiColor"
113# define XtNshdColor		"shdColor"
114# define XtNframeWidth		"frameWidth"
115# define XtCFrameWidth		"FrameWidth"
116# define XtNinnerFramesWidth	"innerFramesWidth"
117# define XtNsepWidth		"sepWidth"
118
119# ifdef DANCING
120/* caolan begin */
121#  define XtNlastEventTime	"lastEventTime"
122#  define XtCLastEventTime	"LastEventTime"
123/* caolan end */
124# endif /* DANCING */
125
126# ifdef XPM
127#  define XtNuseShape		"useShape"
128#  define XtCUseShape		"UseShape"
129#  define XtNlogoFileName	"logoFileName"
130#  define XtCLogoFileName	"LogoFileName"
131#  define XtNlogoPadding	"logoPadding"
132#  define XtCLogoPadding	"LogoPadding"
133# endif /* XPM */
134
135# define XtCGreeting		"Greeting"
136# define XtCNamePrompt		"NamePrompt"
137# define XtCPasswdPrompt	"PasswdPrompt"
138# define XtCFail		"Fail"
139# define XtCFailTimeout		"FailTimeout"
140# define XtCSessionArgument	"SessionArgument"
141# define XtCSecureSession	"SecureSession"
142# define XtCAllowAccess		"AllowAccess"
143# define XtCAllowNullPasswd	"AllowNullPasswd"
144# define XtCAllowRootLogin	"AllowRootLogin"
145# define XtCEchoPasswd		"EchoPasswd"
146# define XtCEchoPasswdChar	"EchoPasswdChar"
147
148# define XtNchangePasswdMessage	"changePasswdMessage"
149# define XtCChangePasswdMessage	"ChangePasswdMessage"
150
151/* notifyDone interface definition */
152
153# ifdef __OpenBSD__
154#  include <sys/param.h>
155# endif
156
157# include <pwd.h>
158# include <limits.h>
159
160# ifdef USE_PAM
161#  define NAME_LEN	PAM_MAX_RESP_SIZE
162#  define PASSWORD_LEN	PAM_MAX_RESP_SIZE
163# endif
164
165/* Defined to be in <limits.h> by SUSv2 */
166# if !defined(PASSWORD_LEN) && defined(PASS_MAX)
167#  define PASSWORD_LEN PASS_MAX
168# endif
169
170/* _PW_NAME_LEN is found in <pwd.h> on OpenBSD > 2.8 (200012) */
171# if !defined(NAME_LEN) && defined(_PW_NAME_LEN)
172#  define NAME_LEN	(_PW_NAME_LEN + 2)
173# endif
174
175/* _PASSWORD_LEN appears to come from 4.4BSD-Lite <pwd.h> */
176# if !defined(PASSWORD_LEN) && defined(_PASSWORD_LEN)
177#  define PASSWORD_LEN	(_PASSWORD_LEN + 2)
178# endif
179
180/* Fallbacks if no other definition found */
181# ifndef NAME_LEN
182#  define NAME_LEN	32
183# endif
184
185# ifndef PASSWORD_LEN
186#  define PASSWORD_LEN	32
187# endif
188
189typedef struct _LoginData {
190	char	name[NAME_LEN], passwd[PASSWORD_LEN];
191} LoginData;
192
193# define NOTIFY_OK	0
194# define NOTIFY_ABORT	1
195# define NOTIFY_RESTART	2
196# define NOTIFY_ABORT_DISPLAY	3
197
198typedef struct _LoginRec *LoginWidget;  /* completely defined in LoginPrivate.h */
199typedef struct _LoginClassRec *LoginWidgetClass;    /* completely defined in LoginPrivate.h */
200
201extern WidgetClass loginWidgetClass;
202
203extern void ErrorMessage(Widget ctx, const char *message, Bool timeout);
204extern void ShowChangePasswdMessage(Widget ctx);
205
206typedef enum {
207    LOGIN_PROMPT_NOT_SHOWN,	/* Neither prompt nor input shown */
208    LOGIN_PROMPT_ECHO_ON,	/* Both prompt and input shown */
209    LOGIN_PROMPT_ECHO_OFF,	/* Prompt shown, input accepted but not
210				   shown (bullets may be shown instead) */
211    LOGIN_TEXT_INFO		/* Prompt shown, no input area */
212} loginPromptState;
213
214/* Default prompt meanings for simple username/password auth systems */
215# define LOGIN_PROMPT_USERNAME 0
216# define LOGIN_PROMPT_PASSWORD 1
217
218extern int SetPrompt(Widget ctx, int promptId, const char *message,
219		     loginPromptState state, Boolean minimumTime);
220extern const char *GetPrompt(Widget ctx, int promptId);
221
222extern int SetValue(Widget ctx, int promptId, char *value);
223extern const char *GetValue(Widget ctx, int promptId);
224
225#endif /* _XtLogin_h */
226/* DON'T ADD STUFF AFTER THIS #endif */
227