Remove Unixware and openserver support
[oweals/cde.git] / cde / programs / dtlogin / dm.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* (c) Copyright 1997 The Open Group */
24 /*                                                                      *
25  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
26  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
27  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
28  * (c) Copyright 1993, 1994 Novell, Inc.                                *
29  */
30 /*
31  * xdm - display manager daemon
32  *
33  * $TOG: dm.h /main/12 1998/04/06 13:21:59 mgreess $
34  *
35  * Copyright 1988 Massachusetts Institute of Technology
36  *
37  * Permission to use, copy, modify, and distribute this software and its
38  * documentation for any purpose and without fee is hereby granted, provided
39  * that the above copyright notice appear in all copies and that both that
40  * copyright notice and this permission notice appear in supporting
41  * documentation, and that the name of M.I.T. not be used in advertising or
42  * publicity pertaining to distribution of the software without specific,
43  * written prior permission.  M.I.T. makes no representations about the
44  * suitability of this software for any purpose.  It is provided "as is"
45  * without express or implied warranty.
46  *
47  * Author:  Keith Packard, MIT X Consortium
48  */
49
50 /*
51  * dm.h
52  *
53  * public interfaces for greet/verify functionality
54  */
55
56
57 #ifndef _DM_H
58 #define _DM_H
59
60
61 /***************************************************************************
62  *
63  *  Includes
64  *
65  ***************************************************************************/
66
67 # include       <errno.h>               /* for errno                       */
68 # include       <pwd.h>                 /* for passwd structure            */
69 # include       <stdio.h>
70 # include       <stdlib.h>              /* for exit(), malloc(), abort()   */
71 # include       <string.h>              /* for string functions, bcopy(),
72                                            sys_errlist                     */
73 # include       <sys/param.h>           /* for NGROUPS                     */
74 # include       <sys/types.h>           /* for fd_set                      */
75 # include       <netinet/in.h>          /* for Internet socket stuff       */
76
77 #ifdef _BSD
78 # include       <strings.h>             /* for BSD string functions        */
79 #endif
80
81 # include       <X11/Xlib.h>
82 # include       <X11/Xos.h>
83 # include       <X11/Xmd.h>
84 # include       <X11/Xauth.h>
85 # include       <X11/Xdmcp.h>
86 #ifdef SVR4 /*** needed for bcopy bcmp ***/
87 #include    <X11/Xlibint.h>
88 #endif      /* SVR4 */
89
90 # include <X11/Xresource.h>
91
92 #ifndef LAST_SESSION_FILE
93 #define LAST_SESSION_FILE "/.dt/sessions/lastsession"
94 #endif
95
96 #ifndef CDE_INSTALLATION_TOP
97 #define CDE_INSTALLATION_TOP "/opt/dt"
98 #endif
99
100 #define DEF_PATH        "/usr/bin:"     /* same as PATH */
101 #define DEF_SUPATH      "/usr/sbin:/usr/bin" /* same as ROOTPATH */
102
103 #define LANGLISTSIZE    2048
104 #define DELIM           " \t"   /* delimiters in language list             */
105
106
107 /***************************************************************************
108  *
109  *  Defines
110  *
111  ***************************************************************************/
112
113 /*
114  * Default directories containing locale information.
115  */
116 #if defined(_AIX) || defined (__osf__)
117   #define DEF_NLS_DIR   "/usr/lib/nls/loc"
118 #elif defined(hpV4)
119   #define DEF_NLS_DIR   "/usr/lib/nls/msg"
120 #else
121   #define DEF_NLS_DIR   CDE_INSTALLATION_TOP "/lib/nls/msg"
122 #endif
123
124 #if defined(sun)
125   #define DEF_X11_NLS_SHARE_DIR "/usr/openwin/share/locale"  
126   #define DEF_X11_NLS_LIB_DIR   "/usr/openwin/lib/locale"  
127 #endif
128
129 /**************************************************************************
130  * 
131  * /etc/utmp
132  *
133  **************************************************************************/
134
135 /* Default dummy device name (/etc/utmp "tty line" for foreign displays ) */
136 #define DEF_NETWORK_DEV "/dev/dtremote"
137
138 /*
139  * Pseudo-tty file creation routine 
140  *
141  *   For remote connections, the value for 'line' in /etc/utmp must also
142  *   exist as a device in the /dev directory for commands such as 'finger'
143  *   to operate properly. 
144  * 
145  *   For most platforms, /dev/dtremote will simply be a symbolic link
146  *   to the /dev/null device. 
147  *
148  *   For AIX, /dev/dtremote will be a character special file whose major
149  *   and minor numbers are the same as /dev/null. This is the case since
150  *   the AIX init command will chown and chmod the 'line' device if dtlogin
151  *   dies while owned by init. If /dev/dtremote were a symlink to /dev/null,
152  *   /dev/null whould be chown/chmod such that regular users could no longer
153  *   write to it. 
154  */
155 #ifdef _AIX
156 #define MK_NETWORK_DEV_PERMS (S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
157 #define MK_NETWORK_DEV(DEV) (mknod(DEV, MK_NETWORK_DEV_PERMS, makedev(2, 2)))
158 #else
159 #define MK_NETWORK_DEV(DEV) (symlink("/dev/null",DEV))
160 #endif
161
162 /* Utmp rec prefix */
163 #define UTMPREC_PREFIX  "dt"
164
165 #ifdef SIGNALRETURNSINT
166 #define SIGVAL int
167 #else
168 #define SIGVAL void
169 #endif
170
171
172 #ifndef UID_NO_CHANGE
173 #  define UID_NO_CHANGE  ((uid_t) -1)  /* for chown(2) and setresuid(2) */
174 #endif
175
176 #ifndef GID_NO_CHANGE
177 #  define GID_NO_CHANGE  ((gid_t) -1)  /* for chown(2) and setresgid(2) */
178 #endif
179
180 #ifndef _BSD
181  #ifdef bzero
182   #undef bzero
183  #endif
184
185  #ifdef SVR4
186   #define bzero(x,y)    memset((void *)(x),0,(y))/* use ANSI C version     */
187  #else
188   #define bzero(x,y)    memset((x),0,(y))       /* use ANSI C version      */
189  #endif
190 #endif
191
192 #define IsVerifyName(n) ((d->verifyName && (strcmp(d->verifyName,(n)) == 0 )) \
193                           ? TRUE : FALSE)
194
195
196 /***************************************************************************
197  *
198  *  wait() 
199  *
200  ***************************************************************************/
201
202 /*#if defined(SYSV) && !defined(hpux)*/
203 #if defined(SYSV) || defined(SVR4) || defined(linux) || defined(CSRG_BASED)
204 #   include     <sys/wait.h>
205 # define waitCode(w)    WEXITSTATUS(w)
206 # define waitSig(w)     WTERMSIG(w)
207 #if defined(_AIX)
208     /*
209      * hpux has a "WCOREDUMP" macro which is undefined in AIX.
210      * For AIX, the macro from hpux's <sys/wait.h> is used.
211      */
212 # define waitCore(w)    ( ((int)(w)&0200) == 0 ? 0 : 1 )
213 #else
214 # define waitCore(w)    ( WCOREDUMP(w) == 0 ? 0 : 1 )
215 #endif /* _AIX */
216 typedef int             waitType;
217 #else
218 # ifdef _BSD
219 #   include     <sys/wait.h>
220 # else
221 #   define _BSD
222 #   include     <sys/wait.h>
223 #   undef _BSD
224 # endif
225 # define waitCode(w)    ((w).w_T.w_Retcode)
226 # define waitSig(w)     ((w).w_T.w_Termsig)
227 # define waitCore(w)    ((w).w_T.w_Coredump)
228 typedef union wait      waitType;
229 #endif
230
231 # define waitCompose(sig,core,code) ((sig) * 256 + (core) * 128 + (code))
232 /*
233 # define waitVal(w)     waitCompose(waitSig(w), waitCore(w), waitCode(w))
234 */
235 # define waitVal(w)     waitCode(w)
236
237
238
239
240 /***************************************************************************
241  *
242  *  select() 
243  *
244  ***************************************************************************/
245
246 #ifndef FD_ZERO
247 typedef struct  my_fd_set { int fds_bits[1]; } my_fd_set;
248 # define FD_ZERO(fdp)   bzero ((fdp), sizeof (*(fdp)))
249 # define FD_SET(f,fdp)  ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] |=  (1 << ((f) % (sizeof (int) * 8))))
250 # define FD_CLR(f,fdp)  ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] &= ~(1 << ((f) % (sizeof (int) * 8))))
251 # define FD_ISSET(f,fdp)        ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] & (1 << ((f) % (sizeof (int) * 8))))
252 # define FD_TYPE        my_fd_set
253 #else
254 # define FD_TYPE        fd_set
255 #endif
256
257
258
259
260 /***************************************************************************
261  *
262  *  Defines and structures for display management
263  *
264  ***************************************************************************/
265
266 typedef enum displayStatus { running, notRunning, zombie, phoenix, suspended }
267              DisplayStatus;
268
269 typedef enum fileState { NewEntry, OldEntry, MissingEntry } FileState;
270
271 /*
272  * local     - server runs on local host
273  * foreign   - server runs on remote host
274  * permanent - session restarted when it exits
275  * transient - session not restarted when it exits
276  * fromFile  - started via entry in servers file
277  * fromXDMCP - started with XDMCP
278  */
279
280 typedef struct displayType {
281         unsigned int    location:1;
282         unsigned int    lifetime:1;
283         unsigned int    origin:1;
284 } DisplayType;
285
286
287 # define Local          1
288 # define Foreign        0
289
290 # define Permanent      1
291 # define Transient      0
292
293 # define FromFile       1
294 # define FromXDMCP      0
295
296 /*
297  * gettyState values
298  *   NONE - no getty running or don't care
299  *   LOGIN - getty running
300  *   USER - user logged in on getty
301  */
302 #define DM_GETTY_NONE   0
303 #define DM_GETTY_LOGIN  1
304 #define DM_GETTY_USER   2
305
306 struct display {
307         struct display  *next;
308         /* Xservers file / XDMCP information */
309         char            *name;          /* DISPLAY name */
310         char            *class;         /* display class (may be NULL) */
311         DisplayType     displayType;    /* method to handle with */
312         char            **argv;         /* program name and arguments */
313
314         /* display state */
315         DisplayStatus   status;         /* current status */
316         int             pid;            /* process id of child */
317         int             serverPid;      /* process id of server (-1 if none) */
318         FileState       state;          /* state during HUP processing */
319         int             startTries;     /* current start try */
320         int             gettyState;     /* current getty state */
321
322         /* XDMCP state */
323         CARD32          sessionID;      /* ID of active session */
324         struct sockaddr *peer;          /* sockaddr of display peer */
325         int             peerlen;        /* length of peer name */
326         struct sockaddr *from;          /* XDMCP port of display */
327         int             fromlen;
328         CARD16          displayNumber;
329         int             useChooser;     /* Run the chooser for this display */
330         ARRAY8          clientAddr;     /* for chooser picking */
331         CARD16          connectionType; /* ... */
332
333 #ifdef BYPASSLOGIN
334         int             bypassLogin;    /* bypass login for this display */
335 #endif /* BYPASSLOGIN */
336
337         /* server management resources */
338         int             serverAttempts; /* number of attempts at running X */
339         int             openDelay;      /* open delay time */
340         int             openRepeat;     /* open attempts to make */
341         int             openTimeout;    /* abort open attempt timeout */
342         int             startAttempts;  /* number of attempts at starting */
343         int             pingInterval;   /* interval between XSync */
344         int             pingTimeout;    /* timeout for XSync */
345         int             terminateServer;/* restart for each session */
346         int             grabServer;     /* keep server grabbed for Login */
347         int             grabTimeout;    /* time to wait for grab */
348         int             resetSignal;    /* signal to reset server */
349         int             termSignal;     /* signal to terminate server */
350         int             resetForAuth;   /* server reads auth file at reset */
351
352         /* session resources */
353         char            *resources;     /* resource file */
354         char            *xrdb;          /* xrdb program */
355         char            *cpp;           /* cpp program */
356         char            *setup;         /* Xsetup program */
357         char            *startup;       /* Xstartup program */
358         char            *reset;         /* Xreset program */
359         char            *session;       /* Xsession program */
360         char            *userPath;      /* path set for session */
361         char            *systemPath;    /* path set for startup/reset */
362         char            *systemShell;   /* interpreter for startup/reset */
363         char            *failsafeClient;/* a client to start when the session fails */
364         char            *chooser;       /* chooser program */
365
366         /* authorization resources */
367         int             authorize;      /* enable authorization */
368         char            **authNames;    /* authorization protocol name */
369         unsigned short  *authNameLens;  /* authorization protocol name len */
370         char            *clientAuthFile;/* client specified auth file */
371         char            *userAuthDir;   /* backup directory for tickets */
372
373         /* information potentially derived from resources */
374         int             authNameNum;    /* number of protocol names */
375         Xauth           **authorizations;       /* authorization data */
376         int             authNum;        /* number of authorizations */
377         char            *authFile;      /* file to store authorization in */
378         char            *language;      /* value for LANG env variable */
379         char            *langList;      /* list of languages on login screen */
380         char            *utmpId;        /* id for entry in utmp file */
381         char            *gettyLine;     /* line to run getty on */
382         char            *gettySpeed;    /* speed for getty (from gettydefs) */
383         char            *environStr;    /* environment variable resource */
384         int             dtlite; /* boolean for HP DT Lite session */
385         int             xdmMode;        /* boolean for XDM style session */
386         int             sessionType;    /* default, XDM, DT, or DTLITE session  */
387         char            *verifyName;    /* default, Kerberos, AFS, B1  */
388         char            *pmSearchPath;  /* motif pixmap search path */
389         char            *bmSearchPath;  /* motif bitmap search path */
390 };
391
392 #define PROTO_TIMEOUT   (30 * 60)   /* 30 minutes should be long enough */
393
394 struct protoDisplay {
395         struct protoDisplay     *next;
396         struct sockaddr         *address;   /* UDP address */
397         int                     addrlen;    /* UDP address length */
398         unsigned long           date;       /* creation date */
399         CARD16                  displayNumber;
400         CARD16                  connectionType;
401         ARRAY8                  connectionAddress;
402         CARD32                  sessionID;
403         Xauth                   *fileAuthorization;
404         Xauth                   *xdmcpAuthorization;
405         ARRAY8                  authenticationName;
406         ARRAY8                  authenticationData;
407         XdmAuthKeyRec           key;
408 };
409
410
411 struct greet_info {
412         char            *name;          /* user name */
413         char            *password;      /* user password */
414 #ifdef BLS
415         char            *b1security;    /* user's b1 security */
416 #endif
417         char            *string;        /* random string */
418 #ifdef __PASSWD_ETC
419         char            *name_full;     /* full SID */
420 #endif
421 };
422
423 struct verify_info {
424         int             uid;            /* user id */
425 #ifdef NGROUPS
426         gid_t           groups[NGROUPS];/* group list */
427         int             ngroups;        /* number of elements in groups */
428 #else
429         int             gid;            /* group id */
430 #endif
431         char            **argv;         /* arguments to session */
432         char            **userEnviron;  /* environment for session */
433         char            **systemEnviron;/* environment for startup/reset */
434 #ifdef AUDIT
435         long            audid;          /* audit id */
436         int             audflg;         /* audit flag */
437 #endif
438 #ifdef BLS
439         char *user_name;
440         struct mand_ir_t *sec_label_ir;
441         struct mand_ir_t *clearance_ir;
442         /* save these for logout time */
443         struct pr_passwd *prpwd;
444         struct passwd *pwd;
445         char terminal[16];
446 #endif
447 };
448
449
450 /* display manager exit status definitions */
451
452 # define OBEYSESS_DISPLAY       0       /* obey multipleSessions resource */
453 # define REMANAGE_DISPLAY       1       /* force remanage */
454 # define UNMANAGE_DISPLAY       2       /* force deletion */
455 # define RESERVER_DISPLAY       3       /* force server termination */
456 # define OPENFAILED_DISPLAY     4       /* XOpenDisplay failed, retry */
457 # define SUSPEND_DISPLAY        5       /* suspend server while getty is run */
458 #ifdef BYPASSLOGIN
459 # define GREETLESS_FAILED       6
460 #endif /* BYPASSLOGIN */
461
462 /*
463  * CloseOnFork flags
464  */
465
466 # define CLOSE_ALWAYS       0
467 # define LEAVE_FOR_DISPLAY  1
468
469
470
471
472 /***************************************************************************
473  *
474  *  External variable declarations
475  *
476  ***************************************************************************/
477
478 #if !defined(linux) && !defined(CSRG_BASED)
479 extern char     *sys_errlist[];         /* system error msgs               */
480 extern int      sys_nerr;               /* system error msgs               */
481 #endif
482 extern XrmDatabase  XresourceDB; 
483
484
485
486 extern char     *config;
487
488 extern char     *sysParmsFile;
489 extern char     *accessFile;
490 extern char     *servers;
491 extern int      request_port;
492 extern int      debugLevel;
493 extern char     *errorLogFile;
494 extern int      errorLogSize;
495 extern int      daemonMode;
496 extern int      quiet;
497 extern char     *pidFile;
498 extern int      lockPidFile;
499 extern char     *authDir;
500 extern int      autoRescan;
501 extern int      removeDomainname;
502 extern char     *keyFile;
503 extern char     *timeZone;
504 extern int      wakeupInterval;
505 extern char     *fpHead;
506 extern char     *fpTail;
507 extern int      langListTimeout;
508 #ifdef DEF_NETWORK_DEV
509 extern char     *networkDev;
510 #endif
511 #if defined(__osf__)
512 extern char     *ignoreLocales;
513 #endif
514
515 #if !defined (ENABLE_DYNAMIC_LANGLIST)
516 extern char     languageList[];         /* util.c                          */
517 #endif /* ENABLE_DYNAMIC_LANGLIST */
518
519 extern char     **exportList;  /* list of export env vars  RK    08.17.93 */
520
521
522
523
524 /****************************************************************************
525  *
526  *  Public procedure declarations
527  *
528  ****************************************************************************/
529
530 /*******************************     access.c    **************************/
531
532 extern int  AcceptableDisplayAddress( 
533                         ARRAY8Ptr clientAddress,
534 #if NeedWidePrototypes
535                         int connectionType,
536 #else
537                         CARD16 connectionType,
538 #endif /* NeedWidePrototypes */
539                         xdmOpCode type) ;
540
541 extern void ForEachChooserHost( 
542                         ARRAY8Ptr clientAddress,
543 #if NeedWidePrototypes
544                         int connectionType,
545 #else
546                         CARD16 connectionType,
547 #endif /* NeedWidePrototypes */
548                         int (*function)(),
549                         char *closure) ;
550 extern int  ForEachMatchingIndirectHost( 
551                         ARRAY8Ptr clientAddress,
552 #if NeedWidePrototypes
553                         int connectionType,
554 #else
555                         CARD16 connectionType,
556 #endif /* NeedWidePrototypes */
557                         int (*function)(CARD16,  struct _ARRAY8 *, char *),
558                         char *closure) ;
559 extern int  ScanAccessDatabase( void ) ;
560 extern int  UseChooser( 
561                         ARRAY8Ptr clientAddress,
562 #if NeedWidePrototypes
563                         int connectionType) ;
564 #else
565                         CARD16 connectionType) ;
566 #endif /* NeedWidePrototypes */
567 extern ARRAY8Ptr getLocalAddress( void ) ;
568
569
570 /*******************************     account.c    **************************/
571
572 extern void Account( 
573                         struct display *d, 
574                         char *user, 
575                         char *line, 
576                         pid_t pid,
577 #if NeedWidePrototypes
578                         int type,
579 #else
580                         short type,
581 #endif /* NeedWidePrototypes */
582                         waitType exitcode) ;
583
584 extern int  UtmpIdOpen( 
585                         char *utmpId) ;
586
587
588 /*******************************     apollo.c     **************************/
589
590 extern int  DoLogin(
591                         char *user, 
592                         char *passwd, 
593                         char *host) ;
594
595
596 /*******************************     auth.c       **************************/
597
598 extern int  ConvertAddr(
599                         XdmcpNetaddr saddr,
600                         int *len,                   /* return */
601                         char **addr);               /* return */
602
603 extern int  ConvertFamily(
604                         int sockfamily);
605
606 extern int  SaveServerAuthorizations(
607                         struct display *d, 
608                         Xauth **auth,
609                         int count) ;
610 extern void SetAuthorization( 
611                         struct display *d) ;
612 extern void SetLocalAuthorization( 
613                         struct display *d) ;
614 extern void SetProtoDisplayAuthorization( 
615                         struct protoDisplay *pdpy,
616 #if NeedWidePrototypes
617                         unsigned int authorizationNameLen,
618 #else
619                         unsigned short authorizationNameLen,
620 #endif /* NeedWidePrototypes */
621                         char *authorizationName) ;
622 extern void SetUserAuthorization( 
623                         struct display *d, 
624                         struct verify_info *verify) ;
625 extern int  ValidAuthorization( 
626 #if NeedWidePrototypes
627                         unsigned int name_length,
628 #else
629                         unsigned short name_length,
630 #endif /* NeedWidePrototypes */
631                         char *name) ;
632
633
634 /*******************************     cryptokey.c  **************************/
635
636 extern void GenerateCryptoKey(
637                         char *auth,
638                         int len) ;
639 extern int  InitCryptoKey( void ) ;
640
641
642 /*******************************     daemon.c     **************************/
643
644 extern void BecomeDaemon( void ) ;
645
646
647 /*******************************     dm.c         **************************/
648
649 extern int  CloseOnFork( void ) ;
650 extern void GettyMessage(
651                         struct display *d,
652                         int msgnum) ;
653 extern void RegisterCloseOnFork(
654                         int fd) ;
655 extern int  SetTitle(
656                         char *name,
657                         char *ptr) ;
658 extern int  StartDisplay(
659                         struct display *d) ;
660 extern void StartDisplays( void ) ;
661 extern void StopDisplay(
662                         struct display *d) ;
663 extern void WaitForChild( void ) ;
664 extern int  main(
665                         int argc,
666                         char **argv) ;
667 extern int  GettyRunning( struct display *d) ;
668
669
670 /*******************************     dpylist.c    **************************/
671
672 extern int  AnyDisplaysLeft( void ) ;
673
674 extern struct display * FindDisplayByAddress(
675                         struct sockaddr *addr,
676                         int addrlen,
677 #if NeedWidePrototypes
678                         int displayNumber) ;
679 #else
680                         CARD16 displayNumber) ;
681 #endif /* NeedWidePrototypes */
682
683 extern struct display * FindDisplayByName(
684                         char *name) ;
685 extern struct display * FindDisplayByPid(
686                         int pid) ;
687 extern struct display * FindDisplayByServerPid(
688                         int serverPid) ;
689 extern struct display * FindDisplayBySessionID(
690                         CARD32 sessionID) ;
691
692 extern void ForEachDisplay(
693                         void (*f)()) ;
694 extern struct display * NewDisplay(
695                         char *name,
696                         char *class) ;
697 extern void RemoveDisplay(
698                         struct display *old) ;
699
700
701 /*******************************     error.c      **************************/
702
703 extern void Debug(
704                         char *fmt, ...) ;
705 extern void InitErrorLog( void ) ;
706 extern void CheckErrorFile( void ) ;
707 extern void LogError(
708                         unsigned char *fmt, ...) ;
709 extern void LogInfo(
710                         unsigned char *fmt, ...) ;
711 extern void LogOutOfMem(
712                         unsigned char *fmt, ...) ;
713 extern void LogPanic(
714                         unsigned char *fmt, ...) ;
715 extern int  Panic(
716                         char *mesg ) ;
717 extern int  SyncErrorFile(
718                         int stamp ) ;
719 extern void TrimErrorFile( void ) ;
720
721
722 /*******************************     file.c       **************************/
723
724 extern int ParseDisplay( char *source,
725                          DisplayType *acceptableTypes,
726                          int numAcceptable,
727                          struct passwd *puser );
728
729
730 /*******************************     mitauth.c    **************************/
731
732 extern Xauth * MitGetAuth( 
733 #if NeedWidePrototypes
734                         unsigned int namelen,
735 #else
736                         unsigned short namelen,
737 #endif /* NeedWidePrototypes */
738                         char *name) ;
739
740 extern int MitInitAuth( 
741 #if NeedWidePrototypes
742                         unsigned int name_len,
743 #else
744                         unsigned short name_len,
745 #endif /* NeedWidePrototypes */
746                         char *name) ;
747
748
749 /*******************************     policy.c     **************************/
750
751 extern ARRAY8Ptr Accept(
752                         struct sockaddr *from,
753                         int fromlen,
754 #if NeedWidePrototypes
755                         int displayNumber) ;
756 #else
757                         CARD16 displayNumber) ;
758 #endif /* NeedWidePrototypes */
759
760 extern int CheckAuthentication(
761                         struct protoDisplay *pdpy,
762                         ARRAY8Ptr displayID,
763                         ARRAY8Ptr name,
764                         ARRAY8Ptr data) ;
765 extern ARRAY8Ptr ChooseAuthentication(
766                         ARRAYofARRAY8Ptr authenticationNames) ;
767 extern int SelectAuthorizationTypeIndex(
768                         ARRAY8Ptr authenticationName,
769                         ARRAYofARRAY8Ptr authorizationNames) ;
770 extern int SelectConnectionTypeIndex(
771                         ARRAY16Ptr connectionTypes,
772                         ARRAYofARRAY8Ptr connectionAddresses) ;
773
774 extern int Willing( 
775                         ARRAY8Ptr addr,
776 #if NeedWidePrototypes
777                         int connectionType,
778 #else
779                         CARD16 connectionType,
780 #endif /* NeedWidePrototypes */
781                         ARRAY8Ptr authenticationName,
782                         ARRAY8Ptr status,
783                         xdmOpCode type) ;
784 extern ARRAY8Ptr Accept( 
785                         struct sockaddr *from,
786                         int fromlen,
787 #if NeedWidePrototypes
788                         int displayNumber) ;
789 #else
790                         CARD16 displayNumber) ;
791 #endif /* NeedWidePrototypes */
792
793 /*******************************     protodpy.c   **************************/
794
795 extern int DisposeProtoDisplay(
796                         struct protoDisplay *pdpy) ;
797 extern void TimeoutProtoDisplays(
798                         long now) ;
799 extern int  addressEqual(
800                         XdmcpNetaddr a1,
801                         int          len1,
802                         XdmcpNetaddr a2,
803                         int          len2);
804 extern struct protoDisplay * FindProtoDisplay(
805                         struct sockaddr *address,
806                         int addrlen,
807 #if NeedWidePrototypes
808                         int displayNumber) ;
809 #else
810                         CARD16 displayNumber) ;
811 #endif /* NeedWidePrototypes */
812
813 extern struct protoDisplay * NewProtoDisplay(
814                         struct sockaddr *address,
815                         int addrlen,
816 #if NeedWidePrototypes
817                         int displayNumber,
818                         int connectionType,
819 #else
820                         CARD16 displayNumber,
821                         CARD16 connectionType,
822 #endif /* NeedWidePrototypes */
823                         ARRAY8Ptr connectionAddress,
824                         CARD32 sessionID) ;
825
826
827
828 /*******************************     reset.c      **************************/
829
830 extern void pseudoReset(
831                         Display *dpy) ;
832
833
834 /*******************************     resource.c   **************************/
835
836 extern int  GetResource(
837                         char *name,
838                         char *class,
839                         int valueType,
840                         char **valuep,
841                         char *default_value) ;
842 extern void InitResources(
843                         int argc,
844                         char **argv) ;
845 extern void ReinitResources( void ) ;
846 extern void LoadDMResources( void ) ;
847 extern void LoadDisplayResources(
848                         struct display *d) ;
849 extern void SetAppName( void ) ;
850
851
852 /*******************************     server.c     **************************/
853
854 extern int  LogOpenError(
855                         int  count) ;
856 extern int  PingServer(
857                         struct display *d,
858                         Display *alternateDpy) ;
859 extern void ResetServer(
860                         struct display *d) ;
861 extern int  StartServer(
862                         struct display *d) ;
863 extern int  StartServerOnce(
864                         struct display *d) ;
865 extern int  WaitForServer(
866                         struct display *d) ;
867
868
869 /*******************************     session.c    **************************/
870
871 extern void ManageSession(
872                         struct display *d) ;
873 extern int  execute(
874                         char **argv,
875                         char **environ) ;
876 extern int  source(
877                         struct verify_info *verify,
878                         char *file) ;
879
880
881
882 /*******************************     socket.c     **************************/
883
884 extern int  AnyWellKnownSockets( void ) ;
885 extern int  CreateWellKnownSockets( void ) ;
886 extern void DestroyWellKnownSockets( void ) ;
887 extern char * NetworkAddressToHostname( 
888 #if NeedWidePrototypes
889                         int connectionType,
890 #else
891                         CARD16 connectionType,
892 #endif /* NeedWidePrototypes */
893                         ARRAY8Ptr connectionAddress) ;
894 extern char * localHostname( void ) ;
895 extern char * NetworkAddressToName( 
896 #if NeedWidePrototypes
897                         int connectionType,
898 #else
899                         CARD16 connectionType,
900 #endif /* NeedWidePrototypes */
901                         ARRAY8Ptr connectionAddress,
902 #if NeedWidePrototypes
903                         int displayNumber) ;
904 #else
905                         CARD16 displayNumber) ;
906 #endif /* NeedWidePrototypes */
907 extern void SendFailed( 
908                         struct display *d,
909                         char *reason) ;
910 extern void WaitForSomething( void ) ;
911
912 extern char * localHostname( void ) ;
913
914
915
916 /*******************************     util.c       **************************/
917
918 extern void CleanUpChild( void ) ;
919 extern Cursor GetHourGlass(
920                         Display *dpy) ;
921 #if !defined (ENABLE_DYNAMIC_LANGLIST)
922 extern void MakeLangList( void ) ;
923 #endif
924 extern void SetHourGlassCursor(
925                         Display *dpy,
926                         Window w) ;
927 extern char * getEnv(
928                         char **e,
929                         char *name) ;
930 extern char ** parseArgs(
931                         char **argv,
932                         char *string) ;
933 extern char ** parseEnv(
934                         char **e,
935                         char *string) ;
936 extern void printEnv(
937                         char **e) ;
938 extern char ** setEnv(
939                         char **e,
940                         char *name,
941                         char *value) ;
942 extern unsigned char * ReadCatalog(
943                         int  set_num,
944                         int  msg_num,
945                         char *def_str) ;
946 extern char ** setLang(
947                         struct display *d, 
948                         char **env , 
949                         char *langptr);
950
951 /*******************************     verify.c     **************************/
952
953 extern void getGroups( 
954                         char *name,
955                         struct verify_info *verify,
956                         int gid) ;
957 extern int groupMember( 
958                         char *name,
959                         char **members) ;
960 extern char ** setDt( 
961                         struct display *d,
962                         char **argv,
963                         int dt_type) ;
964 extern char ** systemEnv( 
965                         struct display *d,
966                         char *user,
967                         char *home) ;
968 extern char ** userEnv( 
969                         struct display *d,
970                         char *user,
971                         char *home,
972                         char *shell,
973                         struct passwd   *p) ;
974 extern int Verify( 
975                         struct display *d,
976                         struct greet_info *greet,
977                         struct verify_info *verify) ;
978
979  
980 extern  char *  login_defaults(struct passwd *p,
981                         struct display *d);
982
983  
984  
985  
986
987
988
989 /*******************************     version.c    **************************/
990 /*******************************     xdmauth.c    **************************/
991 #ifdef HASXDMAUTH
992 extern void XdmInitAuth( 
993 #if NeedWidePrototypes
994                         unsigned int name_len,
995 #else
996                         unsigned short name_len,
997 #endif /* NeedWidePrototypes */
998                         char *name) ;
999
1000 extern Xauth * XdmGetAuth( 
1001 #if NeedWidePrototypes
1002                         unsigned int namelen,
1003 #else
1004                         unsigned short namelen,
1005 #endif /* NeedWidePrototypes */
1006                         char *name) ;
1007
1008 extern void XdmGetXdmcpAuth(
1009                         struct protoDisplay *pdpy,
1010 #if NeedWidePrototypes
1011                         unsigned int authorizationNameLen,
1012 #else
1013                         unsigned short authorizationNameLen,
1014 #endif /* NeedWidePrototypes */
1015                         char *authorizationName) ;
1016
1017 extern int XdmGetKey( 
1018                         struct protoDisplay *pdpy,
1019                         ARRAY8Ptr displayID) ;
1020
1021 extern int XdmCheckAuthentication( 
1022                         struct protoDisplay *pdpy,
1023                         ARRAY8Ptr displayID,
1024                         ARRAY8Ptr authenticationName,
1025                         ARRAY8Ptr authenticationData) ;
1026
1027
1028 #endif /* HASXDMAUTH */
1029
1030
1031 #endif /* _DM_H */