remove OSF1 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)
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
512 #if !defined (ENABLE_DYNAMIC_LANGLIST)
513 extern char     languageList[];         /* util.c                          */
514 #endif /* ENABLE_DYNAMIC_LANGLIST */
515
516 extern char     **exportList;  /* list of export env vars  RK    08.17.93 */
517
518
519
520
521 /****************************************************************************
522  *
523  *  Public procedure declarations
524  *
525  ****************************************************************************/
526
527 /*******************************     access.c    **************************/
528
529 extern int  AcceptableDisplayAddress( 
530                         ARRAY8Ptr clientAddress,
531 #if NeedWidePrototypes
532                         int connectionType,
533 #else
534                         CARD16 connectionType,
535 #endif /* NeedWidePrototypes */
536                         xdmOpCode type) ;
537
538 extern void ForEachChooserHost( 
539                         ARRAY8Ptr clientAddress,
540 #if NeedWidePrototypes
541                         int connectionType,
542 #else
543                         CARD16 connectionType,
544 #endif /* NeedWidePrototypes */
545                         int (*function)(),
546                         char *closure) ;
547 extern int  ForEachMatchingIndirectHost( 
548                         ARRAY8Ptr clientAddress,
549 #if NeedWidePrototypes
550                         int connectionType,
551 #else
552                         CARD16 connectionType,
553 #endif /* NeedWidePrototypes */
554                         int (*function)(CARD16,  struct _ARRAY8 *, char *),
555                         char *closure) ;
556 extern int  ScanAccessDatabase( void ) ;
557 extern int  UseChooser( 
558                         ARRAY8Ptr clientAddress,
559 #if NeedWidePrototypes
560                         int connectionType) ;
561 #else
562                         CARD16 connectionType) ;
563 #endif /* NeedWidePrototypes */
564 extern ARRAY8Ptr getLocalAddress( void ) ;
565
566
567 /*******************************     account.c    **************************/
568
569 extern void Account( 
570                         struct display *d, 
571                         char *user, 
572                         char *line, 
573                         pid_t pid,
574 #if NeedWidePrototypes
575                         int type,
576 #else
577                         short type,
578 #endif /* NeedWidePrototypes */
579                         waitType exitcode) ;
580
581 extern int  UtmpIdOpen( 
582                         char *utmpId) ;
583
584
585 /*******************************     apollo.c     **************************/
586
587 extern int  DoLogin(
588                         char *user, 
589                         char *passwd, 
590                         char *host) ;
591
592
593 /*******************************     auth.c       **************************/
594
595 extern int  ConvertAddr(
596                         XdmcpNetaddr saddr,
597                         int *len,                   /* return */
598                         char **addr);               /* return */
599
600 extern int  ConvertFamily(
601                         int sockfamily);
602
603 extern int  SaveServerAuthorizations(
604                         struct display *d, 
605                         Xauth **auth,
606                         int count) ;
607 extern void SetAuthorization( 
608                         struct display *d) ;
609 extern void SetLocalAuthorization( 
610                         struct display *d) ;
611 extern void SetProtoDisplayAuthorization( 
612                         struct protoDisplay *pdpy,
613 #if NeedWidePrototypes
614                         unsigned int authorizationNameLen,
615 #else
616                         unsigned short authorizationNameLen,
617 #endif /* NeedWidePrototypes */
618                         char *authorizationName) ;
619 extern void SetUserAuthorization( 
620                         struct display *d, 
621                         struct verify_info *verify) ;
622 extern int  ValidAuthorization( 
623 #if NeedWidePrototypes
624                         unsigned int name_length,
625 #else
626                         unsigned short name_length,
627 #endif /* NeedWidePrototypes */
628                         char *name) ;
629
630
631 /*******************************     cryptokey.c  **************************/
632
633 extern void GenerateCryptoKey(
634                         char *auth,
635                         int len) ;
636 extern int  InitCryptoKey( void ) ;
637
638
639 /*******************************     daemon.c     **************************/
640
641 extern void BecomeDaemon( void ) ;
642
643
644 /*******************************     dm.c         **************************/
645
646 extern int  CloseOnFork( void ) ;
647 extern void GettyMessage(
648                         struct display *d,
649                         int msgnum) ;
650 extern void RegisterCloseOnFork(
651                         int fd) ;
652 extern int  SetTitle(
653                         char *name,
654                         char *ptr) ;
655 extern int  StartDisplay(
656                         struct display *d) ;
657 extern void StartDisplays( void ) ;
658 extern void StopDisplay(
659                         struct display *d) ;
660 extern void WaitForChild( void ) ;
661 extern int  main(
662                         int argc,
663                         char **argv) ;
664 extern int  GettyRunning( struct display *d) ;
665
666
667 /*******************************     dpylist.c    **************************/
668
669 extern int  AnyDisplaysLeft( void ) ;
670
671 extern struct display * FindDisplayByAddress(
672                         struct sockaddr *addr,
673                         int addrlen,
674 #if NeedWidePrototypes
675                         int displayNumber) ;
676 #else
677                         CARD16 displayNumber) ;
678 #endif /* NeedWidePrototypes */
679
680 extern struct display * FindDisplayByName(
681                         char *name) ;
682 extern struct display * FindDisplayByPid(
683                         int pid) ;
684 extern struct display * FindDisplayByServerPid(
685                         int serverPid) ;
686 extern struct display * FindDisplayBySessionID(
687                         CARD32 sessionID) ;
688
689 extern void ForEachDisplay(
690                         void (*f)()) ;
691 extern struct display * NewDisplay(
692                         char *name,
693                         char *class) ;
694 extern void RemoveDisplay(
695                         struct display *old) ;
696
697
698 /*******************************     error.c      **************************/
699
700 extern void Debug(
701                         char *fmt, ...) ;
702 extern void InitErrorLog( void ) ;
703 extern void CheckErrorFile( void ) ;
704 extern void LogError(
705                         unsigned char *fmt, ...) ;
706 extern void LogInfo(
707                         unsigned char *fmt, ...) ;
708 extern void LogOutOfMem(
709                         unsigned char *fmt, ...) ;
710 extern void LogPanic(
711                         unsigned char *fmt, ...) ;
712 extern int  Panic(
713                         char *mesg ) ;
714 extern int  SyncErrorFile(
715                         int stamp ) ;
716 extern void TrimErrorFile( void ) ;
717
718
719 /*******************************     file.c       **************************/
720
721 extern int ParseDisplay( char *source,
722                          DisplayType *acceptableTypes,
723                          int numAcceptable,
724                          struct passwd *puser );
725
726
727 /*******************************     mitauth.c    **************************/
728
729 extern Xauth * MitGetAuth( 
730 #if NeedWidePrototypes
731                         unsigned int namelen,
732 #else
733                         unsigned short namelen,
734 #endif /* NeedWidePrototypes */
735                         char *name) ;
736
737 extern int MitInitAuth( 
738 #if NeedWidePrototypes
739                         unsigned int name_len,
740 #else
741                         unsigned short name_len,
742 #endif /* NeedWidePrototypes */
743                         char *name) ;
744
745
746 /*******************************     policy.c     **************************/
747
748 extern ARRAY8Ptr Accept(
749                         struct sockaddr *from,
750                         int fromlen,
751 #if NeedWidePrototypes
752                         int displayNumber) ;
753 #else
754                         CARD16 displayNumber) ;
755 #endif /* NeedWidePrototypes */
756
757 extern int CheckAuthentication(
758                         struct protoDisplay *pdpy,
759                         ARRAY8Ptr displayID,
760                         ARRAY8Ptr name,
761                         ARRAY8Ptr data) ;
762 extern ARRAY8Ptr ChooseAuthentication(
763                         ARRAYofARRAY8Ptr authenticationNames) ;
764 extern int SelectAuthorizationTypeIndex(
765                         ARRAY8Ptr authenticationName,
766                         ARRAYofARRAY8Ptr authorizationNames) ;
767 extern int SelectConnectionTypeIndex(
768                         ARRAY16Ptr connectionTypes,
769                         ARRAYofARRAY8Ptr connectionAddresses) ;
770
771 extern int Willing( 
772                         ARRAY8Ptr addr,
773 #if NeedWidePrototypes
774                         int connectionType,
775 #else
776                         CARD16 connectionType,
777 #endif /* NeedWidePrototypes */
778                         ARRAY8Ptr authenticationName,
779                         ARRAY8Ptr status,
780                         xdmOpCode type) ;
781 extern ARRAY8Ptr Accept( 
782                         struct sockaddr *from,
783                         int fromlen,
784 #if NeedWidePrototypes
785                         int displayNumber) ;
786 #else
787                         CARD16 displayNumber) ;
788 #endif /* NeedWidePrototypes */
789
790 /*******************************     protodpy.c   **************************/
791
792 extern int DisposeProtoDisplay(
793                         struct protoDisplay *pdpy) ;
794 extern void TimeoutProtoDisplays(
795                         long now) ;
796 extern int  addressEqual(
797                         XdmcpNetaddr a1,
798                         int          len1,
799                         XdmcpNetaddr a2,
800                         int          len2);
801 extern struct protoDisplay * FindProtoDisplay(
802                         struct sockaddr *address,
803                         int addrlen,
804 #if NeedWidePrototypes
805                         int displayNumber) ;
806 #else
807                         CARD16 displayNumber) ;
808 #endif /* NeedWidePrototypes */
809
810 extern struct protoDisplay * NewProtoDisplay(
811                         struct sockaddr *address,
812                         int addrlen,
813 #if NeedWidePrototypes
814                         int displayNumber,
815                         int connectionType,
816 #else
817                         CARD16 displayNumber,
818                         CARD16 connectionType,
819 #endif /* NeedWidePrototypes */
820                         ARRAY8Ptr connectionAddress,
821                         CARD32 sessionID) ;
822
823
824
825 /*******************************     reset.c      **************************/
826
827 extern void pseudoReset(
828                         Display *dpy) ;
829
830
831 /*******************************     resource.c   **************************/
832
833 extern int  GetResource(
834                         char *name,
835                         char *class,
836                         int valueType,
837                         char **valuep,
838                         char *default_value) ;
839 extern void InitResources(
840                         int argc,
841                         char **argv) ;
842 extern void ReinitResources( void ) ;
843 extern void LoadDMResources( void ) ;
844 extern void LoadDisplayResources(
845                         struct display *d) ;
846 extern void SetAppName( void ) ;
847
848
849 /*******************************     server.c     **************************/
850
851 extern int  LogOpenError(
852                         int  count) ;
853 extern int  PingServer(
854                         struct display *d,
855                         Display *alternateDpy) ;
856 extern void ResetServer(
857                         struct display *d) ;
858 extern int  StartServer(
859                         struct display *d) ;
860 extern int  StartServerOnce(
861                         struct display *d) ;
862 extern int  WaitForServer(
863                         struct display *d) ;
864
865
866 /*******************************     session.c    **************************/
867
868 extern void ManageSession(
869                         struct display *d) ;
870 extern int  execute(
871                         char **argv,
872                         char **environ) ;
873 extern int  source(
874                         struct verify_info *verify,
875                         char *file) ;
876
877
878
879 /*******************************     socket.c     **************************/
880
881 extern int  AnyWellKnownSockets( void ) ;
882 extern int  CreateWellKnownSockets( void ) ;
883 extern void DestroyWellKnownSockets( void ) ;
884 extern char * NetworkAddressToHostname( 
885 #if NeedWidePrototypes
886                         int connectionType,
887 #else
888                         CARD16 connectionType,
889 #endif /* NeedWidePrototypes */
890                         ARRAY8Ptr connectionAddress) ;
891 extern char * localHostname( void ) ;
892 extern char * NetworkAddressToName( 
893 #if NeedWidePrototypes
894                         int connectionType,
895 #else
896                         CARD16 connectionType,
897 #endif /* NeedWidePrototypes */
898                         ARRAY8Ptr connectionAddress,
899 #if NeedWidePrototypes
900                         int displayNumber) ;
901 #else
902                         CARD16 displayNumber) ;
903 #endif /* NeedWidePrototypes */
904 extern void SendFailed( 
905                         struct display *d,
906                         char *reason) ;
907 extern void WaitForSomething( void ) ;
908
909 extern char * localHostname( void ) ;
910
911
912
913 /*******************************     util.c       **************************/
914
915 extern void CleanUpChild( void ) ;
916 extern Cursor GetHourGlass(
917                         Display *dpy) ;
918 #if !defined (ENABLE_DYNAMIC_LANGLIST)
919 extern void MakeLangList( void ) ;
920 #endif
921 extern void SetHourGlassCursor(
922                         Display *dpy,
923                         Window w) ;
924 extern char * getEnv(
925                         char **e,
926                         char *name) ;
927 extern char ** parseArgs(
928                         char **argv,
929                         char *string) ;
930 extern char ** parseEnv(
931                         char **e,
932                         char *string) ;
933 extern void printEnv(
934                         char **e) ;
935 extern char ** setEnv(
936                         char **e,
937                         char *name,
938                         char *value) ;
939 extern unsigned char * ReadCatalog(
940                         int  set_num,
941                         int  msg_num,
942                         char *def_str) ;
943 extern char ** setLang(
944                         struct display *d, 
945                         char **env , 
946                         char *langptr);
947
948 /*******************************     verify.c     **************************/
949
950 extern void getGroups( 
951                         char *name,
952                         struct verify_info *verify,
953                         int gid) ;
954 extern int groupMember( 
955                         char *name,
956                         char **members) ;
957 extern char ** setDt( 
958                         struct display *d,
959                         char **argv,
960                         int dt_type) ;
961 extern char ** systemEnv( 
962                         struct display *d,
963                         char *user,
964                         char *home) ;
965 extern char ** userEnv( 
966                         struct display *d,
967                         char *user,
968                         char *home,
969                         char *shell,
970                         struct passwd   *p) ;
971 extern int Verify( 
972                         struct display *d,
973                         struct greet_info *greet,
974                         struct verify_info *verify) ;
975
976  
977 extern  char *  login_defaults(struct passwd *p,
978                         struct display *d);
979
980  
981  
982  
983
984
985
986 /*******************************     version.c    **************************/
987 /*******************************     xdmauth.c    **************************/
988 #ifdef HASXDMAUTH
989 extern void XdmInitAuth( 
990 #if NeedWidePrototypes
991                         unsigned int name_len,
992 #else
993                         unsigned short name_len,
994 #endif /* NeedWidePrototypes */
995                         char *name) ;
996
997 extern Xauth * XdmGetAuth( 
998 #if NeedWidePrototypes
999                         unsigned int namelen,
1000 #else
1001                         unsigned short namelen,
1002 #endif /* NeedWidePrototypes */
1003                         char *name) ;
1004
1005 extern void XdmGetXdmcpAuth(
1006                         struct protoDisplay *pdpy,
1007 #if NeedWidePrototypes
1008                         unsigned int authorizationNameLen,
1009 #else
1010                         unsigned short authorizationNameLen,
1011 #endif /* NeedWidePrototypes */
1012                         char *authorizationName) ;
1013
1014 extern int XdmGetKey( 
1015                         struct protoDisplay *pdpy,
1016                         ARRAY8Ptr displayID) ;
1017
1018 extern int XdmCheckAuthentication( 
1019                         struct protoDisplay *pdpy,
1020                         ARRAY8Ptr displayID,
1021                         ARRAY8Ptr authenticationName,
1022                         ARRAY8Ptr authenticationData) ;
1023
1024
1025 #endif /* HASXDMAUTH */
1026
1027
1028 #endif /* _DM_H */