Login.h revision 5ffd6003
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*/ 285ffd6003Smrg/* 295ffd6003Smrg * Copyright © 2006 Sun Microsystems, Inc. All rights reserved. 30145b7b3cSmrg * 31145b7b3cSmrg * Permission is hereby granted, free of charge, to any person obtaining a 325ffd6003Smrg * copy of this software and associated documentation files (the "Software"), 335ffd6003Smrg * to deal in the Software without restriction, including without limitation 345ffd6003Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 355ffd6003Smrg * and/or sell copies of the Software, and to permit persons to whom the 365ffd6003Smrg * Software is furnished to do so, subject to the following conditions: 37145b7b3cSmrg * 385ffd6003Smrg * The above copyright notice and this permission notice (including the next 395ffd6003Smrg * paragraph) shall be included in all copies or substantial portions of the 405ffd6003Smrg * Software. 41145b7b3cSmrg * 425ffd6003Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 435ffd6003Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 445ffd6003Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 455ffd6003Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 465ffd6003Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 475ffd6003Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 485ffd6003Smrg * DEALINGS IN THE SOFTWARE. 49145b7b3cSmrg */ 50145b7b3cSmrg 51145b7b3cSmrg/* 52145b7b3cSmrg * xdm - display manager daemon 53145b7b3cSmrg * Author: Keith Packard, MIT X Consortium 54145b7b3cSmrg */ 55145b7b3cSmrg 56145b7b3cSmrg 57145b7b3cSmrg#ifndef _XtLogin_h 58578741aaSmrg# define _XtLogin_h 59145b7b3cSmrg 60145b7b3cSmrg/*********************************************************************** 61145b7b3cSmrg * 62145b7b3cSmrg * Login Widget 63145b7b3cSmrg * 64145b7b3cSmrg ***********************************************************************/ 65145b7b3cSmrg 66145b7b3cSmrg/* Parameters: 67145b7b3cSmrg 68145b7b3cSmrg Name Class RepType Default Value 69145b7b3cSmrg ---- ----- ------- ------------- 70145b7b3cSmrg background Background pixel White 71145b7b3cSmrg border BorderColor pixel Black 72145b7b3cSmrg borderWidth BorderWidth int 1 73145b7b3cSmrg foreground Foreground Pixel Black 74145b7b3cSmrg height Height int 120 75145b7b3cSmrg mappedWhenManaged MappedWhenManaged Boolean True 76145b7b3cSmrg width Width int 120 77145b7b3cSmrg x Position int 0 78145b7b3cSmrg y Position int 0 79145b7b3cSmrg 80145b7b3cSmrg*/ 81145b7b3cSmrg 82145b7b3cSmrg# define XtNgreeting "greeting" 83145b7b3cSmrg# define XtNunsecureGreeting "unsecureGreeting" 84145b7b3cSmrg# define XtNnamePrompt "namePrompt" 85145b7b3cSmrg# define XtNpasswdPrompt "passwdPrompt" 86145b7b3cSmrg# define XtNfail "fail" 87145b7b3cSmrg# define XtNnotifyDone "notifyDone" 88145b7b3cSmrg# define XtNpromptColor "promptColor" 89145b7b3cSmrg# define XtNgreetColor "greetColor" 90145b7b3cSmrg# define XtNfailColor "failColor" 91145b7b3cSmrg# define XtNpromptFont "promptFont" 92145b7b3cSmrg# define XtNgreetFont "greetFont" 93145b7b3cSmrg# define XtNfailFont "failFont" 94145b7b3cSmrg# define XtNpromptFace "promptFace" 95145b7b3cSmrg# define XtNgreetFace "greetFace" 96145b7b3cSmrg# define XtNfailFace "failFace" 97145b7b3cSmrg# define XtNfailTimeout "failTimeout" 98145b7b3cSmrg# define XtNsessionArgument "sessionArgument" 99145b7b3cSmrg# define XtNsecureSession "secureSession" 100145b7b3cSmrg# define XtNallowAccess "allowAccess" 101145b7b3cSmrg# define XtNallowNullPasswd "allowNullPasswd" 102145b7b3cSmrg# define XtNallowRootLogin "allowRootLogin" 1035ffd6003Smrg# define XtNechoPasswd "echoPasswd" 104145b7b3cSmrg 105145b7b3cSmrg# define XtNface "face" 106145b7b3cSmrg# define XtCFace "Face" 107145b7b3cSmrg# define XtRXftFont "XftFont" 108145b7b3cSmrg# define XtRXftColor "XftColor" 109145b7b3cSmrg 110145b7b3cSmrg/* added by Amit Margalit Oct 1996 */ 111145b7b3cSmrg# define XtNhiColor "hiColor" 112145b7b3cSmrg# define XtNshdColor "shdColor" 113145b7b3cSmrg# define XtNframeWidth "frameWidth" 114145b7b3cSmrg# define XtCFrameWidth "FrameWidth" 115145b7b3cSmrg# define XtNinnerFramesWidth "innerFramesWidth" 116145b7b3cSmrg# define XtNsepWidth "sepWidth" 117145b7b3cSmrg 118578741aaSmrg# ifdef DANCING 119145b7b3cSmrg/* caolan begin */ 120578741aaSmrg# define XtNlastEventTime "lastEventTime" 121578741aaSmrg# define XtCLastEventTime "LastEventTime" 122145b7b3cSmrg/* caolan end */ 123578741aaSmrg# endif /* DANCING */ 124145b7b3cSmrg 125578741aaSmrg# ifdef XPM 126578741aaSmrg# define XtNuseShape "useShape" 127578741aaSmrg# define XtCUseShape "UseShape" 128578741aaSmrg# define XtNlogoFileName "logoFileName" 129578741aaSmrg# define XtCLogoFileName "LogoFileName" 130578741aaSmrg# define XtNlogoPadding "logoPadding" 131578741aaSmrg# define XtCLogoPadding "LogoPadding" 132578741aaSmrg# endif /* XPM */ 133145b7b3cSmrg 134145b7b3cSmrg# define XtCGreeting "Greeting" 135145b7b3cSmrg# define XtCNamePrompt "NamePrompt" 136145b7b3cSmrg# define XtCPasswdPrompt "PasswdPrompt" 137145b7b3cSmrg# define XtCFail "Fail" 138145b7b3cSmrg# define XtCFailTimeout "FailTimeout" 139145b7b3cSmrg# define XtCSessionArgument "SessionArgument" 140145b7b3cSmrg# define XtCSecureSession "SecureSession" 141145b7b3cSmrg# define XtCAllowAccess "AllowAccess" 142145b7b3cSmrg# define XtCAllowNullPasswd "AllowNullPasswd" 143145b7b3cSmrg# define XtCAllowRootLogin "AllowRootLogin" 1445ffd6003Smrg# define XtCEchoPasswd "EchoPasswd" 145145b7b3cSmrg 146145b7b3cSmrg# define XtNchangePasswdMessage "changePasswdMessage" 147145b7b3cSmrg# define XtCChangePasswdMessage "ChangePasswdMessage" 148145b7b3cSmrg 149145b7b3cSmrg/* notifyDone interface definition */ 150145b7b3cSmrg 151578741aaSmrg# ifdef __OpenBSD__ 152578741aaSmrg# include <sys/param.h> 153578741aaSmrg# endif 154145b7b3cSmrg 155578741aaSmrg# include <pwd.h> 156578741aaSmrg# include <limits.h> 157145b7b3cSmrg 158578741aaSmrg# ifdef USE_PAM 159578741aaSmrg# define NAME_LEN PAM_MAX_RESP_SIZE 160578741aaSmrg# define PASSWORD_LEN PAM_MAX_RESP_SIZE 161578741aaSmrg# endif 162145b7b3cSmrg 163145b7b3cSmrg/* Defined to be in <limits.h> by SUSv2 */ 164578741aaSmrg# if !defined(PASSWORD_LEN) && defined(PASS_MAX) 165578741aaSmrg# define PASSWORD_LEN PASS_MAX 166578741aaSmrg# endif 167145b7b3cSmrg 168145b7b3cSmrg/* _PW_NAME_LEN is found in <pwd.h> on OpenBSD > 2.8 (200012) */ 169578741aaSmrg# if !defined(NAME_LEN) && defined(_PW_NAME_LEN) 170578741aaSmrg# define NAME_LEN (_PW_NAME_LEN + 2) 171578741aaSmrg# endif 172145b7b3cSmrg 173145b7b3cSmrg/* _PASSWORD_LEN appears to come from 4.4BSD-Lite <pwd.h> */ 174578741aaSmrg# if !defined(PASSWORD_LEN) && defined(_PASSWORD_LEN) 175578741aaSmrg# define PASSWORD_LEN (_PASSWORD_LEN + 2) 176578741aaSmrg# endif 177145b7b3cSmrg 178145b7b3cSmrg/* Fallbacks if no other definition found */ 179578741aaSmrg# ifndef NAME_LEN 180578741aaSmrg# define NAME_LEN 32 181578741aaSmrg# endif 182145b7b3cSmrg 183578741aaSmrg# ifndef PASSWORD_LEN 184578741aaSmrg# define PASSWORD_LEN 32 185578741aaSmrg# endif 186145b7b3cSmrg 187578741aaSmrgtypedef struct _LoginData { 188145b7b3cSmrg char name[NAME_LEN], passwd[PASSWORD_LEN]; 189145b7b3cSmrg} LoginData; 190145b7b3cSmrg 191145b7b3cSmrg# define NOTIFY_OK 0 192145b7b3cSmrg# define NOTIFY_ABORT 1 193145b7b3cSmrg# define NOTIFY_RESTART 2 194145b7b3cSmrg# define NOTIFY_ABORT_DISPLAY 3 195145b7b3cSmrg 196145b7b3cSmrgtypedef struct _LoginRec *LoginWidget; /* completely defined in LoginPrivate.h */ 197145b7b3cSmrgtypedef struct _LoginClassRec *LoginWidgetClass; /* completely defined in LoginPrivate.h */ 198145b7b3cSmrg 199145b7b3cSmrgextern WidgetClass loginWidgetClass; 200145b7b3cSmrg 201145b7b3cSmrgextern void ErrorMessage(Widget ctx, const char *message, Bool timeout); 202145b7b3cSmrgextern void ShowChangePasswdMessage(Widget ctx); 203145b7b3cSmrg 204145b7b3cSmrgtypedef enum { 205145b7b3cSmrg LOGIN_PROMPT_NOT_SHOWN, /* Neither prompt nor input shown */ 206145b7b3cSmrg LOGIN_PROMPT_ECHO_ON, /* Both prompt and input shown */ 207145b7b3cSmrg LOGIN_PROMPT_ECHO_OFF, /* Prompt shown, input accepted but not 208145b7b3cSmrg shown (bullets may be shown instead) */ 209145b7b3cSmrg LOGIN_TEXT_INFO /* Prompt shown, no input area */ 210145b7b3cSmrg} loginPromptState; 211145b7b3cSmrg 212145b7b3cSmrg/* Default prompt meanings for simple username/password auth systems */ 213578741aaSmrg# define LOGIN_PROMPT_USERNAME 0 214578741aaSmrg# define LOGIN_PROMPT_PASSWORD 1 215145b7b3cSmrg 216145b7b3cSmrgextern int SetPrompt(Widget ctx, int promptId, const char *message, 217145b7b3cSmrg loginPromptState state, Boolean minimumTime); 218145b7b3cSmrgextern const char *GetPrompt(Widget ctx, int promptId); 219145b7b3cSmrg 220145b7b3cSmrgextern int SetValue(Widget ctx, int promptId, char *value); 221145b7b3cSmrgextern const char *GetValue(Widget ctx, int promptId); 222145b7b3cSmrg 223145b7b3cSmrg#endif /* _XtLogin_h */ 224145b7b3cSmrg/* DON'T ADD STUFF AFTER THIS #endif */ 225