dm.h 29 KB

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