1629baa8cSmrg/* 2629baa8cSmrg 3629baa8cSmrgCopyright 1988, 1998 The Open Group 4629baa8cSmrg 5629baa8cSmrgPermission to use, copy, modify, distribute, and sell this software and its 6629baa8cSmrgdocumentation for any purpose is hereby granted without fee, provided that 7629baa8cSmrgthe above copyright notice appear in all copies and that both that 8629baa8cSmrgcopyright notice and this permission notice appear in supporting 9629baa8cSmrgdocumentation. 10629baa8cSmrg 11629baa8cSmrgThe above copyright notice and this permission notice shall be included 12629baa8cSmrgin all copies or substantial portions of the Software. 13629baa8cSmrg 14629baa8cSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15629baa8cSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16629baa8cSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17629baa8cSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 18629baa8cSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19629baa8cSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20629baa8cSmrgOTHER DEALINGS IN THE SOFTWARE. 21629baa8cSmrg 22629baa8cSmrgExcept as contained in this notice, the name of The Open Group shall 23629baa8cSmrgnot be used in advertising or otherwise to promote the sale, use or 24629baa8cSmrgother dealings in this Software without prior written authorization 25629baa8cSmrgfrom The Open Group. 26629baa8cSmrg 27629baa8cSmrg*/ 28629baa8cSmrg 29629baa8cSmrg/* 30629baa8cSmrg * xdm - display manager daemon 31629baa8cSmrg * Author: Keith Packard, MIT X Consortium 32629baa8cSmrg * 33629baa8cSmrg * dm.h 34629baa8cSmrg * 35629baa8cSmrg * public interfaces for greet/verify functionality 36629baa8cSmrg */ 37629baa8cSmrg 38629baa8cSmrg#ifndef _DM_H_ 39629baa8cSmrg# define _DM_H_ 1 40629baa8cSmrg 41629baa8cSmrg# ifdef HAVE_CONFIG_H 42629baa8cSmrg# include "config.h" 43629baa8cSmrg# endif 44629baa8cSmrg 45629baa8cSmrg# include <X11/Xos.h> 46629baa8cSmrg# include <X11/Xfuncs.h> 47629baa8cSmrg# include <X11/Xfuncproto.h> 48629baa8cSmrg# include <X11/Xmd.h> 49629baa8cSmrg# include <X11/Xauth.h> 50629baa8cSmrg# include <X11/Intrinsic.h> 51629baa8cSmrg 52629baa8cSmrg# if defined(X_POSIX_C_SOURCE) 53629baa8cSmrg# define _POSIX_C_SOURCE X_POSIX_C_SOURCE 54629baa8cSmrg# include <setjmp.h> 55629baa8cSmrg# include <limits.h> 56629baa8cSmrg# undef _POSIX_C_SOURCE 57629baa8cSmrg# else 58629baa8cSmrg# include <setjmp.h> 59629baa8cSmrg# include <limits.h> 60629baa8cSmrg# endif 61629baa8cSmrg# include <time.h> 62629baa8cSmrg# define Time_t time_t 63629baa8cSmrg 64629baa8cSmrg/* If XDMCP symbol defined, compile to run XDMCP protocol */ 65629baa8cSmrg 66629baa8cSmrg# define XDMCP 67629baa8cSmrg 68629baa8cSmrg# ifdef XDMCP 69629baa8cSmrg# include <X11/Xdmcp.h> 70629baa8cSmrg# endif 71629baa8cSmrg 72629baa8cSmrg 73629baa8cSmrg# ifndef X_NOT_POSIX 74629baa8cSmrg# ifdef _POSIX_SOURCE 75629baa8cSmrg# include <sys/wait.h> 76629baa8cSmrg# else 77629baa8cSmrg# define _POSIX_SOURCE 78629baa8cSmrg# include <sys/wait.h> 79629baa8cSmrg# undef _POSIX_SOURCE 80629baa8cSmrg# endif 81629baa8cSmrg# define waitCode(w) (WIFEXITED(w) ? WEXITSTATUS(w) : 0) 82629baa8cSmrg# define waitSig(w) (WIFSIGNALED(w) ? WTERMSIG(w) : 0) 83629baa8cSmrg# define waitCore(w) 0 /* not in POSIX. so what? */ 84629baa8cSmrgtypedef int waitType; 85629baa8cSmrg# else /* X_NOT_POSIX */ 86629baa8cSmrg# include <sys/wait.h> 87629baa8cSmrg# define waitCode(w) ((w).w_T.w_Retcode) 88629baa8cSmrg# define waitSig(w) ((w).w_T.w_Termsig) 89629baa8cSmrg# define waitCore(w) ((w).w_T.w_Coredump) 90629baa8cSmrgtypedef union wait waitType; 91629baa8cSmrg# endif /* X_NOT_POSIX */ 92629baa8cSmrg 93629baa8cSmrg# ifdef USE_PAM 9481e7e014Schristos# ifdef HAVE_SECURITY_PAM_TYPES_H 9581e7e014Schristos# include <security/pam_types.h> 9681e7e014Schristos# endif 97b7d26471Smrg# ifdef HAVE_SECURITY_PAM_APPL_H 98b7d26471Smrg# include <security/pam_appl.h> 99b7d26471Smrg# elif defined(HAVE_PAM_PAM_APPL_H) 100b7d26471Smrg# include <pam/pam_appl.h> 101b7d26471Smrg# else 102b7d26471Smrg# error "Unable to determine pam headers" 103b7d26471Smrg# endif 104629baa8cSmrg# endif 105629baa8cSmrg 106629baa8cSmrg# ifdef CSRG_BASED 107629baa8cSmrg# include <sys/param.h> 108629baa8cSmrg# ifdef HAVE_SETUSERCONTEXT 109629baa8cSmrg# include <login_cap.h> 110629baa8cSmrg# include <pwd.h> 111629baa8cSmrg# ifdef USE_BSDAUTH 112629baa8cSmrg# include <bsd_auth.h> 113629baa8cSmrg# endif 114629baa8cSmrg# endif 115629baa8cSmrg# endif 116629baa8cSmrg 117629baa8cSmrg# define waitCompose(sig,core,code) ((sig) * 256 + (core) * 128 + (code)) 118629baa8cSmrg# define waitVal(w) waitCompose(waitSig(w), waitCore(w), waitCode(w)) 119629baa8cSmrg 120629baa8cSmrgtypedef enum displayStatus { running, notRunning, zombie, phoenix } DisplayStatus; 121629baa8cSmrg 122629baa8cSmrg# ifndef FD_ZERO 123629baa8cSmrgtypedef struct my_fd_set { int fds_bits[1]; } my_fd_set; 124629baa8cSmrg# define FD_ZERO(fdp) bzero ((fdp), sizeof (*(fdp))) 125629baa8cSmrg# define FD_SET(f,fdp) ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] |= (1 << ((f) % (sizeof (int) * 8)))) 126629baa8cSmrg# define FD_CLR(f,fdp) ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] &= ~(1 << ((f) % (sizeof (int) * 8)))) 127629baa8cSmrg# define FD_ISSET(f,fdp) ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] & (1 << ((f) % (sizeof (int) * 8)))) 128629baa8cSmrg# define FD_TYPE my_fd_set 129629baa8cSmrg# else 130629baa8cSmrg# define FD_TYPE fd_set 131629baa8cSmrg# endif 132629baa8cSmrg 133629baa8cSmrg/* 134629baa8cSmrg * local - server runs on local host 135629baa8cSmrg * foreign - server runs on remote host 136629baa8cSmrg * permanent - session restarted when it exits 137629baa8cSmrg * transient - session not restarted when it exits 138629baa8cSmrg * fromFile - started via entry in servers file 139629baa8cSmrg * fromXDMCP - started with XDMCP 140629baa8cSmrg */ 141629baa8cSmrg 142629baa8cSmrgtypedef struct displayType { 143629baa8cSmrg unsigned int location:1; 144629baa8cSmrg unsigned int lifetime:1; 145629baa8cSmrg unsigned int origin:1; 146629baa8cSmrg} DisplayType; 147629baa8cSmrg 148629baa8cSmrg# define Local 1 149629baa8cSmrg# define Foreign 0 150629baa8cSmrg 151629baa8cSmrg# define Permanent 1 152629baa8cSmrg# define Transient 0 153629baa8cSmrg 154629baa8cSmrg# define FromFile 1 155629baa8cSmrg# define FromXDMCP 0 156629baa8cSmrg 157629baa8cSmrgextern DisplayType parseDisplayType (char *string, int *usedDefault); 158629baa8cSmrg 159629baa8cSmrgtypedef enum fileState { NewEntry, OldEntry, MissingEntry } FileState; 160629baa8cSmrg 161629baa8cSmrgstruct display { 162629baa8cSmrg struct display *next; 163629baa8cSmrg /* Xservers file / XDMCP information */ 164629baa8cSmrg char *name; /* DISPLAY name */ 165629baa8cSmrg char *class; /* display class (may be NULL) */ 166629baa8cSmrg DisplayType displayType; /* method to handle with */ 167629baa8cSmrg char **argv; /* program name and arguments */ 168629baa8cSmrg 169629baa8cSmrg /* display state */ 170629baa8cSmrg DisplayStatus status; /* current status */ 171629baa8cSmrg pid_t pid; /* process id of child */ 172629baa8cSmrg pid_t serverPid; /* process id of server (-1 if none) */ 173629baa8cSmrg FileState state; /* state during HUP processing */ 174629baa8cSmrg int startTries; /* current start try */ 175629baa8cSmrg Time_t lastReserv; /* time of last reserver crash */ 176629baa8cSmrg int reservTries; /* current reserver try */ 177629baa8cSmrg# ifdef XDMCP 178629baa8cSmrg /* XDMCP state */ 179629baa8cSmrg CARD32 sessionID; /* ID of active session */ 180629baa8cSmrg XdmcpNetaddr peer; /* display peer address */ 181629baa8cSmrg int peerlen; /* length of peer address */ 182629baa8cSmrg XdmcpNetaddr from; /* XDMCP port of display */ 183629baa8cSmrg int fromlen; 184629baa8cSmrg CARD16 displayNumber; 185629baa8cSmrg int useChooser; /* Run the chooser for this display */ 186629baa8cSmrg ARRAY8 clientAddr; /* for chooser picking */ 187629baa8cSmrg CARD16 connectionType; /* ... */ 188629baa8cSmrg int xdmcpFd; 189629baa8cSmrg# endif 190629baa8cSmrg /* server management resources */ 191629baa8cSmrg int serverAttempts; /* number of attempts at running X */ 192629baa8cSmrg int openDelay; /* open delay time */ 193629baa8cSmrg int openRepeat; /* open attempts to make */ 194629baa8cSmrg int openTimeout; /* abort open attempt timeout */ 195629baa8cSmrg int startAttempts; /* number of attempts at starting */ 196629baa8cSmrg int reservAttempts; /* allowed start-IO error sequences */ 197629baa8cSmrg int pingInterval; /* interval between XSync */ 198629baa8cSmrg int pingTimeout; /* timeout for XSync */ 199629baa8cSmrg int terminateServer;/* restart for each session */ 200629baa8cSmrg int grabServer; /* keep server grabbed for Login */ 201629baa8cSmrg int grabTimeout; /* time to wait for grab */ 202629baa8cSmrg int resetSignal; /* signal to reset server */ 203629baa8cSmrg int termSignal; /* signal to terminate server */ 204629baa8cSmrg int resetForAuth; /* server reads auth file at reset */ 205629baa8cSmrg char *keymaps; /* binary compat with DEC */ 206629baa8cSmrg char *greeterLib; /* greeter shared library name */ 207629baa8cSmrg 208629baa8cSmrg /* session resources */ 209629baa8cSmrg char *resources; /* resource file */ 210629baa8cSmrg char *xrdb; /* xrdb program */ 211629baa8cSmrg char *setup; /* Xsetup program */ 212629baa8cSmrg char *startup; /* Xstartup program */ 213629baa8cSmrg char *reset; /* Xreset program */ 214629baa8cSmrg char *session; /* Xsession program */ 215629baa8cSmrg char *userPath; /* path set for session */ 216629baa8cSmrg char *systemPath; /* path set for startup/reset */ 217629baa8cSmrg char *systemShell; /* interpreter for startup/reset */ 218629baa8cSmrg char *failsafeClient;/* a client to start when the session fails */ 219629baa8cSmrg char *chooser; /* chooser program */ 220629baa8cSmrg 221629baa8cSmrg /* authorization resources */ 222629baa8cSmrg int authorize; /* enable authorization */ 223629baa8cSmrg char **authNames; /* authorization protocol names */ 224629baa8cSmrg unsigned short *authNameLens; /* authorization protocol name lens */ 225629baa8cSmrg char *clientAuthFile;/* client specified auth file */ 226629baa8cSmrg char *userAuthDir; /* backup directory for tickets */ 227629baa8cSmrg int authComplain; /* complain when no auth for XDMCP */ 228629baa8cSmrg 229629baa8cSmrg /* information potentially derived from resources */ 230629baa8cSmrg int authNameNum; /* number of protocol names */ 231629baa8cSmrg Xauth **authorizations;/* authorization data */ 232629baa8cSmrg int authNum; /* number of authorizations */ 233629baa8cSmrg char *authFile; /* file to store authorization in */ 234629baa8cSmrg 235629baa8cSmrg int version; /* to keep dynamic greeter clued in */ 236629baa8cSmrg /* add new fields only after here. And preferably at the end. */ 237629baa8cSmrg 238629baa8cSmrg /* Hack for making "Willing to manage" configurable */ 239629baa8cSmrg char *willing; /* "Willing to manage" program */ 240629baa8cSmrg Display *dpy; /* Display */ 241629baa8cSmrg char *windowPath; /* path to server "window" */ 242629baa8cSmrg}; 243629baa8cSmrg 244629baa8cSmrg# ifdef XDMCP 245629baa8cSmrg 246629baa8cSmrg# define PROTO_TIMEOUT (30 * 60) /* 30 minutes should be long enough */ 247629baa8cSmrg# define XDM_BROKEN_INTERVAL (120) /* server crashing more than once within */ 248629baa8cSmrg /* two minutes is assumed to be broken! */ 249629baa8cSmrgstruct protoDisplay { 250629baa8cSmrg struct protoDisplay *next; 251629baa8cSmrg XdmcpNetaddr address; /* UDP address */ 252629baa8cSmrg int addrlen; /* UDP address length */ 253629baa8cSmrg unsigned long date; /* creation date */ 254629baa8cSmrg CARD16 displayNumber; 255629baa8cSmrg CARD16 connectionType; 256629baa8cSmrg ARRAY8 connectionAddress; 257629baa8cSmrg CARD32 sessionID; 258629baa8cSmrg Xauth *fileAuthorization; 259629baa8cSmrg Xauth *xdmcpAuthorization; 260629baa8cSmrg ARRAY8 authenticationName; 261629baa8cSmrg ARRAY8 authenticationData; 262629baa8cSmrg XdmAuthKeyRec key; 263629baa8cSmrg}; 264629baa8cSmrg# endif /* XDMCP */ 265629baa8cSmrg 266629baa8cSmrgstruct greet_info { 267629baa8cSmrg char *name; /* user name */ 268629baa8cSmrg char *password; /* user password */ 269629baa8cSmrg char *string; /* random string */ 270629baa8cSmrg char *passwd; /* binary compat with DEC */ 271629baa8cSmrg int version; /* for dynamic greeter to see */ 272629baa8cSmrg /* add new fields below this line, and preferably at the end */ 273629baa8cSmrg Boolean allow_null_passwd; /* allow null password on login */ 274629baa8cSmrg Boolean allow_root_login; /* allow direct root login */ 275629baa8cSmrg}; 276629baa8cSmrg 277629baa8cSmrgtypedef void (*ChooserFunc)(CARD16 connectionType, ARRAY8Ptr addr, char *closure); 278629baa8cSmrgtypedef void (*ListenFunc)(ARRAY8Ptr addr, void **closure); 279629baa8cSmrg 280629baa8cSmrgstruct verify_info { 281629baa8cSmrg int uid; /* user id */ 282629baa8cSmrg int gid; /* group id */ 283629baa8cSmrg char **argv; /* arguments to session */ 284629baa8cSmrg char **userEnviron; /* environment for session */ 285629baa8cSmrg char **systemEnviron;/* environment for startup/reset */ 286629baa8cSmrg int version; /* for dynamic greeter to see */ 287629baa8cSmrg /* add new fields below this line, and preferably at the end */ 288629baa8cSmrg}; 289629baa8cSmrg 290629baa8cSmrg/* display manager exit status definitions */ 291629baa8cSmrg 292629baa8cSmrg# define OBEYSESS_DISPLAY 0 /* obey multipleSessions resource */ 293629baa8cSmrg# define REMANAGE_DISPLAY 1 /* force remanage */ 294629baa8cSmrg# define UNMANAGE_DISPLAY 2 /* force deletion */ 295629baa8cSmrg# define RESERVER_DISPLAY 3 /* force server termination */ 296629baa8cSmrg# define OPENFAILED_DISPLAY 4 /* XOpenDisplay failed, retry */ 297629baa8cSmrg 298629baa8cSmrg# ifndef TRUE 299629baa8cSmrg# define TRUE 1 300629baa8cSmrg# define FALSE 0 301629baa8cSmrg# endif 302629baa8cSmrg 303629baa8cSmrgextern char *config; 304629baa8cSmrg 305629baa8cSmrgextern char *servers; 306629baa8cSmrgextern int request_port; 307629baa8cSmrgextern int debugLevel; 308629baa8cSmrgextern char *errorLogFile; 309629baa8cSmrgextern int daemonMode; 310629baa8cSmrgextern char *pidFile; 311629baa8cSmrgextern int lockPidFile; 312629baa8cSmrgextern char *authDir; 313629baa8cSmrgextern int autoRescan; 314629baa8cSmrgextern int removeDomainname; 315629baa8cSmrgextern char *keyFile; 316629baa8cSmrgextern char *accessFile; 317629baa8cSmrgextern char **exportList; 318629baa8cSmrg# if !defined(HAVE_ARC4RANDOM) 319629baa8cSmrgextern char *randomFile; 320629baa8cSmrgextern char *prngdSocket; 321629baa8cSmrgextern int prngdPort; 322629baa8cSmrg# endif 323629baa8cSmrg 324629baa8cSmrgextern char *greeterLib; 325629baa8cSmrgextern char *willing; 326629baa8cSmrgextern int choiceTimeout; /* chooser choice timeout */ 327629baa8cSmrg 328629baa8cSmrgextern struct display *FindDisplayByName (char *name), 329629baa8cSmrg *FindDisplayBySessionID (CARD32 sessionID), 330629baa8cSmrg *FindDisplayByAddress (XdmcpNetaddr addr, int addrlen, CARD16 displayNumber), 331629baa8cSmrg *FindDisplayByPid (pid_t pid), 332629baa8cSmrg *FindDisplayByServerPid (pid_t serverPid), 333629baa8cSmrg *NewDisplay (char *name, char *class); 334629baa8cSmrg 335629baa8cSmrgextern struct protoDisplay *FindProtoDisplay ( 336629baa8cSmrg XdmcpNetaddr address, 337629baa8cSmrg int addrlen, 338629baa8cSmrg CARD16 displayNumber); 339629baa8cSmrgextern struct protoDisplay *NewProtoDisplay ( 340629baa8cSmrg XdmcpNetaddr address, 341629baa8cSmrg int addrlen, 342629baa8cSmrg CARD16 displayNumber, 343629baa8cSmrg CARD16 connectionType, 344629baa8cSmrg ARRAY8Ptr connectionAddress, 345629baa8cSmrg CARD32 sessionID); 346629baa8cSmrg 347629baa8cSmrg/* in Login.c */ 348629baa8cSmrgextern void DrawFail (Widget ctx); 349629baa8cSmrg 350629baa8cSmrg/* in access.c */ 351629baa8cSmrgextern ARRAY8Ptr getLocalAddress (void); 352629baa8cSmrgextern int AcceptableDisplayAddress (ARRAY8Ptr clientAddress, CARD16 connectionType, xdmOpCode type); 353629baa8cSmrgextern int ForEachMatchingIndirectHost (ARRAY8Ptr clientAddress, CARD16 connectionType, ChooserFunc function, char *closure); 354629baa8cSmrgextern int ScanAccessDatabase (void); 355629baa8cSmrgextern int UseChooser (ARRAY8Ptr clientAddress, CARD16 connectionType); 356629baa8cSmrgextern void ForEachChooserHost (ARRAY8Ptr clientAddress, CARD16 connectionType, ChooserFunc function, char *closure); 357629baa8cSmrgextern void ForEachListenAddr(ListenFunc listenfunction, 358629baa8cSmrg ListenFunc mcastfcuntion, void **closure); 359629baa8cSmrg 360629baa8cSmrg/* in choose.c */ 361629baa8cSmrgextern ARRAY8Ptr IndirectChoice (ARRAY8Ptr clientAddress, CARD16 connectionType); 362629baa8cSmrgextern int IsIndirectClient (ARRAY8Ptr clientAddress, CARD16 connectionType); 363629baa8cSmrgextern int RememberIndirectClient (ARRAY8Ptr clientAddress, CARD16 connectionType); 364629baa8cSmrgextern void ForgetIndirectClient ( ARRAY8Ptr clientAddress, CARD16 connectionType); 365629baa8cSmrgextern void ProcessChooserSocket (int fd); 366629baa8cSmrg 367629baa8cSmrg/* in chooser.c */ 368b7d26471Smrgextern void RunChooser (struct display *d) _X_NORETURN; 369629baa8cSmrg 370629baa8cSmrg/* in daemon.c */ 371629baa8cSmrgextern void BecomeDaemon (void); 372629baa8cSmrgextern void BecomeOrphan (void); 373629baa8cSmrg 374629baa8cSmrg/* in dm.c */ 375629baa8cSmrgextern void CloseOnFork (void); 376629baa8cSmrgextern void RegisterCloseOnFork (int fd); 377629baa8cSmrgextern void StartDisplay (struct display *d); 378629baa8cSmrg# ifndef HAVE_SETPROCTITLE 379629baa8cSmrgextern void SetTitle (char *name, ...); 380629baa8cSmrg# endif 381629baa8cSmrg 382629baa8cSmrg/* in dpylist.c */ 383629baa8cSmrgextern int AnyDisplaysLeft (void); 384629baa8cSmrgextern void ForEachDisplay (void (*f)(struct display *)); 385629baa8cSmrgextern void RemoveDisplay (struct display *old); 386629baa8cSmrg 387629baa8cSmrg/* in file.c */ 388629baa8cSmrgextern void ParseDisplay (char *source, DisplayType *acceptableTypes, int numAcceptable); 389629baa8cSmrg 390629baa8cSmrg/* in netaddr.c */ 391629baa8cSmrgextern char *NetaddrAddress(XdmcpNetaddr netaddrp, int *lenp); 392629baa8cSmrgextern char *NetaddrPort(XdmcpNetaddr netaddrp, int *lenp); 393629baa8cSmrgextern int ConvertAddr (XdmcpNetaddr saddr, int *len, char **addr); 394629baa8cSmrgextern int NetaddrFamily (XdmcpNetaddr netaddrp); 395629baa8cSmrgextern int addressEqual (XdmcpNetaddr a1, int len1, XdmcpNetaddr a2, int len2); 396629baa8cSmrg 397629baa8cSmrg/* in policy.c */ 398629baa8cSmrgextern ARRAY8Ptr ChooseAuthentication (ARRAYofARRAY8Ptr authenticationNames); 399629baa8cSmrgextern int CheckAuthentication (struct protoDisplay *pdpy, ARRAY8Ptr displayID, ARRAY8Ptr name, ARRAY8Ptr data); 400629baa8cSmrgextern int SelectAuthorizationTypeIndex (ARRAY8Ptr authenticationName, ARRAYofARRAY8Ptr authorizationNames); 401629baa8cSmrgextern int SelectConnectionTypeIndex (ARRAY16Ptr connectionTypes, ARRAYofARRAY8Ptr connectionAddresses); 402629baa8cSmrgextern int Willing (ARRAY8Ptr addr, CARD16 connectionType, ARRAY8Ptr authenticationName, ARRAY8Ptr status, xdmOpCode type); 403629baa8cSmrg 404629baa8cSmrg/* in protodpy.c */ 405629baa8cSmrgextern void DisposeProtoDisplay(struct protoDisplay *pdpy); 406629baa8cSmrg 407629baa8cSmrg/* in reset.c */ 408629baa8cSmrgextern void pseudoReset (Display *dpy); 409629baa8cSmrg 410629baa8cSmrg/* in resource.c */ 411629baa8cSmrgextern void InitResources (int argc, char **argv); 412629baa8cSmrgextern void LoadDMResources (void); 413629baa8cSmrgextern void LoadServerResources (struct display *d); 414629baa8cSmrgextern void LoadSessionResources (struct display *d); 415629baa8cSmrgextern void ReinitResources (void); 416629baa8cSmrg 417629baa8cSmrg/* in session.c */ 418629baa8cSmrg# ifdef USE_PAM 419629baa8cSmrgextern pam_handle_t **thepamhp(void); 420629baa8cSmrgextern pam_handle_t *thepamh(void); 421629baa8cSmrg# endif 422629baa8cSmrgextern char **defaultEnv (void); 423629baa8cSmrgextern char **systemEnv (struct display *d, char *user, char *home); 424629baa8cSmrgextern int PingServer(struct display *d, Display *alternateDpy); 425629baa8cSmrgextern int source (char **environ, char *file); 426629baa8cSmrgextern void ClearCloseOnFork (int fd); 427629baa8cSmrgextern void DeleteXloginResources (struct display *d, Display *dpy); 428629baa8cSmrgextern void LoadXloginResources (struct display *d); 429b7d26471Smrgextern void ManageSession (struct display *d) _X_NORETURN; 430629baa8cSmrgextern void SecureDisplay (struct display *d, Display *dpy); 431b7d26471Smrgextern void SessionExit (struct display *d, int status, int removeAuth) _X_NORETURN; 432b7d26471Smrgextern void SessionPingFailed (struct display *d) _X_NORETURN; 433629baa8cSmrgextern void SetupDisplay (struct display *d); 434629baa8cSmrgextern void UnsecureDisplay (struct display *d, Display *dpy); 435629baa8cSmrgextern void execute(char **argv, char **environ); 436629baa8cSmrg 437629baa8cSmrg/* server.c */ 438b7d26471Smrgextern const char *_SysErrorMsg (int n); 439629baa8cSmrgextern int StartServer (struct display *d); 440629baa8cSmrgextern int WaitForServer (struct display *d); 441629baa8cSmrgextern void ResetServer (struct display *d); 442629baa8cSmrg 443b7d26471Smrg/* socket.c */ 444629baa8cSmrgextern int GetChooserAddr (char *addr, int *lenp); 445629baa8cSmrgextern void CreateWellKnownSockets (void); 446629baa8cSmrgextern void UpdateListenSockets (void); 447629baa8cSmrgextern void CloseListenSockets (void); 448629baa8cSmrgextern void ProcessListenSockets (fd_set *readmask); 449629baa8cSmrg 450629baa8cSmrg/* in util.c */ 451629baa8cSmrg# ifndef HAVE_ASPRINTF 452629baa8cSmrg# define asprintf Asprintf 453629baa8cSmrgextern int Asprintf(char ** ret, const char *restrict format, ...) 454629baa8cSmrg _X_ATTRIBUTE_PRINTF(2,3); 455629baa8cSmrg# endif 456629baa8cSmrgextern char *localHostname (void); 457b7d26471Smrgextern char **parseArgs (char **argv, const char *string); 458b7d26471Smrgextern char **setEnv (char **e, const char *name, const char *value); 459629baa8cSmrgextern char **putEnv(const char *string, char **env); 460b7d26471Smrgextern char *getEnv (char **e, const char *name); 461629baa8cSmrgextern void CleanUpChild (void); 462629baa8cSmrgextern void freeArgs (char **argv); 463629baa8cSmrgextern void freeEnv (char **env); 464629baa8cSmrgextern void printEnv (char **e); 465629baa8cSmrg 466629baa8cSmrg/* in verify.c */ 467629baa8cSmrgextern int Verify (struct display *d, struct greet_info *greet, struct verify_info *verify); 468629baa8cSmrg 469629baa8cSmrg/* in xdmcp.c */ 470629baa8cSmrgextern char *NetworkAddressToHostname (CARD16 connectionType, ARRAY8Ptr connectionAddress); 471629baa8cSmrgextern int AnyWellKnownSockets (void); 472629baa8cSmrgextern void DestroyWellKnownSockets (void); 473b7d26471Smrgextern void SendFailed (struct display *d, const char *reason); 474629baa8cSmrgextern void StopDisplay (struct display *d); 475629baa8cSmrgextern void WaitForChild (void); 476629baa8cSmrgextern void WaitForSomething (void); 477629baa8cSmrgextern void init_session_id(void); 478629baa8cSmrgextern void registerHostname(char *name, int namelen); 479629baa8cSmrgextern void ProcessRequestSocket(int fd); 480629baa8cSmrg 481629baa8cSmrg/* 482629baa8cSmrg * CloseOnFork flags 483629baa8cSmrg */ 484629baa8cSmrg 485629baa8cSmrg# define CLOSE_ALWAYS 0 486629baa8cSmrg# define LEAVE_FOR_DISPLAY 1 487629baa8cSmrg 488629baa8cSmrg# include <stdlib.h> 489629baa8cSmrg 490b7d26471Smrg# if defined(X_NOT_POSIX) || defined(__NetBSD__) && defined(__sparc__) 491629baa8cSmrg# define Setjmp(e) setjmp(e) 492629baa8cSmrg# define Longjmp(e,v) longjmp(e,v) 493629baa8cSmrg# define Jmp_buf jmp_buf 494629baa8cSmrg# else 495629baa8cSmrg# define Setjmp(e) sigsetjmp(e,1) 496629baa8cSmrg# define Longjmp(e,v) siglongjmp(e,v) 497629baa8cSmrg# define Jmp_buf sigjmp_buf 498629baa8cSmrg# endif 499629baa8cSmrg 500b7d26471Smrgtypedef void (*SIGFUNC)(int); 501629baa8cSmrg 502b7d26471Smrgvoid (*Signal(int, SIGFUNC Handler))(int); 503629baa8cSmrg 504629baa8cSmrg#endif /* _DM_H_ */ 505