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