Login.h revision 578741aa
1145b7b3cSmrg/* 2145b7b3cSmrg 3145b7b3cSmrgCopyright 1988, 1998 The Open Group 4145b7b3cSmrg 5145b7b3cSmrgPermission to use, copy, modify, distribute, and sell this software and its 6145b7b3cSmrgdocumentation for any purpose is hereby granted without fee, provided that 7145b7b3cSmrgthe above copyright notice appear in all copies and that both that 8145b7b3cSmrgcopyright notice and this permission notice appear in supporting 9145b7b3cSmrgdocumentation. 10145b7b3cSmrg 11145b7b3cSmrgThe above copyright notice and this permission notice shall be included 12145b7b3cSmrgin all copies or substantial portions of the Software. 13145b7b3cSmrg 14145b7b3cSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15145b7b3cSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16145b7b3cSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17145b7b3cSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 18145b7b3cSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19145b7b3cSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20145b7b3cSmrgOTHER DEALINGS IN THE SOFTWARE. 21145b7b3cSmrg 22145b7b3cSmrgExcept as contained in this notice, the name of The Open Group shall 23145b7b3cSmrgnot be used in advertising or otherwise to promote the sale, use or 24145b7b3cSmrgother dealings in this Software without prior written authorization 25145b7b3cSmrgfrom The Open Group. 26145b7b3cSmrg 27145b7b3cSmrg*/ 28145b7b3cSmrg/* Copyright 2006 Sun Microsystems, Inc. All rights reserved. 29145b7b3cSmrg * 30145b7b3cSmrg * Permission is hereby granted, free of charge, to any person obtaining a 31145b7b3cSmrg * copy of this software and associated documentation files (the 32145b7b3cSmrg * "Software"), to deal in the Software without restriction, including 33145b7b3cSmrg * without limitation the rights to use, copy, modify, merge, publish, 34145b7b3cSmrg * distribute, and/or sell copies of the Software, and to permit persons 35145b7b3cSmrg * to whom the Software is furnished to do so, provided that the above 36145b7b3cSmrg * copyright notice(s) and this permission notice appear in all copies of 37145b7b3cSmrg * the Software and that both the above copyright notice(s) and this 38145b7b3cSmrg * permission notice appear in supporting documentation. 39145b7b3cSmrg * 40145b7b3cSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 41145b7b3cSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 42145b7b3cSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 43145b7b3cSmrg * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 44145b7b3cSmrg * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL 45145b7b3cSmrg * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING 46145b7b3cSmrg * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 47145b7b3cSmrg * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 48145b7b3cSmrg * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 49145b7b3cSmrg * 50145b7b3cSmrg * Except as contained in this notice, the name of a copyright holder 51145b7b3cSmrg * shall not be used in advertising or otherwise to promote the sale, use 52145b7b3cSmrg * or other dealings in this Software without prior written authorization 53145b7b3cSmrg * of the copyright holder. 54145b7b3cSmrg */ 55145b7b3cSmrg 56145b7b3cSmrg/* 57145b7b3cSmrg * xdm - display manager daemon 58145b7b3cSmrg * Author: Keith Packard, MIT X Consortium 59145b7b3cSmrg */ 60145b7b3cSmrg 61145b7b3cSmrg 62145b7b3cSmrg#ifndef _XtLogin_h 63578741aaSmrg# define _XtLogin_h 64145b7b3cSmrg 65145b7b3cSmrg/*********************************************************************** 66145b7b3cSmrg * 67145b7b3cSmrg * Login Widget 68145b7b3cSmrg * 69145b7b3cSmrg ***********************************************************************/ 70145b7b3cSmrg 71145b7b3cSmrg/* Parameters: 72145b7b3cSmrg 73145b7b3cSmrg Name Class RepType Default Value 74145b7b3cSmrg ---- ----- ------- ------------- 75145b7b3cSmrg background Background pixel White 76145b7b3cSmrg border BorderColor pixel Black 77145b7b3cSmrg borderWidth BorderWidth int 1 78145b7b3cSmrg foreground Foreground Pixel Black 79145b7b3cSmrg height Height int 120 80145b7b3cSmrg mappedWhenManaged MappedWhenManaged Boolean True 81145b7b3cSmrg width Width int 120 82145b7b3cSmrg x Position int 0 83145b7b3cSmrg y Position int 0 84145b7b3cSmrg 85145b7b3cSmrg*/ 86145b7b3cSmrg 87145b7b3cSmrg# define XtNgreeting "greeting" 88145b7b3cSmrg# define XtNunsecureGreeting "unsecureGreeting" 89145b7b3cSmrg# define XtNnamePrompt "namePrompt" 90145b7b3cSmrg# define XtNpasswdPrompt "passwdPrompt" 91145b7b3cSmrg# define XtNfail "fail" 92145b7b3cSmrg# define XtNnotifyDone "notifyDone" 93145b7b3cSmrg# define XtNpromptColor "promptColor" 94145b7b3cSmrg# define XtNgreetColor "greetColor" 95145b7b3cSmrg# define XtNfailColor "failColor" 96145b7b3cSmrg# define XtNpromptFont "promptFont" 97145b7b3cSmrg# define XtNgreetFont "greetFont" 98145b7b3cSmrg# define XtNfailFont "failFont" 99145b7b3cSmrg# define XtNpromptFace "promptFace" 100145b7b3cSmrg# define XtNgreetFace "greetFace" 101145b7b3cSmrg# define XtNfailFace "failFace" 102145b7b3cSmrg# define XtNfailTimeout "failTimeout" 103145b7b3cSmrg# define XtNsessionArgument "sessionArgument" 104145b7b3cSmrg# define XtNsecureSession "secureSession" 105145b7b3cSmrg# define XtNallowAccess "allowAccess" 106145b7b3cSmrg# define XtNallowNullPasswd "allowNullPasswd" 107145b7b3cSmrg# define XtNallowRootLogin "allowRootLogin" 108145b7b3cSmrg 109145b7b3cSmrg# define XtNface "face" 110145b7b3cSmrg# define XtCFace "Face" 111145b7b3cSmrg# define XtRXftFont "XftFont" 112145b7b3cSmrg# define XtRXftColor "XftColor" 113145b7b3cSmrg 114145b7b3cSmrg/* added by Amit Margalit Oct 1996 */ 115145b7b3cSmrg# define XtNhiColor "hiColor" 116145b7b3cSmrg# define XtNshdColor "shdColor" 117145b7b3cSmrg# define XtNframeWidth "frameWidth" 118145b7b3cSmrg# define XtCFrameWidth "FrameWidth" 119145b7b3cSmrg# define XtNinnerFramesWidth "innerFramesWidth" 120145b7b3cSmrg# define XtNsepWidth "sepWidth" 121145b7b3cSmrg 122578741aaSmrg# ifdef DANCING 123145b7b3cSmrg/* caolan begin */ 124578741aaSmrg# define XtNlastEventTime "lastEventTime" 125578741aaSmrg# define XtCLastEventTime "LastEventTime" 126145b7b3cSmrg/* caolan end */ 127578741aaSmrg# endif /* DANCING */ 128145b7b3cSmrg 129578741aaSmrg# ifdef XPM 130578741aaSmrg# define XtNuseShape "useShape" 131578741aaSmrg# define XtCUseShape "UseShape" 132578741aaSmrg# define XtNlogoFileName "logoFileName" 133578741aaSmrg# define XtCLogoFileName "LogoFileName" 134578741aaSmrg# define XtNlogoPadding "logoPadding" 135578741aaSmrg# define XtCLogoPadding "LogoPadding" 136578741aaSmrg# endif /* XPM */ 137145b7b3cSmrg 138145b7b3cSmrg# define XtCGreeting "Greeting" 139145b7b3cSmrg# define XtCNamePrompt "NamePrompt" 140145b7b3cSmrg# define XtCPasswdPrompt "PasswdPrompt" 141145b7b3cSmrg# define XtCFail "Fail" 142145b7b3cSmrg# define XtCFailTimeout "FailTimeout" 143145b7b3cSmrg# define XtCSessionArgument "SessionArgument" 144145b7b3cSmrg# define XtCSecureSession "SecureSession" 145145b7b3cSmrg# define XtCAllowAccess "AllowAccess" 146145b7b3cSmrg# define XtCAllowNullPasswd "AllowNullPasswd" 147145b7b3cSmrg# define XtCAllowRootLogin "AllowRootLogin" 148145b7b3cSmrg 149145b7b3cSmrg# define XtNchangePasswdMessage "changePasswdMessage" 150145b7b3cSmrg# define XtCChangePasswdMessage "ChangePasswdMessage" 151145b7b3cSmrg 152145b7b3cSmrg/* notifyDone interface definition */ 153145b7b3cSmrg 154578741aaSmrg# ifdef __OpenBSD__ 155578741aaSmrg# include <sys/param.h> 156578741aaSmrg# endif 157145b7b3cSmrg 158578741aaSmrg# include <pwd.h> 159578741aaSmrg# include <limits.h> 160145b7b3cSmrg 161578741aaSmrg# ifdef USE_PAM 162578741aaSmrg# define NAME_LEN PAM_MAX_RESP_SIZE 163578741aaSmrg# define PASSWORD_LEN PAM_MAX_RESP_SIZE 164578741aaSmrg# endif 165145b7b3cSmrg 166145b7b3cSmrg/* Defined to be in <limits.h> by SUSv2 */ 167578741aaSmrg# if !defined(PASSWORD_LEN) && defined(PASS_MAX) 168578741aaSmrg# define PASSWORD_LEN PASS_MAX 169578741aaSmrg# endif 170145b7b3cSmrg 171145b7b3cSmrg/* _PW_NAME_LEN is found in <pwd.h> on OpenBSD > 2.8 (200012) */ 172578741aaSmrg# if !defined(NAME_LEN) && defined(_PW_NAME_LEN) 173578741aaSmrg# define NAME_LEN (_PW_NAME_LEN + 2) 174578741aaSmrg# endif 175145b7b3cSmrg 176145b7b3cSmrg/* _PASSWORD_LEN appears to come from 4.4BSD-Lite <pwd.h> */ 177578741aaSmrg# if !defined(PASSWORD_LEN) && defined(_PASSWORD_LEN) 178578741aaSmrg# define PASSWORD_LEN (_PASSWORD_LEN + 2) 179578741aaSmrg# endif 180145b7b3cSmrg 181145b7b3cSmrg/* Fallbacks if no other definition found */ 182578741aaSmrg# ifndef NAME_LEN 183578741aaSmrg# define NAME_LEN 32 184578741aaSmrg# endif 185145b7b3cSmrg 186578741aaSmrg# ifndef PASSWORD_LEN 187578741aaSmrg# define PASSWORD_LEN 32 188578741aaSmrg# endif 189145b7b3cSmrg 190578741aaSmrgtypedef struct _LoginData { 191145b7b3cSmrg char name[NAME_LEN], passwd[PASSWORD_LEN]; 192145b7b3cSmrg} LoginData; 193145b7b3cSmrg 194145b7b3cSmrg# define NOTIFY_OK 0 195145b7b3cSmrg# define NOTIFY_ABORT 1 196145b7b3cSmrg# define NOTIFY_RESTART 2 197145b7b3cSmrg# define NOTIFY_ABORT_DISPLAY 3 198145b7b3cSmrg 199145b7b3cSmrgtypedef struct _LoginRec *LoginWidget; /* completely defined in LoginPrivate.h */ 200145b7b3cSmrgtypedef struct _LoginClassRec *LoginWidgetClass; /* completely defined in LoginPrivate.h */ 201145b7b3cSmrg 202145b7b3cSmrgextern WidgetClass loginWidgetClass; 203145b7b3cSmrg 204145b7b3cSmrgextern void ErrorMessage(Widget ctx, const char *message, Bool timeout); 205145b7b3cSmrgextern void ShowChangePasswdMessage(Widget ctx); 206145b7b3cSmrg 207145b7b3cSmrgtypedef enum { 208145b7b3cSmrg LOGIN_PROMPT_NOT_SHOWN, /* Neither prompt nor input shown */ 209145b7b3cSmrg LOGIN_PROMPT_ECHO_ON, /* Both prompt and input shown */ 210145b7b3cSmrg LOGIN_PROMPT_ECHO_OFF, /* Prompt shown, input accepted but not 211145b7b3cSmrg shown (bullets may be shown instead) */ 212145b7b3cSmrg LOGIN_TEXT_INFO /* Prompt shown, no input area */ 213145b7b3cSmrg} loginPromptState; 214145b7b3cSmrg 215145b7b3cSmrg/* Default prompt meanings for simple username/password auth systems */ 216578741aaSmrg# define LOGIN_PROMPT_USERNAME 0 217578741aaSmrg# define LOGIN_PROMPT_PASSWORD 1 218145b7b3cSmrg 219145b7b3cSmrgextern int SetPrompt(Widget ctx, int promptId, const char *message, 220145b7b3cSmrg loginPromptState state, Boolean minimumTime); 221145b7b3cSmrgextern const char *GetPrompt(Widget ctx, int promptId); 222145b7b3cSmrg 223145b7b3cSmrgextern int SetValue(Widget ctx, int promptId, char *value); 224145b7b3cSmrgextern const char *GetValue(Widget ctx, int promptId); 225145b7b3cSmrg 226145b7b3cSmrg#endif /* _XtLogin_h */ 227145b7b3cSmrg/* DON'T ADD STUFF AFTER THIS #endif */ 228