Remove UXPDS support
[oweals/cde.git] / cde / programs / dtlogin / dm.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* (c) Copyright 1997 The Open Group */
24 /*                                                                      *
25  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
26  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
27  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
28  * (c) Copyright 1993, 1994 Novell, Inc.                                *
29  */
30 /*
31  * xdm - display manager daemon
32  *
33  * $TOG: dm.h /main/12 1998/04/06 13:21:59 mgreess $
34  *
35  * Copyright 1988 Massachusetts Institute of Technology
36  *
37  * Permission to use, copy, modify, and distribute this software and its
38  * documentation for any purpose and without fee is hereby granted, provided
39  * that the above copyright notice appear in all copies and that both that
40  * copyright notice and this permission notice appear in supporting
41  * documentation, and that the name of M.I.T. not be used in advertising or
42  * publicity pertaining to distribution of the software without specific,
43  * written prior permission.  M.I.T. makes no representations about the
44  * suitability of this software for any purpose.  It is provided "as is"
45  * without express or implied warranty.
46  *
47  * Author:  Keith Packard, MIT X Consortium
48  */
49
50 /*
51  * dm.h
52  *
53  * public interfaces for greet/verify functionality
54  */
55
56
57 #ifndef _DM_H
58 #define _DM_H
59
60
61 /***************************************************************************
62  *
63  *  Includes
64  *
65  ***************************************************************************/
66
67 # include       <errno.h>               /* for errno                       */
68 # include       <pwd.h>                 /* for passwd structure            */
69 # include       <stdio.h>
70 # include       <stdlib.h>              /* for exit(), malloc(), abort()   */
71 # include       <string.h>              /* for string functions, bcopy(),
72                                            sys_errlist                     */
73 # include       <sys/param.h>           /* for NGROUPS                     */
74 # include       <sys/types.h>           /* for fd_set                      */
75 # include       <netinet/in.h>          /* for Internet socket stuff       */
76
77 #ifdef _BSD
78 # include       <strings.h>             /* for BSD string functions        */
79 #endif
80
81 # include       <X11/Xlib.h>
82 # include       <X11/Xos.h>
83 # include       <X11/Xmd.h>
84 # include       <X11/Xauth.h>
85 # include       <X11/Xdmcp.h>
86 #ifdef SVR4 /*** needed for bcopy bcmp ***/
87 #include    <X11/Xlibint.h>
88 #endif      /* SVR4 */
89
90 # include <X11/Xresource.h>
91
92 #ifndef LAST_SESSION_FILE
93 #define LAST_SESSION_FILE "/.dt/sessions/lastsession"
94 #endif
95
96 #ifndef CDE_INSTALLATION_TOP
97 #define CDE_INSTALLATION_TOP "/opt/dt"
98 #endif
99
100 #define DEF_PATH        "/usr/bin:"     /* same as PATH */
101 #define DEF_SUPATH      "/usr/sbin:/usr/bin" /* same as ROOTPATH */
102
103 #define LANGLISTSIZE    2048
104 #define DELIM           " \t"   /* delimiters in language list             */
105
106
107 /***************************************************************************
108  *
109  *  Defines
110  *
111  ***************************************************************************/
112
113 /*
114  * Default directories containing locale information.
115  */
116 #if defined(_AIX) || defined (__osf__)
117   #define DEF_NLS_DIR   "/usr/lib/nls/loc"
118 #elif defined(hpV4)
119   #define DEF_NLS_DIR   "/usr/lib/nls/msg"
120 #elif 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(CSRG_BASED)
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 int      quiet;
499 extern char     *pidFile;
500 extern int      lockPidFile;
501 extern char     *authDir;
502 extern int      autoRescan;
503 extern int      removeDomainname;
504 extern char     *keyFile;
505 extern char     *timeZone;
506 extern int      wakeupInterval;
507 extern char     *fpHead;
508 extern char     *fpTail;
509 extern int      langListTimeout;
510 #ifdef DEF_NETWORK_DEV
511 extern char     *networkDev;
512 #endif
513 #if defined(__osf__)
514 extern char     *ignoreLocales;
515 #endif
516
517 #if !defined (ENABLE_DYNAMIC_LANGLIST)
518 extern char     languageList[];         /* util.c                          */
519 #endif /* ENABLE_DYNAMIC_LANGLIST */
520
521 extern char     **exportList;  /* list of export env vars  RK    08.17.93 */
522
523
524
525
526 /****************************************************************************
527  *
528  *  Public procedure declarations
529  *
530  ****************************************************************************/
531
532 /*******************************     access.c    **************************/
533
534 extern int  AcceptableDisplayAddress( 
535                         ARRAY8Ptr clientAddress,
536 #if NeedWidePrototypes
537                         int connectionType,
538 #else
539                         CARD16 connectionType,
540 #endif /* NeedWidePrototypes */
541                         xdmOpCode type) ;
542
543 extern void ForEachChooserHost( 
544                         ARRAY8Ptr clientAddress,
545 #if NeedWidePrototypes
546                         int connectionType,
547 #else
548                         CARD16 connectionType,
549 #endif /* NeedWidePrototypes */
550                         int (*function)(),
551                         char *closure) ;
552 extern int  ForEachMatchingIndirectHost( 
553                         ARRAY8Ptr clientAddress,
554 #if NeedWidePrototypes
555                         int connectionType,
556 #else
557                         CARD16 connectionType,
558 #endif /* NeedWidePrototypes */
559                         int (*function)(CARD16,  struct _ARRAY8 *, char *),
560                         char *closure) ;
561 extern int  ScanAccessDatabase( void ) ;
562 extern int  UseChooser( 
563                         ARRAY8Ptr clientAddress,
564 #if NeedWidePrototypes
565                         int connectionType) ;
566 #else
567                         CARD16 connectionType) ;
568 #endif /* NeedWidePrototypes */
569 extern ARRAY8Ptr getLocalAddress( void ) ;
570
571
572 /*******************************     account.c    **************************/
573
574 extern void Account( 
575                         struct display *d, 
576                         char *user, 
577                         char *line, 
578                         pid_t pid,
579 #if NeedWidePrototypes
580                         int type,
581 #else
582                         short type,
583 #endif /* NeedWidePrototypes */
584                         waitType exitcode) ;
585
586 extern int  UtmpIdOpen( 
587                         char *utmpId) ;
588
589
590 /*******************************     apollo.c     **************************/
591
592 extern int  DoLogin(
593                         char *user, 
594                         char *passwd, 
595                         char *host) ;
596
597
598 /*******************************     auth.c       **************************/
599
600 extern int  ConvertAddr(
601                         XdmcpNetaddr saddr,
602                         int *len,                   /* return */
603                         char **addr);               /* return */
604
605 extern int  ConvertFamily(
606                         int sockfamily);
607
608 extern int  SaveServerAuthorizations(
609                         struct display *d, 
610                         Xauth **auth,
611                         int count) ;
612 extern void SetAuthorization( 
613                         struct display *d) ;
614 extern void SetLocalAuthorization( 
615                         struct display *d) ;
616 extern void SetProtoDisplayAuthorization( 
617                         struct protoDisplay *pdpy,
618 #if NeedWidePrototypes
619                         unsigned int authorizationNameLen,
620 #else
621                         unsigned short authorizationNameLen,
622 #endif /* NeedWidePrototypes */
623                         char *authorizationName) ;
624 extern void SetUserAuthorization( 
625                         struct display *d, 
626                         struct verify_info *verify) ;
627 extern int  ValidAuthorization( 
628 #if NeedWidePrototypes
629                         unsigned int name_length,
630 #else
631                         unsigned short name_length,
632 #endif /* NeedWidePrototypes */
633                         char *name) ;
634
635
636 /*******************************     cryptokey.c  **************************/
637
638 extern void GenerateCryptoKey(
639                         char *auth,
640                         int len) ;
641 extern int  InitCryptoKey( void ) ;
642
643
644 /*******************************     daemon.c     **************************/
645
646 extern void BecomeDaemon( void ) ;
647
648
649 /*******************************     dm.c         **************************/
650
651 extern int  CloseOnFork( void ) ;
652 extern void GettyMessage(
653                         struct display *d,
654                         int msgnum) ;
655 extern void RegisterCloseOnFork(
656                         int fd) ;
657 extern int  SetTitle(
658                         char *name,
659                         char *ptr) ;
660 extern int  StartDisplay(
661                         struct display *d) ;
662 extern void StartDisplays( void ) ;
663 extern void StopDisplay(
664                         struct display *d) ;
665 extern void WaitForChild( void ) ;
666 extern int  main(
667                         int argc,
668                         char **argv) ;
669 extern int  GettyRunning( struct display *d) ;
670
671
672 /*******************************     dpylist.c    **************************/
673
674 extern int  AnyDisplaysLeft( void ) ;
675
676 extern struct display * FindDisplayByAddress(
677                         struct sockaddr *addr,
678                         int addrlen,
679 #if NeedWidePrototypes
680                         int displayNumber) ;
681 #else
682                         CARD16 displayNumber) ;
683 #endif /* NeedWidePrototypes */
684
685 extern struct display * FindDisplayByName(
686                         char *name) ;
687 extern struct display * FindDisplayByPid(
688                         int pid) ;
689 extern struct display * FindDisplayByServerPid(
690                         int serverPid) ;
691 extern struct display * FindDisplayBySessionID(
692                         CARD32 sessionID) ;
693
694 extern void ForEachDisplay(
695                         void (*f)()) ;
696 extern struct display * NewDisplay(
697                         char *name,
698                         char *class) ;
699 extern void RemoveDisplay(
700                         struct display *old) ;
701
702
703 /*******************************     error.c      **************************/
704
705 extern void Debug(
706                         char *fmt, ...) ;
707 extern void InitErrorLog( void ) ;
708 extern void CheckErrorFile( void ) ;
709 extern void LogError(
710                         unsigned char *fmt, ...) ;
711 extern void LogInfo(
712                         unsigned char *fmt, ...) ;
713 extern void LogOutOfMem(
714                         unsigned char *fmt, ...) ;
715 extern void LogPanic(
716                         unsigned char *fmt, ...) ;
717 extern int  Panic(
718                         char *mesg ) ;
719 extern int  SyncErrorFile(
720                         int stamp ) ;
721 extern void TrimErrorFile( void ) ;
722
723
724 /*******************************     file.c       **************************/
725
726 extern int ParseDisplay( char *source,
727                          DisplayType *acceptableTypes,
728                          int numAcceptable,
729                          struct passwd *puser );
730
731
732 /*******************************     mitauth.c    **************************/
733
734 extern Xauth * MitGetAuth( 
735 #if NeedWidePrototypes
736                         unsigned int namelen,
737 #else
738                         unsigned short namelen,
739 #endif /* NeedWidePrototypes */
740                         char *name) ;
741
742 extern int MitInitAuth( 
743 #if NeedWidePrototypes
744                         unsigned int name_len,
745 #else
746                         unsigned short name_len,
747 #endif /* NeedWidePrototypes */
748                         char *name) ;
749
750
751 /*******************************     policy.c     **************************/
752
753 extern ARRAY8Ptr Accept(
754                         struct sockaddr *from,
755                         int fromlen,
756 #if NeedWidePrototypes
757                         int displayNumber) ;
758 #else
759                         CARD16 displayNumber) ;
760 #endif /* NeedWidePrototypes */
761
762 extern int CheckAuthentication(
763                         struct protoDisplay *pdpy,
764                         ARRAY8Ptr displayID,
765                         ARRAY8Ptr name,
766                         ARRAY8Ptr data) ;
767 extern ARRAY8Ptr ChooseAuthentication(
768                         ARRAYofARRAY8Ptr authenticationNames) ;
769 extern int SelectAuthorizationTypeIndex(
770                         ARRAY8Ptr authenticationName,
771                         ARRAYofARRAY8Ptr authorizationNames) ;
772 extern int SelectConnectionTypeIndex(
773                         ARRAY16Ptr connectionTypes,
774                         ARRAYofARRAY8Ptr connectionAddresses) ;
775
776 extern int Willing( 
777                         ARRAY8Ptr addr,
778 #if NeedWidePrototypes
779                         int connectionType,
780 #else
781                         CARD16 connectionType,
782 #endif /* NeedWidePrototypes */
783                         ARRAY8Ptr authenticationName,
784                         ARRAY8Ptr status,
785                         xdmOpCode type) ;
786 extern ARRAY8Ptr Accept( 
787                         struct sockaddr *from,
788                         int fromlen,
789 #if NeedWidePrototypes
790                         int displayNumber) ;
791 #else
792                         CARD16 displayNumber) ;
793 #endif /* NeedWidePrototypes */
794
795 /*******************************     protodpy.c   **************************/
796
797 extern int DisposeProtoDisplay(
798                         struct protoDisplay *pdpy) ;
799 extern void TimeoutProtoDisplays(
800                         long now) ;
801 extern int  addressEqual(
802                         XdmcpNetaddr a1,
803                         int          len1,
804                         XdmcpNetaddr a2,
805                         int          len2);
806 extern struct protoDisplay * FindProtoDisplay(
807                         struct sockaddr *address,
808                         int addrlen,
809 #if NeedWidePrototypes
810                         int displayNumber) ;
811 #else
812                         CARD16 displayNumber) ;
813 #endif /* NeedWidePrototypes */
814
815 extern struct protoDisplay * NewProtoDisplay(
816                         struct sockaddr *address,
817                         int addrlen,
818 #if NeedWidePrototypes
819                         int displayNumber,
820                         int connectionType,
821 #else
822                         CARD16 displayNumber,
823                         CARD16 connectionType,
824 #endif /* NeedWidePrototypes */
825                         ARRAY8Ptr connectionAddress,
826                         CARD32 sessionID) ;
827
828
829
830 /*******************************     reset.c      **************************/
831
832 extern void pseudoReset(
833                         Display *dpy) ;
834
835
836 /*******************************     resource.c   **************************/
837
838 extern int  GetResource(
839                         char *name,
840                         char *class,
841                         int valueType,
842                         char **valuep,
843                         char *default_value) ;
844 extern void InitResources(
845                         int argc,
846                         char **argv) ;
847 extern void ReinitResources( void ) ;
848 extern void LoadDMResources( void ) ;
849 extern void LoadDisplayResources(
850                         struct display *d) ;
851 extern void SetAppName( void ) ;
852
853
854 /*******************************     server.c     **************************/
855
856 extern int  LogOpenError(
857                         int  count) ;
858 extern int  PingServer(
859                         struct display *d,
860                         Display *alternateDpy) ;
861 extern void ResetServer(
862                         struct display *d) ;
863 extern int  StartServer(
864                         struct display *d) ;
865 extern int  StartServerOnce(
866                         struct display *d) ;
867 extern int  WaitForServer(
868                         struct display *d) ;
869
870
871 /*******************************     session.c    **************************/
872
873 extern void ManageSession(
874                         struct display *d) ;
875 extern int  execute(
876                         char **argv,
877                         char **environ) ;
878 extern int  source(
879                         struct verify_info *verify,
880                         char *file) ;
881
882
883
884 /*******************************     socket.c     **************************/
885
886 extern int  AnyWellKnownSockets( void ) ;
887 extern int  CreateWellKnownSockets( void ) ;
888 extern void DestroyWellKnownSockets( void ) ;
889 extern char * NetworkAddressToHostname( 
890 #if NeedWidePrototypes
891                         int connectionType,
892 #else
893                         CARD16 connectionType,
894 #endif /* NeedWidePrototypes */
895                         ARRAY8Ptr connectionAddress) ;
896 extern char * localHostname( void ) ;
897 extern char * NetworkAddressToName( 
898 #if NeedWidePrototypes
899                         int connectionType,
900 #else
901                         CARD16 connectionType,
902 #endif /* NeedWidePrototypes */
903                         ARRAY8Ptr connectionAddress,
904 #if NeedWidePrototypes
905                         int displayNumber) ;
906 #else
907                         CARD16 displayNumber) ;
908 #endif /* NeedWidePrototypes */
909 extern void SendFailed( 
910                         struct display *d,
911                         char *reason) ;
912 extern void WaitForSomething( void ) ;
913
914 extern char * localHostname( void ) ;
915
916
917
918 /*******************************     util.c       **************************/
919
920 extern void CleanUpChild( void ) ;
921 extern Cursor GetHourGlass(
922                         Display *dpy) ;
923 #if !defined (ENABLE_DYNAMIC_LANGLIST)
924 extern void MakeLangList( void ) ;
925 #endif
926 extern void SetHourGlassCursor(
927                         Display *dpy,
928                         Window w) ;
929 extern char * getEnv(
930                         char **e,
931                         char *name) ;
932 extern char ** parseArgs(
933                         char **argv,
934                         char *string) ;
935 extern char ** parseEnv(
936                         char **e,
937                         char *string) ;
938 extern void printEnv(
939                         char **e) ;
940 extern char ** setEnv(
941                         char **e,
942                         char *name,
943                         char *value) ;
944 extern unsigned char * ReadCatalog(
945                         int  set_num,
946                         int  msg_num,
947                         char *def_str) ;
948 extern char ** setLang(
949                         struct display *d, 
950                         char **env , 
951                         char *langptr);
952
953 /*******************************     verify.c     **************************/
954
955 extern void getGroups( 
956                         char *name,
957                         struct verify_info *verify,
958                         int gid) ;
959 extern int groupMember( 
960                         char *name,
961                         char **members) ;
962 extern char ** setDt( 
963                         struct display *d,
964                         char **argv,
965                         int dt_type) ;
966 extern char ** systemEnv( 
967                         struct display *d,
968                         char *user,
969                         char *home) ;
970 extern char ** userEnv( 
971                         struct display *d,
972                         char *user,
973                         char *home,
974                         char *shell,
975                         struct passwd   *p) ;
976 extern int Verify( 
977                         struct display *d,
978                         struct greet_info *greet,
979                         struct verify_info *verify) ;
980
981  
982 extern  char *  login_defaults(struct passwd *p,
983                         struct display *d);
984
985  
986  
987  
988
989
990
991 /*******************************     version.c    **************************/
992 /*******************************     xdmauth.c    **************************/
993 #ifdef HASXDMAUTH
994 extern void XdmInitAuth( 
995 #if NeedWidePrototypes
996                         unsigned int name_len,
997 #else
998                         unsigned short name_len,
999 #endif /* NeedWidePrototypes */
1000                         char *name) ;
1001
1002 extern Xauth * XdmGetAuth( 
1003 #if NeedWidePrototypes
1004                         unsigned int namelen,
1005 #else
1006                         unsigned short namelen,
1007 #endif /* NeedWidePrototypes */
1008                         char *name) ;
1009
1010 extern void XdmGetXdmcpAuth(
1011                         struct protoDisplay *pdpy,
1012 #if NeedWidePrototypes
1013                         unsigned int authorizationNameLen,
1014 #else
1015                         unsigned short authorizationNameLen,
1016 #endif /* NeedWidePrototypes */
1017                         char *authorizationName) ;
1018
1019 extern int XdmGetKey( 
1020                         struct protoDisplay *pdpy,
1021                         ARRAY8Ptr displayID) ;
1022
1023 extern int XdmCheckAuthentication( 
1024                         struct protoDisplay *pdpy,
1025                         ARRAY8Ptr displayID,
1026                         ARRAY8Ptr authenticationName,
1027                         ARRAY8Ptr authenticationData) ;
1028
1029
1030 #endif /* HASXDMAUTH */
1031
1032
1033 #endif /* _DM_H */