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