From 5ff0e2bd4b76abb1cd1827c8294843ab0c4fe686 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Mon, 17 Nov 2003 19:03:47 +0000 Subject: merge XFree86 4.3.0.1 to -CURRENT --- Chooser.ad | 4 +- access.c | 156 +++++----- auth.c | 372 ++++++++++++----------- choose.c | 159 +++++----- chooser.c | 351 +++++++++++++++------- config/Xaccess | 6 +- config/Xservers.ws.cpp | 2 +- config/xdm-config.cpp | 26 +- daemon.c | 114 ++++--- dm.c | 179 ++++++----- dm.h | 222 +++++++++++--- dpylist.c | 39 +-- error.c | 124 +++----- file.c | 47 ++- genauth.c | 87 ++++-- greet.h | 143 +++++---- greeter/Login.c | 800 +++++++++++++++++++++++++++++++++++++++---------- greeter/Login.h | 39 ++- greeter/LoginP.h | 34 ++- greeter/greet.c | 174 +++++++---- greeter/verify.c | 383 +++++++++++++++++++++-- krb5auth.c | 32 +- mitauth.c | 12 +- netaddr.c | 37 ++- policy.c | 75 +++-- protodpy.c | 35 +-- reset.c | 25 +- resource.c | 252 ++++++++-------- rpcauth.c | 15 +- server.c | 103 +++---- session.c | 262 +++++++++------- socket.c | 31 +- streams.c | 3 + util.c | 90 ++++-- xdm.man.cpp | 193 +++++++----- xdmauth.c | 18 +- xdmcp.c | 403 ++++++++++++++----------- xdmshell.c | 36 +-- 38 files changed, 3319 insertions(+), 1764 deletions(-) diff --git a/Chooser.ad b/Chooser.ad index 4dc4c74..66dcf7f 100644 --- a/Chooser.ad +++ b/Chooser.ad @@ -1,3 +1,5 @@ +! $XFree86: xc/programs/xdm/Chooser.ad,v 1.2 2001/04/06 02:16:25 dawes Exp $ +! *ShapeStyle: Oval *cursor: left_ptr *allowShellResize: true @@ -18,7 +20,7 @@ : Set() CheckWilling() \n\ (2): Accept() *list.defaultColumns: 1 -*list.forceFolumns: true +*list.forceColumns: true *box.skipAdjust: true *cancel.fromHoriz: viewport diff --git a/access.c b/access.c index 2328ba6..e6984b1 100644 --- a/access.c +++ b/access.c @@ -26,12 +26,15 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/xdm/access.c,v 3.10 2002/12/10 23:36:43 tsi Exp $ */ + /* * Access control for XDMCP - keep a database of allowable display addresses * and (potentially) a list of hosts to send ForwardQuery packets to */ # include "dm.h" +# include "dm_error.h" #ifdef XDMCP @@ -40,19 +43,22 @@ in this Software without prior written authorization from The Open Group. # include # include # include -# include + +# include "dm_socket.h" + # include -# include #define ALIAS_CHARACTER '%' #define NEGATE_CHARACTER '!' #define CHOOSER_STRING "CHOOSER" #define BROADCAST_STRING "BROADCAST" +#define NOBROADCAST_STRING "NOBROADCAST" -#define HOST_ALIAS 0 -#define HOST_ADDRESS 1 -#define HOST_BROADCAST 2 -#define HOST_CHOOSER 3 +#define HOST_ALIAS 0 +#define HOST_ADDRESS 1 +#define HOST_BROADCAST 2 +#define HOST_CHOOSER 3 +#define HOST_NOBROADCAST 4 typedef struct _hostEntry { struct _hostEntry *next; @@ -71,6 +77,7 @@ typedef struct _displayEntry { struct _displayEntry *next; int type; int notAllowed; + int notBroadcast; int chooser; union _displayType { char *aliasName; @@ -88,7 +95,7 @@ static DisplayEntry *database; static ARRAY8 localAddress; ARRAY8Ptr -getLocalAddress () +getLocalAddress (void) { static int haveLocalAddress; @@ -104,8 +111,7 @@ getLocalAddress () } static void -FreeHostEntry (h) - HostEntry *h; +FreeHostEntry (HostEntry *h) { switch (h->type) { case HOST_ALIAS: @@ -121,8 +127,7 @@ FreeHostEntry (h) } static void -FreeDisplayEntry (d) - DisplayEntry *d; +FreeDisplayEntry (DisplayEntry *d) { HostEntry *h, *next; switch (d->type) { @@ -133,7 +138,7 @@ FreeDisplayEntry (d) free (d->entry.displayPattern); break; case DISPLAY_ADDRESS: - XdmcpDisposeARRAY8 (&d->entry.displayAddress); + XdmcpDisposeARRAY8 (&d->entry.displayAddress.clientAddress); break; } for (h = d->hosts; h; h = next) { @@ -144,7 +149,7 @@ FreeDisplayEntry (d) } static void -FreeAccessDatabase () +FreeAccessDatabase (void) { DisplayEntry *d, *next; @@ -161,9 +166,7 @@ static char wordBuffer[WORD_LEN]; static int nextIsEOF; static char * -ReadWord (file, EOFatEOL) - FILE *file; - int EOFatEOL; +ReadWord (FILE *file, int EOFatEOL) { int c; char *wordp; @@ -176,7 +179,7 @@ ReadWord (file, EOFatEOL) return NULL; } quoted = FALSE; - for (;;) { + for (;wordp - wordBuffer < sizeof(wordBuffer)-2;) { c = getc (file); switch (c) { case '#': @@ -219,11 +222,11 @@ ReadWord (file, EOFatEOL) } quoted = FALSE; } + return NULL; } static HostEntry * -ReadHostEntry (file) - FILE *file; +ReadHostEntry (FILE *file) { char *hostOrAlias; HostEntry *h; @@ -252,6 +255,10 @@ tryagain: { h->type = HOST_BROADCAST; } + else if (!strcmp (hostOrAlias, NOBROADCAST_STRING)) + { + h->type = HOST_NOBROADCAST; + } else { h->type = HOST_ADDRESS; @@ -275,8 +282,7 @@ tryagain: } static int -HasGlobCharacters (s) - char *s; +HasGlobCharacters (char *s) { for (;;) switch (*s++) { @@ -289,8 +295,7 @@ HasGlobCharacters (s) } static DisplayEntry * -ReadDisplayEntry (file) - FILE *file; +ReadDisplayEntry (FILE *file) { char *displayOrAlias; DisplayEntry *d; @@ -303,6 +308,7 @@ ReadDisplayEntry (file) return NULL; d = (DisplayEntry *) malloc (sizeof (DisplayEntry)); d->notAllowed = 0; + d->notBroadcast = 0; d->chooser = 0; if (*displayOrAlias == ALIAS_CHARACTER) { @@ -379,6 +385,9 @@ ReadDisplayEntry (file) { FreeHostEntry (h); d->chooser = 1; + } else if (h->type == HOST_NOBROADCAST) { + FreeHostEntry (h); + d->notBroadcast = 1; } else { *prev = h; prev = &h->next; @@ -388,9 +397,8 @@ ReadDisplayEntry (file) return d; } -static -ReadAccessDatabase (file) - FILE *file; +static void +ReadAccessDatabase (FILE *file) { DisplayEntry *d, **prev; @@ -403,7 +411,8 @@ ReadAccessDatabase (file) *prev = NULL; } -ScanAccessDatabase () +int +ScanAccessDatabase (void) { FILE *datafile; @@ -429,17 +438,25 @@ ScanAccessDatabase () #define MAX_DEPTH 32 -static int indirectAlias (); +static int indirectAlias ( + char *alias, + ARRAY8Ptr clientAddress, + CARD16 connectionType, + ChooserFunc function, + char *closure, + int depth, + int broadcast); + static int -scanHostlist (h, clientAddress, connectionType, function, closure, depth, broadcast) - HostEntry *h; - ARRAY8Ptr clientAddress; - CARD16 connectionType; - int (*function)(); - char *closure; - int depth; - int broadcast; +scanHostlist ( + HostEntry *h, + ARRAY8Ptr clientAddress, + CARD16 connectionType, + ChooserFunc function, + char *closure, + int depth, + int broadcast) { int haveLocalhost = 0; @@ -479,8 +496,7 @@ scanHostlist (h, clientAddress, connectionType, function, closure, depth, broadc /* Returns non-0 iff string is matched by pattern. Does case folding. */ static int -patternMatch (string, pattern) - char *string, *pattern; +patternMatch (char *string, char *pattern) { int p, s; @@ -517,15 +533,14 @@ patternMatch (string, pattern) } static int -indirectAlias (alias, clientAddress, connectionType, function, closure, depth, - broadcast) - char *alias; - ARRAY8Ptr clientAddress; - CARD16 connectionType; - int (*function)(); - char *closure; - int depth; - int broadcast; +indirectAlias ( + char *alias, + ARRAY8Ptr clientAddress, + CARD16 connectionType, + ChooserFunc function, + char *closure, + int depth, + int broadcast) { DisplayEntry *d; int haveLocalhost = 0; @@ -545,17 +560,15 @@ indirectAlias (alias, clientAddress, connectionType, function, closure, depth, return haveLocalhost; } -ARRAY8Ptr IndirectChoice (); - -int ForEachMatchingIndirectHost (clientAddress, connectionType, function, closure) - ARRAY8Ptr clientAddress; - CARD16 connectionType; - int (*function)(); - char *closure; +int ForEachMatchingIndirectHost ( + ARRAY8Ptr clientAddress, + CARD16 connectionType, + ChooserFunc function, + char *closure) { int haveLocalhost = 0; DisplayEntry *d; - char *clientName = NULL, *NetworkAddressToHostname (); + char *clientName = NULL; for (d = database; d; d = d->next) { @@ -604,12 +617,12 @@ int ForEachMatchingIndirectHost (clientAddress, connectionType, function, closur return haveLocalhost; } -int UseChooser (clientAddress, connectionType) - ARRAY8Ptr clientAddress; - CARD16 connectionType; +int UseChooser ( + ARRAY8Ptr clientAddress, + CARD16 connectionType) { DisplayEntry *d; - char *clientName = NULL, *NetworkAddressToHostname (); + char *clientName = NULL; for (d = database; d; d = d->next) { @@ -648,15 +661,15 @@ int UseChooser (clientAddress, connectionType) return 0; } -void ForEachChooserHost (clientAddress, connectionType, function, closure) - ARRAY8Ptr clientAddress; - CARD16 connectionType; - int (*function)(); - char *closure; +void ForEachChooserHost ( + ARRAY8Ptr clientAddress, + CARD16 connectionType, + ChooserFunc function, + char *closure) { int haveLocalhost = 0; DisplayEntry *d; - char *clientName = NULL, *NetworkAddressToHostname (); + char *clientName = NULL; for (d = database; d; d = d->next) { @@ -703,13 +716,13 @@ void ForEachChooserHost (clientAddress, connectionType, function, closure) * given display client is acceptable if it occurs without a host list. */ -int AcceptableDisplayAddress (clientAddress, connectionType, type) - ARRAY8Ptr clientAddress; - CARD16 connectionType; - xdmOpCode type; +int AcceptableDisplayAddress ( + ARRAY8Ptr clientAddress, + CARD16 connectionType, + xdmOpCode type) { DisplayEntry *d; - char *clientName = NULL, *NetworkAddressToHostname (); + char *clientName = NULL; if (!*accessFile) return 1; @@ -742,7 +755,8 @@ int AcceptableDisplayAddress (clientAddress, connectionType, type) } if (clientName) free (clientName); - return (d != 0) && (d->notAllowed == 0); + return (d != 0) && (d->notAllowed == 0) + && (type == BROADCAST_QUERY ? d->notBroadcast == 0 : 1); } #endif /* XDMCP */ diff --git a/auth.c b/auth.c index ac92968..e5e57b8 100644 --- a/auth.c +++ b/auth.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.27 2002/12/10 22:37:17 tsi Exp $ */ /* * xdm - display manager daemon @@ -36,86 +37,83 @@ from The Open Group. * maintain the authorization generation daemon */ -#include "dm.h" #include #include #include +#include "dm.h" +#include "dm_auth.h" +#include "dm_error.h" + #include -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif -#include -#ifndef ESIX -# include -#endif /* !ESIX */ +#include -#ifdef TCPCONN -# include +#if defined(TCPCONN) || defined(STREAMSCONN) +# include "dm_socket.h" #endif #ifdef DNETCONN # include # include #endif -#if (defined(_POSIX_SOURCE) && !defined(AIXV3)) || defined(hpux) || defined(USG) || defined(SVR4) +#if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || (defined(SYSV) && defined(i386)) #define NEED_UTSNAME #include #endif -#if defined(SYSV) && defined(SYSV386) +#if defined(SYSV) && defined(i386) # include # ifdef ISC +# include # include # endif /* ISC */ -# ifdef ESIX -# include -# endif /* ESIX */ -#endif /* SYSV386 */ +#endif /* i386 */ #ifdef SVR4 # include +# ifndef SCO325 # include -#ifdef USL +# endif # include #endif -#endif #ifdef __convex__ # include # include #endif +#ifdef __GNU__ +#include +#undef SIOCGIFCONF +#else /* __GNU__ */ #include +#endif /* __GNU__ */ -extern int MitInitAuth (); -extern Xauth *MitGetAuth (); - -#ifdef HASXDMAUTH -extern int XdmInitAuth (); -extern Xauth *XdmGetAuth (); -#ifdef XDMCP -extern void XdmGetXdmcpAuth (); -#else -#define XdmGetXdmcpAuth NULL -#endif +#if ((defined(SVR4) && !defined(sun)) || defined(ISC)) && defined(SIOCGIFCONF) +#define SYSV_SIOCGIFCONF #endif -#ifdef SECURE_RPC -extern int SecureRPCInitAuth (); -extern Xauth *SecureRPCGetAuth (); +#ifdef CSRG_BASED +#include +#if (BSD >= 199103) +#define VARIABLE_IFREQ +#endif #endif -#ifdef K5AUTH -extern int Krb5InitAuth (); -extern Xauth *Krb5GetAuth (); +#ifdef __UNIXOS2__ +#define link rename +int chown(int a,int b,int c) {} +#include #endif struct AuthProtocol { unsigned short name_length; char *name; - int (*InitAuth)(); - Xauth *(*GetAuth)(); - void (*GetXdmcpAuth)(); + void (*InitAuth)(unsigned short len, char *name); + Xauth *(*GetAuth)(unsigned short len, char *name); + void (*GetXdmcpAuth)( + struct protoDisplay *pdpy, + unsigned short authorizationNameLen, + char *authorizationName); int inited; }; @@ -143,9 +141,7 @@ static struct AuthProtocol AuthProtocols[] = { #define NUM_AUTHORIZATION (sizeof (AuthProtocols) / sizeof (AuthProtocols[0])) static struct AuthProtocol * -findProtocol (name_length, name) - unsigned short name_length; - char *name; +findProtocol (unsigned short name_length, char *name) { int i; @@ -158,9 +154,8 @@ findProtocol (name_length, name) return (struct AuthProtocol *) 0; } -ValidAuthorization (name_length, name) - unsigned short name_length; - char *name; +int +ValidAuthorization (unsigned short name_length, char *name) { if (findProtocol (name_length, name)) return TRUE; @@ -168,9 +163,7 @@ ValidAuthorization (name_length, name) } static Xauth * -GenerateAuthorization (name_length, name) -unsigned short name_length; -char *name; +GenerateAuthorization (unsigned short name_length, char *name) { struct AuthProtocol *a; Xauth *auth = 0; @@ -189,7 +182,7 @@ char *name; auth = (*a->GetAuth) (name_length, name); if (auth) { - Debug ("Got 0x%x (%d %*.*s) ", auth, + Debug ("Got %p (%d %*.*s) ", auth, auth->name_length, auth->name_length, auth->name_length, auth->name); for (i = 0; i < (int)auth->data_length; i++) @@ -208,11 +201,11 @@ char *name; #ifdef XDMCP -SetProtoDisplayAuthorization (pdpy, - authorizationNameLen, authorizationName) - struct protoDisplay *pdpy; - unsigned short authorizationNameLen; - char *authorizationName; +void +SetProtoDisplayAuthorization ( + struct protoDisplay *pdpy, + unsigned short authorizationNameLen, + char *authorizationName) { struct AuthProtocol *a; Xauth *auth; @@ -238,7 +231,7 @@ SetProtoDisplayAuthorization (pdpy, pdpy->xdmcpAuthorization = 0; } if (auth) - Debug ("Got 0x%x (%d %*.*s)\n", auth, + Debug ("Got %p (%d %*.*s)\n", auth, auth->name_length, auth->name_length, auth->name_length, auth->name); else @@ -249,9 +242,7 @@ SetProtoDisplayAuthorization (pdpy, #endif /* XDMCP */ void -CleanUpFileName (src, dst, len) - char *src, *dst; - int len; +CleanUpFileName (char *src, char *dst, int len) { while (*src) { if (--len <= 0) @@ -275,9 +266,8 @@ CleanUpFileName (src, dst, len) static char authdir1[] = "authdir"; static char authdir2[] = "authfiles"; -static -MakeServerAuthFile (d) - struct display *d; +static int +MakeServerAuthFile (struct display *d) { int len; #ifdef SYSV @@ -336,10 +326,11 @@ MakeServerAuthFile (d) return TRUE; } -SaveServerAuthorizations (d, auths, count) - struct display *d; - Xauth **auths; - int count; +int +SaveServerAuthorizations ( + struct display *d, + Xauth **auths, + int count) { FILE *auth_file; int mask; @@ -361,7 +352,7 @@ SaveServerAuthorizations (d, auths, count) } else { - Debug ("File: %s auth: %x\n", d->authFile, auths); + Debug ("File: %s auth: %p\n", d->authFile, auths); ret = TRUE; for (i = 0; i < count; i++) { @@ -387,8 +378,7 @@ SaveServerAuthorizations (d, auths, count) } void -SetLocalAuthorization (d) - struct display *d; +SetLocalAuthorization (struct display *d) { Xauth *auth, **auths; int i, j; @@ -445,8 +435,8 @@ SetLocalAuthorization (d) * Well, actually we could use SUN-DES-1 because we tell the server * to allow root in. This is bogus and should be fixed. */ -SetAuthorization (d) - struct display *d; +void +SetAuthorization (struct display *d) { register Xauth **auth = d->authorizations; int i; @@ -464,10 +454,8 @@ SetAuthorization (d) } } -static -openFiles (name, new_name, oldp, newp) -char *name, *new_name; -FILE **oldp, **newp; +static int +openFiles (char *name, char *new_name, FILE **oldp, FILE **newp) { int mask; @@ -486,21 +474,17 @@ FILE **oldp, **newp; return 1; } -static -binaryEqual (a, b, len) -char *a, *b; -unsigned short len; +static int +binaryEqual (char *a, char *b, unsigned short len) { while (len-- > 0) if (*a++ != *b++) - return 0; - return 1; + return FALSE; + return TRUE; } -static -dumpBytes (len, data) -unsigned short len; -char *data; +static void +dumpBytes (unsigned short len, char *data) { unsigned short i; @@ -510,9 +494,8 @@ char *data; Debug ("\n"); } -static -dumpAuth (auth) - Xauth *auth; +static void +dumpAuth (Xauth *auth) { Debug ("family: %d\n", auth->family); Debug ("addr: "); @@ -538,14 +521,14 @@ struct addrList { static struct addrList *addrs; -static -initAddrs () +static void +initAddrs (void) { addrs = 0; } -static -doneAddrs () +static void +doneAddrs (void) { struct addrList *a, *n; for (a = addrs; a; a = n) { @@ -558,11 +541,10 @@ doneAddrs () } } -static checkEntry (); +static int checkEntry (Xauth *auth); static void -saveEntry (auth) - Xauth *auth; +saveEntry (Xauth *auth) { struct addrList *new; @@ -609,9 +591,8 @@ saveEntry (auth) addrs = new; } -static -checkEntry (auth) - Xauth *auth; +static int +checkEntry (Xauth *auth) { struct addrList *a; @@ -632,10 +613,8 @@ checkEntry (auth) static int doWrite; -static -writeAuth (file, auth) - FILE *file; - Xauth *auth; +static void +writeAuth (FILE *file, Xauth *auth) { if (debugLevel >= 15) { /* normally too verbose */ Debug ("writeAuth: doWrite = %d\n", doWrite); @@ -645,13 +624,13 @@ writeAuth (file, auth) XauWriteAuth (file, auth); } -static -writeAddr (family, addr_length, addr, file, auth) - int family; - int addr_length; - char *addr; - FILE *file; - Xauth *auth; +static void +writeAddr ( + int family, + int addr_length, + char *addr, + FILE *file, + Xauth *auth) { auth->family = (unsigned short) family; auth->address_length = addr_length; @@ -661,10 +640,8 @@ writeAddr (family, addr_length, addr, file, auth) saveEntry (auth); } -static -DefineLocal (file, auth) - FILE *file; - Xauth *auth; +static void +DefineLocal (FILE *file, Xauth *auth) { char displayname[100]; char tmp_displayname[100]; @@ -693,11 +670,11 @@ DefineLocal (file, auth) struct utsname name; uname(&name); - strcpy(displayname, name.nodename); + snprintf(displayname, sizeof(displayname), "%s", name.nodename); } writeAddr (FamilyLocal, strlen (displayname), displayname, file, auth); - strcpy(tmp_displayname, displayname); + snprintf(tmp_displayname, sizeof(tmp_displayname), "%s", displayname); #endif #if (!defined(NEED_UTSNAME) || defined (hpux)) @@ -723,13 +700,12 @@ DefineLocal (file, auth) #endif } -#ifdef USL -/* Deal with different SIOCGIFCONF ioctl semantics on UnixWare */ +#ifdef SYSV_SIOCGIFCONF + +/* Deal with different SIOCGIFCONF ioctl semantics on SYSV, SVR4 */ + static int -ifioctl (fd, cmd, arg) - int fd; - int cmd; - char *arg; +ifioctl (int fd, int cmd, char *arg) { struct strioctl ioc; int ret; @@ -741,6 +717,17 @@ ifioctl (fd, cmd, arg) { ioc.ic_len = ((struct ifconf *) arg)->ifc_len; ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf; +#ifdef ISC + /* SIOCGIFCONF is somewhat brain damaged on ISC. The argument + * buffer must contain the ifconf structure as header. Ifc_req + * is also not a pointer but a one element array of ifreq + * structures. On return this array is extended by enough + * ifreq fields to hold all interfaces. The return buffer length + * is placed in the buffer header. + */ + ((struct ifconf *) ioc.ic_dp)->ifc_len = + ioc.ic_len - sizeof(struct ifconf); +#endif } else { @@ -749,11 +736,46 @@ ifioctl (fd, cmd, arg) } ret = ioctl(fd, I_STR, (char *) &ioc); if (ret >= 0 && cmd == SIOCGIFCONF) +#ifdef SVR4 ((struct ifconf *) arg)->ifc_len = ioc.ic_len; +#endif +#ifdef ISC + { + ((struct ifconf *) arg)->ifc_len = + ((struct ifconf *)ioc.ic_dp)->ifc_len; + ((struct ifconf *) arg)->ifc_buf = + (caddr_t)((struct ifconf *)ioc.ic_dp)->ifc_req; + } +#endif return(ret); } -#endif /* USL */ +#else /* SYSV_SIOCGIFCONF */ +#define ifioctl ioctl +#endif /* SYSV_SIOCGIFCONF */ + +#if defined(STREAMSCONN) && !defined(SYSV_SIOCGIFCONF) && !defined(NCR) + +#include + +/* Define this host for access control. Find all the hosts the OS knows about + * for this fd and add them to the selfhosts list. + * TLI version, written without sufficient documentation. + */ +static void +DefineSelf (int fd, FILE *file, Xauth *auth) +{ + struct netbuf netb; + char addrret[1024]; /* easier than t_alloc */ + + netb.maxlen = sizeof(addrret); + netb.buf = addrret; + if (t_getname (fd, &netb, LOCALNAME) == -1) + t_error ("t_getname"); + /* what a kludge */ + writeAddr (FamilyInternet, 4, netb.buf+4, file, auth); +} +#else #ifdef WINTCP /* NCR with Wollongong TCP */ @@ -768,14 +790,11 @@ ifioctl (fd, cmd, arg) #include #include -static -DefineSelf (fd, file, auth) - int fd; - FILE *file; - Xauth *auth; +static void +DefineSelf (int fd, FILE *file, Xauth *auth) { /* - * The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the + * The Wollongong drivers used by NCR SVR4/MP-RAS don't understand the * socket IO calls that most other drivers seem to like. Because of * this, this routine must be special cased for NCR. Eventually, * this will be cleared up. @@ -785,7 +804,7 @@ DefineSelf (fd, file, auth) struct in_ifaddr ifaddr; struct strioctl str; unsigned char *addr; - int family, len, ipfd; + int len, ipfd; if ((ipfd = open ("/dev/ip", O_RDWR, 0 )) < 0) LogError ("Getting interface configuration"); @@ -828,25 +847,29 @@ DefineSelf (fd, file, auth) } close(ipfd); - } #else /* WINTCP */ #ifdef SIOCGIFCONF +/* Handle variable length ifreq in BNR2 and later */ +#ifdef VARIABLE_IFREQ +#define ifr_size(p) (sizeof (struct ifreq) + \ + (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ + p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) +#else +#define ifr_size(p) (sizeof (struct ifreq)) +#endif + /* Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ -static -DefineSelf (fd, file, auth) - int fd; - FILE *file; - Xauth *auth; +static void +DefineSelf (int fd, FILE *file, Xauth *auth) { - char buf[2048]; + char buf[2048], *cp, *cplim; struct ifconf ifc; - register int n; int len; char *addr; int family; @@ -854,24 +877,20 @@ DefineSelf (fd, file, auth) ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - -#ifdef USL if (ifioctl (fd, SIOCGIFCONF, (char *) &ifc) < 0) -#else - if (ioctl (fd, SIOCGIFCONF, (char *) &ifc) < 0) -#endif LogError ("Trouble getting network interface configuration"); - for (ifr = ifc.ifc_req -#ifdef BSD44SOCKETS - ; (char *)ifr < ifc.ifc_buf + ifc.ifc_len; - ifr = (struct ifreq *)((char *)ifr + sizeof (struct ifreq) + - (ifr->ifr_addr.sa_len > sizeof (ifr->ifr_addr) ? - ifr->ifr_addr.sa_len - sizeof (ifr->ifr_addr) : 0)) + +#ifdef ISC +#define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf #else - , n = ifc.ifc_len / sizeof (struct ifreq); --n >= 0; ifr++ +#define IFC_IFC_REQ ifc.ifc_req #endif - ) + + cplim = (char *) IFC_IFC_REQ + ifc.ifc_len; + + for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr)) { + ifr = (struct ifreq *) cp; #ifdef DNETCONN /* * this is ugly but SIOCGIFCONF returns decnet addresses in @@ -884,7 +903,7 @@ DefineSelf (fd, file, auth) } else #endif { - if (ConvertAddr (&ifr->ifr_addr, &len, &addr) < 0) + if (ConvertAddr ((XdmcpNetaddr) &ifr->ifr_addr, &len, &addr) < 0) continue; if (len == 0) { @@ -917,9 +936,8 @@ DefineSelf (fd, file, auth) /* Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ -static -DefineSelf (fd, file, auth) - int fd; +static void +DefineSelf (int fd, int file, int auth) { register int n; int len; @@ -957,14 +975,12 @@ DefineSelf (fd, file, auth) } #endif /* SIOCGIFCONF else */ - -#endif /* WINTCP */ +#endif /* WINTCP else */ +#endif /* STREAMSCONN && !SYSV_SIOCGIFCONF else */ -static -setAuthNumber (auth, name) - Xauth *auth; - char *name; +static void +setAuthNumber (Xauth *auth, char *name) { char *colon; char *dot, *number; @@ -991,11 +1007,8 @@ setAuthNumber (auth, name) } } -static -writeLocalAuth (file, auth, name) - FILE *file; - Xauth *auth; - char *name; +static void +writeLocalAuth (FILE *file, Xauth *auth, char *name) { int fd; @@ -1024,12 +1037,7 @@ writeLocalAuth (file, auth, name) #ifdef XDMCP static void -writeRemoteAuth (file, auth, peer, peerlen, name) - FILE *file; - Xauth *auth; - XdmcpNetaddr peer; - int peerlen; - char *name; +writeRemoteAuth (FILE *file, Xauth *auth, XdmcpNetaddr peer, int peerlen, char *name) { int family = FamilyLocal; char *addr; @@ -1055,19 +1063,16 @@ writeRemoteAuth (file, auth, peer, peerlen, name) #endif /* XDMCP */ void -SetUserAuthorization (d, verify) - struct display *d; - struct verify_info *verify; +SetUserAuthorization (struct display *d, struct verify_info *verify) { FILE *old, *new; char home_name[1024], backup_name[1024], new_name[1024]; - char *name; + char *name = 0; char *home; char *envname = 0; int lockStatus; Xauth *entry, **auths; - int setenv; - char **setEnv (), *getEnv (); + int setenv = 0; struct stat statb; int i; int magicCookie; @@ -1079,10 +1084,7 @@ SetUserAuthorization (d, verify) home = getEnv (verify->userEnviron, "HOME"); lockStatus = LOCK_ERROR; if (home) { - strcpy (home_name, home); - if (home[strlen(home) - 1] != '/') - strcat (home_name, "/"); - strcat (home_name, ".Xauthority"); + snprintf (home_name, sizeof(home_name), "%s/.Xauthority", home); Debug ("XauLockAuth %s\n", home_name); lockStatus = XauLockAuth (home_name, 1, 2, 10); Debug ("Lock is %d\n", lockStatus); @@ -1098,7 +1100,7 @@ SetUserAuthorization (d, verify) } } if (lockStatus != LOCK_SUCCESS) { - sprintf (backup_name, "%s/.XauthXXXXXX", d->userAuthDir); + snprintf (backup_name, sizeof(backup_name), "%s/.XauthXXXXXX", d->userAuthDir); (void) mktemp (backup_name); lockStatus = XauLockAuth (backup_name, 1, 2, 10); Debug ("backup lock is %d\n", lockStatus); @@ -1206,9 +1208,7 @@ SetUserAuthorization (d, verify) } void -RemoveUserAuthorization (d, verify) - struct display *d; - struct verify_info *verify; +RemoveUserAuthorization (struct display *d, struct verify_info *verify) { char *home; Xauth **auths, *entry; @@ -1217,7 +1217,6 @@ RemoveUserAuthorization (d, verify) FILE *old, *new; struct stat statb; int i; - char *getEnv (); if (!(auths = d->authorizations)) return; @@ -1225,10 +1224,7 @@ RemoveUserAuthorization (d, verify) if (!home) return; Debug ("RemoveUserAuthorization\n"); - strcpy (name, home); - if (home[strlen(home) - 1] != '/') - strcat (name, "/"); - strcat (name, ".Xauthority"); + snprintf(name, sizeof(name), "%s/.Xauthority", home); Debug ("XauLockAuth %s\n", name); lockStatus = XauLockAuth (name, 1, 2, 10); Debug ("Lock is %d\n", lockStatus); diff --git a/choose.c b/choose.c index 1e88be7..e4b94d8 100644 --- a/choose.c +++ b/choose.c @@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/xdm/choose.c,v 3.15 2001/12/14 20:01:20 dawes Exp $ */ + /* * choose.c * @@ -33,35 +35,39 @@ in this Software without prior written authorization from The Open Group. */ #include "dm.h" +#include "dm_error.h" #ifdef XDMCP #include #include -#include -#include + +#include "dm_socket.h" + +#ifndef X_NO_SYS_UN +#ifndef Lynx #include +#else +#include +#endif +#endif + #include #include + #if defined(STREAMSCONN) # include #endif -#ifdef X_NOT_STDC_ENV -extern int errno; -#define Time_t long -extern Time_t time (); -#else #include #define Time_t time_t -#endif -static -FormatBytes (data, length, buf, buflen) - unsigned char *data; - int length; - char *buf; - int buflen; +static int +FormatBytes ( + unsigned char *data, + int length, + char *buf, + int buflen) { int i; static char HexChars[] = "0123456789abcdef"; @@ -77,11 +83,11 @@ FormatBytes (data, length, buf, buflen) return 1; } -static -FormatARRAY8 (a, buf, buflen) - ARRAY8Ptr a; - char *buf; - int buflen; +static int +FormatARRAY8 ( + ARRAY8Ptr a, + char *buf, + int buflen) { return FormatBytes (a->data, a->length, buf, buflen); } @@ -91,10 +97,10 @@ FormatARRAY8 (a, buf, buflen) Returns 1 if successful, 0 if not. */ static int -ARRAY8ToDottedDecimal (a, buf, buflen) - ARRAY8Ptr a; - char *buf; - int buflen; +ARRAY8ToDottedDecimal ( + ARRAY8Ptr a, + char *buf, + int buflen) { if (a->length != 4 || buflen < 20) return 0; @@ -111,9 +117,10 @@ typedef struct _IndirectUsers { static IndirectUsersPtr indirectUsers; -RememberIndirectClient (clientAddress, connectionType) - ARRAY8Ptr clientAddress; - CARD16 connectionType; +int +RememberIndirectClient ( + ARRAY8Ptr clientAddress, + CARD16 connectionType) { IndirectUsersPtr i; @@ -133,9 +140,10 @@ RememberIndirectClient (clientAddress, connectionType) return 1; } -ForgetIndirectClient (clientAddress, connectionType) - ARRAY8Ptr clientAddress; - CARD16 connectionType; +void +ForgetIndirectClient ( + ARRAY8Ptr clientAddress, + CARD16 connectionType) { IndirectUsersPtr i, prev; @@ -157,9 +165,10 @@ ForgetIndirectClient (clientAddress, connectionType) } } -IsIndirectClient (clientAddress, connectionType) - ARRAY8Ptr clientAddress; - CARD16 connectionType; +int +IsIndirectClient ( + ARRAY8Ptr clientAddress, + CARD16 connectionType) { IndirectUsersPtr i; @@ -170,12 +179,8 @@ IsIndirectClient (clientAddress, connectionType) return 0; } -extern char *NetaddrPort(); - -static -FormatChooserArgument (buf, len) - char *buf; - int len; +static int +FormatChooserArgument (char *buf, int len) { unsigned char addr_buf[1024]; int addr_len = sizeof (addr_buf); @@ -183,7 +188,7 @@ FormatChooserArgument (buf, len) int result_len = 0; int netfamily; - if (GetChooserAddr (addr_buf, &addr_len) == -1) + if (GetChooserAddr ((char *)addr_buf, &addr_len) == -1) { LogError ("Cannot get return address for chooser socket\n"); Debug ("Cannot get chooser socket address\n"); @@ -195,7 +200,7 @@ FormatChooserArgument (buf, len) { char *port; int portlen; - ARRAY8Ptr localAddress, getLocalAddress (); + ARRAY8Ptr localAddress; port = NetaddrPort((XdmcpNetaddr)addr_buf, &portlen); result_buf[0] = netfamily >> 8; @@ -230,9 +235,9 @@ typedef struct _Choices { static ChoicePtr choices; ARRAY8Ptr -IndirectChoice (clientAddress, connectionType) - ARRAY8Ptr clientAddress; - CARD16 connectionType; +IndirectChoice ( + ARRAY8Ptr clientAddress, + CARD16 connectionType) { ChoicePtr c, next, prev; Time_t now; @@ -242,10 +247,12 @@ IndirectChoice (clientAddress, connectionType) for (c = choices; c; c = next) { next = c->next; - Debug ("Choice checking timeout: %d >? %d\n", now - c->time, choiceTimeout); + Debug ("Choice checking timeout: %ld >? %d\n", + (long)(now - c->time), choiceTimeout); if (now - c->time > (Time_t)choiceTimeout) { - Debug ("Timeout choice %d > %d\n", now - c->time, choiceTimeout); + Debug ("Timeout choice %ld > %d\n", + (long)(now - c->time), choiceTimeout); if (prev) prev->next = next; else @@ -266,9 +273,10 @@ IndirectChoice (clientAddress, connectionType) } static int -RegisterIndirectChoice (clientAddress, connectionType, choice) - ARRAY8Ptr clientAddress, choice; - CARD16 connectionType; +RegisterIndirectChoice ( + ARRAY8Ptr clientAddress, + CARD16 connectionType, + ARRAY8Ptr choice) { ChoicePtr c; int insert; @@ -282,8 +290,10 @@ RegisterIndirectChoice (clientAddress, connectionType, choice) break; } } +#if 0 if (!found) return 0; +#endif insert = 0; if (!c) @@ -347,13 +357,13 @@ RemoveIndirectChoice (clientAddress, connectionType) #endif /*ARGSUSED*/ -static -AddChooserHost (connectionType, addr, closure) - CARD16 connectionType; - ARRAY8Ptr addr; - char *closure; +static void +AddChooserHost ( + CARD16 connectionType, + ARRAY8Ptr addr, + char *closure) { - char ***argp, **parseArgs(); + char ***argp; char hostbuf[1024]; argp = (char ***) closure; @@ -368,8 +378,8 @@ AddChooserHost (connectionType, addr, closure) } } -ProcessChooserSocket (fd) - int fd; +void +ProcessChooserSocket (int fd) { int client_fd; char buf[1024]; @@ -426,7 +436,7 @@ ProcessChooserSocket (fd) return; } #else - client_fd = accept (fd, (struct sockaddr *)buf, &len); + client_fd = accept (fd, (struct sockaddr *)buf, (void *)&len); if (client_fd == -1) { LogError ("Cannot accept chooser connection\n"); @@ -451,16 +461,22 @@ ProcessChooserSocket (fd) clientAddress.length = 0; choice.data = 0; choice.length = 0; - if (XdmcpReadARRAY8 (&buffer, &clientAddress) && - XdmcpReadCARD16 (&buffer, &connectionType) && - XdmcpReadARRAY8 (&buffer, &choice)) - { - Debug ("Read from chooser succesfully\n"); - if (!RegisterIndirectChoice (&clientAddress, connectionType, &choice)) - Debug ("Invalid chooser reply\n"); + if (XdmcpReadARRAY8 (&buffer, &clientAddress)) { + if (XdmcpReadCARD16 (&buffer, &connectionType)) { + if (XdmcpReadARRAY8 (&buffer, &choice)) { + Debug ("Read from chooser succesfully\n"); + RegisterIndirectChoice (&clientAddress, connectionType, &choice); + XdmcpDisposeARRAY8 (&choice); + } else { + LogError ("Invalid choice response length %d\n", len); + } + } else { + LogError ("Invalid choice response length %d\n", len); + } + XdmcpDisposeARRAY8 (&clientAddress); + } else { + LogError ("Invalid choice response length %d\n", len); } - XdmcpDisposeARRAY8 (&clientAddress); - XdmcpDisposeARRAY8 (&choice); } else { @@ -476,15 +492,19 @@ ProcessChooserSocket (fd) #endif } -RunChooser (d) - struct display *d; +void +RunChooser (struct display *d) { - char **args, **parseArgs(), **systemEnv(); + char **args; char buf[1024]; char **env; Debug ("RunChooser %s\n", d->name); +#ifndef HAS_SETPROCTITLE SetTitle (d->name, "chooser", (char *) 0); +#else + setproctitle("chooser %s", d->name); +#endif LoadXloginResources (d); args = parseArgs ((char **) 0, d->chooser); strcpy (buf, "-xdmaddress "); @@ -506,3 +526,4 @@ RunChooser (d) } #endif /* XDMCP */ + diff --git a/chooser.c b/chooser.c index 3724691..4e63ee7 100644 --- a/chooser.c +++ b/chooser.c @@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/xdm/chooser.c,v 3.24 2001/12/14 20:01:20 dawes Exp $ */ + /* * Chooser - display a menu of names and let the user select one */ @@ -68,11 +70,28 @@ in this Software without prior written authorization from The Open Group. #include #include -#ifdef SVR4 +#ifdef USE_XINERAMA +#include +#endif + +#if defined(SVR4) && !defined(SCO325) #include #endif -#include -#include +#if defined(SVR4) && defined(PowerMAX_OS) +#include +#endif +#if defined(SYSV) && defined(i386) +#include +#ifdef ISC +#include +#include +#endif +#endif + +#include "dm_socket.h" + +#include + #include #ifdef STREAMSCONN #ifdef WINTCP /* NCR with Wollongong TCP */ @@ -84,6 +103,13 @@ in this Software without prior written authorization from The Open Group. #include #endif +#ifdef CSRG_BASED +#include +#if (BSD >= 199103) +#define VARIABLE_IFREQ +#endif +#endif + #ifdef XKB #include #endif @@ -91,7 +117,7 @@ in this Software without prior written authorization from The Open Group. #define BROADCAST_HOSTNAME "BROADCAST" #ifndef ishexdigit -#define ishexdigit(c) (isdigit(c) || 'a' <= (c) && (c) <= 'f') +#define ishexdigit(c) (isdigit(c) || ('a' <= (c) && (c) <= 'f')) #endif #ifdef hpux @@ -104,14 +130,22 @@ in this Software without prior written authorization from The Open Group. # include # include #endif +#ifndef __GNU__ # include +#endif /* __GNU__ */ #endif /* hpux */ #include +static int FromHex (char *s, char *d, int len); + Widget toplevel, label, viewport, paned, list, box, cancel, acceptit, ping; -static void CvtStringToARRAY8(); +static void CvtStringToARRAY8( + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal); static struct _app_resources { ARRAY8Ptr xdmAddress; @@ -134,9 +168,9 @@ static XtResource resources[] = { #undef offset static XrmOptionDescRec options[] = { - "-xdmaddress", "*xdmAddress", XrmoptionSepArg, NULL, - "-clientaddress", "*clientAddress", XrmoptionSepArg, NULL, - "-connectionType", "*connectionType", XrmoptionSepArg, NULL, + { "-xdmaddress", "*xdmAddress", XrmoptionSepArg, NULL }, + { "-clientaddress", "*clientAddress", XrmoptionSepArg, NULL }, + { "-connectionType","*connectionType", XrmoptionSepArg, NULL }, }; typedef struct _hostAddr { @@ -169,20 +203,72 @@ static int pingTry; static XdmcpBuffer directBuffer, broadcastBuffer; static XdmcpBuffer buffer; +#if ((defined(SVR4) && !defined(sun) && !defined(__sgi) && !defined(NCR)) || defined(ISC)) && defined(SIOCGIFCONF) + +/* Deal with different SIOCGIFCONF ioctl semantics on these OSs */ + +static int +ifioctl (int fd, int cmd, char *arg) +{ + struct strioctl ioc; + int ret; + + bzero((char *) &ioc, sizeof(ioc)); + ioc.ic_cmd = cmd; + ioc.ic_timout = 0; + if (cmd == SIOCGIFCONF) + { + ioc.ic_len = ((struct ifconf *) arg)->ifc_len; + ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf; +#ifdef ISC + /* SIOCGIFCONF is somewhat brain damaged on ISC. The argument + * buffer must contain the ifconf structure as header. Ifc_req + * is also not a pointer but a one element array of ifreq + * structures. On return this array is extended by enough + * ifreq fields to hold all interfaces. The return buffer length + * is placed in the buffer header. + */ + ((struct ifconf *) ioc.ic_dp)->ifc_len = + ioc.ic_len - sizeof(struct ifconf); +#endif + } + else + { + ioc.ic_len = sizeof(struct ifreq); + ioc.ic_dp = arg; + } + ret = ioctl(fd, I_STR, (char *) &ioc); + if (ret >= 0 && cmd == SIOCGIFCONF) +#ifdef SVR4 + ((struct ifconf *) arg)->ifc_len = ioc.ic_len; +#endif +#ifdef ISC + { + ((struct ifconf *) arg)->ifc_len = + ((struct ifconf *)ioc.ic_dp)->ifc_len; + ((struct ifconf *) arg)->ifc_buf = + (caddr_t)((struct ifconf *)ioc.ic_dp)->ifc_req; + } +#endif + return(ret); +} +#else /* ((SVR4 && !sun && !NCR) || ISC) && SIOCGIFCONF */ +#define ifioctl ioctl +#endif /* ((SVR4 && !sun) || ISC) && SIOCGIFCONF */ + + /* ARGSUSED */ static void -PingHosts (closure, id) - XtPointer closure; - XtIntervalId *id; +PingHosts (XtPointer closure, XtIntervalId *id) { HostAddr *hosts; for (hosts = hostAddrdb; hosts; hosts = hosts->next) { if (hosts->type == QUERY) - XdmcpFlush (socketFD, &directBuffer, hosts->addr, hosts->addrlen); + XdmcpFlush (socketFD, &directBuffer, (XdmcpNetaddr) hosts->addr, hosts->addrlen); else - XdmcpFlush (socketFD, &broadcastBuffer, hosts->addr, hosts->addrlen); + XdmcpFlush (socketFD, &broadcastBuffer, (XdmcpNetaddr) hosts->addr, hosts->addrlen); } if (++pingTry < TRIES) XtAddTimeOut (PING_INTERVAL, PingHosts, (XtPointer) 0); @@ -192,19 +278,13 @@ char **NameTable; int NameTableSize; static int -HostnameCompare (a, b) -#ifdef __STDC__ - const void *a, *b; -#else - char *a, *b; -#endif +HostnameCompare (const void *a, const void *b) { return strcmp (*(char **)a, *(char **)b); } static void -RebuildTable (size) - int size; +RebuildTable (int size) { char **newTable = 0; HostName *names; @@ -227,10 +307,7 @@ RebuildTable (size) } static int -AddHostname (hostname, status, addr, willing) - ARRAY8Ptr hostname, status; - struct sockaddr *addr; - int willing; +AddHostname (ARRAY8Ptr hostname, ARRAY8Ptr status, struct sockaddr *addr, int willing) { HostName *new, **names, *name; ARRAY8 hostAddr; @@ -281,7 +358,7 @@ AddHostname (hostname, status, addr, willing) if (hostent) { XdmcpDisposeARRAY8 (hostname); - host = hostent->h_name; + host = (char *)hostent->h_name; XdmcpAllocARRAY8 (hostname, strlen (host)); memmove( hostname->data, host, hostname->length); } @@ -332,8 +409,7 @@ AddHostname (hostname, status, addr, willing) } static void -DisposeHostname (host) - HostName *host; +DisposeHostname (HostName *host) { XdmcpDisposeARRAY8 (&host->hostname); XdmcpDisposeARRAY8 (&host->hostaddr); @@ -342,9 +418,9 @@ DisposeHostname (host) free ((char *) host); } +#if 0 static void -RemoveHostname (host) - HostName *host; +RemoveHostname (HostName *host) { HostName **prev, *hosts; @@ -362,9 +438,10 @@ RemoveHostname (host) NameTableSize--; RebuildTable (NameTableSize); } +#endif static void -EmptyHostnames () +EmptyHostnames (void) { HostName *hosts, *next; @@ -380,10 +457,7 @@ EmptyHostnames () /* ARGSUSED */ static void -ReceivePacket (closure, source, id) - XtPointer closure; - int *source; - XtInputId *id; +ReceivePacket (XtPointer closure, int *source, XtInputId *id) { XdmcpHeader header; ARRAY8 authenticationName; @@ -394,7 +468,7 @@ ReceivePacket (closure, source, id) int addrlen; addrlen = sizeof (addr); - if (!XdmcpFill (socketFD, &buffer, &addr, &addrlen)) + if (!XdmcpFill (socketFD, &buffer, (XdmcpNetaddr) &addr, &addrlen)) return; if (!XdmcpReadHeader (&buffer, &header)) return; @@ -441,10 +515,7 @@ ReceivePacket (closure, source, id) } static void -RegisterHostaddr (addr, len, type) - struct sockaddr *addr; - int len; - xdmOpCode type; +RegisterHostaddr (struct sockaddr *addr, int len, xdmOpCode type) { HostAddr *host, **prev; @@ -473,17 +544,26 @@ RegisterHostaddr (addr, len, type) * addresses on the local host. */ +#if !defined(__GNU__) + +/* Handle variable length ifreq in BNR2 and later */ +#ifdef VARIABLE_IFREQ +#define ifr_size(p) (sizeof (struct ifreq) + \ + (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ + p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) +#else +#define ifr_size(p) (sizeof (struct ifreq)) +#endif + static void -RegisterHostname (name) - char *name; +RegisterHostname (char *name) { struct hostent *hostent; struct sockaddr_in in_addr; struct ifconf ifc; register struct ifreq *ifr; struct sockaddr broad_addr; - char buf[2048]; - int n; + char buf[2048], *cp, *cplim; if (!strcmp (name, BROADCAST_HOSTNAME)) { @@ -491,6 +571,7 @@ RegisterHostname (name) int ipfd; struct ifconf *ifcp; struct strioctl ioc; + int n; ifcp = (struct ifconf *)buf; ifcp->ifc_buf = buf+4; @@ -514,27 +595,29 @@ RegisterHostname (name) return; } - for (ifr = ifcp->ifc_req, -n = ifcp->ifc_len / sizeof (struct ifreq); + for (ifr = ifcp->ifc_req, n = ifcp->ifc_len / sizeof (struct ifreq); --n >= 0; ifr++) #else /* WINTCP */ ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ioctl (socketFD, (int) SIOCGIFCONF, (char *) &ifc) < 0) + if (ifioctl (socketFD, (int) SIOCGIFCONF, (char *) &ifc) < 0) return; - for (ifr = ifc.ifc_req -#ifdef BSD44SOCKETS - ; (char *)ifr < ifc.ifc_buf + ifc.ifc_len; - ifr = (struct ifreq *)((char *)ifr + sizeof (struct ifreq) + - (ifr->ifr_addr.sa_len > sizeof (ifr->ifr_addr) ? - ifr->ifr_addr.sa_len - sizeof (ifr->ifr_addr) : 0)) + +#ifdef ISC +#define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf #else - , n = ifc.ifc_len / sizeof (struct ifreq); --n >= 0; ifr++ +#define IFC_IFC_REQ ifc.ifc_req #endif - ) + + cplim = (char *) IFC_IFC_REQ + ifc.ifc_len; + + for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr)) #endif /* WINTCP */ { +#ifndef WINTCP + ifr = (struct ifreq *) cp; +#endif if (ifr->ifr_addr.sa_family != AF_INET) continue; @@ -554,7 +637,7 @@ n = ifcp->ifc_len / sizeof (struct ifreq); if (ioctl (ipfd, I_STR, (char *) &ioc) != -1 && #else /* WINTCP */ - if (ioctl (socketFD, SIOCGIFFLAGS, (char *) &broad_req) != -1 && + if (ifioctl (socketFD, SIOCGIFFLAGS, (char *) &broad_req) != -1 && #endif /* WINTCP */ (broad_req.ifr_flags & IFF_BROADCAST) && (broad_req.ifr_flags & IFF_UP) @@ -569,7 +652,7 @@ n = ifcp->ifc_len / sizeof (struct ifreq); if (ioctl (ipfd, I_STR, (char *) &ioc) != -1) #else /* WINTCP */ - if (ioctl (socketFD, SIOCGIFBRDADDR, &broad_req) != -1) + if (ifioctl (socketFD, SIOCGIFBRDADDR, &broad_req) != -1) #endif /* WINTCP */ broad_addr = broad_req.ifr_addr; else @@ -618,13 +701,54 @@ n = ifcp->ifc_len / sizeof (struct ifreq); QUERY); } } +#else /* __GNU__ */ +static void +RegisterHostname (char *name) +{ + struct hostent *hostent; + struct sockaddr_in in_addr; + + if (!strcmp (name, BROADCAST_HOSTNAME)) + { + in_addr.sin_addr.s_addr= htonl(0xFFFFFFFF); + in_addr.sin_port = htons (XDM_UDP_PORT); + RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), + BROADCAST_QUERY); + } + else + { + + /* address as hex string, e.g., "12180022" (depreciated) */ + if (strlen(name) == 8 && + FromHex(name, (char *)&in_addr.sin_addr, strlen(name)) == 0) + { + in_addr.sin_family = AF_INET; + } + /* Per RFC 1123, check first for IP address in dotted-decimal form */ + else if ((in_addr.sin_addr.s_addr = inet_addr(name)) != -1) + in_addr.sin_family = AF_INET; + else + { + hostent = gethostbyname (name); + if (!hostent) + return; + if (hostent->h_addrtype != AF_INET || hostent->h_length != 4) + return; + in_addr.sin_family = hostent->h_addrtype; + memmove( &in_addr.sin_addr, hostent->h_addr, 4); + } + in_addr.sin_port = htons (XDM_UDP_PORT); + RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), + QUERY); + } +} +#endif /* __GNU__ */ static ARRAYofARRAY8 AuthenticationNames; +#if 0 static void -RegisterAuthenticationName (name, namelen) - char *name; - int namelen; +RegisterAuthenticationName (char *name, int namelen) { ARRAY8Ptr authName; if (!XdmcpReallocARRAYofARRAY8 (&AuthenticationNames, @@ -635,10 +759,10 @@ RegisterAuthenticationName (name, namelen) return; memmove( authName->data, name, namelen); } +#endif -int -InitXDMCP (argv) - char **argv; +static int +InitXDMCP (char **argv) { int soopts = 1; XdmcpHeader header; @@ -661,11 +785,13 @@ InitXDMCP (argv) XdmcpWriteARRAYofARRAY8 (&directBuffer, &AuthenticationNames); #if defined(STREAMSCONN) if ((socketFD = t_open ("/dev/udp", O_RDWR, 0)) < 0) - return 0; - if (t_bind( socketFD, NULL, NULL ) < 0) { + return 0; + + if (t_bind( socketFD, NULL, NULL ) < 0) + { t_close(socketFD); return 0; - } + } /* * This part of the code looks contrived. It will actually fit in nicely @@ -674,18 +800,20 @@ InitXDMCP (argv) { struct netconfig *nconf; - if( (nconf=getnetconfigent("udp")) == NULL ) { + if( (nconf=getnetconfigent("udp")) == NULL ) + { t_unbind(socketFD); t_close(socketFD); return 0; - } + } - if( netdir_options(nconf, ND_SET_BROADCAST, socketFD, NULL) ) { + if( netdir_options(nconf, ND_SET_BROADCAST, socketFD, NULL) ) + { freenetconfigent(nconf); t_unbind(socketFD); t_close(socketFD); return 0; - } + } freenetconfigent(nconf); } @@ -693,10 +821,12 @@ InitXDMCP (argv) if ((socketFD = socket (AF_INET, SOCK_DGRAM, 0)) < 0) return 0; #endif +#ifndef STREAMSCONN #ifdef SO_BROADCAST soopts = 1; if (setsockopt (socketFD, SOL_SOCKET, SO_BROADCAST, (char *)&soopts, sizeof (soopts)) < 0) perror ("setsockopt"); +#endif #endif XtAddInput (socketFD, (XtPointer) XtInputReadMask, ReceivePacket, @@ -712,15 +842,14 @@ InitXDMCP (argv) } static void -Choose (h) - HostName *h; +Choose (HostName *h) { if (app_resources.xdmAddress) { struct sockaddr_in in_addr; - struct sockaddr *addr; + struct sockaddr *addr = NULL; int family; - int len; + int len = 0; int fd; char buf[1024]; XdmcpBuffer buffer; @@ -823,11 +952,7 @@ Choose (h) /* ARGSUSED */ static void -DoAccept (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +DoAccept (Widget w, XEvent *event, String *params, Cardinal *num_params) { XawListReturnStruct *r; HostName *h; @@ -852,11 +977,7 @@ DoAccept (w, event, params, num_params) /* ARGSUSED */ static void -DoCheckWilling (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +DoCheckWilling (Widget w, XEvent *event, String *params, Cardinal *num_params) { XawListReturnStruct *r; HostName *h; @@ -872,22 +993,14 @@ DoCheckWilling (w, event, params, num_params) /* ARGSUSED */ static void -DoCancel (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +DoCancel (Widget w, XEvent *event, String *params, Cardinal *num_params) { exit (OBEYSESS_DISPLAY); } /* ARGSUSED */ static void -DoPing (w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +DoPing (Widget w, XEvent *event, String *params, Cardinal *num_params) { EmptyHostnames (); pingTry = 0; @@ -895,19 +1008,23 @@ DoPing (w, event, params, num_params) } static XtActionsRec app_actions[] = { - "Accept", DoAccept, - "Cancel", DoCancel, - "CheckWilling", DoCheckWilling, - "Ping", DoPing, + { "Accept", DoAccept }, + { "Cancel", DoCancel }, + { "CheckWilling", DoCheckWilling }, + { "Ping", DoPing }, }; -main (argc, argv) - int argc; - char **argv; +int +main (int argc, char **argv) { Arg position[3]; Dimension width, height; Position x, y; +#ifdef USE_XINERAMA + XineramaScreenInfo *screens; + int s_num; +#endif + toplevel = XtInitialize (argv[0], "Chooser", options, XtNumber(options), &argc, argv); @@ -935,8 +1052,23 @@ main (argc, argv) XtSetArg (position[0], XtNwidth, &width); XtSetArg (position[1], XtNheight, &height); XtGetValues (toplevel, position, (Cardinal) 2); - x = (Position)(WidthOfScreen (XtScreen (toplevel)) - width) / 2; - y = (Position)(HeightOfScreen (XtScreen (toplevel)) - height) / 3; +#ifdef USE_XINERAMA + if ( + XineramaIsActive(XtDisplay(toplevel)) && + (screens = XineramaQueryScreens(XtDisplay(toplevel), &s_num)) != NULL + ) + { + x = (Position)(screens[0].x_org + (screens[0].width - width) / 2); + y = (Position)(screens[0].y_org + (screens[0].height - height) / 3); + + XFree(screens); + } + else +#endif + { + x = (Position)(WidthOfScreen (XtScreen (toplevel)) - width) / 2; + y = (Position)(HeightOfScreen (XtScreen (toplevel)) - height) / 3; + } XtSetArg (position[0], XtNx, x); XtSetArg (position[1], XtNy, y); XtSetValues (toplevel, position, (Cardinal) 2); @@ -954,10 +1086,8 @@ main (argc, argv) /* Converts the hex string s of length len into the byte array d. Returns 0 if s was a legal hex string, 1 otherwise. */ -int -FromHex (s, d, len) - char *s, *d; - int len; +static int +FromHex (char *s, char *d, int len) { int t; int ret = len&1; /* odd-length hex strings are illegal */ @@ -981,11 +1111,7 @@ FromHex (s, d, len) /*ARGSUSED*/ static void -CvtStringToARRAY8 (args, num_args, fromVal, toVal) - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; +CvtStringToARRAY8 (XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal) { static ARRAY8Ptr dest; char *s; @@ -1003,3 +1129,4 @@ CvtStringToARRAY8 (args, num_args, fromVal, toVal) toVal->addr = (caddr_t) &dest; toVal->size = sizeof (ARRAY8Ptr); } + diff --git a/config/Xaccess b/config/Xaccess index b41c4c3..c83cc18 100644 --- a/config/Xaccess +++ b/config/Xaccess @@ -1,5 +1,7 @@ # $Xorg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # +# $XFree86: xc/programs/xdm/config/Xaccess,v 1.3 2001/01/17 23:45:24 dawes Exp $ +# # Access control file for XDMCP connections # # To control Direct and Broadcast access: @@ -37,7 +39,7 @@ # right hand sides can match. # -* #any host can get a login window +#* #any host can get a login window # # To hardwire a specific terminal to a specific host, you can @@ -55,7 +57,7 @@ # so this may not work in all environments. # -* CHOOSER BROADCAST #any indirect host can get a chooser +#* CHOOSER BROADCAST #any indirect host can get a chooser # # If you'd prefer to configure the set of hosts each terminal sees, diff --git a/config/Xservers.ws.cpp b/config/Xservers.ws.cpp index 6153daf..0041178 100644 --- a/config/Xservers.ws.cpp +++ b/config/Xservers.ws.cpp @@ -10,4 +10,4 @@ XCOMM you can add them here as well. Each X terminal line should XCOMM look like: XCOMM XTerminalName:0 foreign XCOMM -:0 local BINDIR/X +:0 local BINDIR/X DEFAULTVT diff --git a/config/xdm-config.cpp b/config/xdm-config.cpp index 0f81104..b83ccb7 100644 --- a/config/xdm-config.cpp +++ b/config/xdm-config.cpp @@ -1,14 +1,20 @@ ! $Xorg: xdm-conf.cpp,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ -DisplayManager.errorLogFile: XDMDIR/xdm-errors -DisplayManager.pidFile: XDMDIR/xdm-pid +! +! +! +! +! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.10 2002/11/30 19:11:32 herrb Exp $ +! +DisplayManager.errorLogFile: XDMLOGDIR/xdm.log +DisplayManager.pidFile: XDMPIDDIR/xdm.pid DisplayManager.keyFile: XDMDIR/xdm-keys DisplayManager.servers: XDMDIR/Xservers DisplayManager.accessFile: XDMDIR/Xaccess +DisplayManager.willing: SU nobody -c XDMDIR/Xwilling ! All displays should use authorization, but we cannot be sure -! X terminals will be configured that way, so by default -! use authorization only for local displays :0, :1, etc. -DisplayManager._0.authorize: true -DisplayManager._1.authorize: true +! X terminals may not be configured that way, so they will require +! individual resource settings. +DisplayManager*authorize: true ! The following three resources set up display :0 as the console. DisplayManager._0.setup: XDMDIR/Xsetup_0 DisplayManager._0.startup: XDMDIR/GiveConsole @@ -16,4 +22,10 @@ DisplayManager._0.reset: XDMDIR/TakeConsole ! DisplayManager*resources: XDMDIR/Xresources DisplayManager*session: XDMDIR/Xsession -DisplayManager*authComplain: false +DisplayManager*authComplain: true +#ifdef XPM +DisplayManager*loginmoveInterval: 10 +#endif /* XPM */ +! SECURITY: do not listen for XDMCP or Chooser requests +! Comment out this line if you want to manage X terminals with xdm +DisplayManager.requestPort: 0 diff --git a/daemon.c b/daemon.c index 937240c..8bfa0de 100644 --- a/daemon.c +++ b/daemon.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/daemon.c,v 3.20 2002/12/04 16:53:39 tsi Exp $ */ /* * xdm - display manager daemon @@ -33,35 +34,42 @@ from The Open Group. */ #include +#include +#include +#include +#include + +#ifndef __GLIBC__ +# if defined(__osf__) || \ + defined(__GNU__) || \ + defined(__CYGWIN__) || \ + defined(linux) +# define setpgrp setpgid +# endif +#endif -#if defined(SVR4) || defined(USG) -#include +#if defined(SVR4) || defined(USG) || defined(__GLIBC__) +# include #else -#include -#endif -#if defined(__osf__) || defined(linux) -#define setpgrp setpgid +# include #endif #ifdef hpux -#include -#endif -#include -#ifdef X_NOT_STDC_ENV -extern int errno; +# include #endif -#include + #ifdef X_NOT_POSIX -#define Pid_t int +# define Pid_t int #else -#define Pid_t pid_t +# define Pid_t pid_t #endif -extern void exit (); +#include "dm.h" +#include "dm_error.h" -BecomeOrphan () +void +BecomeOrphan (void) { Pid_t child_id; - int stat; /* * fork so that the process goes into the background automatically. Also @@ -72,70 +80,81 @@ BecomeOrphan () * killed when the init script that's running xdm exits. */ - child_id = fork(); + child_id = fork (); switch (child_id) { case 0: /* child */ break; case -1: /* error */ - LogError("daemon fork failed, errno = %d\n", errno); + LogError ("daemon fork failed, errno = %d\n", errno); break; - default: + default: { /* parent */ -#if defined(SVR4) - stat = setpgid(child_id, child_id); - /* This gets error EPERM. Why? */ +#if defined(CSRG_BASED) || defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) || defined(__GLIBC__) +#if defined(SVR4) || defined(__QNXNTO__) + /* This gets error EPERM. Why? */ + int stat = setpgid(child_id, child_id); +#elif defined(SYSV) + /* don't know how to set child's process group */ + int stat = 0; +#elif defined(__GLIBC__) + int stat = setpgrp (); #else -#if defined(SYSV) - stat = 0; /* don't know how to set child's process group */ -#else - stat = setpgrp(child_id, child_id); - if (stat != 0) - LogError("setting process grp for daemon failed, errno = %d\n", - errno); -#endif + int stat = setpgrp (child_id, child_id); #endif + if (stat != 0) + LogError ("setting process group for daemon failed: %s\n", + strerror(errno)); +#endif /* ! (CSRG_BASED || SYSV || SVR4 || __QNXNTO__ || __GLIBC__) */ + } exit (0); } } -BecomeDaemon () +void +BecomeDaemon (void) { - register int i; - /* * Close standard file descriptors and get rid of controlling tty */ -#if defined(SYSV) || defined(SVR4) - setpgrp (); + /* If our C library has the daemon() function, just use it. */ +#if defined(__GLIBC__) || defined(CSRG_BASED) + daemon (0, 0); #else - setpgrp (0, getpid()); -#endif + int i; + +# if defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) + setpgrp (); +# else + setpgrp (0, getpid ()); +# endif - close (0); + close (0); close (1); close (2); -#if !((defined(SYSV) || defined(SVR4)) && defined(i386)) +# if !defined(__UNIXOS2__) && !defined(__CYGWIN__) +# if !((defined(SYSV) || defined(SVR4)) && defined(i386)) if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ -#if defined(USG) && defined(TCCLRCTTY) +# if defined(USG) && defined(TCCLRCTTY) int zero = 0; (void) ioctl (i, TCCLRCTTY, &zero); -#else -#if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) +# else +# if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) int zero = 0; (void) ioctl (i, TIOCTTY, &zero); -#else +# else (void) ioctl (i, TIOCNOTTY, (char *) 0); /* detach, BSD style */ -#endif -#endif +# endif +# endif (void) close (i); } -#endif /* !i386 */ +# endif /* !((SYSV || SVR4) && i386) */ +# endif /* !__UNIXOS2__ && !__CYGWIN__*/ /* * Set up the standard file descriptors. @@ -143,4 +162,5 @@ BecomeDaemon () (void) open ("/", O_RDONLY); /* root inode already in core */ (void) dup2 (0, 1); (void) dup2 (0, 2); +#endif } diff --git a/dm.c b/dm.c index 4cdbbc0..09834e6 100644 --- a/dm.c +++ b/dm.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.21 2002/12/07 20:31:04 herrb Exp $ */ /* * xdm - display manager daemon @@ -35,6 +36,8 @@ from The Open Group. */ # include "dm.h" +# include "dm_auth.h" +# include "dm_error.h" # include #ifdef X_POSIX_C_SOURCE @@ -50,6 +53,9 @@ from The Open Group. #undef _POSIX_SOURCE #endif #endif +#ifdef __NetBSD__ +#include +#endif #ifndef sigmask #define sigmask(m) (1 << ((m - 1))) @@ -58,13 +64,7 @@ from The Open Group. # include # include # include -#if NeedVarargsPrototypes -# include -# define Va_start(a,b) va_start(a,b) -#else -# include -# define Va_start(a,b) va_start(a) -#endif +# include #ifndef F_TLOCK #ifndef X_NOT_POSIX @@ -72,23 +72,22 @@ from The Open Group. #endif #endif -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - -#ifdef SVR4 +#if defined(SVR4) && !defined(SCO) extern FILE *fdopen(); #endif -static void RescanServers (); -static void ScanServers (); +static SIGVAL StopAll (int n), RescanNotify (int n); +static void RescanServers (void); +static void RestartDisplay (struct display *d, int forceReserver); +static void ScanServers (void); +static void SetAccessFileTime (void); +static void SetConfigFileTime (void); +static void StartDisplays (void); +static void TerminateProcess (int pid, int signal); + int Rescan; static long ServersModTime, ConfigModTime, AccessFileModTime; -static SIGVAL StopAll (), RescanNotify (); -void StopDisplay (); -static void RestartDisplay (); -static void StartDisplays (); int nofork_session = 0; @@ -98,14 +97,15 @@ static int TitleLen; #endif #ifndef UNRELIABLE_SIGNALS -static SIGVAL ChildNotify (); +static SIGVAL ChildNotify (int n); #endif +static int StorePid (void); + static int parent_pid = -1; /* PID of parent xdm process */ -main (argc, argv) -int argc; -char **argv; +int +main (int argc, char **argv) { int oldpid, oldumask; char cmdbuf[1024]; @@ -153,7 +153,8 @@ char **argv; if (nofork_session == 0) { /* Clean up any old Authorization files */ - sprintf(cmdbuf, "/bin/rm -f %s/authdir/authfiles/A*", authDir); + /* AUD: all good? */ + snprintf(cmdbuf, sizeof(cmdbuf), "/bin/rm -f %s/authdir/authfiles/A*", authDir); system(cmdbuf); } @@ -207,18 +208,20 @@ char **argv; /* ARGSUSED */ static SIGVAL -RescanNotify (n) - int n; +RescanNotify (int n) { + int olderrno = errno; + Debug ("Caught SIGHUP\n"); Rescan = 1; #ifdef SIGNALS_RESET_WHEN_CAUGHT (void) Signal (SIGHUP, RescanNotify); #endif + errno = olderrno; } static void -ScanServers () +ScanServers (void) { char lineBuf[10240]; int len; @@ -260,14 +263,13 @@ ScanServers () } static void -MarkDisplay (d) -struct display *d; +MarkDisplay (struct display *d) { d->state = MissingEntry; } static void -RescanServers () +RescanServers (void) { Debug ("rescanning servers\n"); LogInfo ("Rescanning both config and servers files\n"); @@ -283,7 +285,8 @@ RescanServers () StartDisplays (); } -SetConfigFileTime () +static void +SetConfigFileTime (void) { struct stat statb; @@ -291,7 +294,8 @@ SetConfigFileTime () ConfigModTime = statb.st_mtime; } -SetAccessFileTime () +static void +SetAccessFileTime (void) { struct stat statb; @@ -299,8 +303,8 @@ SetAccessFileTime () AccessFileModTime = statb.st_mtime; } -static -RescanIfMod () +static void +RescanIfMod (void) { struct stat statb; @@ -346,9 +350,10 @@ RescanIfMod () /* ARGSUSED */ static SIGVAL -StopAll (n) - int n; +StopAll (int n) { + int olderrno = errno; + if (parent_pid != getpid()) { /* @@ -361,6 +366,7 @@ StopAll (n) Debug ("Child xdm caught SIGTERM before it remove that signal.\n"); (void) Signal (n, SIG_DFL); TerminateProcess (getpid(), SIGTERM); + errno = olderrno; return; } Debug ("Shutting down entire manager\n"); @@ -373,6 +379,7 @@ StopAll (n) (void) Signal (SIGTERM, StopAll); (void) Signal (SIGINT, StopAll); #endif + errno = olderrno; } /* @@ -385,19 +392,25 @@ int ChildReady; #ifndef UNRELIABLE_SIGNALS /* ARGSUSED */ static SIGVAL -ChildNotify (n) - int n; +ChildNotify (int n) { + int olderrno = errno; + ChildReady = 1; +#ifdef ISC + (void) Signal (SIGCHLD, ChildNotify); +#endif + errno = olderrno; } #endif -WaitForChild () +void +WaitForChild (void) { int pid; struct display *d; waitType status; -#ifndef X_NOT_POSIX +#if !defined(X_NOT_POSIX) && !defined(__UNIXOS2__) sigset_t mask, omask; #else int omask; @@ -412,10 +425,11 @@ WaitForChild () sigaddset(&mask, SIGCHLD); sigaddset(&mask, SIGHUP); sigprocmask(SIG_BLOCK, &mask, &omask); + Debug ("signals blocked\n"); #else omask = sigblock (sigmask (SIGCHLD) | sigmask (SIGHUP)); -#endif Debug ("signals blocked, mask was 0x%x\n", omask); +#endif if (!ChildReady && !Rescan) #ifndef X_NOT_POSIX sigsuspend(&omask); @@ -493,13 +507,30 @@ WaitForChild () StopDisplay(d); else RestartDisplay (d, TRUE); + { + Time_t Time; + time(&Time); + Debug("time %i %i\n",Time,d->lastCrash); + if (d->lastCrash && + ((Time - d->lastCrash) < XDM_BROKEN_INTERVAL)) { + Debug("Server crash frequency too high:" + " removing display %s\n",d->name); + LogError("Server crash rate too high:" + " removing display %s\n",d->name); + RemoveDisplay (d); + } else + d->lastCrash = Time; + } break; case waitCompose (SIGTERM,0,0): - d->startTries = 0; - Debug ("Display exited on SIGTERM\n"); - if (d->displayType.origin == FromXDMCP || d->status == zombie) + Debug ("Display exited on SIGTERM, try %d of %d\n", + d->startTries, d->startAttempts); + if (d->displayType.origin == FromXDMCP || + d->status == zombie || + ++d->startTries >= d->startAttempts) { + LogError ("Display %s is being disabled\n", d->name); StopDisplay(d); - else + } else RestartDisplay (d, TRUE); break; case REMANAGE_DISPLAY: @@ -531,13 +562,13 @@ WaitForChild () d->status = notRunning; break; case running: - Debug ("Server for display %s terminated unexpectedly, status %d\n", d->name, waitVal (status)); + Debug ("Server for display %s terminated unexpectedly, status %d %d\n", d->name, waitVal (status), status); LogError ("Server for display %s terminated unexpectedly: %d\n", d->name, waitVal (status)); if (d->pid != -1) { Debug ("Terminating session pid %d\n", d->pid); TerminateProcess (d->pid, SIGTERM); - } + } break; case notRunning: Debug ("Server exited for notRunning session on display %s\n", d->name); @@ -553,8 +584,7 @@ WaitForChild () } static void -CheckDisplayStatus (d) -struct display *d; +CheckDisplayStatus (struct display *d) { if (d->displayType.origin == FromFile) { @@ -573,14 +603,13 @@ struct display *d; } static void -StartDisplays () +StartDisplays (void) { ForEachDisplay (CheckDisplayStatus); } void -StartDisplay (d) -struct display *d; +StartDisplay (struct display *d) { int pid; @@ -651,7 +680,8 @@ struct display *d; } } -TerminateProcess (pid, signal) +static void +TerminateProcess (int pid, int signal) { kill (pid, signal); #ifdef SIGCONT @@ -664,8 +694,7 @@ TerminateProcess (pid, signal) */ void -StopDisplay (d) - struct display *d; +StopDisplay (struct display *d) { if (d->serverPid != -1) d->status = zombie; /* be careful about race conditions */ @@ -682,9 +711,7 @@ StopDisplay (d) */ static void -RestartDisplay (d, forceReserver) - struct display *d; - int forceReserver; +RestartDisplay (struct display *d, int forceReserver) { if (d->serverPid != -1 && (forceReserver || d->terminateServer)) { @@ -700,16 +727,16 @@ RestartDisplay (d, forceReserver) static FD_TYPE CloseMask; static int max; -RegisterCloseOnFork (fd) -int fd; +void +RegisterCloseOnFork (int fd) { FD_SET (fd, &CloseMask); if (fd > max) max = fd; } -ClearCloseOnFork (fd) -int fd; +void +ClearCloseOnFork (int fd) { FD_CLR (fd, &CloseMask); if (fd == max) { @@ -720,13 +747,16 @@ int fd; } } -CloseOnFork () +void +CloseOnFork (void) { int fd; for (fd = 0; fd <= max; fd++) if (FD_ISSET (fd, &CloseMask)) + { close (fd); + } FD_ZERO (&CloseMask); max = 0; } @@ -734,12 +764,13 @@ CloseOnFork () static int pidFd; static FILE *pidFilePtr; -StorePid () +static int +StorePid (void) { int oldpid; if (pidFile[0] != '\0') { - pidFd = open (pidFile, 2); + pidFd = open (pidFile, O_RDWR); if (pidFd == -1 && errno == ENOENT) pidFd = open (pidFile, O_RDWR|O_CREAT, 0666); if (pidFd == -1 || !(pidFilePtr = fdopen (pidFd, "r+"))) @@ -788,14 +819,16 @@ StorePid () #endif #endif } - fprintf (pidFilePtr, "%5d\n", getpid ()); + fprintf (pidFilePtr, "%5ld\n", (long)getpid ()); (void) fflush (pidFilePtr); RegisterCloseOnFork (pidFd); } return 0; } -UnlockPidFile () +#if 0 +void +UnlockPidFile (void) { if (lockPidFile) #ifdef F_SETLK @@ -816,15 +849,10 @@ UnlockPidFile () close (pidFd); fclose (pidFilePtr); } - -#if NeedVarargsPrototypes -SetTitle (char *name, ...) -#else -/*VARARGS*/ -SetTitle (name, va_alist) -char *name; -va_dcl #endif + +#ifndef HAS_SETPROCTITLE +void SetTitle (char *name, ...) { #ifndef NOXDMTITLE char *p = Title; @@ -832,7 +860,7 @@ va_dcl char *s; va_list args; - Va_start(args,name); + va_start(args,name); *p++ = '-'; --left; s = name; @@ -853,3 +881,4 @@ va_dcl va_end(args); #endif } +#endif diff --git a/dm.h b/dm.h index 801ceab..1df6f88 100644 --- a/dm.h +++ b/dm.h @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.29 2002/05/31 18:46:10 dawes Exp $ */ /* * xdm - display manager daemon @@ -36,25 +37,26 @@ from The Open Group. * public interfaces for greet/verify functionality */ +#ifndef _DM_H_ +#define _DM_H_ 1 + #include #include #include #include +#include #if defined(X_POSIX_C_SOURCE) #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include #include #undef _POSIX_C_SOURCE -#elif defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) -#include -#include #else -#define _POSIX_SOURCE #include #include -#undef _POSIX_SOURCE #endif +#include +#define Time_t time_t /* If XDMCP symbol defined, compile to run XDMCP protocol */ @@ -73,6 +75,10 @@ from The Open Group. #include #else #define _POSIX_SOURCE +#ifdef SCO325 +#include +#include +#endif #include #undef _POSIX_SOURCE #endif @@ -95,6 +101,21 @@ typedef union wait waitType; #endif #endif /* X_NOT_POSIX */ +#ifdef USE_PAM +#include +#endif + +#ifdef CSRG_BASED +#include +#ifdef HAS_SETUSERCONTEXT +#include +#include +#ifdef USE_BSDAUTH +#include +#endif +#endif +#endif + # define waitCompose(sig,core,code) ((sig) * 256 + (core) * 128 + (code)) # define waitVal(w) waitCompose(waitSig(w), waitCore(w), waitCode(w)) @@ -135,7 +156,7 @@ typedef struct displayType { # define FromFile 1 # define FromXDMCP 0 -extern DisplayType parseDisplayType (); +extern DisplayType parseDisplayType (char *string, int *usedDefault); typedef enum fileState { NewEntry, OldEntry, MissingEntry } FileState; @@ -153,7 +174,7 @@ struct display { int serverPid; /* process id of server (-1 if none) */ FileState state; /* state during HUP processing */ int startTries; /* current start try */ - + Time_t lastCrash; /* time of last crash */ #ifdef XDMCP /* XDMCP state */ CARD32 sessionID; /* ID of active session */ @@ -212,12 +233,16 @@ struct display { int version; /* to keep dynamic greeter clued in */ /* add new fields only after here. And preferably at the end. */ + + /* Hack for making "Willing to manage" configurable */ + char *willing; /* "Willing to manage" program */ }; #ifdef XDMCP #define PROTO_TIMEOUT (30 * 60) /* 30 minutes should be long enough */ - +#define XDM_BROKEN_INTERVAL (120) /* server crashing more than once within */ + /* two minutes is assumed to be broken! */ struct protoDisplay { struct protoDisplay *next; XdmcpNetaddr address; /* UDP address */ @@ -242,15 +267,19 @@ struct greet_info { char *passwd; /* binary compat with DEC */ int version; /* for dynamic greeter to see */ /* add new fields below this line, and preferably at the end */ + Boolean allow_null_passwd; /* allow null password on login */ + Boolean allow_root_login; /* allow direct root login */ }; /* setgroups is not covered by POSIX, arg type varies */ -#if defined(SYSV) || defined(SVR4) || defined(__osf__) || defined(linux) +#if defined(SYSV) || defined(SVR4) || defined(__osf__) || defined(linux) || defined(__GNU__) #define GID_T gid_t #else #define GID_T int #endif +typedef void (*ChooserFunc)(CARD16 connectionType, ARRAY8Ptr addr, char *closure); + struct verify_info { int uid; /* user id */ int gid; /* group id */ @@ -291,38 +320,153 @@ extern char *accessFile; extern char **exportList; extern char *randomFile; extern char *greeterLib; +extern char *willing; extern int choiceTimeout; /* chooser choice timeout */ -extern struct display *FindDisplayByName (), - *FindDisplayBySessionID (), - *FindDisplayByAddress (), - *FindDisplayByPid (), - *FindDisplayByServerPid (), - *NewDisplay (); +extern struct display *FindDisplayByName (char *name), + *FindDisplayBySessionID (CARD32 sessionID), + *FindDisplayByAddress (XdmcpNetaddr addr, int addrlen, CARD16 displayNumber), + *FindDisplayByPid (int pid), + *FindDisplayByServerPid (int serverPid), + *NewDisplay (char *name, char *class); + +extern struct protoDisplay *FindProtoDisplay ( + XdmcpNetaddr address, + int addrlen, + CARD16 displayNumber); +extern struct protoDisplay *NewProtoDisplay ( + XdmcpNetaddr address, + int addrlen, + CARD16 displayNumber, + CARD16 connectionType, + ARRAY8Ptr connectionAddress, + CARD32 sessionID); + +/* in Login.c */ +extern void DrawFail (Widget ctx); + +/* in access.c */ +extern ARRAY8Ptr getLocalAddress (void); +extern int AcceptableDisplayAddress (ARRAY8Ptr clientAddress, CARD16 connectionType, xdmOpCode type); +extern int ForEachMatchingIndirectHost (ARRAY8Ptr clientAddress, CARD16 connectionType, ChooserFunc function, char *closure); +extern int ScanAccessDatabase (void); +extern int UseChooser (ARRAY8Ptr clientAddress, CARD16 connectionType); +extern void ForEachChooserHost (ARRAY8Ptr clientAddress, CARD16 connectionType, ChooserFunc function, char *closure); + +/* in choose.c */ +extern ARRAY8Ptr IndirectChoice (ARRAY8Ptr clientAddress, CARD16 connectionType); +extern int IsIndirectClient (ARRAY8Ptr clientAddress, CARD16 connectionType); +extern int RememberIndirectClient (ARRAY8Ptr clientAddress, CARD16 connectionType); +extern void ForgetIndirectClient ( ARRAY8Ptr clientAddress, CARD16 connectionType); +extern void ProcessChooserSocket (int fd); + +/* in chooser.c */ +extern void RunChooser (struct display *d); + +/* in daemon.c */ +extern void BecomeDaemon (void); +extern void BecomeOrphan (void); -extern struct protoDisplay *FindProtoDisplay (), - *NewProtoDisplay (); - -extern char *localHostname (); +/* in dm.c */ +extern void CloseOnFork (void); +extern void RegisterCloseOnFork (int fd); +extern void StartDisplay (struct display *d); +#ifndef HAS_SETPROCTITLE +extern void SetTitle (char *name, ...); +#endif -/* in xdmcp.c */ -extern void init_session_id(); -extern void registerHostname(); +/* in dpylist.c */ +extern int AnyDisplaysLeft (void); +extern void ForEachDisplay (void (*f)(struct display *)); +extern void RemoveDisplay (struct display *old); -/* in dm.c */ -extern void StartDisplay(); +/* in file.c */ +extern void ParseDisplay (char *source, DisplayType *acceptableTypes, int numAcceptable); -/* in session.c */ -extern void execute(); +/* in netaddr.c */ +extern char *NetaddrAddress(XdmcpNetaddr netaddrp, int *lenp); +extern char *NetaddrPort(XdmcpNetaddr netaddrp, int *lenp); +extern int ConvertAddr (XdmcpNetaddr saddr, int *len, char **addr); +extern int NetaddrFamily (XdmcpNetaddr netaddrp); +extern int addressEqual (XdmcpNetaddr a1, int len1, XdmcpNetaddr a2, int len2); -/* in auth.c */ -extern void SetLocalAuthorization(); -extern void SetUserAuthorization(); -extern void RemoveUserAuthorization(); -extern void CleanUpFileName(); +/* in policy.c */ +#if 0 +extern ARRAY8Ptr Accept (/* struct sockaddr *from, int fromlen, CARD16 displayNumber */); +#endif +extern ARRAY8Ptr ChooseAuthentication (ARRAYofARRAY8Ptr authenticationNames); +extern int CheckAuthentication (struct protoDisplay *pdpy, ARRAY8Ptr displayID, ARRAY8Ptr name, ARRAY8Ptr data); +extern int SelectAuthorizationTypeIndex (ARRAY8Ptr authenticationName, ARRAYofARRAY8Ptr authorizationNames); +extern int SelectConnectionTypeIndex (ARRAY16Ptr connectionTypes, ARRAYofARRAY8Ptr connectionAddresses); +extern int Willing (ARRAY8Ptr addr, CARD16 connectionType, ARRAY8Ptr authenticationName, ARRAY8Ptr status, xdmOpCode type); /* in protodpy.c */ -extern void DisposeProtoDisplay(); +extern void DisposeProtoDisplay(struct protoDisplay *pdpy); + +/* in reset.c */ +extern void pseudoReset (Display *dpy); + +/* in resource.c */ +extern void InitResources (int argc, char **argv); +extern void LoadDMResources (void); +extern void LoadServerResources (struct display *d); +extern void LoadSessionResources (struct display *d); +extern void ReinitResources (void); + +/* in session.c */ +#ifdef USE_PAM +extern pam_handle_t **thepamhp(void); +extern pam_handle_t *thepamh(void); +#endif +extern char **defaultEnv (void); +extern char **systemEnv (struct display *d, char *user, char *home); +extern int PingServer(struct display *d, Display *alternateDpy); +extern int source (char **environ, char *file); +extern void ClearCloseOnFork (int fd); +extern void DeleteXloginResources (struct display *d, Display *dpy); +extern void LoadXloginResources (struct display *d); +extern void ManageSession (struct display *d); +extern void SecureDisplay (struct display *d, Display *dpy); +extern void SessionExit (struct display *d, int status, int removeAuth); +extern void SessionPingFailed (struct display *d); +extern void SetupDisplay (struct display *d); +extern void UnsecureDisplay (struct display *d, Display *dpy); +extern void execute(char **argv, char **environ); + +/* server.c */ +extern char *_SysErrorMsg (int n); +extern int StartServer (struct display *d); +extern int WaitForServer (struct display *d); +extern void ResetServer (struct display *d); + +/* socket.c */ +extern int GetChooserAddr (char *addr, int *lenp); +extern void CreateWellKnownSockets (void); + +/* in util.c */ +extern char *localHostname (void); +extern char **parseArgs (char **argv, char *string); +extern char **setEnv (char **e, char *name, char *value); +extern char **putEnv(const char *string, char **env); +extern char *getEnv (char **e, char *name); +extern void CleanUpChild (void); +extern void freeArgs (char **argv); +extern void freeEnv (char **env); +extern void printEnv (char **e); + +/* in verify.c */ +extern int Verify (struct display *d, struct greet_info *greet, struct verify_info *verify); + +/* in xdmcp.c */ +extern char *NetworkAddressToHostname (CARD16 connectionType, ARRAY8Ptr connectionAddress); +extern int AnyWellKnownSockets (void); +extern void DestroyWellKnownSockets (void); +extern void SendFailed (struct display *d, char *reason); +extern void StopDisplay (struct display *d); +extern void WaitForChild (void); +extern void WaitForSomething (void); +extern void init_session_id(void); +extern void registerHostname(char *name, int namelen); /* * CloseOnFork flags @@ -331,11 +475,7 @@ extern void DisposeProtoDisplay(); # define CLOSE_ALWAYS 0 # define LEAVE_FOR_DISPLAY 1 -#ifndef X_NOT_STDC_ENV #include -#else -char *malloc(), *realloc(); -#endif #if defined(X_NOT_POSIX) && defined(SIGNALRETURNSINT) #define SIGVAL int @@ -343,8 +483,8 @@ char *malloc(), *realloc(); #define SIGVAL void #endif -#ifdef X_NOT_POSIX -#ifdef SYSV +#if defined(X_NOT_POSIX) || defined(__UNIXOS2__) || defined(__NetBSD__) && defined(__sparc__) +#if defined(SYSV) || defined(__UNIXOS2__) #define SIGNALS_RESET_WHEN_CAUGHT #define UNRELIABLE_SIGNALS #endif @@ -357,4 +497,8 @@ char *malloc(), *realloc(); #define Jmp_buf sigjmp_buf #endif -SIGVAL (*Signal())(); +typedef SIGVAL (*SIGFUNC)(int); + +SIGVAL (*Signal(int, SIGFUNC Handler))(int); + +#endif /* _DM_H_ */ diff --git a/dpylist.c b/dpylist.c index 6dcaafa..cbd8009 100644 --- a/dpylist.c +++ b/dpylist.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/dpylist.c,v 1.5 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon @@ -35,16 +36,18 @@ from The Open Group. */ # include "dm.h" +# include "dm_error.h" static struct display *displays; -AnyDisplaysLeft () +int +AnyDisplaysLeft (void) { return displays != (struct display *) 0; } -ForEachDisplay (f) - void (*f)(); +void +ForEachDisplay (void (*f)(struct display *)) { struct display *d, *next; @@ -55,8 +58,7 @@ ForEachDisplay (f) } struct display * -FindDisplayByName (name) -char *name; +FindDisplayByName (char *name) { struct display *d; @@ -67,8 +69,7 @@ char *name; } struct display * -FindDisplayByPid (pid) -int pid; +FindDisplayByPid (int pid) { struct display *d; @@ -79,8 +80,7 @@ int pid; } struct display * -FindDisplayByServerPid (serverPid) -int serverPid; +FindDisplayByServerPid (int serverPid) { struct display *d; @@ -93,8 +93,7 @@ int serverPid; #ifdef XDMCP struct display * -FindDisplayBySessionID (sessionID) - CARD32 sessionID; +FindDisplayBySessionID (CARD32 sessionID) { struct display *d; @@ -105,10 +104,7 @@ FindDisplayBySessionID (sessionID) } struct display * -FindDisplayByAddress (addr, addrlen, displayNumber) - XdmcpNetaddr addr; - int addrlen; - CARD16 displayNumber; +FindDisplayByAddress (XdmcpNetaddr addr, int addrlen, CARD16 displayNumber) { struct display *d; @@ -126,8 +122,8 @@ FindDisplayByAddress (addr, addrlen, displayNumber) #define IfFree(x) if (x) free ((char *) x) -RemoveDisplay (old) -struct display *old; +void +RemoveDisplay (struct display *old) { struct display *d, *p; char **x; @@ -184,9 +180,7 @@ struct display *old; } struct display * -NewDisplay (name, class) -char *name; -char *class; +NewDisplay (char *name, char *class) { struct display *d; @@ -250,6 +244,7 @@ char *class; d->openTimeout = 0; d->startAttempts = 0; d->startTries = 0; + d->lastCrash = 0; d->terminateServer = 0; d->grabTimeout = 0; #ifdef XDMCP @@ -268,7 +263,3 @@ char *class; displays = d; return d; } - - - - diff --git a/error.c b/error.c index f80468f..6c53ec6 100644 --- a/error.c +++ b/error.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/error.c,v 1.7 2002/10/09 16:38:20 tsi Exp $ */ /* * xdm - display manager daemon @@ -37,114 +38,73 @@ from The Open Group. * we generally do not have a terminal to talk to */ -# include "dm.h" # include -#if NeedVarargsPrototypes # include -#else -/* this type needs to be big enough to contain int or pointer */ -typedef long Fmtarg_t; -#endif - -/*VARARGS1*/ -LogInfo( -#if NeedVarargsPrototypes - char * fmt, ...) -#else - fmt, arg1, arg2, arg3, arg4, arg5, arg6) - char *fmt; - Fmtarg_t arg1, arg2, arg3, arg4, arg5, arg6; -#endif + +# include "dm.h" +# include "dm_error.h" + +#define WRITES(fd, buf) write(fd, buf, strlen(buf)) + +void LogInfo(char * fmt, ...) { - fprintf (stderr, "xdm info (pid %d): ", getpid()); -#if NeedVarargsPrototypes + char buf[1024]; + + snprintf(buf, sizeof buf, "xdm info (pid %ld): ", (long)getpid()); + WRITES(STDERR_FILENO, buf); { va_list args; va_start(args, fmt); - vfprintf (stderr, fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); } -#else - fprintf (stderr, fmt, arg1, arg2, arg3, arg4, arg5, arg6); -#endif - fflush (stderr); + WRITES(STDERR_FILENO, buf); } -/*VARARGS1*/ -LogError ( -#if NeedVarargsPrototypes - char * fmt, ...) -#else - fmt, arg1, arg2, arg3, arg4, arg5, arg6) - char *fmt; - Fmtarg_t arg1, arg2, arg3, arg4, arg5, arg6; -#endif +void LogError (char * fmt, ...) { - fprintf (stderr, "xdm error (pid %d): ", getpid()); -#if NeedVarargsPrototypes + char buf[1024]; + + snprintf (buf, sizeof buf, "xdm error (pid %ld): ", (long)getpid()); + WRITES(STDERR_FILENO, buf); { va_list args; va_start(args, fmt); - vfprintf (stderr, fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); } -#else - fprintf (stderr, fmt, arg1, arg2, arg3, arg4, arg5, arg6); -#endif - fflush (stderr); + WRITES(STDERR_FILENO, buf); } -/*VARARGS1*/ -LogPanic ( -#if NeedVarargsPrototypes - char * fmt, ...) -#else - fmt, arg1, arg2, arg3, arg4, arg5, arg6) - char *fmt; - Fmtarg_t arg1, arg2, arg3, arg4, arg5, arg6; -#endif +void LogPanic (char * fmt, ...) { - fprintf (stderr, "xdm panic (pid %d): ", getpid()); -#if NeedVarargsPrototypes + char buf[1024]; + + snprintf (buf, sizeof buf, "xdm panic (pid %ld): ", (long)getpid()); + WRITES(STDERR_FILENO, buf); { va_list args; va_start(args, fmt); - vfprintf (stderr, fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); } -#else - fprintf (fmt, arg1, arg2, arg3, arg4, arg5, arg6); -#endif - fflush (stderr); - exit (1); + WRITES(STDERR_FILENO, buf); + _exit (1); } -/*VARARGS1*/ -LogOutOfMem ( -#if NeedVarargsPrototypes - char * fmt, ...) -#else - fmt, arg1, arg2, arg3, arg4, arg5, arg6) - char *fmt; - Fmtarg_t arg1, arg2, arg3, arg4, arg5, arg6; -#endif +void LogOutOfMem (char * fmt, ...) { fprintf (stderr, "xdm: out of memory in routine "); -#if NeedVarargsPrototypes { va_list args; va_start(args, fmt); vfprintf (stderr, fmt, args); va_end(args); } -#else - fprintf (stderr, fmt, arg1, arg2, arg3, arg4, arg5, arg6); -#endif fflush (stderr); } -Panic (mesg) -char *mesg; +void Panic (char *mesg) { int i; @@ -155,31 +115,21 @@ char *mesg; } -/*VARARGS1*/ -Debug ( -#if NeedVarargsPrototypes - char * fmt, ...) -#else - fmt, arg1, arg2, arg3, arg4, arg5, arg6) - char *fmt; - Fmtarg_t arg1, arg2, arg3, arg4, arg5, arg6; -#endif +void Debug (char * fmt, ...) { + char buf[1024]; + if (debugLevel > 0) { -#if NeedVarargsPrototypes va_list args; va_start(args, fmt); - vprintf (fmt, args); + vsnprintf (buf, sizeof buf, fmt, args); va_end(args); -#else - printf (fmt, arg1, arg2, arg3, arg4, arg5, arg6); -#endif - fflush (stdout); + WRITES(STDOUT_FILENO, buf); } } -InitErrorLog () +void InitErrorLog (void) { int i; if (errorLogFile[0]) { diff --git a/file.c b/file.c index 547b739..49b2217 100644 --- a/file.c +++ b/file.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/file.c,v 1.6 2001/12/14 20:01:21 dawes Exp $ */ /* * xdm - display manager daemon @@ -35,10 +36,12 @@ from The Open Group. */ # include "dm.h" +# include "dm_error.h" + # include -DisplayTypeMatch (d1, d2) -DisplayType d1, d2; +static int +DisplayTypeMatch (DisplayType d1, DisplayType d2) { return d1.location == d2.location && d1.lifetime == d2.lifetime && @@ -46,8 +49,7 @@ DisplayType d1, d2; } static void -freeArgs (args) - char **args; +freeFileArgs (char **args) { char **a; @@ -57,8 +59,7 @@ freeArgs (args) } static char ** -splitIntoWords (s) - char *s; +splitIntoWords (char *s) { char **args, **newargs; char *wordStart; @@ -87,7 +88,7 @@ splitIntoWords (s) (nargs+2)*sizeof (char *)); if (!newargs) { - freeArgs (args); + freeFileArgs (args); return NULL; } args = newargs; @@ -95,7 +96,7 @@ splitIntoWords (s) args[nargs] = malloc (s - wordStart + 1); if (!args[nargs]) { - freeArgs (args); + freeFileArgs (args); return NULL; } strncpy (args[nargs], wordStart, s - wordStart); @@ -107,8 +108,7 @@ splitIntoWords (s) } static char ** -copyArgs (args) - char **args; +copyArgs (char **args) { char **a, **new, **n; @@ -127,9 +127,8 @@ copyArgs (args) return new; } -freeSomeArgs (args, n) - char **args; - int n; +static void +freeSomeArgs (char **args, int n) { char **a; @@ -139,10 +138,8 @@ freeSomeArgs (args, n) free ((char *) args); } -ParseDisplay (source, acceptableTypes, numAcceptable) -char *source; -DisplayType *acceptableTypes; -int numAcceptable; +void +ParseDisplay (char *source, DisplayType *acceptableTypes, int numAcceptable) { char **args, **argv, **a; char *name, *class, *type; @@ -156,14 +153,14 @@ int numAcceptable; if (!args[0]) { LogError ("Missing display name in servers file\n"); - freeArgs (args); + freeFileArgs (args); return; } name = args[0]; if (!args[1]) { LogError ("Missing display type for %s\n", args[0]); - freeArgs (args); + freeFileArgs (args); return; } displayType = parseDisplayType (args[1], &usedDefault); @@ -215,7 +212,7 @@ int numAcceptable; } } Debug ("Found existing display: %s %s %s", d->name, d->class , type); - freeArgs (d->argv); + freeFileArgs (d->argv); } else { @@ -235,15 +232,13 @@ static struct displayMatch { char *name; DisplayType type; } displayTypes[] = { - "local", { Local, Permanent, FromFile }, - "foreign", { Foreign, Permanent, FromFile }, - 0, { Local, Permanent, FromFile }, + { "local", { Local, Permanent, FromFile } }, + { "foreign", { Foreign, Permanent, FromFile } }, + { 0, { Local, Permanent, FromFile } }, }; DisplayType -parseDisplayType (string, usedDefault) - char *string; - int *usedDefault; +parseDisplayType (char *string, int *usedDefault) { struct displayMatch *d; diff --git a/genauth.c b/genauth.c index a4f8ced..0568e6f 100644 --- a/genauth.c +++ b/genauth.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.15 2002/10/06 18:12:29 herrb Exp $ */ /* * xdm - display manager daemon @@ -34,18 +35,15 @@ from The Open Group. # include # include + # include "dm.h" +# include "dm_auth.h" +# include "dm_error.h" #include -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -extern int errno; -#else #include #define Time_t time_t -#endif static unsigned char key[8]; @@ -57,10 +55,8 @@ typedef struct auth_ks_struct { auth_cblock _; } auth_wrapper_schedule[16]; extern void _XdmcpWrapperToOddParity(); -static -longtochars (l, c) - long l; - unsigned char *c; +static void +longtochars (long l, unsigned char *c) { c[0] = (l >> 24) & 0xff; c[1] = (l >> 16) & 0xff; @@ -72,10 +68,9 @@ longtochars (l, c) # define FILE_LIMIT 1024 /* no more than this many buffers */ +#if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) static int -sumFile (name, sum) -char *name; -long sum[2]; +sumFile (char *name, long sum[2]) { long buf[1024*2]; int cnt; @@ -85,7 +80,7 @@ long sum[2]; int i; int ret_status = 0; - fd = open (name, 0); + fd = open (name, O_RDONLY); if (fd < 0) { LogError("Cannot open randomFile \"%s\", errno = %d\n", name, errno); return 0; @@ -109,12 +104,37 @@ long sum[2]; close (fd); return ret_status; } +#endif #ifdef HASXDMAUTH - -static -InitXdmcpWrapper () +static void +InitXdmcpWrapper (void) { + +#ifdef ARC4_RANDOM + u_int32_t sum[2]; + + sum[0] = arc4random(); + sum[1] = arc4random(); + *(u_char *)sum = 0; + + _XdmcpWrapperToOddParity(sum, key); + +#elif defined(DEV_RANDOM) + int fd; + unsigned char tmpkey[8]; + + if ((fd = open(DEV_RANDOM, O_RDONLY)) >= 0) { + if (read(fd, tmpkey, 8) == 8) { + tmpkey[0] = 0; + _XdmcpWrapperToOddParity(tmpkey, key); + close(fd); + return; + } else { + close(fd); + } + } +#else long sum[2]; unsigned char tmpkey[8]; @@ -126,6 +146,7 @@ InitXdmcpWrapper () longtochars (sum[1], tmpkey+4); tmpkey[0] = 0; _XdmcpWrapperToOddParity (tmpkey, key); +#endif } #endif @@ -138,23 +159,21 @@ InitXdmcpWrapper () static unsigned long int next = 1; static int -xdm_rand() +xdm_rand(void) { next = next * 1103515245 + 12345; return (unsigned int)(next/65536) % 32768; } static void -xdm_srand(seed) - unsigned int seed; +xdm_srand(unsigned int seed) { next = seed; } #endif /* no HASXDMAUTH */ -GenerateAuthData (auth, len) -char *auth; -int len; +void +GenerateAuthData (char *auth, int len) { long ldata[2]; @@ -168,7 +187,9 @@ int len; } #else { +#ifndef __UNIXOS2__ long time (); +#endif ldata[0] = time ((long *) 0); ldata[1] = getpid (); @@ -193,8 +214,8 @@ int len; for (i = 0; i < len; i++) { auth[i] = 0; for (bit = 1; bit < 256; bit <<= 1) { - _XdmcpAuthDoIt (data, data, schedule, 1); - if (data[0] + data[1] & 0x4) + _XdmcpAuthDoIt (data, data, schedule, 1); + if ((data[0] + data[1]) & 0x4) auth[i] |= bit; } } @@ -207,9 +228,25 @@ int len; static long localkey[2] = {0,0}; if ( (localkey[0] == 0) && (localkey[1] == 0) ) { +#ifdef ARC4_RANDOM + localkey[0] = arc4random(); + localkey[1] = arc4random(); +#elif defined(DEV_RANDOM) + int fd; + + if ((fd = open(DEV_RANDOM, O_RDONLY)) >= 0) { + if (read(fd, (char *)localkey, 8) != 8) { + localkey[0] = 1; + } + close(fd); + } else { + localkey[0] = 1; + } +#else if (!sumFile (randomFile, localkey)) { localkey[0] = 1; /* To keep from continually calling sumFile() */ } +#endif } seed = (ldata[0]+localkey[0]) + ((ldata[1]+localkey[1]) << 16); diff --git a/greet.h b/greet.h index a45d971..e826d40 100644 --- a/greet.h +++ b/greet.h @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/greet.h,v 1.8 2001/12/14 20:01:22 dawes Exp $ */ /* * greet.h - interface to xdm's dynamically-loadable modular greeter @@ -33,34 +34,60 @@ from The Open Group. #include +/* + * Do this rather than break a build over a const-mismatch + */ +#if defined(__linux__) || defined(CSRG_BASED) +#define CRYPT_ARGS const char *s1, const char *s2 +#define GETSPNAM_ARGS const char *name +#define GETPWNAM_ARGS const char *name +#else +#define CRYPT_ARGS /*unknown*/ +#define GETSPNAM_ARGS /*unknown*/ +#define GETPWNAM_ARGS /*unknown*/ +#endif + +#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__osf__) +#define SETGRENT_TYPE int +#else +#define SETGRENT_TYPE void +#endif + struct dlfuncs { - int (*_PingServer)(); - int (*_SessionPingFailed)(); - int (*_Debug)(); - int (*_RegisterCloseOnFork)(); - int (*_SecureDisplay)(); - int (*_UnsecureDisplay)(); - int (*_ClearCloseOnFork)(); - int (*_SetupDisplay)(); - int (*_LogError)(); - int (*_SessionExit)(); - int (*_DeleteXloginResources)(); - int (*_source)(); - char **(*_defaultEnv)(); - char **(*_setEnv)(); - char **(*_parseArgs)(); - int (*_printEnv)(); - char **(*_systemEnv)(); - int (*_LogOutOfMem)(); - void (*_setgrent)(); /* no longer used */ - struct group *(*_getgrent)(); /* no longer used */ - void (*_endgrent)(); /* no longer used */ + int (*_PingServer)(struct display *d, Display *alternateDpy); + void (*_SessionPingFailed)(struct display *d); + void (*_Debug)(char * fmt, ...); + void (*_RegisterCloseOnFork)(int fd); + void (*_SecureDisplay)(struct display *d, Display *dpy); + void (*_UnsecureDisplay)(struct display *d, Display *dpy); + void (*_ClearCloseOnFork)(int fd); + void (*_SetupDisplay)(struct display *d); + void (*_LogError)(char * fmt, ...); + void (*_SessionExit)(struct display *d, int status, int removeAuth); + void (*_DeleteXloginResources)(struct display *d, Display *dpy); + int (*_source)(char **environ, char *file); + char **(*_defaultEnv)(void); + char **(*_setEnv)(char **e, char *name, char *value); + char **(*_putEnv)(const char *string, char **env); + char **(*_parseArgs)(char **argv, char *string); + void (*_printEnv)(char **e); + char **(*_systemEnv)(struct display *d, char *user, char *home); + void (*_LogOutOfMem)(char * fmt, ...); + SETGRENT_TYPE (*_setgrent)(void); /* no longer used */ + struct group *(*_getgrent)(void); /* no longer used */ + void (*_endgrent)(void); /* no longer used */ #ifdef USESHADOW - struct spwd *(*_getspnam)(); - void (*_endspent)(); + struct spwd *(*_getspnam)(GETSPNAM_ARGS); + void (*_endspent)(void); +#endif + struct passwd *(*_getpwnam)(GETPWNAM_ARGS); +#ifdef linux + void (*_endpwent)(void); +#endif + char *(*_crypt)(CRYPT_ARGS); +#ifdef USE_PAM + pam_handle_t **(*_thepamhp)(void); #endif - struct passwd *(*_getpwnam)(); - char *(*_crypt)(); }; /* @@ -123,33 +150,40 @@ typedef greet_user_rtn (*GreetUserProc)( * called, with the pointer values passed as a paramter. */ -extern int (*__xdm_PingServer)(); -extern int (*__xdm_SessionPingFailed)(); -extern int (*__xdm_Debug)(); -extern int (*__xdm_RegisterCloseOnFork)(); -extern int (*__xdm_SecureDisplay)(); -extern int (*__xdm_UnsecureDisplay)(); -extern int (*__xdm_ClearCloseOnFork)(); -extern int (*__xdm_SetupDisplay)(); -extern int (*__xdm_LogError)(); -extern int (*__xdm_SessionExit)(); -extern int (*__xdm_DeleteXloginResources)(); -extern int (*__xdm_source)(); -extern char **(*__xdm_defaultEnv)(); -extern char **(*__xdm_setEnv)(); -extern char **(*__xdm_parseArgs)(); -extern int (*__xdm_printEnv)(); -extern char **(*__xdm_systemEnv)(); -extern int (*__xdm_LogOutOfMem)(); -extern void (*__xdm_setgrent)(); -extern struct group *(*__xdm_getgrent)(); -extern void (*__xdm_endgrent)(); +extern int (*__xdm_PingServer)(struct display *d, Display *alternateDpy); +extern void (*__xdm_SessionPingFailed)(struct display *d); +extern void (*__xdm_Debug)(char * fmt, ...); +extern void (*__xdm_RegisterCloseOnFork)(int fd); +extern void (*__xdm_SecureDisplay)(struct display *d, Display *dpy); +extern void (*__xdm_UnsecureDisplay)(struct display *d, Display *dpy); +extern void (*__xdm_ClearCloseOnFork)(int fd); +extern void (*__xdm_SetupDisplay)(struct display *d); +extern void (*__xdm_LogError)(char * fmt, ...); +extern void (*__xdm_SessionExit)(struct display *d, int status, int removeAuth); +extern void (*__xdm_DeleteXloginResources)(struct display *d, Display *dpy); +extern int (*__xdm_source)(char **environ, char *file); +extern char **(*__xdm_defaultEnv)(void); +extern char **(*__xdm_setEnv)(char **e, char *name, char *value); +extern char **(*__xdm_putEnv)(const char *string, char **env); +extern char **(*__xdm_parseArgs)(char **argv, char *string); +extern void (*__xdm_printEnv)(char **e); +extern char **(*__xdm_systemEnv)(struct display *d, char *user, char *home); +extern void (*__xdm_LogOutOfMem)(char * fmt, ...); +extern void (*__xdm_setgrent)(void); +extern struct group *(*__xdm_getgrent)(void); +extern void (*__xdm_endgrent)(void); #ifdef USESHADOW -extern struct spwd *(*__xdm_getspnam)(); -extern void (*__xdm_endspent)(); +extern struct spwd *(*__xdm_getspnam)(GETSPNAM_ARGS); +extern void (*__xdm_endspent)(void); +#endif +extern struct passwd *(*__xdm_getpwnam)(GETPWNAM_ARGS); +#ifdef linux +extern void (*__xdm_endpwent)(void); +#endif +extern char *(*__xdm_crypt)(CRYPT_ARGS); +#ifdef USE_PAM +extern pam_handle_t **(*__xdm_thepamhp)(void); #endif -extern struct passwd *(*__xdm_getpwnam)(); -extern char *(*__xdm_crypt)(); /* * Force the shared library to call through the function pointer @@ -167,9 +201,10 @@ extern char *(*__xdm_crypt)(); #define LogError (*__xdm_LogError) #define SessionExit (*__xdm_SessionExit) #define DeleteXloginResources (*__xdm_DeleteXloginResources) -#define source (*__xdm_source) +#define source (*__xdm_source) #define defaultEnv (*__xdm_defaultEnv) -#define setEnv (*__xdm_setEnv) +#define setEnv (*__xdm_setEnv) +#define putEnv (*__xdm_putEnv) #define parseArgs (*__xdm_parseArgs) #define printEnv (*__xdm_printEnv) #define systemEnv (*__xdm_systemEnv) @@ -181,7 +216,11 @@ extern char *(*__xdm_crypt)(); #define getspnam (*__xdm_getspnam) #define endspent (*__xdm_endspent) #endif +#ifdef linux +#define endpwent (*__xdm_endpwent) +#endif #define getpwnam (*__xdm_getpwnam) #define crypt (*__xdm_crypt) +#define thepamhp (*__xdm_thepamhp) #endif /* GREET_LIB */ diff --git a/greeter/Login.c b/greeter/Login.c index 7650774..df91b0d 100644 --- a/greeter/Login.c +++ b/greeter/Login.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.16 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon @@ -37,17 +38,40 @@ from The Open Group. # include # include # include +# include # include # include +#ifdef XPM +# include +#endif /* XPM */ # include "dm.h" +# include "dm_error.h" # include "greet.h" # include "LoginP.h" +#ifdef XPM +#include +#include +#include +#include +#include +#include +#endif /* XPM */ + +#ifdef USE_XINERAMA +#include +#endif + +static void RedrawFail (LoginWidget w); +static void ResetLogin (LoginWidget w); +static void failTimeout (XtPointer client_data, XtIntervalId * id); + #define offset(field) XtOffsetOf(LoginRec, login.field) #define goffset(field) XtOffsetOf(WidgetRec, core.field) + static XtResource resources[] = { {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), goffset(width), XtRImmediate, (XtPointer) 0}, @@ -65,6 +89,37 @@ static XtResource resources[] = { offset(greetpixel), XtRString, XtDefaultForeground}, {XtNfailColor, XtCForeground, XtRPixel, sizeof (Pixel), offset(failpixel), XtRString, XtDefaultForeground}, + +#ifdef XPM +/* added by Caolan McNamara */ + {XtNlastEventTime, XtCLastEventTime, XtRInt , sizeof (int), + offset(lastEventTime), XtRImmediate, (XtPointer)0}, +/* end (caolan) */ + +/* added by Ivan Griffin (ivan.griffin@ul.ie) */ + {XtNlogoFileName, XtCLogoFileName, XtRString, sizeof(char*), + offset(logoFileName), XtRImmediate, (XtPointer)0}, + {XtNuseShape, XtCUseShape, XtRBoolean, sizeof(Boolean), + offset(useShape), XtRImmediate, (XtPointer) True}, + {XtNlogoPadding, XtCLogoPadding, XtRInt, sizeof(int), + offset(logoPadding), XtRImmediate, (XtPointer) 5}, +/* end (ivan) */ + + +/* added by Amit Margalit */ + {XtNhiColor, XtCForeground, XtRPixel, sizeof (Pixel), + offset(hipixel), XtRString, XtDefaultForeground}, + {XtNshdColor, XtCForeground, XtRPixel, sizeof (Pixel), + offset(shdpixel), XtRString, XtDefaultForeground}, + {XtNframeWidth, XtCFrameWidth, XtRInt, sizeof(int), + offset(outframewidth), XtRImmediate, (XtPointer) 1}, + {XtNinnerFramesWidth, XtCFrameWidth, XtRInt, sizeof(int), + offset(inframeswidth), XtRImmediate, (XtPointer) 1}, + {XtNsepWidth, XtCFrameWidth, XtRInt, sizeof(int), + offset(sepwidth), XtRImmediate, (XtPointer) 1}, +/* end (amit) */ +#endif /* XPM */ + {XtNfont, XtCFont, XtRFontStruct, sizeof (XFontStruct *), offset (font), XtRString, "*-new century schoolbook-medium-r-normal-*-180-*"}, {XtNpromptFont, XtCFont, XtRFontStruct, sizeof (XFontStruct *), @@ -92,7 +147,11 @@ static XtResource resources[] = { {XtNsecureSession, XtCSecureSession, XtRBoolean, sizeof (Boolean), offset(secure_session), XtRImmediate, False }, {XtNallowAccess, XtCAllowAccess, XtRBoolean, sizeof (Boolean), - offset(allow_access), XtRImmediate, False } + offset(allow_access), XtRImmediate, False }, + {XtNallowNullPasswd, XtCAllowNullPasswd, XtRBoolean, sizeof (Boolean), + offset(allow_null_passwd), XtRImmediate, False}, + {XtNallowRootLogin, XtCAllowRootLogin, XtRBoolean, sizeof(Boolean), + offset(allow_root_login), XtRImmediate, (XtPointer) True} }; #undef offset @@ -113,22 +172,43 @@ static XtResource resources[] = { # define Y_INC(w) max (TEXT_Y_INC(w), PROMPT_Y_INC(w)) +#ifndef XPM # define LOGIN_PROMPT_W(w) (XTextWidth (w->login.promptFont,\ w->login.namePrompt,\ strlen (w->login.namePrompt))) +#else +# define LOGIN_PROMPT_W(w) (XTextWidth (w->login.promptFont,\ + w->login.namePrompt,\ + strlen (w->login.namePrompt)) + \ + w->login.inframeswidth) +#endif /* XPM */ +#ifndef XPM # define PASS_PROMPT_W(w) (XTextWidth (w->login.promptFont,\ w->login.passwdPrompt,\ strlen (w->login.passwdPrompt))) +#else +# define PASS_PROMPT_W(w) (XTextWidth (w->login.promptFont,\ + w->login.passwdPrompt,\ + strlen (w->login.passwdPrompt)) + \ + w->login.inframeswidth) +#endif /* XPM */ # define PROMPT_W(w) (max(LOGIN_PROMPT_W(w), PASS_PROMPT_W(w))) # define GREETING(w) ((w)->login.secure_session && !(w)->login.allow_access ?\ (w)->login.greeting : (w)->login.unsecure_greet) # define GREET_X(w) ((int)(w->core.width - XTextWidth (w->login.greetFont,\ GREETING(w), strlen (GREETING(w)))) / 2) # define GREET_Y(w) (GREETING(w)[0] ? 2 * GREET_Y_INC (w) : 0) +#ifndef XPM # define GREET_W(w) (max (XTextWidth (w->login.greetFont,\ w->login.greeting, strlen (w->login.greeting)), \ XTextWidth (w->login.greetFont,\ w->login.unsecure_greet, strlen (w->login.unsecure_greet)))) +#else +# define GREET_W(w) (max (XTextWidth (w->login.greetFont,\ + w->login.greeting, strlen (w->login.greeting)), \ + XTextWidth (w->login.greetFont,\ + w->login.unsecure_greet, strlen (w->login.unsecure_greet)))) + w->login.logoWidth + (2*w->login.logoPadding) +#endif /* XPM */ # define LOGIN_X(w) (2 * PROMPT_X_INC(w)) # define LOGIN_Y(w) (GREET_Y(w) + GREET_Y_INC(w) +\ w->login.greetFont->max_bounds.ascent + Y_INC(w)) @@ -136,7 +216,11 @@ static XtResource resources[] = { # define LOGIN_H(w) (3 * Y_INC(w) / 2) # define LOGIN_TEXT_X(w)(LOGIN_X(w) + PROMPT_W(w)) # define PASS_X(w) (LOGIN_X(w)) +#ifndef XPM # define PASS_Y(w) (LOGIN_Y(w) + 8 * Y_INC(w) / 5) +#else +# define PASS_Y(w) (LOGIN_Y(w) + 10 * Y_INC(w) / 5) +#endif /* XPM */ # define PASS_W(w) (LOGIN_W(w)) # define PASS_H(w) (LOGIN_H(w)) # define PASS_TEXT_X(w) (PASS_X(w) + PROMPT_W(w)) @@ -144,24 +228,25 @@ static XtResource resources[] = { w->login.fail, strlen (w->login.fail))) / 2) # define FAIL_Y(w) (PASS_Y(w) + 2 * FAIL_Y_INC (w) +\ w->login.failFont->max_bounds.ascent) +#ifndef XPM # define FAIL_W(w) (XTextWidth (w->login.failFont,\ w->login.fail, strlen (w->login.fail))) +#else +# define FAIL_W(w) (XTextWidth (w->login.failFont,\ + w->login.fail, strlen (w->login.fail))) + w->login.logoWidth + (2*w->login.logoPadding) +#endif /* XPM */ # define PAD_X(w) (2 * (LOGIN_X(w) + max (GREET_X_INC(w), FAIL_X_INC(w)))) # define PAD_Y(w) (max (max (Y_INC(w), GREET_Y_INC(w)),\ FAIL_Y_INC(w))) -static void Initialize(), Realize(), Destroy(), Redisplay(); -static Boolean SetValues(); -static void draw_it (); - -static int max (a,b) { return a > b ? a : b; } +#ifndef max +static int max (int a, int b) { return a > b ? a : b; } +#endif static void -EraseName (w, cursor) - LoginWidget w; - int cursor; +EraseName (LoginWidget w, int cursor) { int x; @@ -173,9 +258,7 @@ EraseName (w, cursor) } static void -DrawName (w, cursor) - LoginWidget w; - int cursor; +DrawName (LoginWidget w, int cursor) { int x; @@ -184,12 +267,16 @@ DrawName (w, cursor) x += XTextWidth (w->login.font, w->login.data.name, cursor); XDrawString (XtDisplay(w), XtWindow (w), w->login.textGC, x, LOGIN_Y(w), w->login.data.name + cursor, strlen (w->login.data.name + cursor)); + +#ifdef XPM + /*as good a place as any Caolan begin*/ + w->login.lastEventTime = time(NULL); + /*as good a place as any Caolan end*/ +#endif /* XPM */ } static void -realizeCursor (w, gc) - LoginWidget w; - GC gc; +realizeCursor (LoginWidget w, GC gc) { int x, y; int height, width; @@ -213,12 +300,31 @@ realizeCursor (w, gc) return; } XFillRectangle (XtDisplay (w), XtWindow (w), gc, +#ifndef XPM x, y - w->login.font->max_bounds.ascent, width, height); +#else + x, y+1 - w->login.font->max_bounds.ascent, width, height-1); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x-1 , y - w->login.font->max_bounds.ascent); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x+1 , y - w->login.font->max_bounds.ascent); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x-1 , y - w->login.font->max_bounds.ascent+height); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x+1 , y - w->login.font->max_bounds.ascent+height); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x-2 , y - w->login.font->max_bounds.ascent); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x+2 , y - w->login.font->max_bounds.ascent); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x-2 , y - w->login.font->max_bounds.ascent+height); + XDrawPoint (XtDisplay (w), XtWindow (w), gc, + x+2 , y - w->login.font->max_bounds.ascent+height); +#endif /* XPM */ } static void -EraseFail (w) - LoginWidget w; +EraseFail (LoginWidget w) { int x = FAIL_X(w); int y = FAIL_Y(w); @@ -234,31 +340,26 @@ EraseFail (w) } static void -XorCursor (w) - LoginWidget w; +XorCursor (LoginWidget w) { realizeCursor (w, w->login.xorGC); } static void -RemoveFail (w) - LoginWidget w; +RemoveFail (LoginWidget w) { if (w->login.failUp) EraseFail (w); } static void -EraseCursor (w) - LoginWidget (w); +EraseCursor (LoginWidget w) { realizeCursor (w, w->login.bgGC); } /*ARGSUSED*/ -void failTimeout (client_data, id) - XtPointer client_data; - XtIntervalId * id; +static void failTimeout (XtPointer client_data, XtIntervalId * id) { LoginWidget w = (LoginWidget)client_data; @@ -266,8 +367,8 @@ void failTimeout (client_data, id) EraseFail (w); } -DrawFail (ctx) - Widget ctx; +void +DrawFail (Widget ctx) { LoginWidget w; @@ -285,8 +386,8 @@ DrawFail (ctx) } } -RedrawFail (w) - LoginWidget w; +static void +RedrawFail (LoginWidget w) { int x = FAIL_X(w); int y = FAIL_Y(w); @@ -298,13 +399,101 @@ RedrawFail (w) } static void -draw_it (w) - LoginWidget w; +draw_it (LoginWidget w) { +#ifdef XPM + int i,in_frame_x,in_login_y,in_pass_y,in_width,in_height; + int gr_line_x, gr_line_y, gr_line_w; +#endif /* XPM */ + EraseCursor (w); + +#ifdef XPM + if( (w->login.outframewidth) < 1 ) + w->login.outframewidth = 1; + for(i=1;i<=(w->login.outframewidth);i++) + { + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + i-1,i-1,w->core.width-i,i-1); + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + i-1,i-1,i-1,w->core.height-i); + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + w->core.width-i,i-1,w->core.width-i,w->core.height-i); + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + i-1,w->core.height-i,w->core.width-i,w->core.height-i); + } + + /* make separator line */ + gr_line_x = w->login.outframewidth + w->login.logoPadding; + gr_line_y = GREET_Y(w) + GREET_Y_INC(w); + gr_line_w = w->core.width - 2*(w->login.outframewidth) - + (w->login.logoWidth + 3*(w->login.logoPadding)); + + for(i=1;i<=(w->login.sepwidth);i++) + { + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + gr_line_x, gr_line_y + i-1, + gr_line_x+gr_line_w, gr_line_y + i-1); + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + gr_line_x, gr_line_y + 2*(w->login.inframeswidth) -i, + gr_line_x+gr_line_w, gr_line_y + 2*(w->login.inframeswidth) -i); + } + + in_frame_x = LOGIN_TEXT_X(w) - w->login.inframeswidth - 3; + in_login_y = LOGIN_Y(w) - w->login.inframeswidth - 1 - TEXT_Y_INC(w); + in_pass_y = PASS_Y(w) - w->login.inframeswidth - 1 - TEXT_Y_INC(w); + + in_width = LOGIN_W(w) - PROMPT_W(w) - + (w->login.logoWidth + 2*(w->login.logoPadding)); + in_height = LOGIN_H(w) + w->login.inframeswidth + 2; + + for(i=1;i<=(w->login.inframeswidth);i++) + { + /* Make top/left sides */ + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + in_frame_x + i-1, in_login_y + i-1, + in_frame_x + in_width-i, in_login_y + i-1); + + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + in_frame_x + i-1, in_login_y + i-1, + in_frame_x + i-1, in_login_y + in_height-i); + + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + in_frame_x + in_width-i, in_login_y + i-1, + in_frame_x + in_width-i, in_login_y + in_height-i); + + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + in_frame_x + i-1, in_login_y + in_height-i, + in_frame_x + in_width-i, in_login_y + in_height-i); + + /* Make bottom/right sides */ + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + in_frame_x + i-1, in_pass_y + i-1, + in_frame_x + in_width-i, in_pass_y + i-1); + + XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC, + in_frame_x + i-1, in_pass_y + i-1, + in_frame_x + i-1, in_pass_y + in_height-i); + + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + in_frame_x + in_width-i, in_pass_y + i-1, + in_frame_x + in_width-i, in_pass_y + in_height-i); + + XDrawLine(XtDisplay (w), XtWindow (w), w->login.hiGC, + in_frame_x + i-1, in_pass_y + in_height-i, + in_frame_x + in_width-i, in_pass_y + in_height-i); + } +#endif /* XPM */ + if (GREETING(w)[0]) XDrawString (XtDisplay (w), XtWindow (w), w->login.greetGC, +#ifndef XPM GREET_X(w), GREET_Y(w), +#else + GREET_X(w) - + ((w->login.logoWidth/2) + w->login.logoPadding), + GREET_Y(w), +#endif /* XPM */ GREETING(w), strlen (GREETING(w))); XDrawString (XtDisplay (w), XtWindow (w), w->login.promptGC, LOGIN_X(w), LOGIN_Y(w), @@ -333,11 +522,7 @@ draw_it (w) /*ARGSUSED*/ static void -DeleteBackwardChar (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +DeleteBackwardChar (Widget ctxw, XEvent *event, String *params, Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -363,11 +548,7 @@ DeleteBackwardChar (ctxw, event, params, num_params) /*ARGSUSED*/ static void -DeleteForwardChar (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +DeleteForwardChar (Widget ctxw, XEvent *event, String *params, Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -394,11 +575,11 @@ DeleteForwardChar (ctxw, event, params, num_params) /*ARGSUSED*/ static void -MoveBackwardChar (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +MoveBackwardChar ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -411,11 +592,11 @@ MoveBackwardChar (ctxw, event, params, num_params) /*ARGSUSED*/ static void -MoveForwardChar (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +MoveForwardChar ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -436,11 +617,11 @@ MoveForwardChar (ctxw, event, params, num_params) /*ARGSUSED*/ static void -MoveToBegining (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +MoveToBegining ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -452,11 +633,11 @@ MoveToBegining (ctxw, event, params, num_params) /*ARGSUSED*/ static void -MoveToEnd (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +MoveToEnd ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -475,11 +656,11 @@ MoveToEnd (ctxw, event, params, num_params) /*ARGSUSED*/ static void -EraseToEndOfLine (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +EraseToEndOfLine ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -499,11 +680,11 @@ EraseToEndOfLine (ctxw, event, params, num_params) /*ARGSUSED*/ static void -EraseLine (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +EraseLine ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { MoveToBegining (ctxw, event, params, num_params); EraseToEndOfLine (ctxw, event, params, num_params); @@ -511,11 +692,11 @@ EraseLine (ctxw, event, params, num_params) /*ARGSUSED*/ static void -FinishField (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +FinishField ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -535,13 +716,36 @@ FinishField (ctxw, event, params, num_params) XorCursor (ctx); } +#ifdef XPM /*ARGSUSED*/ static void -AllowAccess (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +TabField(Widget ctxw, XEvent *event, String *params, Cardinal *num_params) +{ + LoginWidget ctx = (LoginWidget)ctxw; + + XorCursor (ctx); + RemoveFail (ctx); + switch (ctx->login.state) { + case GET_NAME: + ctx->login.state = GET_PASSWD; + ctx->login.cursor = 0; + break; + case GET_PASSWD: + ctx->login.state = GET_NAME; + ctx->login.cursor = 0; + break; + } + XorCursor (ctx); +} +#endif /* XPM */ + +/*ARGSUSED*/ +static void +AllowAccess ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; Arg arglist[1]; @@ -556,11 +760,11 @@ AllowAccess (ctxw, event, params, num_params) /*ARGSUSED*/ static void -SetSessionArgument (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +SetSessionArgument ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -579,11 +783,11 @@ SetSessionArgument (ctxw, event, params, num_params) /*ARGSUSED*/ static void -RestartSession (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +RestartSession ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -597,11 +801,11 @@ RestartSession (ctxw, event, params, num_params) /*ARGSUSED*/ static void -AbortSession (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +AbortSession ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -615,11 +819,11 @@ AbortSession (ctxw, event, params, num_params) /*ARGSUSED*/ static void -AbortDisplay (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +AbortDisplay ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; @@ -631,8 +835,8 @@ AbortDisplay (ctxw, event, params, num_params) XorCursor (ctx); } -ResetLogin (w) - LoginWidget w; +static void +ResetLogin (LoginWidget w) { EraseName (w, 0); w->login.cursor = 0; @@ -641,30 +845,138 @@ ResetLogin (w) w->login.state = GET_NAME; } +static void +InitI18N(Widget ctxw) +{ + LoginWidget ctx = (LoginWidget)ctxw; + XIM xim = (XIM) NULL; + char *p; + + ctx->login.xic = (XIC) NULL; + + if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p) + xim = XOpenIM(XtDisplay(ctx), NULL, NULL, NULL); + + if (!xim) { + LogError("Failed to open input method\n"); + return; + } + + ctx->login.xic = XCreateIC(xim, + XNInputStyle, (XIMPreeditNothing|XIMStatusNothing), + XNClientWindow, ctx->core.window, + XNFocusWindow, ctx->core.window, NULL); + + if (!ctx->login.xic) { + LogError("Failed to create input context\n"); + XCloseIM(xim); + } + return; +} + /* ARGSUSED */ static void -InsertChar (ctxw, event, params, num_params) - Widget ctxw; - XEvent *event; - String *params; - Cardinal *num_params; +InsertChar ( + Widget ctxw, + XEvent *event, + String *params, + Cardinal *num_params) { LoginWidget ctx = (LoginWidget)ctxw; char strbuf[128]; +#ifndef XPM int len; - - len = XLookupString (&event->xkey, strbuf, sizeof (strbuf), 0, 0); +#else + int len,pixels; +#endif /* XPM */ + KeySym keysym = 0; + + if (ctx->login.xic) { + static Status status; + len = XmbLookupString(ctx->login.xic, &event->xkey, strbuf, + sizeof (strbuf), &keysym, &status); + } else { + static XComposeStatus compose_status = {NULL, 0}; + len = XLookupString (&event->xkey, strbuf, sizeof (strbuf), + &keysym, &compose_status); + } strbuf[len] = '\0'; + +#ifdef XPM + pixels = 3 + ctx->login.font->max_bounds.width * len + + XTextWidth(ctx->login.font, + ctx->login.data.name, + strlen(ctx->login.data.name)); + /* pixels to be added */ +#endif /* XPM */ + + /* + * Note: You can override this default key handling + * by the settings in the translation table + * loginActionsTable at the end of this file. + */ + switch (keysym) { + case XK_Return: + case XK_KP_Enter: + case XK_Linefeed: + case XK_Execute: + FinishField(ctxw, event, params, num_params); + return; + case XK_BackSpace: + DeleteBackwardChar(ctxw, event, params, num_params); + return; + case XK_Delete: + case XK_KP_Delete: + case DXK_Remove: + /* Sorry, it's not a telex machine, it's a terminal */ + DeleteForwardChar(ctxw, event, params, num_params); + return; + case XK_Left: + case XK_KP_Left: + MoveBackwardChar(ctxw, event, params, num_params); + return; + case XK_Right: + case XK_KP_Right: + MoveForwardChar(ctxw, event, params, num_params); + return; + case XK_End: + case XK_KP_End: + MoveToEnd(ctxw, event, params, num_params); + return; + case XK_Home: + case XK_KP_Home: + MoveToBegining(ctxw, event, params, num_params); + return; + default: + if (len == 0) { + if (!IsModifierKey(keysym)) /* it's not a modifier */ + XBell(XtDisplay(ctxw), 60); + return; + } else + break; + } + switch (ctx->login.state) { case GET_NAME: +#ifndef XPM if (len + (int)strlen(ctx->login.data.name) >= NAME_LEN - 1) +#else + if ( + (len + (int)strlen(ctx->login.data.name) >= NAME_LEN - 1)/* && + (pixels <= LOGIN_W(ctx) - PROMPT_W(ctx))*/ + ) +#endif /* XPM */ len = NAME_LEN - strlen(ctx->login.data.name) - 2; case GET_PASSWD: - if (len + (int)strlen(ctx->login.data.passwd) >= NAME_LEN - 1) - len = NAME_LEN - strlen(ctx->login.data.passwd) - 2; + if (len + (int)strlen(ctx->login.data.passwd) >= PASSWORD_LEN - 1) + len = PASSWORD_LEN - strlen(ctx->login.data.passwd) - 2; } +#ifndef XPM if (len == 0) +#else + if (len == 0 || pixels >= LOGIN_W(ctx) - PROMPT_W(ctx)) +#endif /* XPM */ return; XorCursor (ctx); RemoveFail (ctx); @@ -684,22 +996,45 @@ InsertChar (ctxw, event, params, num_params) strlen (ctx->login.data.passwd + ctx->login.cursor) + 1); memmove( ctx->login.data.passwd + ctx->login.cursor, strbuf, len); ctx->login.cursor += len; + +#ifdef XPM + /*as good a place as any Caolan begin*/ + ctx->login.lastEventTime = time(NULL); + /*as good a place as any Caolan end*/ +#endif /* XPM */ break; } XorCursor (ctx); } /* ARGSUSED */ -static void Initialize (greq, gnew, args, num_args) - Widget greq, gnew; - ArgList args; - Cardinal *num_args; +static void Initialize ( + Widget greq, + Widget gnew, + ArgList args, + Cardinal *num_args) { LoginWidget w = (LoginWidget)gnew; XtGCMask valuemask, xvaluemask; XGCValues myXGCV; Arg position[2]; Position x, y; +#ifdef USE_XINERAMA + XineramaScreenInfo *screens; + int s_num; +#endif + +#ifdef XPM + myXGCV.foreground = w->login.hipixel; + myXGCV.background = w->core.background_pixel; + valuemask = GCForeground | GCBackground; + w->login.hiGC = XtGetGC(gnew, valuemask, &myXGCV); + + myXGCV.foreground = w->login.shdpixel; + myXGCV.background = w->core.background_pixel; + valuemask = GCForeground | GCBackground; + w->login.shdGC = XtGetGC(gnew, valuemask, &myXGCV); +#endif /* XPM */ myXGCV.foreground = w->login.textpixel; myXGCV.background = w->core.background_pixel; @@ -756,6 +1091,55 @@ static void Initialize (greq, gnew, args, num_args) myXGCV.font = w->login.failFont->fid; w->login.failGC = XtGetGC (gnew, xvaluemask, &myXGCV); +#ifdef XPM + w->login.logoValid = False; + + if (NULL != w->login.logoFileName) + { + XpmAttributes myAttributes = { 0 }; + Window tmpWindow = { 0 }; + struct stat myBuffer = { 0 }; + unsigned int myPixmapDepth = 0; + + if (0 != stat(w->login.logoFileName, &myBuffer)) + { + LogError("Unable to stat() pixmap file %s\n", + w->login.logoFileName); + w->login.logoValid = False; + goto SkipXpmLoad; + } + else + + myAttributes.valuemask |= XpmReturnPixels; + myAttributes.valuemask |= XpmReturnExtensions; + + XpmReadFileToPixmap(XtDisplay(w), /* display */ + RootWindowOfScreen(XtScreen(w)), /* window */ + w->login.logoFileName, /* XPM filename */ + &(w->login.logoPixmap), /* pixmap */ + &(w->login.logoMask), /* pixmap mask */ + &myAttributes); /* XPM attributes */ + w->login.logoValid = True; + + XGetGeometry(XtDisplay(w), w->login.logoPixmap, + &tmpWindow, + &(w->login.logoX), + &(w->login.logoY), + &(w->login.logoWidth), + &(w->login.logoHeight), + &(w->login.logoBorderWidth), + &myPixmapDepth); + } else { + w->login.logoX = 0; + w->login.logoY = 0; + w->login.logoWidth = 0; + w->login.logoHeight = 0; + w->login.logoBorderWidth = 0; + } + + +SkipXpmLoad: +#endif /* XPM */ w->login.data.name[0] = '\0'; w->login.data.passwd[0] = '\0'; w->login.state = GET_NAME; @@ -767,55 +1151,148 @@ static void Initialize (greq, gnew, args, num_args) int fy = FAIL_Y(w); int pady = PAD_Y(w); +#ifndef XPM w->core.height = fy + pady; /* for stupid compilers */ +#else +/* w->core.height = fy + pady; * for stupid compilers */ + + w->core.height = max(fy + pady, + (w->login.logoHeight + (2*w->login.logoPadding)) + pady); + +#endif /* XPM */ + } +#ifdef USE_XINERAMA + if ( + XineramaIsActive(XtDisplay(w)) && + (screens = XineramaQueryScreens(XtDisplay(w), &s_num)) != NULL + ) + { + if ((x = w->core.x) == -1) + x = screens[0].x_org + (int)(screens[0].width - w->core.width) / 2; + if ((y = w->core.y) == -1) + y = screens[0].y_org + (int)(screens[0].height - w->core.height) / 3; + + XFree(screens); + } + else +#endif + { + if ((x = w->core.x) == -1) + x = (int)(XWidthOfScreen (XtScreen (w)) - w->core.width) / 2; + if ((y = w->core.y) == -1) + y = (int)(XHeightOfScreen (XtScreen (w)) - w->core.height) / 3; } - if ((x = w->core.x) == -1) - x = (int)(XWidthOfScreen (XtScreen (w)) - w->core.width) / 2; - if ((y = w->core.y) == -1) - y = (int)(XHeightOfScreen (XtScreen (w)) - w->core.height) / 3; XtSetArg (position[0], XtNx, x); XtSetArg (position[1], XtNy, y); XtSetValues (XtParent (w), position, (Cardinal) 2); } -static void Realize (gw, valueMask, attrs) - Widget gw; - XtValueMask *valueMask; - XSetWindowAttributes *attrs; +static void Realize ( + Widget gw, + XtValueMask *valueMask, + XSetWindowAttributes *attrs) { +#ifdef XPM + LoginWidget w = (LoginWidget) gw; + Cursor cursor; +#endif /* XPM */ XtCreateWindow( gw, (unsigned)InputOutput, (Visual *)CopyFromParent, *valueMask, attrs ); + InitI18N(gw); +#ifdef XPM + cursor = XCreateFontCursor(XtDisplay(gw), XC_left_ptr); + XDefineCursor(XtDisplay(gw), XtWindow(gw), cursor); + + /* + * Check if Pixmap was valid + */ + if (True == w->login.logoValid) + { + /* + * Create pixmap window + */ + { + unsigned long valueMask = CWBackPixel | CWBackPixmap; + XSetWindowAttributes windowAttributes = { 0 }; + + windowAttributes.background_pixel = w->core.background_pixel; + windowAttributes.background_pixmap = None; + + w->login.logoWindow = XCreateWindow(XtDisplay(w), + XtWindow(w), + w->core.width - w->login.outframewidth - + w->login.logoWidth - w->login.logoPadding, + (w->core.height - w->login.logoHeight) /2, + w->login.logoWidth, w->login.logoHeight, 0, + CopyFromParent, InputOutput, CopyFromParent, + valueMask, &windowAttributes); + } + + /* + * check if we can use shape extension + */ + if (True == w->login.useShape) + { + int foo, bar; + + if (XShapeQueryExtension(XtDisplay(w), &foo, &bar) == TRUE) + { + XShapeCombineMask(XtDisplay(w), w->login.logoWindow, + ShapeBounding, w->login.logoX, w->login.logoY, + w->login.logoMask, ShapeSet); + } + } + + XSetWindowBackgroundPixmap(XtDisplay(w), w->login.logoWindow, + w->login.logoPixmap); + XMapWindow(XtDisplay(w), w->login.logoWindow); + } +#endif /* XPM */ } -static void Destroy (gw) - Widget gw; +static void Destroy (Widget gw) { LoginWidget w = (LoginWidget)gw; bzero (w->login.data.name, NAME_LEN); - bzero (w->login.data.passwd, NAME_LEN); + bzero (w->login.data.passwd, PASSWORD_LEN); XtReleaseGC(gw, w->login.textGC); XtReleaseGC(gw, w->login.bgGC); XtReleaseGC(gw, w->login.xorGC); XtReleaseGC(gw, w->login.promptGC); XtReleaseGC(gw, w->login.greetGC); XtReleaseGC(gw, w->login.failGC); +#ifdef XPM + XtReleaseGC(gw, w->login.hiGC); + XtReleaseGC(gw, w->login.shdGC); + + if (True == w->login.logoValid) + { + if (w->login.logoPixmap != 0) + XFreePixmap(XtDisplay(w), w->login.logoPixmap); + + if (w->login.logoMask != 0) + XFreePixmap(XtDisplay(w), w->login.logoMask); + } +#endif /* XPM */ } /* ARGSUSED */ -static void Redisplay(gw, event, region) - Widget gw; - XEvent *event; - Region region; +static void Redisplay( + Widget gw, + XEvent *event, + Region region) { draw_it ((LoginWidget) gw); } /*ARGSUSED*/ -static Boolean SetValues (current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; +static Boolean SetValues ( + Widget current, + Widget request, + Widget new, + ArgList args, + Cardinal *num_args) { LoginWidget currentL, newL; @@ -827,24 +1304,32 @@ static Boolean SetValues (current, request, new, args, num_args) } char defaultLoginTranslations [] = -"\ -CtrlH: delete-previous-character() \n\ -CtrlD: delete-character() \n\ -CtrlB: move-backward-character() \n\ -CtrlF: move-forward-character() \n\ -CtrlA: move-to-begining() \n\ -CtrlE: move-to-end() \n\ -CtrlK: erase-to-end-of-line() \n\ -CtrlU: erase-line() \n\ -CtrlX: erase-line() \n\ -CtrlC: restart-session() \n\ -Ctrl\\\\: abort-session() \n\ -:Ctrlplus: allow-all-access() \n\ -BackSpace: delete-previous-character() \n\ -Delete: delete-previous-character() \n\ -Return: finish-field() \n\ -: insert-char() \ -"; +"CtrlH: delete-previous-character() \n" +"CtrlD: delete-character() \n" +"CtrlB: move-backward-character() \n" +"CtrlF: move-forward-character() \n" +"CtrlA: move-to-begining() \n" +"CtrlE: move-to-end() \n" +"CtrlK: erase-to-end-of-line() \n" +"CtrlU: erase-line() \n" +"CtrlX: erase-line() \n" +"CtrlC: restart-session() \n" +"Ctrl\\\\: abort-session() \n" +":Ctrlplus: allow-all-access() \n" +"BackSpace: delete-previous-character() \n" +#ifdef linux +"Delete: delete-character() \n" +#else +"Delete: delete-previous-character() \n" +#endif +"Return: finish-field() \n" +#ifndef XPM +": insert-char()" +#else +"Tab: tab-field() \n" +": insert-char()" +#endif /* XPM */ +; XtActionsRec loginActionsTable [] = { {"delete-previous-character", DeleteBackwardChar}, @@ -856,6 +1341,9 @@ XtActionsRec loginActionsTable [] = { {"erase-to-end-of-line", EraseToEndOfLine}, {"erase-line", EraseLine}, {"finish-field", FinishField}, +#ifdef XPM + {"tab-field", TabField}, +#endif /* XPM */ {"abort-session", AbortSession}, {"abort-display", AbortDisplay}, {"restart-session", RestartSession}, @@ -889,7 +1377,11 @@ LoginClassRec loginClassRec = { /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, +#ifndef XPM /* set_values_almost */ NULL, +#else + /* set_values_almost */ XtInheritSetValuesAlmost, +#endif /* XPM */ /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, diff --git a/greeter/Login.h b/greeter/Login.h index d2b88f4..08578f3 100644 --- a/greeter/Login.h +++ b/greeter/Login.h @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.7 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon @@ -74,7 +75,32 @@ from The Open Group. # define XtNsessionArgument "sessionArgument" # define XtNsecureSession "secureSession" # define XtNallowAccess "allowAccess" - +# define XtNallowNullPasswd "allowNullPasswd" +# define XtNallowRootLogin "allowRootLogin" + +#ifdef XPM +/* added by Amit Margalit Oct 1996 */ +# define XtNhiColor "hiColor" +# define XtNshdColor "shdColor" +# define XtNframeWidth "frameWidth" +# define XtNinnerFramesWidth "innerFramesWidth" +# define XtNsepWidth "sepWidth" + +/* caolan begin */ +#define XtNlastEventTime "lastEventTime" +#define XtCLastEventTime "LastEventTime" +/* caolan end */ + +#define XtNuseShape "useShape" +#define XtCUseShape "UseShape" +#define XtNlogoFileName "logoFileName" +#define XtCLogoFileName "LogoFileName" +#define XtNlogoPadding "logoPadding" +#define XtCLogoPadding "LogoPadding" + +# define XtCFrameWidth "FrameWidth" + +#endif /* XPM */ # define XtCGreeting "Greeting" # define XtCNamePrompt "NamePrompt" # define XtCPasswdPrompt "PasswdPrompt" @@ -83,13 +109,22 @@ from The Open Group. # define XtCSessionArgument "SessionArgument" # define XtCSecureSession "SecureSession" # define XtCAllowAccess "AllowAccess" +# define XtCAllowNullPasswd "AllowNullPasswd" +# define XtCAllowRootLogin "AllowRootLogin" /* notifyDone interface definition */ +#ifndef __OpenBSD__ #define NAME_LEN 32 +#define PASSWORD_LEN 32 +#else +#include +#define NAME_LEN (_PW_NAME_LEN + 2) +#define PASSWORD_LEN (_PASSWORD_LEN + 2) +#endif typedef struct _LoginData { - char name[NAME_LEN], passwd[NAME_LEN]; + char name[NAME_LEN], passwd[PASSWORD_LEN]; } LoginData; # define NOTIFY_OK 0 diff --git a/greeter/LoginP.h b/greeter/LoginP.h index 8a8f467..0f88d79 100644 --- a/greeter/LoginP.h +++ b/greeter/LoginP.h @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.8 2001/12/14 20:01:29 dawes Exp $ */ /* * xdm - display manager daemon @@ -37,23 +38,36 @@ from The Open Group. #include "Login.h" #include +#ifdef XPM +#include +#endif /* XPM */ #define GET_NAME 0 #define GET_PASSWD 1 #define DONE 2 +typedef void (*LoginFunc)(LoginWidget, LoginData *, int); + /* New fields for the login widget instance record */ typedef struct { Pixel textpixel; /* foreground pixel */ Pixel promptpixel; /* prompt pixel */ Pixel greetpixel; /* greeting pixel */ Pixel failpixel; /* failure pixel */ +#ifdef XPM + Pixel hipixel; /* frame hilite pixel */ + Pixel shdpixel; /* shadow frame pixel */ +#endif /* XPM */ GC textGC; /* pointer to GraphicsContext */ GC bgGC; /* pointer to GraphicsContext */ GC xorGC; /* pointer to GraphicsContext */ GC promptGC; GC greetGC; GC failGC; +#ifdef XPM + GC hiGC; /* for hilight part of frame */ + GC shdGC; /* for shaded part of frame */ +#endif /* XPM */ char *greeting; /* greeting */ char *unsecure_greet;/* message displayed when insecure */ char *namePrompt; /* name prompt */ @@ -68,11 +82,29 @@ typedef struct { int failUp; /* failure message displayed */ LoginData data; /* name/passwd */ char *sessionArg; /* argument passed to session */ - void (*notify_done)();/* proc to call when done */ + LoginFunc notify_done; /* proc to call when done */ int failTimeout; /* seconds til drop fail msg */ XtIntervalId interval_id; /* drop fail message note */ Boolean secure_session; /* session is secured */ Boolean allow_access; /* disable access control on login */ + Boolean allow_null_passwd; /* allow null password on login */ + Boolean allow_root_login; /* allow root login */ + XIC xic; /* input method of input context */ +#ifdef XPM + /*caolan begin*/ + int lastEventTime; + /*caolan end*/ + int outframewidth; /* outer frame thickness */ + int inframeswidth; /* inner frames thickness */ + int sepwidth; /* width of separator line */ + + char *logoFileName; + unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth; + int logoX, logoY; + Window logoWindow; + Boolean useShape, logoValid; + Pixmap logoPixmap, logoMask; +#endif /* XPM */ } LoginPart; /* Full instance record declaration */ diff --git a/greeter/greet.c b/greeter/greet.c index 93c64a6..5af88e8 100644 --- a/greeter/greet.c +++ b/greeter/greet.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.16 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon @@ -40,42 +41,63 @@ from The Open Group. #include #include +#ifdef USE_XINERAMA +#include +#endif + #include "dm.h" +#include "dm_error.h" #include "greet.h" #include "Login.h" -#if GREET_LIB +#ifdef __OpenBSD__ +#include +#endif + +#if defined(SECURE_RPC) && defined(sun) +/* Go figure, there's no getdomainname() prototype available */ +extern int getdomainname(char *name, size_t len); +#endif + +#ifdef GREET_LIB /* * Function pointers filled in by the initial call ito the library */ -int (*__xdm_PingServer)() = NULL; -int (*__xdm_SessionPingFailed)() = NULL; -int (*__xdm_Debug)() = NULL; -int (*__xdm_RegisterCloseOnFork)() = NULL; -int (*__xdm_SecureDisplay)() = NULL; -int (*__xdm_UnsecureDisplay)() = NULL; -int (*__xdm_ClearCloseOnFork)() = NULL; -int (*__xdm_SetupDisplay)() = NULL; -int (*__xdm_LogError)() = NULL; -int (*__xdm_SessionExit)() = NULL; -int (*__xdm_DeleteXloginResources)() = NULL; -int (*__xdm_source)() = NULL; -char **(*__xdm_defaultEnv)() = NULL; -char **(*__xdm_setEnv)() = NULL; -char **(*__xdm_parseArgs)() = NULL; -int (*__xdm_printEnv)() = NULL; -char **(*__xdm_systemEnv)() = NULL; -int (*__xdm_LogOutOfMem)() = NULL; -void (*__xdm_setgrent)() = NULL; -struct group *(*__xdm_getgrent)() = NULL; -void (*__xdm_endgrent)() = NULL; +int (*__xdm_PingServer)(struct display *d, Display *alternateDpy) = NULL; +void (*__xdm_SessionPingFailed)(struct display *d) = NULL; +void (*__xdm_Debug)(char * fmt, ...) = NULL; +void (*__xdm_RegisterCloseOnFork)(int fd) = NULL; +void (*__xdm_SecureDisplay)(struct display *d, Display *dpy) = NULL; +void (*__xdm_UnsecureDisplay)(struct display *d, Display *dpy) = NULL; +void (*__xdm_ClearCloseOnFork)(int fd) = NULL; +void (*__xdm_SetupDisplay)(struct display *d) = NULL; +void (*__xdm_LogError)(char * fmt, ...) = NULL; +void (*__xdm_SessionExit)(struct display *d, int status, int removeAuth) = NULL; +void (*__xdm_DeleteXloginResources)(struct display *d, Display *dpy) = NULL; +int (*__xdm_source)(char **environ, char *file) = NULL; +char **(*__xdm_defaultEnv)(void) = NULL; +char **(*__xdm_setEnv)(char **e, char *name, char *value) = NULL; +char **(*__xdm_putEnv)(const char *string, char **env) = NULL; +char **(*__xdm_parseArgs)(char **argv, char *string) = NULL; +void (*__xdm_printEnv)(char **e) = NULL; +char **(*__xdm_systemEnv)(struct display *d, char *user, char *home) = NULL; +void (*__xdm_LogOutOfMem)(char * fmt, ...) = NULL; +void (*__xdm_setgrent)(void) = NULL; +struct group *(*__xdm_getgrent)(void) = NULL; +void (*__xdm_endgrent)(void) = NULL; #ifdef USESHADOW -struct spwd *(*__xdm_getspnam)() = NULL; -void (*__xdm_endspent)() = NULL; +struct spwd *(*__xdm_getspnam)(GETSPNAM_ARGS) = NULL; +void (*__xdm_endspent)(void) = NULL; +#endif +struct passwd *(*__xdm_getpwnam)(GETPWNAM_ARGS) = NULL; +#ifdef linux +void (*__xdm_endpwent)(void) = NULL; +#endif +char *(*__xdm_crypt)(CRYPT_ARGS) = NULL; +#ifdef USE_PAM +pam_handle_t **(*__xdm_thepamhp)(void) = NULL; #endif -struct passwd *(*__xdm_getpwnam)() = NULL; -char *(*__xdm_crypt)() = NULL; #endif @@ -99,9 +121,9 @@ static XtIntervalId pingTimeout; /*ARGSUSED*/ static void -GreetPingServer (closure, intervalId) - XtPointer closure; - XtIntervalId *intervalId; +GreetPingServer ( + XtPointer closure, + XtIntervalId *intervalId) { struct display *d; @@ -114,10 +136,10 @@ GreetPingServer (closure, intervalId) /*ARGSUSED*/ static void -GreetDone (w, data, status) - Widget w; - LoginData *data; - int status; +GreetDone ( + Widget w, + LoginData *data, + int status) { Debug ("GreetDone: %s, (password is %d long)\n", data->name, strlen (data->passwd)); @@ -125,7 +147,7 @@ GreetDone (w, data, status) case NOTIFY_OK: strcpy (name, data->name); strcpy (password, data->passwd); - bzero (data->passwd, NAME_LEN); + bzero (data->passwd, PASSWORD_LEN); code = 0; done = 1; break; @@ -148,8 +170,7 @@ GreetDone (w, data, status) } static Display * -InitGreet (d) - struct display *d; +InitGreet (struct display *d) { Arg arglist[10]; int i; @@ -157,6 +178,10 @@ InitGreet (d) Screen *scrn; static char *argv[] = { "xlogin", 0 }; Display *dpy; +#ifdef USE_XINERAMA + XineramaScreenInfo *screens; + int s_num; +#endif Debug ("greet %s\n", d->name); argc = 1; @@ -168,15 +193,16 @@ InitGreet (d) if (!dpy) return 0; +#ifdef XKB { int opcode, evbase, errbase, majret, minret; unsigned int value = XkbPCF_GrabsUseXKBStateMask; if (XkbQueryExtension (dpy, &opcode, &evbase, &errbase, &majret, &minret)) { - if (XkbSetPerClientControls (dpy, XkbPCF_GrabsUseXKBStateMask, &value)) + if (!XkbSetPerClientControls (dpy, XkbPCF_GrabsUseXKBStateMask, &value)) LogError ("%s\n", "SetPerClientControls failed"); } } - +#endif RegisterCloseOnFork (ConnectionNumber (dpy)); SecureDisplay (d, dpy); @@ -200,6 +226,21 @@ InitGreet (d) arglist, i); XtRealizeWidget (toplevel); +#ifdef USE_XINERAMA + if ( + XineramaIsActive(dpy) && + (screens = XineramaQueryScreens(dpy, &s_num)) != NULL + ) + { + XWarpPointer(dpy, None, XRootWindowOfScreen (scrn), + 0, 0, 0, 0, + screens[0].x_org + screens[0].width / 2, + screens[0].y_org + screens[0].height / 2); + + XFree(screens); + } + else +#endif XWarpPointer(dpy, None, XRootWindowOfScreen (scrn), 0, 0, 0, 0, XWidthOfScreen(scrn) / 2, @@ -213,9 +254,8 @@ InitGreet (d) return dpy; } -static -CloseGreet (d) - struct display *d; +static void +CloseGreet (struct display *d) { Boolean allow; Arg arglist[1]; @@ -241,12 +281,10 @@ CloseGreet (d) } static int -Greet (d, greet) - struct display *d; - struct greet_info *greet; +Greet (struct display *d, struct greet_info *greet) { XEvent event; - Arg arglist[1]; + Arg arglist[3]; XtSetArg (arglist[0], XtNallowAccess, False); XtSetValues (login, arglist, 1); @@ -254,8 +292,15 @@ Greet (d, greet) Debug ("dispatching %s\n", d->name); done = 0; while (!done) { - XtAppNextEvent (context, &event); + XtAppNextEvent (context, &event); + switch (event.type) { + case MappingNotify: + XRefreshKeyboardMapping(&event.xmapping); + break; + default: XtDispatchEvent (&event); + break; + } } XFlush (XtDisplay (toplevel)); Debug ("Done dispatch %s\n", d->name); @@ -264,7 +309,9 @@ Greet (d, greet) greet->name = name; greet->password = password; XtSetArg (arglist[0], XtNsessionArgument, (char *) &(greet->string)); - XtGetValues (login, arglist, 1); + XtSetArg (arglist[1], XtNallowNullPasswd, (char *) &(greet->allow_null_passwd)); + XtSetArg (arglist[2], XtNallowRootLogin, (char *) &(greet->allow_root_login)); + XtGetValues (login, arglist, 3); Debug ("sessionArgument: %s\n", greet->string ? greet->string : ""); } return code; @@ -272,22 +319,27 @@ Greet (d, greet) static void -FailedLogin (d, greet) - struct display *d; - struct greet_info *greet; +FailedLogin (struct display *d, struct greet_info *greet) { +#ifdef __OpenBSD__ + syslog(LOG_NOTICE, "LOGIN FAILURE ON %s", + d->name); + syslog(LOG_AUTHPRIV|LOG_NOTICE, + "LOGIN FAILURE ON %s, %s", + d->name, greet->name); +#endif DrawFail (login); bzero (greet->name, strlen(greet->name)); bzero (greet->password, strlen(greet->password)); } -greet_user_rtn GreetUser(d, dpy, verify, greet, dlfuncs) - struct display *d; - Display ** dpy; - struct verify_info *verify; - struct greet_info *greet; - struct dlfuncs *dlfuncs; +greet_user_rtn GreetUser( + struct display *d, + Display ** dpy, + struct verify_info *verify, + struct greet_info *greet, + struct dlfuncs *dlfuncs) { int i; @@ -309,6 +361,7 @@ greet_user_rtn GreetUser(d, dpy, verify, greet, dlfuncs) __xdm_source = dlfuncs->_source; __xdm_defaultEnv = dlfuncs->_defaultEnv; __xdm_setEnv = dlfuncs->_setEnv; + __xdm_putEnv = dlfuncs->_putEnv; __xdm_parseArgs = dlfuncs->_parseArgs; __xdm_printEnv = dlfuncs->_printEnv; __xdm_systemEnv = dlfuncs->_systemEnv; @@ -321,7 +374,13 @@ greet_user_rtn GreetUser(d, dpy, verify, greet, dlfuncs) __xdm_endspent = dlfuncs->_endspent; #endif __xdm_getpwnam = dlfuncs->_getpwnam; +#ifdef linux + __xdm_endpwent = dlfuncs->_endpwent; +#endif __xdm_crypt = dlfuncs->_crypt; +#ifdef USE_PAM + __xdm_thepamhp = dlfuncs->_thepamhp; +#endif #endif *dpy = InitGreet (d); @@ -335,6 +394,9 @@ greet_user_rtn GreetUser(d, dpy, verify, greet, dlfuncs) LogError ("Cannot reopen display %s for greet window\n", d->name); exit (RESERVER_DISPLAY); } +#ifdef __OpenBSD__ + openlog("xdm", LOG_ODELAY, LOG_AUTH); +#endif for (;;) { /* * Greet user, requesting name/password diff --git a/greeter/verify.c b/greeter/verify.c index 52b8138..182fef4 100644 --- a/greeter/verify.c +++ b/greeter/verify.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.24 2002/11/26 01:16:09 dawes Exp $ */ /* * xdm - display manager daemon @@ -36,20 +37,24 @@ from The Open Group. * typical unix verification routine. */ -# include "dm.h" -# include -#ifdef USESHADOW -# include -# include -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif +#include "dm.h" +#include "dm_error.h" + +#include +#ifdef USE_PAM +# include +# include +#else +# ifdef USESHADOW +# include +# include +# endif #endif # include "greet.h" -#ifdef X_NOT_STDC_ENV -char *getenv(); +#ifdef QNX4 +extern char *crypt(const char *, const char *); #endif static char *envvars[] = { @@ -71,17 +76,19 @@ static char *envvars[] = { NULL }; +#ifdef KERBEROS +#include +#include +static char krbtkfile[MAXPATHLEN]; +#endif + static char ** -userEnv (d, useSystemPath, user, home, shell) -struct display *d; -int useSystemPath; -char *user, *home, *shell; +userEnv (struct display *d, int useSystemPath, char *user, char *home, char *shell) { char **env; char **envvar; char *str; - extern char **defaultEnv (), **setEnv (); - + env = defaultEnv (); env = setEnv (env, "DISPLAY", d->name); env = setEnv (env, "HOME", home); @@ -89,6 +96,10 @@ char *user, *home, *shell; env = setEnv (env, "USER", user); /* BSD */ env = setEnv (env, "PATH", useSystemPath ? d->systemPath : d->userPath); env = setEnv (env, "SHELL", shell); +#ifdef KERBEROS + if (krbtkfile[0] != '\0') + env = setEnv (env, "KRBTKFILE", krbtkfile); +#endif for (envvar = envvars; *envvar; envvar++) { str = getenv(*envvar); @@ -98,33 +109,260 @@ char *user, *home, *shell; return env; } +#ifdef USE_PAM +static char *PAM_password; +static int pam_error; + +static int PAM_conv (int num_msg, +#ifdef sun + struct pam_message **msg, +#else + const struct pam_message **msg, +#endif + struct pam_response **resp, + void *appdata_ptr) { + int count = 0, replies = 0; + struct pam_response *reply = NULL; + +#define PAM_RESPONSE_SIZE sizeof(struct pam_response) + size_t size = PAM_RESPONSE_SIZE; + +#define COPY_STRING(s) (s) ? strdup(s) : (char*)NULL + + for (count = 0; count < num_msg; count++) { + switch (msg[count]->msg_style) { + case PAM_PROMPT_ECHO_ON: + /* user name given to PAM already */ + return PAM_CONV_ERR; + case PAM_PROMPT_ECHO_OFF: + /* wants password */ + if (reply) { + reply = realloc(reply, size); + bzero(reply + size - PAM_RESPONSE_SIZE, PAM_RESPONSE_SIZE); + } else { + reply = (struct pam_response*)malloc(size); + bzero(reply, size); + } + + if (!reply) + return PAM_CONV_ERR; + + size += PAM_RESPONSE_SIZE; + + reply[replies].resp_retcode = PAM_SUCCESS; + reply[replies].resp = COPY_STRING(PAM_password); + /* PAM frees resp */ + break; + case PAM_TEXT_INFO: + /* ignore the informational mesage */ + break; + default: + /* unknown or PAM_ERROR_MSG */ + if (reply) free (reply); + return PAM_CONV_ERR; + } + } + +#undef COPY_STRING + if (reply) *resp = reply; + return PAM_SUCCESS; +} + +static struct pam_conv PAM_conversation = { + PAM_conv, + NULL +}; +#endif /* USE_PAM */ + +#ifdef USE_BSDAUTH int -Verify (d, greet, verify) -struct display *d; -struct greet_info *greet; -struct verify_info *verify; +Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) { struct passwd *p; + login_cap_t *lc; + auth_session_t *as; + char *style, *shell, *home, *s, **argv; + char path[MAXPATHLEN]; + int authok; + + /* User may have specified an authentication style. */ + if ((style = strchr(greet->name, ':')) != NULL) + *style++ = '\0'; + + Debug ("Verify %s, style %s ...\n", greet->name, + style ? style : "default"); + + p = getpwnam (greet->name); + endpwent(); + + if (!p || strlen (greet->name) == 0) { + Debug("getpwnam() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + if ((lc = login_getclass(p->pw_class)) == NULL) { + Debug("login_getclass() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + if ((style = login_getstyle(lc, style, "xdm")) == NULL) { + Debug("login_getstyle() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + if ((as = auth_open()) == NULL) { + Debug("auth_open() failed.\n"); + login_close(lc); + bzero(greet->password, strlen(greet->password)); + return 0; + } + if (auth_setoption(as, "login", "yes") == -1) { + Debug("auth_setoption() failed.\n"); + login_close(lc); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + /* Set up state for no challenge, just check a response. */ + auth_setstate(as, 0); + auth_setdata(as, "", 1); + auth_setdata(as, greet->password, strlen(greet->password) + 1); + + /* Build path of the auth script and call it */ + snprintf(path, sizeof(path), _PATH_AUTHPROG "%s", style); + auth_call(as, path, style, "-s", "response", greet->name, + (void *)NULL); + authok = auth_getstate(as); + + if ((authok & AUTH_ALLOW) == 0) { + Debug("password verify failed\n"); + bzero(greet->password, strlen(greet->password)); + auth_close(as); + login_close(lc); + return 0; + } + /* Run the approval script */ + if (!auth_approval(as, lc, greet->name, "auth-xdm")) { + Debug("login not approved\n"); + bzero(greet->password, strlen(greet->password)); + auth_close(as); + login_close(lc); + return 0; + } + auth_close(as); + login_close(lc); + /* Check empty passwords against allowNullPasswd */ + if (!greet->allow_null_passwd && strlen(greet->password) == 0) { + Debug("empty password not allowed\n"); + return 0; + } + /* Only accept root logins if allowRootLogin resource is set */ + if (p->pw_uid == 0 && !greet->allow_root_login) { + Debug("root logins not allowed\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + /* + * Shell must be in /etc/shells + */ + for (;;) { + s = getusershell(); + if (s == NULL) { + /* did not found the shell in /etc/shells + -> failure */ + Debug("shell not in /etc/shells\n"); + bzero(greet->password, strlen(greet->password)); + endusershell(); + return 0; + } + if (strcmp(s, p->pw_shell) == 0) { + /* found the shell in /etc/shells */ + endusershell(); + break; + } + } +#else /* !USE_BSDAUTH */ +int +Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) +{ + struct passwd *p; +#ifdef USE_PAM + pam_handle_t **pamhp = thepamhp(); +#else #ifdef USESHADOW struct spwd *sp; #endif - char *user_pass; -#if !defined(SVR4) || !defined(GREET_LIB) /* shared lib decls handle this */ - char *crypt (); - char **systemEnv (), **parseArgs (); + char *user_pass = NULL; +#endif +#ifdef __OpenBSD__ + char *s; + struct timeval tp; #endif char *shell, *home; char **argv; Debug ("Verify %s ...\n", greet->name); +#ifndef USE_PAM p = getpwnam (greet->name); + endpwent(); + if (!p || strlen (greet->name) == 0) { Debug ("getpwnam() failed.\n"); bzero(greet->password, strlen(greet->password)); return 0; } else { +#ifdef linux + if (!strcmp(p->pw_passwd, "!") || !strcmp(p->pw_passwd, "*")) { + Debug ("The account is locked, no login allowed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } +#endif user_pass = p->pw_passwd; } +#endif +#ifdef KERBEROS + if(strcmp(greet->name, "root") != 0){ + char name[ANAME_SZ]; + char realm[REALM_SZ]; + char *q; + int ret; + + if(krb_get_lrealm(realm, 1)){ + Debug ("Can't get Kerberos realm.\n"); + } else { + + sprintf(krbtkfile, "%s.%s", TKT_ROOT, d->name); + krb_set_tkt_string(krbtkfile); + unlink(krbtkfile); + + ret = krb_verify_user(greet->name, "", realm, + greet->password, 1, "rcmd"); + + if(ret == KSUCCESS){ + chown(krbtkfile, p->pw_uid, p->pw_gid); + Debug("kerberos verify succeeded\n"); + if (k_hasafs()) { + if (k_setpag() == -1) + LogError ("setpag() failed for %s\n", + greet->name); + + if((ret = k_afsklog(NULL, NULL)) != KSUCCESS) + LogError("Warning %s\n", + krb_get_err_text(ret)); + } + goto done; + } else if(ret != KDC_PR_UNKNOWN && ret != SKDC_CANT){ + /* failure */ + Debug("kerberos verify failure %d\n", ret); + krbtkfile[0] = '\0'; + } + } + } +#endif +#ifndef USE_PAM #ifdef USESHADOW errno = 0; sp = getspnam(greet->name); @@ -133,7 +371,9 @@ struct verify_info *verify; } else { user_pass = sp->sp_pwdp; } +#ifndef QNX4 endspent(); +#endif /* QNX4 doesn't need endspent() to end shadow passwd ops */ #endif #if defined(ultrix) || defined(__ultrix__) if (authenticate_user(p, greet->password, NULL) < 0) @@ -141,12 +381,103 @@ struct verify_info *verify; if (strcmp (crypt (greet->password, user_pass), user_pass)) #endif { - Debug ("password verify failed\n"); + if(!greet->allow_null_passwd || strlen(p->pw_passwd) > 0) { + Debug ("password verify failed\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } /* else: null passwd okay */ + } +#ifdef KERBEROS +done: +#endif +#ifdef __OpenBSD__ + /* + * Only accept root logins if allowRootLogin resource is set + */ + if ((p->pw_uid == 0) && !greet->allow_root_login) { + Debug("root logins not allowed\n"); bzero(greet->password, strlen(greet->password)); return 0; } - Debug ("verify succeeded\n"); + /* + * Shell must be in /etc/shells + */ + for (;;) { + s = getusershell(); + if (s == NULL) { + /* did not found the shell in /etc/shells + -> failure */ + Debug("shell not in /etc/shells\n"); + bzero(greet->password, strlen(greet->password)); + endusershell(); + return 0; + } + if (strcmp(s, p->pw_shell) == 0) { + /* found the shell in /etc/shells */ + endusershell(); + break; + } + } + /* + * Test for expired password + */ + if (p->pw_change || p->pw_expire) + (void)gettimeofday(&tp, (struct timezone *)NULL); + if (p->pw_change) { + if (tp.tv_sec >= p->pw_change) { + Debug("Password has expired.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + } + if (p->pw_expire) { + if (tp.tv_sec >= p->pw_expire) { + Debug("account has expired.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + } +#endif /* __OpenBSD__ */ bzero(user_pass, strlen(user_pass)); /* in case shadow password */ + +#else /* USE_PAM */ +#define PAM_BAIL \ + if (pam_error != PAM_SUCCESS) goto pam_failed; + + PAM_password = greet->password; + pam_error = pam_start("xdm", greet->name, &PAM_conversation, pamhp); + PAM_BAIL; + pam_error = pam_set_item(*pamhp, PAM_TTY, d->name); + PAM_BAIL; + pam_error = pam_set_item(*pamhp, PAM_RHOST, ""); + PAM_BAIL; + pam_error = pam_authenticate(*pamhp, 0); + PAM_BAIL; + pam_error = pam_acct_mgmt(*pamhp, 0); + /* really should do password changing, but it doesn't fit well */ + PAM_BAIL; + pam_error = pam_setcred(*pamhp, 0); + PAM_BAIL; + p = getpwnam (greet->name); + endpwent(); + + if (!p || strlen (greet->name) == 0) { + Debug ("getpwnam() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } + + if (pam_error != PAM_SUCCESS) { + pam_failed: + pam_end(*pamhp, PAM_SUCCESS); + *pamhp = NULL; + return 0; + } +#undef PAM_BAIL +#endif /* USE_PAM */ +#endif /* USE_BSDAUTH */ + + Debug ("verify succeeded\n"); /* The password is passed to StartClient() for use by user-based authorization schemes. It is zeroed there. */ verify->uid = p->pw_uid; diff --git a/krb5auth.c b/krb5auth.c index 5451430..d6f57da 100644 --- a/krb5auth.c +++ b/krb5auth.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - display manager daemon @@ -39,15 +40,16 @@ from The Open Group. */ #include "dm.h" +#include "dm_error.h" + #include #include #include #include /* for TGTNAME */ /*ARGSUSED*/ -Krb5InitAuth (name_len, name) - unsigned short name_len; - char *name; +void +Krb5InitAuth (unsigned short name_len, char *name) { krb5_init_ets(); /* initialize error_message() tables */ } @@ -57,8 +59,7 @@ Krb5InitAuth (name_len, name) * name should be freed by caller. */ char * -Krb5CCacheName(dname) - char *dname; +Krb5CCacheName(char *dname) { char *name; char *tmpdir; @@ -75,9 +76,7 @@ Krb5CCacheName(dname) } krb5_error_code -Krb5DisplayCCache(dname, ccache_return) - char *dname; - krb5_ccache *ccache_return; +Krb5DisplayCCache(char *dname, krb5_ccache *ccache_return) { krb5_error_code code; char *name; @@ -92,10 +91,7 @@ Krb5DisplayCCache(dname, ccache_return) } Xauth * -Krb5GetAuthFor(namelen, name, dname) - unsigned short namelen; - char *name; - char *dname; +Krb5GetAuthFor(unsigned short namelen, char *name, char *dname) { Xauth *new; char *filename; @@ -145,9 +141,7 @@ Krb5GetAuthFor(namelen, name, dname) Xauth * -Krb5GetAuth (namelen, name) - unsigned short namelen; - char *name; +Krb5GetAuth (unsigned short namelen, char *name) { return Krb5GetAuthFor(namelen, name, NULL); } @@ -164,10 +158,10 @@ int preauth_search_list[] = { * Returns 0 if successful, 1 if not. */ int -Krb5Init(name, passwd, d) - char *name; - char *passwd; - struct display *d; /* k5_ccache filled in if successful */ +Krb5Init( + char *name, + char *passwd, + struct display *d) /* k5_ccache filled in if successful */ { krb5_ccache ccache; krb5_error_code code; diff --git a/mitauth.c b/mitauth.c index 1eee630..6c0ad9c 100644 --- a/mitauth.c +++ b/mitauth.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/mitauth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - display manager daemon @@ -38,15 +39,16 @@ from The Open Group. */ # include + # include "dm.h" +# include "dm_auth.h" # define AUTH_DATA_LEN 16 /* bytes of authorization data */ static char auth_name[256]; static int auth_name_len; -MitInitAuth (name_len, name) - unsigned short name_len; - char *name; +void +MitInitAuth (unsigned short name_len, char *name) { if (name_len > 256) name_len = 256; @@ -55,9 +57,7 @@ MitInitAuth (name_len, name) } Xauth * -MitGetAuth (namelen, name) - unsigned short namelen; - char *name; +MitGetAuth (unsigned short namelen, char *name) { Xauth *new; new = (Xauth *) malloc (sizeof (Xauth)); diff --git a/netaddr.c b/netaddr.c index 7053780..02cde08 100644 --- a/netaddr.c +++ b/netaddr.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/netaddr.c,v 3.6 2001/12/14 20:01:22 dawes Exp $ */ /* * xdm - X display manager @@ -34,16 +35,22 @@ from The Open Group. */ #include "dm.h" +#include "dm_error.h" #include /* FamilyInternet, etc. */ #ifdef XDMCP -#include /* struct sockaddr */ -#include /* struct sockaddr_in */ +#include "dm_socket.h" #ifdef UNIXCONN +#ifndef X_NO_SYS_UN +#ifndef Lynx #include /* struct sockaddr_un */ +#else +#include /* struct sockaddr_un */ +#endif +#endif #endif #ifdef DNETCONN #include /* struct sockaddr_dn */ @@ -52,8 +59,7 @@ from The Open Group. /* given an XdmcpNetaddr, returns the socket protocol family used, e.g., AF_INET */ -int NetaddrFamily(netaddrp) - XdmcpNetaddr netaddrp; +int NetaddrFamily(XdmcpNetaddr netaddrp) { #ifdef STREAMSCONN short family = *(short *)netaddrp; @@ -68,9 +74,7 @@ int NetaddrFamily(netaddrp) and sets *lenp to the length of the address or 0 if not using TCP or UDP. */ -char * NetaddrPort(netaddrp, lenp) - XdmcpNetaddr netaddrp; - int *lenp; /* return */ +char * NetaddrPort(XdmcpNetaddr netaddrp, int *lenp) { #ifdef STREAMSCONN *lenp = 2; @@ -92,9 +96,7 @@ char * NetaddrPort(netaddrp, lenp) /* given an XdmcpNetaddr, returns a pointer to the network address and sets *lenp to the length of the address */ -char * NetaddrAddress(netaddrp, lenp) - XdmcpNetaddr netaddrp; - int *lenp; /* return */ +char * NetaddrAddress(XdmcpNetaddr netaddrp, int *lenp) { #ifdef STREAMSCONN *lenp = 4; @@ -131,10 +133,7 @@ char * NetaddrAddress(netaddrp, lenp) sets *len to the number of bytes in addr. Returns the X protocol family used, e.g., FamilyInternet */ -int ConvertAddr (saddr, len, addr) - XdmcpNetaddr saddr; - int *len; /* return */ - char **addr; /* return */ +int ConvertAddr (XdmcpNetaddr saddr, int *len, char **addr) { int retval; @@ -185,9 +184,8 @@ int ConvertAddr (saddr, len, addr) return retval; } -addressEqual (a1, len1, a2, len2) - XdmcpNetaddr a1, a2; - int len1, len2; +int +addressEqual (XdmcpNetaddr a1, int len1, XdmcpNetaddr a2, int len2) { int partlen1, partlen2; char *part1, *part2; @@ -217,9 +215,8 @@ addressEqual (a1, len1, a2, len2) #ifdef DEBUG /*ARGSUSED*/ -PrintSockAddr (a, len) /* Debugging routine */ - struct sockaddr *a; - int len; +void +PrintSockAddr (struct sockaddr *a, int len) { unsigned char *t, *p; diff --git a/policy.c b/policy.c index 3cffa90..29982cb 100644 --- a/policy.c +++ b/policy.c @@ -33,16 +33,18 @@ from The Open Group. * * policy.c. Implement site-dependent policy for XDMCP connections */ +/* $XFree86: xc/programs/xdm/policy.c,v 3.8 2002/12/07 20:31:04 herrb Exp $ */ # include "dm.h" +# include "dm_auth.h" + +#include #ifdef XDMCP # include -# include -#ifdef AF_INET -# include -#endif + +# include "dm_socket.h" static ARRAY8 noAuthentication = { (CARD16) 0, (CARD8Ptr) 0 }; @@ -65,8 +67,7 @@ static XdmAuthRec auth[] = { #define NumAuth (sizeof auth / sizeof auth[0]) ARRAY8Ptr -ChooseAuthentication (authenticationNames) - ARRAYofARRAY8Ptr authenticationNames; +ChooseAuthentication (ARRAYofARRAY8Ptr authenticationNames) { int i, j; @@ -78,9 +79,12 @@ ChooseAuthentication (authenticationNames) return &noAuthentication; } -CheckAuthentication (pdpy, displayID, name, data) - struct protoDisplay *pdpy; - ARRAY8Ptr displayID, name, data; +int +CheckAuthentication ( + struct protoDisplay *pdpy, + ARRAY8Ptr displayID, + ARRAY8Ptr name, + ARRAY8Ptr data) { #ifdef HASXDMAUTH if (name->length && !strncmp ((char *)name->data, "XDM-AUTHENTICATION-1", 20)) @@ -90,9 +94,9 @@ CheckAuthentication (pdpy, displayID, name, data) } int -SelectAuthorizationTypeIndex (authenticationName, authorizationNames) - ARRAY8Ptr authenticationName; - ARRAYofARRAY8Ptr authorizationNames; +SelectAuthorizationTypeIndex ( + ARRAY8Ptr authenticationName, + ARRAYofARRAY8Ptr authorizationNames) { int i, j; @@ -116,12 +120,12 @@ SelectAuthorizationTypeIndex (authenticationName, authorizationNames) /*ARGSUSED*/ int -Willing (addr, connectionType, authenticationName, status, type) - ARRAY8Ptr addr; - CARD16 connectionType; - ARRAY8Ptr authenticationName; - ARRAY8Ptr status; - xdmOpCode type; +Willing ( + ARRAY8Ptr addr, + CARD16 connectionType, + ARRAY8Ptr authenticationName, + ARRAY8Ptr status, + xdmOpCode type) { char statusBuf[256]; int ret; @@ -130,7 +134,26 @@ Willing (addr, connectionType, authenticationName, status, type) if (!ret) sprintf (statusBuf, "Display not authorized to connect"); else - sprintf (statusBuf, "Willing to manage"); + { + if (*willing) + { FILE *fd = NULL; + if ((fd = popen(willing, "r"))) + { + char *s = NULL; + while(!(s = fgets(statusBuf, 256, fd)) && errno == EINTR) + ; + if (s && strlen(statusBuf) > 0) + statusBuf[strlen(statusBuf)-1] = 0; /* chop newline */ + else + snprintf (statusBuf, sizeof(statusBuf), "Willing, but %s failed",willing); + } + else + snprintf (statusBuf, sizeof(statusBuf), "Willing, but %s failed",willing); + if (fd) pclose(fd); + } + else + sprintf (statusBuf, "Willing to manage"); + } status->length = strlen (statusBuf); status->data = (CARD8Ptr) malloc (status->length); if (!status->data) @@ -142,19 +165,19 @@ Willing (addr, connectionType, authenticationName, status, type) /*ARGSUSED*/ ARRAY8Ptr -Accept (from, fromlen, displayNumber) - struct sockaddr *from; - int fromlen; - CARD16 displayNumber; +Accept ( + struct sockaddr *from, + int fromlen, + CARD16 displayNumber) { return 0; } /*ARGSUSED*/ int -SelectConnectionTypeIndex (connectionTypes, connectionAddresses) - ARRAY16Ptr connectionTypes; - ARRAYofARRAY8Ptr connectionAddresses; +SelectConnectionTypeIndex ( + ARRAY16Ptr connectionTypes, + ARRAYofARRAY8Ptr connectionAddresses) { return 0; } diff --git a/protodpy.c b/protodpy.c index 4672f77..47c25e4 100644 --- a/protodpy.c +++ b/protodpy.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/xdm/protodpy.c,v 1.5 2001/12/14 20:01:23 dawes Exp $ */ /* * protodpy.c @@ -35,17 +36,13 @@ in this Software without prior written authorization from The Open Group. */ #include "dm.h" +#include "dm_error.h" #ifdef XDMCP #include -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else #include #define Time_t time_t -#endif static struct protoDisplay *protoDisplays; @@ -64,10 +61,10 @@ PrintProtoDisplay (pdpy) #endif struct protoDisplay * -FindProtoDisplay (address, addrlen, displayNumber) - XdmcpNetaddr address; - int addrlen; - CARD16 displayNumber; +FindProtoDisplay ( + XdmcpNetaddr address, + int addrlen, + CARD16 displayNumber) { struct protoDisplay *pdpy; @@ -83,9 +80,8 @@ FindProtoDisplay (address, addrlen, displayNumber) return (struct protoDisplay *) 0; } -static -TimeoutProtoDisplays (now) - Time_t now; +static void +TimeoutProtoDisplays (Time_t now) { struct protoDisplay *pdpy, *next; @@ -98,14 +94,13 @@ TimeoutProtoDisplays (now) } struct protoDisplay * -NewProtoDisplay (address, addrlen, displayNumber, - connectionType, connectionAddress, sessionID) - XdmcpNetaddr address; - int addrlen; - CARD16 displayNumber; - CARD16 connectionType; - ARRAY8Ptr connectionAddress; - CARD32 sessionID; +NewProtoDisplay ( + XdmcpNetaddr address, + int addrlen, + CARD16 displayNumber, + CARD16 connectionType, + ARRAY8Ptr connectionAddress, + CARD32 sessionID) { struct protoDisplay *pdpy; Time_t date; diff --git a/reset.c b/reset.c index 76dfb9d..d5c49ca 100644 --- a/reset.c +++ b/reset.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/reset.c,v 1.4 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon @@ -37,16 +38,17 @@ from The Open Group. */ # include "dm.h" +# include "dm_error.h" + # include # include /*ARGSUSED*/ static int -ignoreErrors (dpy, event) -Display *dpy; -XErrorEvent *event; +ignoreErrors (Display *dpy, XErrorEvent *event) { Debug ("ignoring error\n"); + return 0; } /* @@ -55,10 +57,8 @@ XErrorEvent *event; * this code wouldn't have to be this kludgy. */ -static -killWindows (dpy, window) -Display *dpy; -Window window; +static void +killWindows (Display *dpy, Window window) { Window root, parent, *children; int child; @@ -68,7 +68,7 @@ Window window; && nchildren > 0) { for (child = 0; child < nchildren; child++) { - Debug ("XKillClient 0x%x\n", children[child]); + Debug ("XKillClient 0x%lx\n", (unsigned long)children[child]); XKillClient (dpy, children[child]); } XFree ((char *)children); @@ -79,8 +79,7 @@ static Jmp_buf resetJmp; /* ARGSUSED */ static SIGVAL -abortReset (n) - int n; +abortReset (int n) { Longjmp (resetJmp, 1); } @@ -89,8 +88,8 @@ abortReset (n) * this display connection better not have any windows... */ -pseudoReset (dpy) -Display *dpy; +void +pseudoReset (Display *dpy) { Window root; int screen; @@ -111,6 +110,6 @@ Display *dpy; (void) alarm (0); } Signal (SIGALRM, SIG_DFL); - XSetErrorHandler ((int (*)()) 0); + XSetErrorHandler ((XErrorHandler)0 ); Debug ("pseudoReset done\n"); } diff --git a/resource.c b/resource.c index 5745ae6..982dd8e 100644 --- a/resource.c +++ b/resource.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/resource.c,v 3.10 2002/12/07 20:31:04 herrb Exp $ */ /* * xdm - display manager daemon @@ -35,6 +36,8 @@ from The Open Group. */ # include "dm.h" +# include "dm_error.h" + # include # include @@ -47,6 +50,7 @@ char *errorLogFile; int daemonMode; char *pidFile; int lockPidFile; +int sourceAddress; char *authDir; int autoRescan; int removeDomainname; @@ -55,6 +59,7 @@ char *accessFile; char **exportList; char *randomFile; char *greeterLib; +char *willing; int choiceTimeout; /* chooser choice timeout */ # define DM_STRING 0 @@ -114,10 +119,14 @@ int choiceTimeout; /* chooser choice timeout */ #define DEF_ACCESS_FILE "" #endif #ifndef DEF_RANDOM_FILE -#define DEF_RANDOM_FILE "/dev/mem" +# ifdef linux +# define DEF_RANDOM_FILE "/dev/urandom" +# else +# define DEF_RANDOM_FILE "/dev/mem" +# endif #endif #ifndef DEF_GREETER_LIB -#define DEF_GREETER_LIB "/X11/lib/X11/xdm/libXdmGreet.so" +#define DEF_GREETER_LIB "/usr/lib/X11/xdm/libXdmGreet.so" #endif #define DEF_UDP_PORT "177" /* registered XDMCP port, dont change */ @@ -128,38 +137,42 @@ struct dmResources { char **dm_value; char *default_value; } DmResources[] = { -"servers", "Servers", DM_STRING, &servers, - DEF_SERVER_LINE, -"requestPort", "RequestPort", DM_INT, (char **) &request_port, - DEF_UDP_PORT, -"debugLevel", "DebugLevel", DM_INT, (char **) &debugLevel, - "0", -"errorLogFile", "ErrorLogFile", DM_STRING, &errorLogFile, - "", -"daemonMode", "DaemonMode", DM_BOOL, (char **) &daemonMode, - "true", -"pidFile", "PidFile", DM_STRING, &pidFile, - "", -"lockPidFile", "LockPidFile", DM_BOOL, (char **) &lockPidFile, - "true", -"authDir", "authDir", DM_STRING, &authDir, - DEF_AUTH_DIR, -"autoRescan", "AutoRescan", DM_BOOL, (char **) &autoRescan, - "true", -"removeDomainname","RemoveDomainname",DM_BOOL, (char **) &removeDomainname, - "true", -"keyFile", "KeyFile", DM_STRING, &keyFile, - DEF_KEY_FILE, -"accessFile", "AccessFile", DM_STRING, &accessFile, - DEF_ACCESS_FILE, -"exportList", "ExportList", DM_ARGV, (char **) &exportList, - "", -"randomFile", "RandomFile", DM_STRING, &randomFile, - DEF_RANDOM_FILE, -"greeterLib", "GreeterLib", DM_STRING, &greeterLib, - DEF_GREETER_LIB, -"choiceTimeout","ChoiceTimeout",DM_INT, (char **) &choiceTimeout, - "15", +{ "servers", "Servers", DM_STRING, &servers, + DEF_SERVER_LINE} , +{ "requestPort","RequestPort", DM_INT, (char **) &request_port, + DEF_UDP_PORT} , +{ "debugLevel", "DebugLevel", DM_INT, (char **) &debugLevel, + "0"} , +{ "errorLogFile","ErrorLogFile", DM_STRING, &errorLogFile, + ""} , +{ "daemonMode", "DaemonMode", DM_BOOL, (char **) &daemonMode, + "true"} , +{ "pidFile", "PidFile", DM_STRING, &pidFile, + ""} , +{ "lockPidFile","LockPidFile", DM_BOOL, (char **) &lockPidFile, + "true"} , +{ "authDir", "authDir", DM_STRING, &authDir, + DEF_AUTH_DIR} , +{ "autoRescan", "AutoRescan", DM_BOOL, (char **) &autoRescan, + "true"} , +{ "removeDomainname","RemoveDomainname",DM_BOOL,(char **) &removeDomainname, + "true"} , +{ "keyFile", "KeyFile", DM_STRING, &keyFile, + DEF_KEY_FILE} , +{ "accessFile", "AccessFile", DM_STRING, &accessFile, + DEF_ACCESS_FILE} , +{ "exportList", "ExportList", DM_ARGV, (char **) &exportList, + ""} , +{ "randomFile", "RandomFile", DM_STRING, &randomFile, + DEF_RANDOM_FILE} , +{ "greeterLib", "GreeterLib", DM_STRING, &greeterLib, + DEF_GREETER_LIB} , +{ "choiceTimeout","ChoiceTimeout",DM_INT, (char **) &choiceTimeout, + "15"} , +{ "sourceAddress","SourceAddress",DM_BOOL, (char **) &sourceAddress, + "false"} , +{ "willing", "Willing", DM_STRING, &willing, + ""} , }; # define NUM_DM_RESOURCES (sizeof DmResources / sizeof DmResources[0]) @@ -176,40 +189,40 @@ struct displayResource { /* resources for managing the server */ struct displayResource serverResources[] = { -"serverAttempts","ServerAttempts",DM_INT, boffset(serverAttempts), - "1", -"openDelay", "OpenDelay", DM_INT, boffset(openDelay), - "15", -"openRepeat", "OpenRepeat", DM_INT, boffset(openRepeat), - "5", -"openTimeout", "OpenTimeout", DM_INT, boffset(openTimeout), - "30", -"startAttempts","StartAttempts",DM_INT, boffset(startAttempts), - "4", -"pingInterval", "PingInterval", DM_INT, boffset(pingInterval), - "5", -"pingTimeout", "PingTimeout", DM_INT, boffset(pingTimeout), - "5", -"terminateServer","TerminateServer",DM_BOOL, boffset(terminateServer), - "false", -"grabServer", "GrabServer", DM_BOOL, boffset(grabServer), - "false", -"grabTimeout", "GrabTimeout", DM_INT, boffset(grabTimeout), - "3", -"resetSignal", "Signal", DM_INT, boffset(resetSignal), - "1", /* SIGHUP */ -"termSignal", "Signal", DM_INT, boffset(termSignal), - "15", /* SIGTERM */ -"resetForAuth", "ResetForAuth", DM_BOOL, boffset(resetForAuth), - "false", -"authorize", "Authorize", DM_BOOL, boffset(authorize), - "true", -"authComplain", "AuthComplain", DM_BOOL, boffset(authComplain), - "true", -"authName", "AuthName", DM_ARGV, boffset(authNames), - DEF_AUTH_NAME, -"authFile", "AuthFile", DM_STRING, boffset(clientAuthFile), - "", +{ "serverAttempts","ServerAttempts",DM_INT, boffset(serverAttempts), + "1" }, +{ "openDelay", "OpenDelay", DM_INT, boffset(openDelay), + "15" }, +{ "openRepeat", "OpenRepeat", DM_INT, boffset(openRepeat), + "5" }, +{ "openTimeout","OpenTimeout", DM_INT, boffset(openTimeout), + "120" }, +{ "startAttempts","StartAttempts",DM_INT, boffset(startAttempts), + "4" }, +{ "pingInterval","PingInterval",DM_INT, boffset(pingInterval), + "5" }, +{ "pingTimeout","PingTimeout", DM_INT, boffset(pingTimeout), + "5" }, +{ "terminateServer","TerminateServer",DM_BOOL, boffset(terminateServer), + "false" }, +{ "grabServer", "GrabServer", DM_BOOL, boffset(grabServer), + "false" }, +{ "grabTimeout","GrabTimeout", DM_INT, boffset(grabTimeout), + "3" }, +{ "resetSignal","Signal", DM_INT, boffset(resetSignal), + "1" }, /* SIGHUP */ +{ "termSignal", "Signal", DM_INT, boffset(termSignal), + "15" }, /* SIGTERM */ +{ "resetForAuth","ResetForAuth",DM_BOOL, boffset(resetForAuth), + "false" }, +{ "authorize", "Authorize", DM_BOOL, boffset(authorize), + "true" }, +{ "authComplain","AuthComplain",DM_BOOL, boffset(authComplain), + "true" }, +{ "authName", "AuthName", DM_ARGV, boffset(authNames), + DEF_AUTH_NAME }, +{ "authFile", "AuthFile", DM_STRING, boffset(clientAuthFile), + "" }, }; # define NUM_SERVER_RESOURCES (sizeof serverResources/\ @@ -218,30 +231,30 @@ struct displayResource serverResources[] = { /* resources which control the session behaviour */ struct displayResource sessionResources[] = { -"resources", "Resources", DM_STRING, boffset(resources), - "", -"xrdb", "Xrdb", DM_STRING, boffset(xrdb), - XRDB_PROGRAM, -"setup", "Setup", DM_STRING, boffset(setup), - "", -"startup", "Startup", DM_STRING, boffset(startup), - "", -"reset", "Reset", DM_STRING, boffset(reset), - "", -"session", "Session", DM_STRING, boffset(session), - DEF_SESSION, -"userPath", "Path", DM_STRING, boffset(userPath), - DEF_USER_PATH, -"systemPath", "Path", DM_STRING, boffset(systemPath), - DEF_SYSTEM_PATH, -"systemShell", "Shell", DM_STRING, boffset(systemShell), - DEF_SYSTEM_SHELL, -"failsafeClient","FailsafeClient", DM_STRING, boffset(failsafeClient), - DEF_FAILSAFE_CLIENT, -"userAuthDir", "UserAuthDir", DM_STRING, boffset(userAuthDir), - DEF_USER_AUTH_DIR, -"chooser", "Chooser", DM_STRING, boffset(chooser), - DEF_CHOOSER, +{ "resources", "Resources", DM_STRING, boffset(resources), + "" }, +{ "xrdb", "Xrdb", DM_STRING, boffset(xrdb), + XRDB_PROGRAM }, +{ "setup", "Setup", DM_STRING, boffset(setup), + "" }, +{ "startup", "Startup", DM_STRING, boffset(startup), + "" }, +{ "reset", "Reset", DM_STRING, boffset(reset), + "" }, +{ "session", "Session", DM_STRING, boffset(session), + DEF_SESSION }, +{ "userPath", "Path", DM_STRING, boffset(userPath), + DEF_USER_PATH }, +{ "systemPath", "Path", DM_STRING, boffset(systemPath), + DEF_SYSTEM_PATH }, +{ "systemShell","Shell", DM_STRING, boffset(systemShell), + DEF_SYSTEM_SHELL }, +{ "failsafeClient","FailsafeClient", DM_STRING, boffset(failsafeClient), + DEF_FAILSAFE_CLIENT }, +{ "userAuthDir","UserAuthDir", DM_STRING, boffset(userAuthDir), + DEF_USER_AUTH_DIR }, +{ "chooser", "Chooser", DM_STRING, boffset(chooser), + DEF_CHOOSER }, }; # define NUM_SESSION_RESOURCES (sizeof sessionResources/\ @@ -249,18 +262,19 @@ struct displayResource sessionResources[] = { XrmDatabase DmResourceDB; -GetResource (name, class, valueType, valuep, default_value) - char *name, *class; - int valueType; - char **valuep; - char *default_value; +static void +GetResource ( + char *name, + char *class, + int valueType, + char **valuep, + char *default_value) { char *type; XrmValue value; char *string, *new_string; char str_buf[50]; int len; - extern char **parseArgs(); if (DmResourceDB && XrmGetResource (DmResourceDB, name, class, @@ -347,9 +361,8 @@ XrmOptionDescRec optionTable [] = { static int originalArgc; static char **originalArgv; -InitResources (argc, argv) -int argc; -char **argv; +void +InitResources (int argc, char **argv) { XrmInitialize (); originalArgc = argc; @@ -357,7 +370,8 @@ char **argv; ReinitResources (); } -ReinitResources () +void +ReinitResources (void) { int argc; char **a; @@ -401,24 +415,23 @@ ReinitResources () free (argv); } -LoadDMResources () +void +LoadDMResources (void) { int i; char name[1024], class[1024]; for (i = 0; i < NUM_DM_RESOURCES; i++) { - sprintf (name, "DisplayManager.%s", DmResources[i].name); - sprintf (class, "DisplayManager.%s", DmResources[i].class); + snprintf (name, sizeof(name), "DisplayManager.%s", DmResources[i].name); + snprintf (class, sizeof(class), "DisplayManager.%s", DmResources[i].class); GetResource (name, class, DmResources[i].type, (char **) DmResources[i].dm_value, DmResources[i].default_value); } } -static -CleanUpName (src, dst, len) -char *src, *dst; -int len; +static void +CleanUpName (char *src, char *dst, int len) { while (*src) { if (--len <= 0) @@ -437,10 +450,11 @@ int len; *dst = '\0'; } -LoadDisplayResources (d, resources, numResources) - struct display *d; - struct displayResource *resources; - int numResources; +static void +LoadDisplayResources ( + struct display *d, + struct displayResource *resources, + int numResources) { int i; char name[1024], class[1024]; @@ -449,9 +463,9 @@ LoadDisplayResources (d, resources, numResources) CleanUpName (d->name, dpyName, sizeof (dpyName)); CleanUpName (d->class ? d->class : d->name, dpyClass, sizeof (dpyClass)); for (i = 0; i < numResources; i++) { - sprintf (name, "DisplayManager.%s.%s", + snprintf (name, sizeof(name), "DisplayManager.%s.%s", dpyName, resources[i].name); - sprintf (class, "DisplayManager.%s.%s", + snprintf (class, sizeof(class), "DisplayManager.%s.%s", dpyClass, resources[i].class); GetResource (name, class, resources[i].type, (char **) (((char *) d) + resources[i].offset), @@ -459,14 +473,14 @@ LoadDisplayResources (d, resources, numResources) } } -LoadServerResources (d) - struct display *d; +void +LoadServerResources (struct display *d) { LoadDisplayResources (d, serverResources, NUM_SERVER_RESOURCES); } -LoadSessionResources (d) - struct display *d; +void +LoadSessionResources (struct display *d) { LoadDisplayResources (d, sessionResources, NUM_SESSION_RESOURCES); } diff --git a/rpcauth.c b/rpcauth.c index 7c94652..399ebb6 100644 --- a/rpcauth.c +++ b/rpcauth.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.4 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon @@ -39,19 +40,21 @@ from The Open Group. # include # include # include + # include "dm.h" +# include "dm_auth.h" +# include "dm_error.h" /*ARGSUSED*/ -SecureRPCInitAuth (name_len, name) - unsigned short name_len; - char *name; +void +SecureRPCInitAuth (unsigned short name_len, char *name) { } Xauth * -SecureRPCGetAuth (namelen, name) - unsigned short namelen; - char *name; +SecureRPCGetAuth ( + unsigned short namelen, + char *name) { char key[MAXNETNAMELEN+1]; Xauth *new; diff --git a/server.c b/server.c index 76c17d7..2ee5bba 100644 --- a/server.c +++ b/server.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/server.c,v 3.13 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon @@ -35,6 +36,9 @@ from The Open Group. */ # include "dm.h" +# include "dm_error.h" +# include "dm_socket.h" + # include # include # include @@ -42,42 +46,38 @@ from The Open Group. # include # include -static receivedUsr1; - -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif +static int receivedUsr1; -static serverPause (); +static int serverPause (unsigned t, int serverPid); static Display *dpy; /* ARGSUSED */ static SIGVAL -CatchUsr1 (n) - int n; +CatchUsr1 (int n) { + int olderrno = errno; + #ifdef SIGNALS_RESET_WHEN_CAUGHT (void) Signal (SIGUSR1, CatchUsr1); #endif Debug ("display manager caught SIGUSR1\n"); ++receivedUsr1; + errno = olderrno; } -char *_SysErrorMsg (n) - int n; +char *_SysErrorMsg (int n) { char *s = strerror(n); return (s ? s : "unknown error"); } -StartServerOnce (d) -struct display *d; +static int +StartServerOnce (struct display *d) { char **f; char **argv; char arg[1024]; - char **parseArgs (); int pid; Debug ("StartServer for %s\n", d->name); @@ -87,6 +87,10 @@ struct display *d; switch (pid = fork ()) { case 0: CleanUpChild (); +#ifdef XDMCP + /* The chooser socket is not closed by CleanUpChild() */ + DestroyWellKnownSockets(); +#endif if (d->authFile) { sprintf (arg, "-auth %s", d->authFile); argv = parseArgs (argv, arg); @@ -123,8 +127,8 @@ struct display *d; return TRUE; } -StartServer (d) -struct display *d; +int +StartServer (struct display *d) { int i; int ret = FALSE; @@ -150,26 +154,22 @@ static int serverPauseRet; /* ARGSUSED */ static SIGVAL -serverPauseAbort (n) - int n; +serverPauseAbort (int n) { Longjmp (pauseAbort, 1); } /* ARGSUSED */ static SIGVAL -serverPauseUsr1 (n) - int n; +serverPauseUsr1 (int n) { Debug ("display manager paused til SIGUSR1\n"); ++receivedUsr1; Longjmp (pauseAbort, 1); } -static -serverPause (t, serverPid) -unsigned t; -int serverPid; +static int +serverPause (unsigned t, int serverPid) { int pid; @@ -203,7 +203,7 @@ int serverPid; #endif /* X_NOT_POSIX */ #endif /* SYSV */ if (pid == serverPid || - pid == -1 && errno == ECHILD) + (pid == -1 && errno == ECHILD)) { Debug ("Server dead\n"); serverPauseRet = 1; @@ -240,8 +240,7 @@ static Jmp_buf openAbort; /* ARGSUSED */ static SIGVAL -abortOpen (n) - int n; +abortOpen (int n) { Longjmp (openAbort, 1); } @@ -252,10 +251,8 @@ abortOpen (n) #include #endif -static -GetRemoteAddress (d, fd) - struct display *d; - int fd; +static void +GetRemoteAddress (struct display *d, int fd) { char buf[512]; int len = sizeof (buf); @@ -272,7 +269,7 @@ GetRemoteAddress (d, fd) len = 8; /* lucky for us, t_getname returns something that looks like a sockaddr */ #else - getpeername (fd, (struct sockaddr *) buf, &len); + getpeername (fd, (struct sockaddr *) buf, (void *)&len); #endif d->peerlen = 0; if (len) @@ -290,18 +287,18 @@ GetRemoteAddress (d, fd) #endif /* XDMCP */ static int -openErrorHandler (dpy) - Display *dpy; +openErrorHandler (Display *dpy) { LogError ("IO Error in XOpenDisplay\n"); exit (OPENFAILED_DISPLAY); + /*NOTREACHED*/ + return(0); } int -WaitForServer (d) - struct display *d; +WaitForServer (struct display *d) { - int i; + static int i; for (i = 0; i < (d->openRepeat > 0 ? d->openRepeat : 1); i++) { (void) Signal (SIGALRM, abortOpen); @@ -324,7 +321,7 @@ WaitForServer (d) #endif (void) alarm ((unsigned) 0); (void) Signal (SIGALRM, SIG_DFL); - (void) XSetIOErrorHandler ((int (*)()) 0); + (void) XSetIOErrorHandler ((int (*)(Display *)) 0); Debug ("After XOpenDisplay(%s)\n", d->name); if (dpy) { #ifdef XDMCP @@ -336,7 +333,7 @@ WaitForServer (d) return 1; } else { Debug ("OpenDisplay failed %d (%s) on \"%s\"\n", - errno, _SysErrorMsg (errno), d->name); + errno, strerror (errno), d->name); } Debug ("waiting for server to start %d\n", i); sleep ((unsigned) d->openDelay); @@ -352,8 +349,8 @@ WaitForServer (d) return 0; } -ResetServer (d) - struct display *d; +void +ResetServer (struct display *d) { if (dpy && d->displayType.origin != FromXDMCP) pseudoReset (dpy); @@ -362,37 +359,35 @@ ResetServer (d) static Jmp_buf pingTime; static void -PingLost () +PingLost (void) { Longjmp (pingTime, 1); } /* ARGSUSED */ static int -PingLostIOErr (dpy) - Display *dpy; +PingLostIOErr (Display *dpy) { PingLost(); + return 0; } /* ARGSUSED */ static SIGVAL -PingLostSig (n) - int n; +PingLostSig (int n) { PingLost(); } -PingServer (d, alternateDpy) - struct display *d; - Display *alternateDpy; +int +PingServer (struct display *d, Display *alternateDpy) { - int (*oldError)(); - SIGVAL (*oldSig)(); + int (*oldError)(Display *); + SIGVAL (*oldSig)(int); int oldAlarm; - - if (!alternateDpy) - alternateDpy = dpy; + static Display *aDpy; + + aDpy = (alternateDpy != NULL ? alternateDpy : dpy); oldError = XSetIOErrorHandler (PingLostIOErr); oldAlarm = alarm (0); oldSig = Signal (SIGALRM, PingLostSig); @@ -400,7 +395,7 @@ PingServer (d, alternateDpy) if (!Setjmp (pingTime)) { Debug ("Ping server\n"); - XSync (alternateDpy, 0); + XSync (aDpy, 0); } else { diff --git a/session.c b/session.c index 9eae405..9befc15 100644 --- a/session.c +++ b/session.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/session.c,v 3.33 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon @@ -35,13 +36,18 @@ from The Open Group. */ #include "dm.h" +#include "dm_auth.h" +#include "dm_error.h" #include "greet.h" + #include #include #include +#include #include #include #include +#include /* for initgroups */ #ifdef AIXV3 # include #endif @@ -60,41 +66,50 @@ from The Open Group. #endif #endif -#ifdef CSRG_BASED -#include -#ifdef HAS_SETUSERCONTEXT -#include +static int runAndWait (char **args, char **environ); + +#if defined(CSRG_BASED) || defined(__osf__) || defined(__DARWIN__) || defined(__QNXNTO__) +#include +#include +#else +/* should be in */ +extern void setgrent(void); +extern struct group *getgrent(void); +extern void endgrent(void); +#endif + +#ifdef USESHADOW +extern struct spwd *getspnam(GETSPNAM_ARGS); +extern void endspent(void); +#endif +#if defined(CSRG_BASED) #include +#include +#else +extern struct passwd *getpwnam(GETPWNAM_ARGS); +#ifdef linux +extern void endpwent(void); #endif +extern char *crypt(CRYPT_ARGS); #endif +#ifdef USE_PAM +pam_handle_t **thepamhp() +{ + static pam_handle_t *pamh = NULL; + return &pamh; +} -extern int PingServer(); -extern int SessionPingFailed(); -extern int Debug(); -extern int RegisterCloseOnFork(); -extern int SecureDisplay(); -extern int UnsecureDisplay(); -extern int ClearCloseOnFork(); -extern int SetupDisplay(); -extern int LogError(); -extern int SessionExit(); -extern int DeleteXloginResources(); -extern int source(); -extern char **defaultEnv(); -extern char **setEnv(); -extern char **parseArgs(); -extern int printEnv(); -extern char **systemEnv(); -extern int LogOutOfMem(); -extern void setgrent(); -extern struct group *getgrent(); -extern void endgrent(); -#ifdef USESHADOW -extern struct spwd *getspnam(); -extern void endspent(); +pam_handle_t *thepamh() +{ + pam_handle_t **pamhp; + + pamhp = thepamhp(); + if (pamhp) + return *pamhp; + else + return NULL; +} #endif -extern struct passwd *getpwnam(); -extern char *crypt(); static struct dlfuncs dlfuncs = { PingServer, @@ -111,6 +126,7 @@ static struct dlfuncs dlfuncs = { source, defaultEnv, setEnv, + putEnv, parseArgs, printEnv, systemEnv, @@ -120,17 +136,26 @@ static struct dlfuncs dlfuncs = { endgrent, #ifdef USESHADOW getspnam, +#ifndef QNX4 endspent, +#endif /* QNX4 doesn't use endspent */ #endif getpwnam, +#ifdef linux + endpwent, +#endif crypt, - }; - -#ifdef X_NOT_STDC_ENV -extern int errno; +#ifdef USE_PAM + thepamhp, #endif + }; -static Bool StartClient(); +static Bool StartClient( + struct verify_info *verify, + struct display *d, + int *pidp, + char *name, + char *passwd); static int clientPid; static struct greet_info greet; @@ -140,8 +165,7 @@ static Jmp_buf abortSession; /* ARGSUSED */ static SIGVAL -catchTerm (n) - int n; +catchTerm (int n) { Longjmp (abortSession, 1); } @@ -150,8 +174,7 @@ static Jmp_buf pingTime; /* ARGSUSED */ static SIGVAL -catchAlrm (n) - int n; +catchAlrm (int n) { Longjmp (pingTime, 1); } @@ -160,8 +183,7 @@ static Jmp_buf tenaciousClient; /* ARGSUSED */ static SIGVAL -waitAbort (n) - int n; +waitAbort (int n) { Longjmp (tenaciousClient, 1); } @@ -171,16 +193,12 @@ waitAbort (n) #endif static void -AbortClient (pid) - int pid; +AbortClient (int pid) { int sig = SIGTERM; -#ifdef __STDC__ volatile int i; -#else - int i; -#endif int retId; + for (i = 0; i < 4; i++) { if (killpg (pid, sig) == -1) { switch (errno) { @@ -205,8 +223,8 @@ AbortClient (pid) } } -SessionPingFailed (d) - struct display *d; +void +SessionPingFailed (struct display *d) { if (clientPid > 1) { @@ -225,18 +243,17 @@ SessionPingFailed (d) */ /*ARGSUSED*/ -static -IOErrorHandler (dpy) - Display *dpy; +static int +IOErrorHandler (Display *dpy) { LogError("fatal IO error %d (%s)\n", errno, _SysErrorMsg(errno)); exit(RESERVER_DISPLAY); + /*NOTREACHED*/ + return 0; } static int -ErrorHandler(dpy, event) - Display *dpy; - XErrorEvent *event; +ErrorHandler(Display *dpy, XErrorEvent *event) { LogError("X error\n"); if (XmuPrintDefaultErrorMessage (dpy, event, stderr) == 0) return 0; @@ -244,10 +261,10 @@ ErrorHandler(dpy, event) /*NOTREACHED*/ } -ManageSession (d) -struct display *d; +void +ManageSession (struct display *d) { - int pid; + static int pid = 0; Display *dpy; greet_user_rtn greet_stat; static GreetUserProc greet_user_proc = NULL; @@ -258,7 +275,11 @@ struct display *d; Debug ("ManageSession %s\n", d->name); (void)XSetIOErrorHandler(IOErrorHandler); (void)XSetErrorHandler(ErrorHandler); +#ifndef HAS_SETPROCTITLE SetTitle(d->name, (char *) 0); +#else + setproctitle("%s", d->name); +#endif /* * Load system default Resources */ @@ -348,11 +369,11 @@ struct display *d; SessionExit (d, OBEYSESS_DISPLAY, TRUE); } -LoadXloginResources (d) -struct display *d; +void +LoadXloginResources (struct display *d) { - char **args, **parseArgs(); - char **env = 0, **setEnv(), **systemEnv(); + char **args; + char **env = 0; if (d->resources[0] && access (d->resources, 4) == 0) { env = systemEnv (d, (char *) 0, (char *) 0); @@ -365,10 +386,10 @@ struct display *d; } } -SetupDisplay (d) -struct display *d; +void +SetupDisplay (struct display *d) { - char **env = 0, **setEnv(), **systemEnv(); + char **env = 0; if (d->setup && d->setup[0]) { @@ -379,9 +400,8 @@ struct display *d; } /*ARGSUSED*/ -DeleteXloginResources (d, dpy) -struct display *d; -Display *dpy; +void +DeleteXloginResources (struct display *d, Display *dpy) { int i; Atom prop = XInternAtom(dpy, "SCREEN_RESOURCES", True); @@ -397,15 +417,13 @@ static Jmp_buf syncJump; /* ARGSUSED */ static SIGVAL -syncTimeout (n) - int n; +syncTimeout (int n) { Longjmp (syncJump, 1); } -SecureDisplay (d, dpy) -struct display *d; -Display *dpy; +void +SecureDisplay (struct display *d, Display *dpy) { Debug ("SecureDisplay %s\n", d->name); (void) Signal (SIGALRM, syncTimeout); @@ -438,9 +456,8 @@ Display *dpy; Debug ("done secure %s\n", d->name); } -UnsecureDisplay (d, dpy) -struct display *d; -Display *dpy; +void +UnsecureDisplay (struct display *d, Display *dpy) { Debug ("Unsecure display %s\n", d->name); if (d->grabServer) @@ -450,9 +467,21 @@ Display *dpy; } } -SessionExit (d, status, removeAuth) - struct display *d; +void +SessionExit (struct display *d, int status, int removeAuth) { +#ifdef USE_PAM + pam_handle_t *pamh = thepamh(); +#endif +#ifdef USE_PAM + if (pamh) { + /* shutdown PAM session */ + pam_close_session(pamh, 0); + pam_end(pamh, PAM_SUCCESS); + pamh = NULL; + } +#endif + /* make sure the server gets reset after the session is over */ if (d->serverPid >= 2 && d->resetSignal) kill (d->serverPid, d->resetSignal); @@ -493,19 +522,22 @@ SessionExit (d, status, removeAuth) } static Bool -StartClient (verify, d, pidp, name, passwd) - struct verify_info *verify; - struct display *d; - int *pidp; - char *name; - char *passwd; +StartClient ( + struct verify_info *verify, + struct display *d, + int *pidp, + char *name, + char *passwd) { - char **f, *home, *getEnv (); + char **f, *home; char *failsafeArgv[2]; int pid; #ifdef HAS_SETUSERCONTEXT struct passwd* pwd; #endif +#ifdef USE_PAM + pam_handle_t *pamh = thepamh(); +#endif if (verify->argv) { Debug ("StartSession %s: ", verify->argv[0]); @@ -518,12 +550,31 @@ StartClient (verify, d, pidp, name, passwd) Debug ("%s ", *f); Debug ("\n"); } +#ifdef USE_PAM + if (pamh) pam_open_session(pamh, 0); +#endif switch (pid = fork ()) { case 0: CleanUpChild (); +#ifdef XDMCP + /* The chooser socket is not closed by CleanUpChild() */ + DestroyWellKnownSockets(); +#endif /* Do system-dependent login setup here */ +#ifdef USE_PAM + /* pass in environment variables set by libpam and modules it called */ + if (pamh) { + long i; + char **pam_env = pam_getenvlist(pamh); + for(i = 0; pam_env && pam_env[i]; i++) { + verify->userEnviron = putEnv(pam_env[i], verify->userEnviron); + } + } +#endif + + #ifndef AIXV3 #ifndef HAS_SETUSERCONTEXT if (setgid(verify->gid) < 0) @@ -532,18 +583,25 @@ StartClient (verify, d, pidp, name, passwd) verify->gid, name, errno); return (0); } -#if (BSD >= 199103) +#if defined(BSD) && (BSD >= 199103) if (setlogin(name) < 0) { LogError("setlogin for \"%s\" failed, errno=%d", name, errno); return(0); } #endif +#ifndef QNX4 if (initgroups(name, verify->gid) < 0) { LogError("initgroups for \"%s\" failed, errno=%d\n", name, errno); return (0); } +#endif /* QNX4 doesn't support multi-groups, no initgroups() */ +#ifdef USE_PAM + if (thepamh()) { + pam_setcred(thepamh(), PAM_ESTABLISH_CRED); + } +#endif if (setuid(verify->uid) < 0) { LogError("setuid %d (user \"%s\") failed, errno=%d\n", @@ -707,12 +765,9 @@ StartClient (verify, d, pidp, name, passwd) } int -source (environ, file) -char **environ; -char *file; +source (char **environ, char *file) { char **args, *args_safe[2]; - extern char **parseArgs (); int ret; if (file && file[0]) { @@ -731,10 +786,8 @@ char *file; return 0; } -int -runAndWait (args, environ) - char **args; - char **environ; +static int +runAndWait (char **args, char **environ) { int pid; waitType result; @@ -759,13 +812,11 @@ runAndWait (args, environ) } void -execute (argv, environ) - char **argv; - char **environ; +execute (char **argv, char **environ) { /* give /dev/null as stdin */ (void) close (0); - open ("/dev/null", 0); + open ("/dev/null", O_RDONLY); /* make stdout follow stderr to the log file */ dup2 (2,1); execve (argv[0], argv, environ); @@ -837,10 +888,8 @@ execute (argv, environ) } } -extern char **setEnv (); - char ** -defaultEnv () +defaultEnv (void) { char **env, **exp, *value; @@ -855,9 +904,7 @@ defaultEnv () } char ** -systemEnv (d, user, home) -struct display *d; -char *user, *home; +systemEnv (struct display *d, char *user, char *home) { char **env; @@ -876,3 +923,10 @@ char *user, *home; env = setEnv (env, "XAUTHORITY", d->authFile); return env; } + +#if (defined(Lynx) && !defined(HAS_CRYPT)) || defined(SCO) && !defined(SCO_USA) && !defined(_SCO_DS) +char *crypt(char *s1, char *s2) +{ + return(s2); +} +#endif diff --git a/socket.c b/socket.c index 47b0c79..83dddf6 100644 --- a/socket.c +++ b/socket.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/socket.c,v 3.10 2001/12/14 20:01:24 dawes Exp $ */ /* * xdm - display manager daemon @@ -35,19 +36,22 @@ from The Open Group. */ #include "dm.h" +#include "dm_error.h" #ifdef XDMCP #ifndef STREAMSCONN #include -#include -#include -#include -#include +#include "dm_socket.h" -#ifdef X_NOT_STDC_ENV -extern int errno; +#ifndef X_NO_SYS_UN +#ifndef Lynx +#include +#else +#include #endif +#endif +#include extern int xdmcpFd; @@ -56,10 +60,11 @@ extern int chooserFd; extern FD_TYPE WellKnownSocketsMask; extern int WellKnownSocketsMax; -CreateWellKnownSockets () +void +CreateWellKnownSockets (void) { struct sockaddr_in sock_addr; - char *name, *localHostname(); + char *name; if (request_port == 0) return; @@ -103,19 +108,21 @@ CreateWellKnownSockets () FD_SET (chooserFd, &WellKnownSocketsMask); } -GetChooserAddr (addr, lenp) - char *addr; - int *lenp; +int +GetChooserAddr ( + char *addr, + int *lenp) { struct sockaddr_in in_addr; int len; len = sizeof in_addr; - if (getsockname (chooserFd, (struct sockaddr *)&in_addr, &len) < 0) + if (getsockname (chooserFd, (struct sockaddr *)&in_addr, (void *)&len) < 0) return -1; Debug ("Chooser socket port: %d\n", ntohs(in_addr.sin_port)); memmove( addr, (char *) &in_addr, len); *lenp = len; + return 0; } diff --git a/streams.c b/streams.c index 585fe90..de6b41a 100644 --- a/streams.c +++ b/streams.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/streams.c,v 3.6 2001/12/14 20:01:24 dawes Exp $ */ /* * xdm - display manager daemon @@ -35,6 +36,7 @@ from The Open Group. */ #include "dm.h" +#include "dm_error.h" #ifdef XDMCP #ifdef STREAMSCONN @@ -50,6 +52,7 @@ extern int chooserFd; extern FD_TYPE WellKnownSocketsMask; extern int WellKnownSocketsMax; +void CreateWellKnownSockets () { struct t_bind bind_addr; diff --git a/util.c b/util.c index 372f372..401d4ae 100644 --- a/util.c +++ b/util.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/util.c,v 3.20 2002/05/31 18:46:10 dawes Exp $ */ /* * xdm - display manager daemon @@ -37,6 +38,10 @@ from The Open Group. */ # include "dm.h" +# include "dm_error.h" + +#include /* for XmuGetHostname */ + #ifdef X_POSIX_C_SOURCE #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include @@ -50,21 +55,19 @@ from The Open Group. #undef _POSIX_SOURCE #endif #endif -#if defined(__osf__) || defined(linux) +#if defined(__osf__) || defined(linux) || defined(__QNXNTO__) || defined(__GNU__) #define setpgrp setpgid #endif -printEnv (e) -char **e; +void +printEnv (char **e) { while (*e) Debug ("%s\n", *e++); } static char * -makeEnv (name, value) -char *name; -char *value; +makeEnv (char *name, char *value) { char *result; @@ -78,9 +81,7 @@ char *value; } char * -getEnv (e, name) - char **e; - char *name; +getEnv (char **e, char *name) { int l = strlen (name); @@ -96,10 +97,7 @@ getEnv (e, name) } char ** -setEnv (e, name, value) - char **e; - char *name; - char *value; +setEnv (char **e, char *name, char *value) { char **new, **old; char *newe; @@ -138,8 +136,33 @@ setEnv (e, name, value) return new; } -freeEnv (env) - char **env; +char ** +putEnv(const char *string, char **env) +{ + char *v, *b, *n; + int nl; + + if ((b = strchr(string, '=')) == NULL) + return NULL; + v = b + 1; + + nl = b - string; + if ((n = malloc(nl + 1)) == NULL) + { + LogOutOfMem ("putAllEnv"); + return NULL; + } + + strncpy(n, string,nl + 1); + n[nl] = 0; + + env = setEnv(env,n,v); + free(n); + return env; +} + +void +freeEnv (char **env) { char **e; @@ -154,12 +177,11 @@ freeEnv (env) # define isblank(c) ((c) == ' ' || c == '\t') char ** -parseArgs (argv, string) -char **argv; -char *string; +parseArgs (char **argv, char *string) { char *word; char *save; + char **newargv; int i; i = 0; @@ -176,16 +198,17 @@ char *string; for (;;) { if (!*string || isblank (*string)) { if (word != string) { - argv = (char **) realloc ((char *) argv, + newargv = (char **) realloc ((char *) argv, (unsigned) ((i + 2) * sizeof (char *))); save = malloc ((unsigned) (string - word + 1)); - if (!argv || !save) { + if (!newargv || !save) { LogOutOfMem ("parseArgs"); - if (argv) - free ((char *) argv); + free ((char *) argv); if (save) free (save); return 0; + } else { + argv = newargv; } argv[i] = strncpy (save, word, string-word); argv[i][string-word] = '\0'; @@ -201,8 +224,8 @@ char *string; return argv; } -freeArgs (argv) - char **argv; +void +freeArgs (char **argv) { char **a; @@ -214,14 +237,21 @@ freeArgs (argv) free ((char *) argv); } -CleanUpChild () +void +CleanUpChild (void) { -#if defined(SYSV) || defined(SVR4) +#ifdef CSRG_BASED + setsid(); +#else +#if defined(SYSV) || defined(SVR4) || defined(__CYGWIN__) +#if !(defined(SVR4) && defined(i386)) || defined(SCO325) setpgrp (); +#endif #else setpgrp (0, getpid ()); sigsetmask (0); #endif +#endif #ifdef SIGCHLD (void) Signal (SIGCHLD, SIG_DFL); #endif @@ -236,7 +266,7 @@ static char localHostbuf[256]; static int gotLocalHostname; char * -localHostname () +localHostname (void) { if (!gotLocalHostname) { @@ -246,11 +276,9 @@ localHostname () return localHostbuf; } -SIGVAL (*Signal (sig, handler))() - int sig; - SIGVAL (*handler)(); +SIGVAL (*Signal (int sig, SIGFUNC handler))(int) { -#ifndef X_NOT_POSIX +#if !defined(X_NOT_POSIX) && !defined(__UNIXOS2__) struct sigaction sigact, osigact; sigact.sa_handler = handler; sigemptyset(&sigact.sa_mask); diff --git a/xdm.man.cpp b/xdm.man.cpp index 45f8a90..07fd53f 100644 --- a/xdm.man.cpp +++ b/xdm.man.cpp @@ -22,7 +22,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.TH XDM 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.22 2002/10/12 16:06:47 herrb Exp $ +.\" +.TH XDM 1 __xorgversion__ .SH NAME xdm \- X Display Manager with support for XDMCP, host chooser .SH SYNOPSIS @@ -82,6 +85,13 @@ offer a menu of possible hosts that offer XDMCP display management. This feature is useful with X terminals that do not offer a host menu themselves. .PP +.I Xdm +can be configured to ignore BroadcastQuery messages from selected hosts. +This is useful when you don't want the host to appear in menus produced +by +.I chooser +or X terminals themselves. +.PP Because .I xdm provides the first interface that users will see, it is designed to be @@ -134,7 +144,7 @@ When the \fIXsession\fP script exits, the session is over. At the end of the session, the \fIXreset\fP script is run to clean up, the X server is reset, and the cycle starts over. .PP -The file \fI/usr/X11R6/lib/X11/xdm/xdm-errors\fP will contain error +The file \fI__projectroot__/lib/X11/xdm/xdm-errors\fP will contain error messages from .I xdm and anything output to stderr by \fIXsetup, Xstartup, Xsession\fP @@ -153,7 +163,7 @@ as resources. Names the configuration file, which specifies resources to control the behavior of .I xdm. -.I /lib/X11/xdm/xdm-config +.I __projectroot__/lib/X11/xdm/xdm-config is the default. See the section \fBConfiguration File\fP. .IP "\fB\-nodaemon\fP" @@ -199,7 +209,8 @@ sets the port-number which .I xdm will monitor for XDMCP requests. As XDMCP uses the registered well-known UDP port 177, this resource should -not be changed except for debugging. +not be changed except for debugging. If set to 0 xdm will not listen +for XDMCP or Chooser requests. .IP "\fB\-session\fP \fIsession_program\fP" Specifies the value for the \fBDisplayManager*session\fP resource. This indicates the program to run as the session after the user has logged in. @@ -294,7 +305,7 @@ uses the \fIlockf\fP library call, while on BSD it uses \fIflock.\fP This names a directory under which .I xdm stores authorization files while initializing the session. The -default value is \fI/lib/X11/xdm.\fP +default value is \fI__projectroot__/lib/X11/xdm.\fP Can be overridden for specific displays by DisplayManager.\fIDISPLAY\fP.authFile. .IP \fBDisplayManager.autoRescan\fP @@ -340,7 +351,8 @@ This should be a file that changes frequently. The default is \fI/dev/mem\fP. .IP \fBDisplayManager.greeterLib\fP On systems that support a dynamically-loadable greeter library, the -name of the library. Default is \fI/lib/X11/xdm/libXdmGreet.so\fP. +name of the library. The default is +\fI__projectroot__/lib/X11/xdm/libXdmGreet.so\fP. .IP \fBDisplayManager.choiceTimeout\fP Number of seconds to wait for display to respond after user has selected a host from the chooser. If the display sends an XDMCP @@ -348,6 +360,17 @@ IndirectQuery within this time, the request is forwarded to the chosen host. Otherwise, it is assumed to be from a new session and the chooser is offered again. Default is 15. +.IP \fBDisplayManager.sourceAddress\fP +Use the numeric IP address of the incoming connection on multihomed hosts +instead of the host name. This is to avoid trying to connect on the wrong +interface which might be down at this time. +.IP \fBDisplayManager.willing\fP +This specifies a program which is run (as) root when an an XDMCP +BroadcastQuery is received and this host is configured to offer XDMCP +display management. The output of this program may be displayed on a chooser +window. If no program is specified, the string \fIWilling to manage\fP is +sent. +.PP .\" .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.resources\fP" This resource specifies the name of the file to be loaded by \fIxrdb\fP @@ -361,17 +384,17 @@ section which describes the various resources that are appropriate to place in this file. There is no default value for this resource, but -\fI/lib/X11/xdm/Xresources\fP +\fI__projectroot__/lib/X11/xdm/Xresources\fP is the conventional name. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.chooser\fP" Specifies the program run to offer a host menu for Indirect queries redirected to the special host name CHOOSER. -\fI/lib/X11/xdm/chooser\fP is the default. +\fI__projectroot__/lib/X11/xdm/chooser\fP is the default. See the sections \fBXDMCP Access Control\fP and \fBChooser\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.xrdb\fP" Specifies the program used to load the resources. By default, .I xdm -uses \fI/bin/xrdb\fP. +uses \fI__projectroot__/bin/xrdb\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.cpp\fP" This specifies the name of the C preprocessor which is used by \fIxrdb\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.setup\fP" @@ -389,7 +412,7 @@ file used here is \fIXstartup\fP. See the section \fBStartup Program.\fP .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.session\fP" This specifies the session to be executed (not running as root). -By default, \fI/bin/xterm\fP is +By default, \fI__projectroot__/bin/xterm\fP is run. The conventional name is \fIXsession\fP. See the section .B "Session Program." @@ -452,7 +475,7 @@ sets the PATH environment variable for the session to this value. It should be a colon separated list of directories; see .IR sh (1) for a full description. -``:/bin:/usr/bin:/usr/X11R6/bin:/usr/ucb'' +``:/bin:/usr/bin:__projectroot__/bin:/usr/ucb'' is a common setting. The default value can be specified at build time in the X system configuration file with DefaultUserPath. @@ -461,7 +484,7 @@ configuration file with DefaultUserPath. sets the PATH environment variable for the startup and reset scripts to the value of this resource. The default for this resource is specified at build time by the DefaultSystemPath entry in the system configuration file; -``/etc:/bin:/usr/bin:/usr/X11R6/bin:/usr/ucb'' is a common choice. +``/etc:/bin:/usr/bin:__projectroot__/bin:/usr/ucb'' is a common choice. Note the absence of ``.'' from this entry. This is a good practice to follow for root; it avoids many common Trojan Horse system penetration schemes. @@ -475,7 +498,7 @@ If the default session fails to execute, will fall back to this program. This program is executed with no arguments, but executes using the same environment variables as the session would have had (see the section \fBSession Program\fP). -By default, \fI/bin/xterm\fP is used. +By default, \fI__projectroot__/bin/xterm\fP is used. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.grabServer\fP" .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.grabTimeout\fP" To improve security, @@ -554,10 +577,8 @@ variable XAUTHORITY at the created file. It uses \fI/tmp\fP by default. First, the .I xdm configuration file should be set up. -Make a directory (usually \fI/lib/X11/xdm\fP, where -refers to the root of the X11 install tree) to contain all of the relevant -files. In the examples that follow, we use /usr/X11R6 as the value of -. +Make a directory (usually \fI__projectroot__/lib/X11/xdm\fP) to contain all +of the relevant files. .LP Here is a reasonable configuration file, which could be named \fIxdm-config\fP: @@ -565,12 +586,12 @@ named \fIxdm-config\fP: .ta .5i 4i - DisplayManager.servers: /usr/X11R6/lib/X11/xdm/Xservers - DisplayManager.errorLogFile: /usr/X11R6/lib/X11/xdm/xdm-errors - DisplayManager*resources: /usr/X11R6/lib/X11/xdm/Xresources - DisplayManager*startup: /usr/X11R6/lib/X11/xdm/Xstartup - DisplayManager*session: /usr/X11R6/lib/X11/xdm/Xsession - DisplayManager.pidFile: /usr/X11R6/lib/X11/xdm/xdm-pid + DisplayManager.servers: __projectroot__/lib/X11/xdm/Xservers + DisplayManager.errorLogFile: __projectroot__/lib/X11/xdm/xdm-errors + DisplayManager*resources: __projectroot__/lib/X11/xdm/Xresources + DisplayManager*startup: __projectroot__/lib/X11/xdm/Xstartup + DisplayManager*session: __projectroot__/lib/X11/xdm/Xsession + DisplayManager.pidFile: __projectroot__/lib/X11/xdm/xdm-pid DisplayManager._0.authorize: true DisplayManager*authorize: false @@ -606,6 +627,11 @@ Preceding either a host name or a pattern with a `!' character causes hosts which match that entry to be excluded. .PP +To only respond to Direct queries for a host or pattern, +it can be followed by the optional ``NOBROADCAST'' keyword. +This can be used to prevent an xdm server from appearing on +menus based on Broadcast queries. +.PP An Indirect entry also contains a host name or pattern, but follows it with a list of host names or macros to which indirect queries should be sent. @@ -634,21 +660,24 @@ Here is an example Xaccess file: .LP .ta 2i 4i .nf -# -# Xaccess \- XDMCP access control file -# +XCOMM +XCOMM Xaccess \- XDMCP access control file +XCOMM -# -# Direct/Broadcast query entries -# +XCOMM +XCOMM Direct/Broadcast query entries +XCOMM !xtra.lcs.mit.edu # disallow direct/broadcast service for xtra bambi.ogi.edu # allow access from this particular display *.lcs.mit.edu # allow access from any display in LCS -# -# Indirect query entries -# +*.deshaw.com NOBROADCAST # allow only direct access +*.gw.com # allow direct and broadcast + +XCOMM +XCOMM Indirect query entries +XCOMM %HOSTS expo.lcs.mit.edu xenon.lcs.mit.edu \\ excess.lcs.mit.edu kanga.lcs.mit.edu @@ -715,7 +744,7 @@ line to start the server. A typical entry for local display number 0 would be: .nf - :0 Digital-QV local /usr/X11R6/bin/X :0 + :0 Digital-QV local __projectroot__/bin/X :0 .fi The display types are: @@ -730,8 +759,8 @@ foreign remote display: \fIxdm\fP opens an X connection to a running server The display name must be something that can be passed in the \fB\-display\fP option to an X program. This string is used to generate the display-specific resource names, so be careful to match the -names (e.g., use ``:0 Sun-CG3 local /usr/X11R6/bin/X :0'' instead of -``localhost:0 Sun-CG3 local /usr/X11R6/bin/X :0'' +names (e.g., use ``:0 Sun-CG3 local __projectroot__/bin/X :0'' instead of +``localhost:0 Sun-CG3 local __projectroot__/bin/X :0'' if your other resources are specified as ``DisplayManager._0.session''). The display class portion is also used in the display-specific resources, as the class of the resource. This is @@ -767,17 +796,17 @@ parameters for that widget: Return: set-session-argument() finish-field() xlogin*borderWidth: 3 xlogin*greeting: CLIENTHOST - #ifdef COLOR +\& #ifdef COLOR xlogin*greetColor: CadetBlue xlogin*failColor: red - #endif +\& #endif .fi .PP Please note the translations entry; it specifies a few new translations for the widget which allow users to escape from the default session (and avoid troubles that may occur in it). Note that if -#override is not specified, the default translations are removed and replaced +\&#override is not specified, the default translations are removed and replaced by the new value, not a very useful result as some of the default translations are quite useful (such as ``: insert-char ()'' which responds to normal typing). @@ -815,9 +844,9 @@ can be put into the file named by Here is a sample \fIXsetup\fP script: .nf - #!/bin/sh - # Xsetup_0 \- setup script for one workstation - xcmsdb < /usr/X11R6/lib/monitors/alex.0 +\& #!/bin/sh +\& # Xsetup_0 \- setup script for one workstation + xcmsdb < __projectroot__/lib/monitors/alex.0 xconsole\0\-geometry\0480x130\-0\-0\0\-notify\0\-verbose\0\-exitOnFail & .fi @@ -893,6 +922,15 @@ translation table is: : insert-char() \\ .fi +.IP "\fBxlogin.Login.allowRootLogin\fP" +If set to ``false'', don't allow root (and any other user with uid = 0) to +log in directly. +The default is ``true''. +.IP "\fBxlogin.Login.allowNullPasswd\fP" +If set to ``true'', allow an otherwise failing password match to succeed +if the account does not require a password at all. +The default is ``false'', so only users that have passwords assigned can +log in. .PP The actions which are supported by the widget are: .IP "delete-previous-character" @@ -944,6 +982,11 @@ the .Xauthority file cannot be created by Be very careful using this; it might be better to disconnect the machine from the network before doing this. +.PP +On some systems (OpenBSD) the user's shell must be listed in +.I /etc/shells +to allow login through xdm. The normal password and account expiration +dates are enforced too. .SH "STARTUP PROGRAM" .PP The \fIXstartup\fP program is run as @@ -990,18 +1033,18 @@ Here is a sample \fIXstartup\fP script: .nf .ta .5i 1i - #!/bin/sh - # - # Xstartup - # - # This program is run as root after the user is verified - # +\& #!/bin/sh +\& # +\& # Xstartup +\& # +\& # This program is run as root after the user is verified +\& # if [ \-f /etc/nologin ]; then xmessage\0\-file /etc/nologin\0\-timeout 30\0\-center exit 1 fi - sessreg\0\-a\0\-l $DISPLAY\0\-x /usr/X11R6/lib/xdm/Xservers $LOGNAME - /usr/X11R6/lib/xdm/GiveConsole + sessreg\0\-a\0\-l $DISPLAY\0\-x __projectroot__/lib/xdm/Xservers $LOGNAME + __projectroot__/lib/xdm/GiveConsole exit 0 .fi .SH "SESSION PROGRAM" @@ -1051,12 +1094,12 @@ be executable so we don't have to guess what shell it wants to use. .nf .ta .5i 1i 1.5i - #!/bin/sh - # - # Xsession - # - # This is the program that is run as the client - # for the display manager. +\& #!/bin/sh +\& # +\& # Xsession +\& # +\& # This is the program that is run as the client +\& # for the display manager. case $# in 1) @@ -1086,8 +1129,8 @@ be executable so we don't have to guess what shell it wants to use. The user's \fI.xsession\fP file might look something like this example. Don't forget that the file must have execute permission. .nf - #! /bin/csh - # no \-f in the previous line so .cshrc gets run to set $PATH +\& #! /bin/csh +\& # no \-f in the previous line so .cshrc gets run to set $PATH twm & xrdb \-merge "$HOME/.Xresources" emacs \-geometry +0+50 & @@ -1108,14 +1151,14 @@ passed to \fIXreset\fP. A sample \fIXreset\fP script: .nf .ta .5i 1i - #!/bin/sh - # - # Xreset - # - # This program is run as root after the session ends - # - sessreg\0\-d\0\-l $DISPLAY\0\-x /usr/X11R6/lib/xdm/Xservers $LOGNAME - /usr/X11R6/lib/xdm/TakeConsole +\& #!/bin/sh +\& # +\& # Xreset +\& # +\& # This program is run as root after the session ends +\& # + sessreg\0\-d\0\-l $DISPLAY\0\-x __projectroot__/lib/xdm/Xservers $LOGNAME + __projectroot__/lib/xdm/TakeConsole exit 0 .fi .SH "CONTROLLING THE SERVER" @@ -1187,7 +1230,7 @@ line: .nf .ta .5i - xdm \-server ":0 SUN-3/60CG4 local /usr/X11R6/bin/X :0" + xdm \-server ":0 SUN-3/60CG4 local __projectroot__/bin/X :0" .fi .PP @@ -1218,36 +1261,34 @@ interested in .I xinit. .SH FILES .TP 20 -.I /lib/X11/xdm/xdm-config +.I __projectroot__/lib/X11/xdm/xdm-config the default configuration file .TP 20 .I $HOME/.Xauthority user authorization file where \fIxdm\fP stores keys for clients to read .TP 20 -.I /lib/X11/xdm/chooser +.I __projectroot__/lib/X11/xdm/chooser the default chooser .TP 20 -.I /bin/xrdb +.I __projectroot__/bin/xrdb the default resource database loader .TP 20 -.I /bin/X +.I __projectroot__/bin/X the default server .TP 20 -.I /bin/xterm +.I __projectroot__/bin/xterm the default session program and failsafe client .TP 20 -.I /lib/X11/xdm/A\- +.I __projectroot__/lib/X11/xdm/A\- the default place for authorization files .TP 20 .I /tmp/K5C Kerberos credentials cache -.LP -Note: refers to the root of the X11 install tree. .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR xinit (1), .IR xauth (1), -.IR Xsecurity (1), +.IR Xsecurity (__miscmansuffix__), .IR sessreg (1), .IR Xserver (1), .\" .IR chooser (1), \" except that there isn't a manual for it yet diff --git a/xdmauth.c b/xdmauth.c index cd4d221..7be4d3d 100644 --- a/xdmauth.c +++ b/xdmauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ - +/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.5 2001/12/14 20:01:25 dawes Exp $ */ /* * xdm - display manager daemon * Author: Keith Packard, MIT X Consortium @@ -37,12 +37,15 @@ from The Open Group. */ #include "dm.h" +#include "dm_auth.h" +#include "dm_error.h" #ifdef HASXDMAUTH static char auth_name[256]; static int auth_name_len; +void XdmPrintDataHex (s, a, l) char *s; char *a; @@ -57,6 +60,7 @@ XdmPrintDataHex (s, a, l) } #ifdef notdef /* not used */ +void XdmPrintKey (s, k) char *s; XdmAuthKeyRec *k; @@ -66,6 +70,7 @@ XdmPrintKey (s, k) #endif #ifdef XDMCP +void XdmPrintArray8Hex (s, a) char *s; ARRAY8Ptr a; @@ -74,6 +79,7 @@ XdmPrintArray8Hex (s, a) } #endif +void XdmInitAuth (name_len, name) unsigned short name_len; char *name; @@ -194,7 +200,7 @@ XdmGetXdmcpAuth (pdpy,authorizationNameLen, authorizationName) XdmPrintDataHex ("Accept packet auth", xdmcpauth->data, xdmcpauth->data_length); XdmPrintDataHex ("Auth file auth", fileauth->data, fileauth->data_length); /* encrypt the session key for its trip back to the server */ - XdmcpWrap (xdmcpauth->data, &pdpy->key, xdmcpauth->data, 8); + XdmcpWrap (xdmcpauth->data, (unsigned char *)&pdpy->key, xdmcpauth->data, 8); pdpy->fileAuthorization = fileauth; pdpy->xdmcpAuthorization = xdmcpauth; } @@ -203,7 +209,7 @@ XdmGetXdmcpAuth (pdpy,authorizationNameLen, authorizationName) 'a' <= c && c <= 'f' ? c - 'a' + 10 : \ 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1) -static +static int HexToBinary (key) char *key; { @@ -234,6 +240,7 @@ HexToBinary (key) * routine accepts either plain ascii strings for keys, or hex-encoded numbers */ +int XdmGetKey (pdpy, displayID) struct protoDisplay *pdpy; ARRAY8Ptr displayID; @@ -275,6 +282,7 @@ XdmGetKey (pdpy, displayID) } /*ARGSUSED*/ +int XdmCheckAuthentication (pdpy, displayID, authenticationName, authenticationData) struct protoDisplay *pdpy; ARRAY8Ptr displayID, authenticationName, authenticationData; @@ -285,14 +293,14 @@ XdmCheckAuthentication (pdpy, displayID, authenticationName, authenticationData) return FALSE; if (authenticationData->length != 8) return FALSE; - XdmcpUnwrap (authenticationData->data, &pdpy->key, + XdmcpUnwrap (authenticationData->data, (unsigned char *)&pdpy->key, authenticationData->data, 8); XdmPrintArray8Hex ("Request packet auth", authenticationData); if (!XdmcpCopyARRAY8(authenticationData, &pdpy->authenticationData)) return FALSE; incoming = (XdmAuthKeyPtr) authenticationData->data; XdmcpIncrementKey (incoming); - XdmcpWrap (authenticationData->data, &pdpy->key, + XdmcpWrap (authenticationData->data, (unsigned char *)&pdpy->key, authenticationData->data, 8); return TRUE; } diff --git a/xdmcp.c b/xdmcp.c index 6e16575..726902f 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.21 2002/12/10 22:37:17 tsi Exp $ */ /* * xdm - display manager daemon @@ -35,6 +36,8 @@ from The Open Group. */ # include "dm.h" +# include "dm_auth.h" +# include "dm_error.h" #ifdef XDMCP @@ -43,29 +46,51 @@ from The Open Group. # include # include -#include -#include +# include "dm_socket.h" + +#ifndef X_NO_SYS_UN +#ifndef Lynx #include +#else +#include +#endif +#endif +#if defined(__SVR4) && defined(__sun) + /* + * make sure we get the resolver's version of gethostbyname + * otherwise we may not get all the addresses! + */ +#define gethostbyname res_gethostbyname +#endif #include -#ifdef X_NOT_STDC_ENV -#define Time_t long -extern Time_t time (); -#else #include #define Time_t time_t -#endif #define getString(name,len) ((name = malloc (len + 1)) ? 1 : 0) /* - * interface to policy routines + * misc externs + */ +extern int Rescan, ChildReady; +extern int sourceAddress; + +/* + * Forward reference */ +static void broadcast_respond (struct sockaddr *from, int fromlen, int length); +static void forward_respond (struct sockaddr *from, int fromlen, int length); +static void manage (struct sockaddr *from, int fromlen, int length); +static void query_respond (struct sockaddr *from, int fromlen, int length); +static void request_respond (struct sockaddr *from, int fromlen, int length); +static void send_accept (struct sockaddr *to, int tolen, CARD32 sessionID, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, ARRAY8Ptr authorizationData); +static void send_alive (struct sockaddr *from, int fromlen, int length); +static void send_decline (struct sockaddr *to, int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr status); +static void send_failed (struct sockaddr *from, int fromlen, char *name, CARD32 sessionID, char *reason); +static void send_refuse (struct sockaddr *from, int fromlen, CARD32 sessionID); +static void send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status); +static void send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status); -extern ARRAY8Ptr ChooseAuthentication (); -extern int Willing (); -extern ARRAY8Ptr Accept (); -extern int SelectConnectionTypeIndex (); int xdmcpFd = -1; int chooserFd = -1; @@ -75,7 +100,8 @@ int WellKnownSocketsMax; #define pS(s) ((s) ? ((char *) (s)) : "empty string") -DestroyWellKnownSockets () +void +DestroyWellKnownSockets (void) { if (xdmcpFd != -1) { @@ -89,7 +115,8 @@ DestroyWellKnownSockets () } } -AnyWellKnownSockets () +int +AnyWellKnownSockets (void) { return xdmcpFd != -1 || chooserFd != -1; } @@ -98,10 +125,10 @@ static XdmcpBuffer buffer; /*ARGSUSED*/ static void -sendForward (connectionType, address, closure) - CARD16 connectionType; - ARRAY8Ptr address; - char *closure; +sendForward ( + CARD16 connectionType, + ARRAY8Ptr address, + char *closure) { #ifdef AF_INET struct sockaddr_in in_addr; @@ -134,27 +161,26 @@ sendForward (connectionType, address, closure) default: return; } - XdmcpFlush (xdmcpFd, &buffer, addr, addrlen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) addr, addrlen); + return; } -extern char *NetaddrAddress(); -extern char *NetaddrPort(); - static void -ClientAddress (from, addr, port, type) - struct sockaddr *from; - ARRAY8Ptr addr, port; /* return */ - CARD16 *type; /* return */ +ClientAddress ( + struct sockaddr *from, + ARRAY8Ptr addr, /* return */ + ARRAY8Ptr port, /* return */ + CARD16 *type) /* return */ { int length, family; char *data; - data = NetaddrPort(from, &length); + data = NetaddrPort((XdmcpNetaddr) from, &length); XdmcpAllocARRAY8 (port, length); memmove( port->data, data, length); port->length = length; - family = ConvertAddr(from, &length, &data); + family = ConvertAddr((XdmcpNetaddr) from, &length, &data); XdmcpAllocARRAY8 (addr, length); memmove( addr->data, data, length); addr->length = length; @@ -163,11 +189,11 @@ ClientAddress (from, addr, port, type) } static void -all_query_respond (from, fromlen, authenticationNames, type) - struct sockaddr *from; - int fromlen; - ARRAYofARRAY8Ptr authenticationNames; - xdmOpCode type; +all_query_respond ( + struct sockaddr *from, + int fromlen, + ARRAYofARRAY8Ptr authenticationNames, + xdmOpCode type) { ARRAY8Ptr authenticationName; ARRAY8 status; @@ -176,10 +202,10 @@ all_query_respond (from, fromlen, authenticationNames, type) int family; int length; - family = ConvertAddr(from, &length, &(addr.data)); + family = ConvertAddr((XdmcpNetaddr) from, &length, (char **)&(addr.data)); addr.length = length; /* convert int to short */ Debug ("all_query_respond: conntype=%d, addr=%lx, len=%d\n", - family, *(addr.data), addr.length); + family, (unsigned long) *(addr.data), addr.length); if (family < 0) return; connectionType = family; @@ -199,10 +225,10 @@ all_query_respond (from, fromlen, authenticationNames, type) } static void -indirect_respond (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +indirect_respond ( + struct sockaddr *from, + int fromlen, + int length) { ARRAYofARRAY8 queryAuthenticationNames; ARRAY8 clientAddress; @@ -254,15 +280,15 @@ indirect_respond (from, fromlen, length) } static void -ProcessRequestSocket () +ProcessRequestSocket (void) { XdmcpHeader header; - struct sockaddr_in addr; + struct sockaddr addr; int addrlen = sizeof addr; Debug ("ProcessRequestSocket\n"); bzero ((char *) &addr, sizeof (addr)); - if (!XdmcpFill (xdmcpFd, &buffer, &addr, &addrlen)) { + if (!XdmcpFill (xdmcpFd, &buffer, (XdmcpNetaddr) &addr, &addrlen)) { Debug ("XdmcpFill failed\n"); return; } @@ -302,11 +328,11 @@ ProcessRequestSocket () } } -WaitForSomething () +void +WaitForSomething (void) { FD_TYPE reads; int nready; - extern int Rescan, ChildReady; Debug ("WaitForSomething\n"); if (AnyWellKnownSockets () && !ChildReady) { @@ -319,6 +345,11 @@ WaitForSomething () if (xdmcpFd >= 0 && FD_ISSET (xdmcpFd, &reads)) ProcessRequestSocket (); if (chooserFd >= 0 && FD_ISSET (chooserFd, &reads)) +#ifdef ISC + if (!ChildReady) { + WaitForSomething (); + } else +#endif ProcessChooserSocket (chooserFd); } if (ChildReady) @@ -336,9 +367,9 @@ WaitForSomething () static ARRAY8 Hostname; void -registerHostname (name, namelen) - char *name; - int namelen; +registerHostname ( + char *name, + int namelen) { int i; @@ -349,11 +380,11 @@ registerHostname (name, namelen) } static void -direct_query_respond (from, fromlen, length, type) - struct sockaddr *from; - int fromlen; - int length; - xdmOpCode type; +direct_query_respond ( + struct sockaddr *from, + int fromlen, + int length, + xdmOpCode type) { ARRAYofARRAY8 queryAuthenticationNames; int expectedLen; @@ -369,19 +400,21 @@ direct_query_respond (from, fromlen, length, type) XdmcpDisposeARRAYofARRAY8 (&queryAuthenticationNames); } -query_respond (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +static void +query_respond ( + struct sockaddr *from, + int fromlen, + int length) { Debug ("Query respond %d\n", length); direct_query_respond (from, fromlen, length, QUERY); } -broadcast_respond (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +static void +broadcast_respond ( + struct sockaddr *from, + int fromlen, + int length) { direct_query_respond (from, fromlen, length, BROADCAST_QUERY); } @@ -389,10 +422,11 @@ broadcast_respond (from, fromlen, length) /* computes an X display name */ static char * -NetworkAddressToName(connectionType, connectionAddress, displayNumber) - CARD16 connectionType; - ARRAY8Ptr connectionAddress; - CARD16 displayNumber; +NetworkAddressToName( + CARD16 connectionType, + ARRAY8Ptr connectionAddress, + struct sockaddr *originalAddress, + CARD16 displayNumber) { switch (connectionType) { @@ -401,11 +435,17 @@ NetworkAddressToName(connectionType, connectionAddress, displayNumber) CARD8 *data; struct hostent *hostent; char *name; - char *localhost, *localHostname(); + char *localhost; + int multiHomed = 0; data = connectionAddress->data; hostent = gethostbyaddr ((char *)data, connectionAddress->length, AF_INET); + if (sourceAddress && hostent) { + hostent = gethostbyname(hostent->h_name); + if (hostent) + multiHomed = hostent->h_addr_list[1] != NULL; + } localhost = localHostname (); @@ -413,7 +453,8 @@ NetworkAddressToName(connectionType, connectionAddress, displayNumber) * protect against bogus host names */ if (hostent && hostent->h_name && hostent->h_name[0] - && (hostent->h_name[0] != '.')) + && (hostent->h_name[0] != '.') + && !multiHomed) { if (!strcmp (localhost, hostent->h_name)) { @@ -453,6 +494,9 @@ NetworkAddressToName(connectionType, connectionAddress, displayNumber) { if (!getString (name, 25)) return 0; + if (multiHomed) + data = (CARD8 *) &((struct sockaddr_in *)originalAddress)-> + sin_addr.s_addr; sprintf(name, "%d.%d.%d.%d:%d", data[0], data[1], data[2], data[3], displayNumber); } @@ -468,10 +512,11 @@ NetworkAddressToName(connectionType, connectionAddress, displayNumber) } /*ARGSUSED*/ -forward_respond (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +static void +forward_respond ( + struct sockaddr *from, + int fromlen, + int length) { ARRAY8 clientAddress; ARRAY8 clientPort; @@ -547,7 +592,7 @@ forward_respond (from, fromlen, length) memmove( un_addr.sun_path, clientAddress.data, clientAddress.length); un_addr.sun_path[clientAddress.length] = '\0'; client = (struct sockaddr *) &un_addr; -#ifdef BSD44SOCKETS +#if defined(BSD44SOCKETS) && !defined(Lynx) && defined(UNIXCONN) un_addr.sun_len = strlen(un_addr.sun_path); clientlen = SUN_LEN(&un_addr); #else @@ -579,11 +624,12 @@ badAddress: XdmcpDisposeARRAYofARRAY8 (&authenticationNames); } -send_willing (from, fromlen, authenticationName, status) - struct sockaddr *from; - int fromlen; - ARRAY8Ptr authenticationName; - ARRAY8Ptr status; +static void +send_willing ( + struct sockaddr *from, + int fromlen, + ARRAY8Ptr authenticationName, + ARRAY8Ptr status) { XdmcpHeader header; @@ -601,14 +647,15 @@ send_willing (from, fromlen, authenticationName, status) XdmcpWriteARRAY8 (&buffer, authenticationName); XdmcpWriteARRAY8 (&buffer, &Hostname); XdmcpWriteARRAY8 (&buffer, status); - XdmcpFlush (xdmcpFd, &buffer, from, fromlen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); } -send_unwilling (from, fromlen, authenticationName, status) - struct sockaddr *from; - int fromlen; - ARRAY8Ptr authenticationName; - ARRAY8Ptr status; +static void +send_unwilling ( + struct sockaddr *from, + int fromlen, + ARRAY8Ptr authenticationName, + ARRAY8Ptr status) { XdmcpHeader header; @@ -624,14 +671,14 @@ send_unwilling (from, fromlen, authenticationName, status) XdmcpWriteHeader (&buffer, &header); XdmcpWriteARRAY8 (&buffer, &Hostname); XdmcpWriteARRAY8 (&buffer, status); - XdmcpFlush (xdmcpFd, &buffer, from, fromlen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); } static unsigned long globalSessionID; #define NextSessionID() (++globalSessionID) -void init_session_id() +void init_session_id(void) { /* Set randomly so we are unlikely to reuse id's from a previous * incarnation so we don't say "Alive" to those displays. @@ -645,10 +692,11 @@ static ARRAY8 noValidAddr = { (CARD16) 16, (CARD8Ptr) "No valid address" }; static ARRAY8 noValidAuth = { (CARD16) 22, (CARD8Ptr) "No valid authorization" }; static ARRAY8 noAuthentic = { (CARD16) 29, (CARD8Ptr) "XDM has no authentication key" }; -request_respond (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +static void +request_respond ( + struct sockaddr *from, + int fromlen, + int length) { CARD16 displayNumber; ARRAY16 connectionTypes; @@ -657,7 +705,7 @@ request_respond (from, fromlen, length) ARRAY8 authenticationData; ARRAYofARRAY8 authorizationNames; ARRAY8 manufacturerDisplayID; - ARRAY8Ptr reason; + ARRAY8Ptr reason = 0; int expectlen; int i, j; struct protoDisplay *pdpy; @@ -705,7 +753,7 @@ request_respond (from, fromlen, length) pdpy = 0; goto decline; } - pdpy = FindProtoDisplay (from, fromlen, displayNumber); + pdpy = FindProtoDisplay ((XdmcpNetaddr) from, fromlen, displayNumber); if (!pdpy) { /* Check this Display against the Manager's policy */ @@ -723,10 +771,10 @@ request_respond (from, fromlen, length) /* The Manager considers this a new session */ connectionAddress = &connectionAddresses.data[i]; - pdpy = NewProtoDisplay (from, fromlen, displayNumber, + pdpy = NewProtoDisplay ((XdmcpNetaddr) from, fromlen, displayNumber, connectionTypes.data[i], connectionAddress, NextSessionID()); - Debug ("NewProtoDisplay 0x%x\n", pdpy); + Debug ("NewProtoDisplay %p\n", pdpy); if (!pdpy) { reason = &outOfMemory; goto decline; @@ -794,18 +842,19 @@ abort: XdmcpDisposeARRAY8 (&manufacturerDisplayID); } -send_accept (to, tolen, sessionID, - authenticationName, authenticationData, - authorizationName, authorizationData) - struct sockaddr *to; - int tolen; - CARD32 sessionID; - ARRAY8Ptr authenticationName, authenticationData; - ARRAY8Ptr authorizationName, authorizationData; +static void +send_accept ( + struct sockaddr *to, + int tolen, + CARD32 sessionID, + ARRAY8Ptr authenticationName, + ARRAY8Ptr authenticationData, + ARRAY8Ptr authorizationName, + ARRAY8Ptr authorizationData) { XdmcpHeader header; - Debug ("Accept Session ID %d\n", sessionID); + Debug ("Accept Session ID %ld\n", (long) sessionID); header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) ACCEPT; header.length = 4; /* session ID */ @@ -819,14 +868,16 @@ send_accept (to, tolen, sessionID, XdmcpWriteARRAY8 (&buffer, authenticationData); XdmcpWriteARRAY8 (&buffer, authorizationName); XdmcpWriteARRAY8 (&buffer, authorizationData); - XdmcpFlush (xdmcpFd, &buffer, to, tolen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) to, tolen); } -send_decline (to, tolen, authenticationName, authenticationData, status) - struct sockaddr *to; - int tolen; - ARRAY8Ptr authenticationName, authenticationData; - ARRAY8Ptr status; +static void +send_decline ( + struct sockaddr *to, + int tolen, + ARRAY8Ptr authenticationName, + ARRAY8Ptr authenticationData, + ARRAY8Ptr status) { XdmcpHeader header; @@ -841,13 +892,14 @@ send_decline (to, tolen, authenticationName, authenticationData, status) XdmcpWriteARRAY8 (&buffer, status); XdmcpWriteARRAY8 (&buffer, authenticationName); XdmcpWriteARRAY8 (&buffer, authenticationData); - XdmcpFlush (xdmcpFd, &buffer, to, tolen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) to, tolen); } -manage (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +static void +manage ( + struct sockaddr *from, + int fromlen, + int length) { CARD32 sessionID; CARD16 displayNumber; @@ -876,8 +928,8 @@ manage (from, fromlen, length) Debug ("Manage length error got %d expect %d\n", length, expectlen); goto abort; } - pdpy = FindProtoDisplay (from, fromlen, displayNumber); - Debug ("Manage Session ID %d, pdpy 0x%x\n", sessionID, pdpy); + pdpy = FindProtoDisplay ((XdmcpNetaddr) from, fromlen, displayNumber); + Debug ("Manage Session ID %ld, pdpy %p\n", (long) sessionID, pdpy); if (!pdpy || pdpy->sessionID != sessionID) { /* @@ -889,20 +941,21 @@ manage (from, fromlen, length) * can be ignored. */ if (!pdpy - && (d = FindDisplayByAddress(from, fromlen, displayNumber)) + && (d = FindDisplayByAddress((XdmcpNetaddr) from, fromlen, displayNumber)) && d->sessionID == sessionID) { Debug("manage: got duplicate pkt, ignoring\n"); goto abort; } - Debug ("Session ID %d refused\n", sessionID); + Debug ("Session ID %ld refused\n", (long) sessionID); if (pdpy) - Debug ("Existing Session ID %d\n", pdpy->sessionID); + Debug ("Existing Session ID %ld\n", (long) pdpy->sessionID); send_refuse (from, fromlen, sessionID); } else { name = NetworkAddressToName (pdpy->connectionType, &pdpy->connectionAddress, + from, pdpy->displayNumber); Debug ("Computed display name: %s\n", name); if (!name) @@ -913,8 +966,6 @@ manage (from, fromlen, length) d = FindDisplayByName (name); if (d) { - extern void StopDisplay (); - Debug ("Terminating active session for %s\n", d->name); StopDisplay (d); } @@ -995,28 +1046,30 @@ abort: if (class) free ((char*) class); } -SendFailed (d, reason) - struct display *d; - char *reason; +void +SendFailed ( + struct display *d, + char *reason) { Debug ("Display start failed, sending Failed\n"); - send_failed (d->from, d->fromlen, d->name, d->sessionID, reason); + send_failed ((struct sockaddr *)(d->from), d->fromlen, d->name, d->sessionID, reason); } -send_failed (from, fromlen, name, sessionID, reason) - struct sockaddr *from; - int fromlen; - char *name; - CARD32 sessionID; - char *reason; +static void +send_failed ( + struct sockaddr *from, + int fromlen, + char *name, + CARD32 sessionID, + char *reason) { static char buf[256]; XdmcpHeader header; ARRAY8 status; - sprintf (buf, "Session %d failed for display %s: %s", - sessionID, name, reason); - Debug ("Send failed %d %s\n", sessionID, buf); + sprintf (buf, "Session %ld failed for display %.100s: %.100s", + (long) sessionID, name, reason); + Debug ("Send failed %ld %s\n", (long) sessionID, buf); status.length = strlen (buf); status.data = (CARD8Ptr) buf; header.version = XDM_PROTOCOL_VERSION; @@ -1025,29 +1078,31 @@ send_failed (from, fromlen, name, sessionID, reason) XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD32 (&buffer, sessionID); XdmcpWriteARRAY8 (&buffer, &status); - XdmcpFlush (xdmcpFd, &buffer, from, fromlen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); } -send_refuse (from, fromlen, sessionID) - struct sockaddr *from; - int fromlen; - CARD32 sessionID; +static void +send_refuse ( + struct sockaddr *from, + int fromlen, + CARD32 sessionID) { XdmcpHeader header; - Debug ("Send refuse %d\n", sessionID); + Debug ("Send refuse %ld\n", (long) sessionID); header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) REFUSE; header.length = 4; XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD32 (&buffer, sessionID); - XdmcpFlush (xdmcpFd, &buffer, from, fromlen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); } -send_alive (from, fromlen, length) - struct sockaddr *from; - int fromlen; - int length; +static void +send_alive ( + struct sockaddr *from, + int fromlen, + int length) { CARD32 sessionID; CARD16 displayNumber; @@ -1064,7 +1119,7 @@ send_alive (from, fromlen, length) { d = FindDisplayBySessionID (sessionID); if (!d) { - d = FindDisplayByAddress (from, fromlen, displayNumber); + d = FindDisplayByAddress ((XdmcpNetaddr) from, fromlen, displayNumber); } sendRunning = 0; sendSessionID = 0; @@ -1077,19 +1132,19 @@ send_alive (from, fromlen, length) header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) ALIVE; header.length = 5; - Debug ("alive: %d %d\n", sendRunning, sendSessionID); + Debug ("alive: %d %ld\n", sendRunning, (long) sendSessionID); XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD8 (&buffer, sendRunning); XdmcpWriteCARD32 (&buffer, sendSessionID); - XdmcpFlush (xdmcpFd, &buffer, from, fromlen); + XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); } } } char * -NetworkAddressToHostname (connectionType, connectionAddress) - CARD16 connectionType; - ARRAY8Ptr connectionAddress; +NetworkAddressToHostname ( + CARD16 connectionType, + ARRAY8Ptr connectionAddress) { char *name = 0; @@ -1097,16 +1152,29 @@ NetworkAddressToHostname (connectionType, connectionAddress) { case FamilyInternet: { - struct hostent *hostent; + struct hostent *hostent = NULL; char dotted[20]; - char *local_name; + char *local_name = ""; hostent = gethostbyaddr ((char *)connectionAddress->data, connectionAddress->length, AF_INET); - if (hostent) - local_name = hostent->h_name; - else { + if (hostent) { + /* check for DNS spoofing */ + char *s = strdup(hostent->h_name); /* fscking non-reentrancy of getXXX() */ + if ((hostent = gethostbyname(s))) { + if (memcmp((char*)connectionAddress->data, hostent->h_addr, + hostent->h_length) != 0) { + LogError("Possible DNS spoof attempt."); + hostent = NULL; /* so it enters next if() */ + } else { + local_name = hostent->h_name; + } + } + free(s); + } + + if (!hostent) { /* can't get name, so use emergency fallback */ sprintf(dotted, "%d.%d.%d.%d", connectionAddress->data[0], @@ -1130,13 +1198,14 @@ NetworkAddressToHostname (connectionType, connectionAddress) break; } return name; -} + } -static -HostnameToNetworkAddress (name, connectionType, connectionAddress) -char *name; -CARD16 connectionType; -ARRAY8Ptr connectionAddress; +#if 0 +static int +HostnameToNetworkAddress ( +char *name, +CARD16 connectionType, +ARRAY8Ptr connectionAddress) { switch (connectionType) { @@ -1164,13 +1233,12 @@ ARRAY8Ptr connectionAddress; * converts a display name into a network address, using * the same rules as XOpenDisplay (algorithm cribbed from there) */ - -static -NameToNetworkAddress(name, connectionTypep, connectionAddress, displayNumber) -char *name; -CARD16Ptr connectionTypep; -ARRAY8Ptr connectionAddress; -CARD16Ptr displayNumber; +static int +NameToNetworkAddress( +char *name, +CARD16Ptr connectionTypep, +ARRAY8Ptr connectionAddress, +CARD16Ptr displayNumber) { char *colon, *display_number; char hostname[1024]; @@ -1222,5 +1290,6 @@ CARD16Ptr displayNumber; *connectionTypep = connectionType; return TRUE; } +#endif #endif /* XDMCP */ diff --git a/xdmshell.c b/xdmshell.c index 166e689..30f6345 100644 --- a/xdmshell.c +++ b/xdmshell.c @@ -36,12 +36,11 @@ in this Software without prior written authorization from The Open Group. * bring down X when you are finished. */ +/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.7 2001/12/14 20:01:26 dawes Exp $ */ + #include #include "dm.h" #include -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif #ifdef macII #define ON_CONSOLE_ONLY @@ -64,17 +63,9 @@ extern int errno; char *ProgramName; -static char *SysErrorMsg (n) - int n; -{ - char *s = strerror(n); - return (s ? s : "unknown error"); -} - - -static int exec_args (filename, args) - char *filename; - char **args; +static int exec_args ( + char *filename, + char **args) { int pid; waitType status; @@ -103,9 +94,10 @@ static int exec_args (filename, args) return waitCode (status); } -static int exec_one_arg (filename, arg) - char *filename; - char *arg; +#if defined(macII) || defined(sun) +static int exec_one_arg ( + char *filename, + char *arg) { char *argv[3]; @@ -114,10 +106,12 @@ static int exec_one_arg (filename, arg) argv[2] = NULL; return exec_args (filename, argv); } +#endif -main (argc, argv) - int argc; - char *argv[]; +int +main ( + int argc, + char *argv[]) { int ttyfd; char cmdbuf[256]; @@ -199,7 +193,7 @@ main (argc, argv) args[4] = NULL; if (exec_args (cmdbuf, args) == -1) { fprintf (stderr, "%s: unable to execute %s (error %d, %s)\r\n", - ProgramName, cmdbuf, errno, SysErrorMsg(errno)); + ProgramName, cmdbuf, errno, strerror(errno)); exit (1); } -- cgit v1.2.3 From 90bb927330a88d3ae026b10ec5419cd3348b4f81 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Wed, 26 Nov 2003 22:49:11 +0000 Subject: merge latest (4.3.99.16) from XFree86 (vendor) branch --- access.c | 177 ++++++++++++++++-- auth.c | 167 +++++++++++++++-- choose.c | 32 +++- chooser.c | 135 ++++++++++++-- config/Xaccess | 22 +++ config/Xresources.cpp | 20 +- dm.c | 19 +- dm.h | 22 ++- dm_auth.h | 15 +- dpylist.c | 3 +- genauth.c | 498 ++++++++++++++++++++++++++++++++++++-------------- greet.h | 28 +-- greeter/Login.c | 10 +- greeter/Login.h | 12 +- greeter/greet.c | 29 ++- greeter/verify.c | 47 ++++- mitauth.c | 12 +- netaddr.c | 41 ++++- prngc.c | 195 ++++++++++++++++++++ resource.c | 86 ++++++++- server.c | 20 +- session.c | 207 ++++++++++----------- socket.c | 461 ++++++++++++++++++++++++++++++++++++++++++---- streams.c | 29 ++- xdm.man.cpp | 138 +++++++++++--- xdmauth.c | 68 +++---- xdmcp.c | 426 ++++++++++++++++++++++++++++++++++-------- 27 files changed, 2376 insertions(+), 543 deletions(-) create mode 100644 prngc.c diff --git a/access.c b/access.c index e6984b1..567129e 100644 --- a/access.c +++ b/access.c @@ -2,6 +2,7 @@ * $Xorg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group +Copyright 2002 Sun Microsystems, Inc. All rights reserved. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -19,14 +20,14 @@ OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Except as contained in this notice, the name of The Open Group shall not be +Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. +in this Software without prior written authorization from the copyright holder. * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/access.c,v 3.10 2002/12/10 23:36:43 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/access.c,v 3.12 2003/07/18 15:53:28 tsi Exp $ */ /* * Access control for XDMCP - keep a database of allowable display addresses @@ -53,12 +54,15 @@ in this Software without prior written authorization from The Open Group. #define CHOOSER_STRING "CHOOSER" #define BROADCAST_STRING "BROADCAST" #define NOBROADCAST_STRING "NOBROADCAST" +#define LISTEN_STRING "LISTEN" +#define WILDCARD_STRING "*" #define HOST_ALIAS 0 #define HOST_ADDRESS 1 #define HOST_BROADCAST 2 #define HOST_CHOOSER 3 #define HOST_NOBROADCAST 4 +#define HOST_ANYADDR 5 typedef struct _hostEntry { struct _hostEntry *next; @@ -67,11 +71,13 @@ typedef struct _hostEntry { char *aliasName; ARRAY8 hostAddress; } entry; + int hopCount; } HostEntry; #define DISPLAY_ALIAS 0 #define DISPLAY_PATTERN 1 #define DISPLAY_ADDRESS 2 +#define DISPLAY_LISTEN 3 typedef struct _displayEntry { struct _displayEntry *next; @@ -101,11 +107,37 @@ getLocalAddress (void) if (!haveLocalAddress) { +#if defined(IPv6) && defined(AF_INET6) + struct addrinfo *ai; + + if (getaddrinfo(localHostname(), NULL, NULL, &ai) != 0) { + XdmcpAllocARRAY8 (&localAddress, 4); + localAddress.data[0] = 127; + localAddress.data[1] = 0; + localAddress.data[2] = 0; + localAddress.data[3] = 1; + } else { + if (ai->ai_addr->sa_family == AF_INET) { + XdmcpAllocARRAY8 (&localAddress, sizeof(struct in_addr)); + memcpy(localAddress.data, + &((struct sockaddr_in *)ai->ai_addr)->sin_addr, + sizeof(struct in_addr)); + } else if (ai->ai_addr->sa_family == AF_INET6) { + XdmcpAllocARRAY8 (&localAddress, sizeof(struct in6_addr)); + memcpy(localAddress.data, + &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr, + sizeof(struct in6_addr)); + } + freeaddrinfo(ai); + } +#else struct hostent *hostent; hostent = gethostbyname (localHostname()); XdmcpAllocARRAY8 (&localAddress, hostent->h_length); memmove( localAddress.data, hostent->h_addr, hostent->h_length); +#endif + } return &localAddress; } @@ -140,6 +172,9 @@ FreeDisplayEntry (DisplayEntry *d) case DISPLAY_ADDRESS: XdmcpDisposeARRAY8 (&d->entry.displayAddress.clientAddress); break; + case DISPLAY_LISTEN: + /* do nothing - this case doesn't use the d->entry union */ + break; } for (h = d->hosts; h; h = next) { next = h->next; @@ -217,7 +252,8 @@ ReadWord (FILE *file, int EOFatEOL) continue; } default: - *wordp++ = c; + if (wordp < &(wordBuffer[WORD_LEN])) + *wordp++ = c; break; } quoted = FALSE; @@ -230,13 +266,13 @@ ReadHostEntry (FILE *file) { char *hostOrAlias; HostEntry *h; - struct hostent *hostent; tryagain: hostOrAlias = ReadWord (file, TRUE); if (!hostOrAlias) return NULL; h = (HostEntry *) malloc (sizeof (DisplayEntry)); + h->hopCount = 1; if (*hostOrAlias == ALIAS_CHARACTER) { h->type = HOST_ALIAS; @@ -259,24 +295,64 @@ tryagain: { h->type = HOST_NOBROADCAST; } + else if (!strcmp (hostOrAlias, WILDCARD_STRING)) + { + h->type = HOST_ANYADDR; + h->entry.hostAddress.length = 0; + } else { + void *addr=NULL; + size_t addr_length=0; +#if defined(IPv6) && defined(AF_INET6) + struct addrinfo *ai; +#else + struct hostent *hostent = gethostbyname (hostOrAlias); +#endif + char *hops = strrchr(hostOrAlias, '/'); + + if (hops) { + *(hops++) = '\0'; + h->hopCount = strtol(hops, NULL, 10); + if (h->hopCount < 1) + h->hopCount = 1; + } + +#if defined(IPv6) && defined(AF_INET6) + if (getaddrinfo(hostOrAlias, NULL, NULL, &ai) == 0) { + if (ai->ai_addr->sa_family == AF_INET) { + addr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr; + addr_length = sizeof(struct in_addr); + } else if (ai->ai_addr->sa_family == AF_INET6) { + addr = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr; + addr_length = sizeof(struct in6_addr); + } + } +#else + if (hostent) { + addr = &(hostent->h_addr); + addr_length = hostent->h_length; + } +#endif h->type = HOST_ADDRESS; - hostent = gethostbyname (hostOrAlias); - if (!hostent) + + if (!addr) { Debug ("No such host %s\n", hostOrAlias); LogError ("Access file \"%s\", host \"%s\" not found\n", accessFile, hostOrAlias); free ((char *) h); goto tryagain; } - if (!XdmcpAllocARRAY8 (&h->entry.hostAddress, hostent->h_length)) + if (!XdmcpAllocARRAY8 (&h->entry.hostAddress, addr_length)) { LogOutOfMem ("ReadHostEntry\n"); free ((char *) h); return NULL; } - memmove( h->entry.hostAddress.data, hostent->h_addr, hostent->h_length); + memmove( h->entry.hostAddress.data, addr, addr_length); +#if defined(IPv6) && defined(AF_INET6) + freeaddrinfo(ai); +#endif } return h; } @@ -301,7 +377,6 @@ ReadDisplayEntry (FILE *file) DisplayEntry *d; struct _display *display; HostEntry *h, **prev; - struct hostent *hostent; displayOrAlias = ReadWord (file, FALSE); if (!displayOrAlias) @@ -321,6 +396,10 @@ ReadDisplayEntry (FILE *file) } strcpy (d->entry.aliasName, displayOrAlias); } + else if (!strcmp(displayOrAlias, LISTEN_STRING)) + { + d->type = DISPLAY_LISTEN; + } else { if (*displayOrAlias == NEGATE_CHARACTER) @@ -341,7 +420,34 @@ ReadDisplayEntry (FILE *file) } else { + void *addr = NULL; + size_t addr_length = 0; + int addrtype = 0; + +#if defined(IPv6) && defined(AF_INET6) + struct addrinfo *ai; + + if (getaddrinfo(displayOrAlias, NULL, NULL, &ai) == 0) { + addrtype = ai->ai_addr->sa_family; + if (addrtype == AF_INET) { + addr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr; + addr_length = sizeof(struct in_addr); + } else if (addrtype == AF_INET6) { + addr = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr; + addr_length = sizeof(struct in6_addr); + } + } +#else + struct hostent *hostent; + if ((hostent = gethostbyname (displayOrAlias)) == NULL) + { + addr = &(hostent->h_addr); + addrtype = hostent->h_addrtype; + addr_length = hostent->h_length; + } +#endif + if (addr == NULL) { LogError ("Access file %s, display %s unknown\n", accessFile, displayOrAlias); free ((char *) d); @@ -349,13 +455,13 @@ ReadDisplayEntry (FILE *file) } d->type = DISPLAY_ADDRESS; display = &d->entry.displayAddress; - if (!XdmcpAllocARRAY8 (&display->clientAddress, hostent->h_length)) + if (!XdmcpAllocARRAY8 (&display->clientAddress, addr_length)) { free ((char *) d); return NULL; } - memmove( display->clientAddress.data, hostent->h_addr, hostent->h_length); - switch (hostent->h_addrtype) + memmove( display->clientAddress.data, addr, addr_length); + switch (addrtype) { #ifdef AF_UNIX case AF_UNIX: @@ -367,6 +473,11 @@ ReadDisplayEntry (FILE *file) display->connectionType = FamilyInternet; break; #endif +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + display->connectionType = FamilyInternet6; + break; +#endif #ifdef AF_DECnet case AF_DECnet: display->connectionType = FamilyDECnet; @@ -388,6 +499,14 @@ ReadDisplayEntry (FILE *file) } else if (h->type == HOST_NOBROADCAST) { FreeHostEntry (h); d->notBroadcast = 1; + } else if (h->type == HOST_ANYADDR) { + if (d->type == DISPLAY_LISTEN) { + *prev = h; + prev = &h->next; + } else { + Debug("Wildcard host specified in Xaccess for type other than LISTEN -- ignoring\n"); + FreeHostEntry (h); + } } else { *prev = h; prev = &h->next; @@ -574,6 +693,7 @@ int ForEachMatchingIndirectHost ( { switch (d->type) { case DISPLAY_ALIAS: + case DISPLAY_LISTEN: continue; case DISPLAY_PATTERN: if (!clientName) @@ -628,6 +748,7 @@ int UseChooser ( { switch (d->type) { case DISPLAY_ALIAS: + case DISPLAY_LISTEN: continue; case DISPLAY_PATTERN: if (!clientName) @@ -675,6 +796,7 @@ void ForEachChooserHost ( { switch (d->type) { case DISPLAY_ALIAS: + case DISPLAY_LISTEN: continue; case DISPLAY_PATTERN: if (!clientName) @@ -734,6 +856,7 @@ int AcceptableDisplayAddress ( continue; switch (d->type) { case DISPLAY_ALIAS: + case DISPLAY_LISTEN: continue; case DISPLAY_PATTERN: if (!clientName) @@ -759,4 +882,32 @@ int AcceptableDisplayAddress ( && (type == BROADCAST_QUERY ? d->notBroadcast == 0 : 1); } +void ForEachListenAddr ( + ListenFunc listenfunction, + ListenFunc mcastfunction, + void **closure) +{ + DisplayEntry *d; + HostEntry *h; + int listenFound = 0; + + for (d = database; d != NULL ; d = d->next) + { + if (d->type == DISPLAY_LISTEN) { + listenFound = 1; + h = d->hosts; + if (h != NULL) { + (*listenfunction) (&h->entry.hostAddress, closure); + } + for (h = h->next; h != NULL; h = h->next) { + (*mcastfunction) (&h->entry.hostAddress, closure); + } + } + } + if (!listenFound) { + (*listenfunction) (NULL, closure); + } +} + + #endif /* XDMCP */ diff --git a/auth.c b/auth.c index e5e57b8..678a035 100644 --- a/auth.c +++ b/auth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.27 2002/12/10 22:37:17 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.30 2003/11/16 16:35:02 herrb Exp $ */ /* * xdm - display manager daemon @@ -88,7 +88,21 @@ from The Open Group. #include #endif /* __GNU__ */ -#if ((defined(SVR4) && !defined(sun)) || defined(ISC)) && defined(SIOCGIFCONF) +/* Solaris provides an extended interface SIOCGLIFCONF. Other systems + * may have this as well, but the code has only been tested on Solaris + * so far, so we only enable it there. Other platforms may be added as + * needed. + * + * Test for Solaris commented out -- TSI @ UQV 2003.06.13 + */ +#ifdef SIOCGLIFCONF +/* #if defined(sun) */ +#define USE_SIOCGLIFCONF +/* #endif */ +#endif + +#if ((defined(SVR4) && !defined(sun)) || defined(ISC)) && \ + defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF) #define SYSV_SIOCGIFCONF #endif @@ -270,7 +284,7 @@ static int MakeServerAuthFile (struct display *d) { int len; -#ifdef SYSV +#if defined(SYSV) && !defined(SVR4) #define NAMELEN 14 #else #define NAMELEN 255 @@ -700,6 +714,52 @@ DefineLocal (FILE *file, Xauth *auth) #endif } +#ifdef HAS_GETIFADDRS +#include + +static void +DefineSelf(int fd, FILE *file, Xauth *auth) +{ + struct ifaddrs *ifap, *ifr; + char *addr; + int family, len; + + Debug("DefineSelf\n"); + if (getifaddrs(&ifap) < 0) + return; + for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) { + len = sizeof(*(ifr->ifa_addr)); + family = ConvertAddr((XdmcpNetaddr)(ifr->ifa_addr), &len, &addr); + if (family == -1 || family == FamilyLocal) + continue; + /* + * don't write out 'localhost' entries, as + * they may conflict with other local entries. + * DefineLocal will always be called to add + * the local entry anyway, so this one can + * be tossed. + */ + if (family == FamilyInternet && len == 4 && + addr[0] == 127 && addr[1] == 0 && + addr[2] == 0 && addr[3] == 1) + { + Debug ("Skipping localhost address\n"); + continue; + } +#if defined(IPv6) && defined(AF_INET6) + if(family == FamilyInternet6) { + if (IN6_IS_ADDR_LOOPBACK(((struct in6_addr *)addr))) { + Debug ("Skipping IPv6 localhost address\n"); + continue; + } + } +#endif + writeAddr(family, len, addr, file, auth); + } + Debug("DefineSelf done\n"); +} +#else /* GETIFADDRS */ + #ifdef SYSV_SIOCGIFCONF /* Deal with different SIOCGIFCONF ioctl semantics on SYSV, SVR4 */ @@ -851,7 +911,22 @@ DefineSelf (int fd, FILE *file, Xauth *auth) #else /* WINTCP */ -#ifdef SIOCGIFCONF +#if defined(SIOCGIFCONF) || defined (USE_SIOCGLIFCONF) + +#ifdef USE_SIOCGLIFCONF +#define ifr_type struct lifreq +#else +#define ifr_type struct ifreq +#endif + +/* Handle variable length ifreq in BNR2 and later */ +#ifdef VARIABLE_IFREQ +#define ifr_size(p) (sizeof (struct ifreq) + \ + (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ + p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) +#else +#define ifr_size(p) (sizeof (ifr_type)) +#endif /* Handle variable length ifreq in BNR2 and later */ #ifdef VARIABLE_IFREQ @@ -869,42 +944,92 @@ static void DefineSelf (int fd, FILE *file, Xauth *auth) { char buf[2048], *cp, *cplim; - struct ifconf ifc; int len; char *addr; int family; - register struct ifreq *ifr; + register ifr_type *ifr; +#ifdef USE_SIOCGLIFCONF + int n; + void * bufptr = buf; + size_t buflen = sizeof(buf); + struct lifconf ifc; +#ifdef SIOCGLIFNUM + struct lifnum ifn; +#endif +#else + struct ifconf ifc; +#endif +#if defined(SIOCGLIFNUM) && defined(SIOCGLIFCONF) + ifn.lifn_family = AF_UNSPEC; + ifn.lifn_flags = 0; + if (ioctl (fd, (int) SIOCGLIFNUM, (char *) &ifn) < 0) + LogError ("Failed getting interface count"); + if (buflen < (ifn.lifn_count * sizeof(struct lifreq))) { + buflen = ifn.lifn_count * sizeof(struct lifreq); + bufptr = malloc(buflen); + } +#endif + +#ifdef USE_SIOCGLIFCONF + ifc.lifc_family = AF_UNSPEC; + ifc.lifc_flags = 0; + ifc.lifc_len = buflen; + ifc.lifc_buf = bufptr; + +#define IFC_IOCTL_REQ SIOCGLIFCONF +#define IFC_IFC_REQ ifc.lifc_req +#define IFC_IFC_LEN ifc.lifc_len +#define IFR_IFR_ADDR ifr->lifr_addr +#define IFR_IFR_NAME ifr->lifr_name + +#else ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ifioctl (fd, SIOCGIFCONF, (char *) &ifc) < 0) - LogError ("Trouble getting network interface configuration"); +#define IFC_IOCTL_REQ SIOCGIFCONF #ifdef ISC #define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf #else #define IFC_IFC_REQ ifc.ifc_req +#endif +#define IFC_IFC_LEN ifc.ifc_len +#define IFR_IFR_ADDR ifr->ifr_addr +#define IFR_IFR_NAME ifr->ifr_name #endif - cplim = (char *) IFC_IFC_REQ + ifc.ifc_len; + if (ifioctl (fd, IFC_IOCTL_REQ, (char *) &ifc) < 0) { + LogError ("Trouble getting network interface configuration"); + +#ifdef USE_SIOCGLIFCONF + if (bufptr != buf) { + free(bufptr); + } +#endif + return; + } + + cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN; for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr)) { - ifr = (struct ifreq *) cp; + ifr = (ifr_type *) cp; #ifdef DNETCONN /* * this is ugly but SIOCGIFCONF returns decnet addresses in * a different form from other decnet calls */ - if (ifr->ifr_addr.sa_family == AF_DECnet) { + if (IFR_IFR_ADDR.sa_family == AF_DECnet) { len = sizeof (struct dn_naddr); addr = (char *)ifr->ifr_addr.sa_data; family = FamilyDECnet; } else #endif { - if (ConvertAddr ((XdmcpNetaddr) &ifr->ifr_addr, &len, &addr) < 0) + family = ConvertAddr ((XdmcpNetaddr) &IFR_IFR_ADDR, &len, &addr); + if (family < 0) continue; + if (len == 0) { Debug ("Skipping zero length address\n"); @@ -917,14 +1042,21 @@ DefineSelf (int fd, FILE *file, Xauth *auth) * the local entry anyway, so this one can * be tossed. */ - if (len == 4 && + if (family == FamilyInternet && len == 4 && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) { Debug ("Skipping localhost address\n"); continue; } - family = FamilyInternet; +#if defined(IPv6) && defined(AF_INET6) + if(family == FamilyInternet6) { + if (IN6_IS_ADDR_LOOPBACK(((struct in6_addr *)addr))) { + Debug ("Skipping IPv6 localhost address\n"); + continue; + } + } +#endif } Debug ("DefineSelf: write network address, length %d\n", len); writeAddr (family, len, addr, file, auth); @@ -974,10 +1106,11 @@ DefineSelf (int fd, int file, int auth) } } + #endif /* SIOCGIFCONF else */ #endif /* WINTCP else */ #endif /* STREAMSCONN && !SYSV_SIOCGIFCONF else */ - +#endif /* HAS_GETIFADDRS */ static void setAuthNumber (Xauth *auth, char *name) @@ -1022,7 +1155,11 @@ writeLocalAuth (FILE *file, Xauth *auth, char *name) t_close (fd); #endif #ifdef TCPCONN +#if defined(IPv6) && defined(AF_INET6) + fd = socket (AF_INET6, SOCK_STREAM, 0); +#else fd = socket (AF_INET, SOCK_STREAM, 0); +#endif DefineSelf (fd, file, auth); close (fd); #endif diff --git a/choose.c b/choose.c index e4b94d8..24bc596 100644 --- a/choose.c +++ b/choose.c @@ -26,7 +26,7 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/choose.c,v 3.15 2001/12/14 20:01:20 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/choose.c,v 3.17 2003/07/09 15:27:38 tsi Exp $ */ /* * choose.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. #include #include "dm_socket.h" +#include #ifndef X_NO_SYS_UN #ifndef Lynx @@ -197,19 +198,29 @@ FormatChooserArgument (char *buf, int len) netfamily = NetaddrFamily((XdmcpNetaddr)addr_buf); switch (netfamily) { case AF_INET: +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: +#endif { char *port; int portlen; - ARRAY8Ptr localAddress; + ARRAY8Ptr localAddress = getLocalAddress (); + +#if defined(IPv6) && defined(AF_INET6) + if (localAddress->length == 16) + netfamily = AF_INET6; + else + netfamily = AF_INET; +#endif port = NetaddrPort((XdmcpNetaddr)addr_buf, &portlen); result_buf[0] = netfamily >> 8; result_buf[1] = netfamily & 0xFF; result_buf[2] = port[0]; result_buf[3] = port[1]; - localAddress = getLocalAddress (); - memmove( (char *)result_buf+4, (char *)localAddress->data, 4); - result_len = 8; + memmove( (char *)result_buf+4, (char *)localAddress->data, + localAddress->length); + result_len = 4 + localAddress->length; } break; #ifdef AF_DECnet @@ -280,13 +291,17 @@ RegisterIndirectChoice ( { ChoicePtr c; int insert; +#if 0 int found = 0; +#endif Debug ("Got indirect choice back\n"); for (c = choices; c; c = c->next) { if (XdmcpARRAY8Equal (clientAddress, &c->client) && connectionType == c->connectionType) { +#if 0 found = 1; +#endif break; } } @@ -372,6 +387,13 @@ AddChooserHost ( { *argp = parseArgs (*argp, "BROADCAST"); } +#if defined(IPv6) && defined(AF_INET6) + else if ( (addr->length == 16) && + (inet_ntop(AF_INET6, addr->data, hostbuf, sizeof(hostbuf)))) + { + *argp = parseArgs (*argp, hostbuf); + } +#endif else if (ARRAY8ToDottedDecimal (addr, hostbuf, sizeof (hostbuf))) { *argp = parseArgs (*argp, hostbuf); diff --git a/chooser.c b/chooser.c index 4e63ee7..4d47a12 100644 --- a/chooser.c +++ b/chooser.c @@ -26,7 +26,7 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/chooser.c,v 3.24 2001/12/14 20:01:20 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/chooser.c,v 3.26 2003/07/18 15:53:28 tsi Exp $ */ /* * Chooser - display a menu of names and let the user select one @@ -194,6 +194,9 @@ typedef struct _hostName { static HostName *hostNamedb; static int socketFD; +#if defined(IPv6) && defined(AF_INET6) +static int socket6FD; +#endif static int pingTry; @@ -262,13 +265,22 @@ static void PingHosts (XtPointer closure, XtIntervalId *id) { HostAddr *hosts; + int sfd = socketFD; for (hosts = hostAddrdb; hosts; hosts = hosts->next) { +#if defined(IPv6) && defined(AF_INET6) + if ( ((struct sockaddr *) hosts->addr)->sa_family == AF_INET6 ) + sfd = socket6FD; + else + sfd = socketFD; +#endif if (hosts->type == QUERY) - XdmcpFlush (socketFD, &directBuffer, (XdmcpNetaddr) hosts->addr, hosts->addrlen); + XdmcpFlush (sfd, &directBuffer, + (XdmcpNetaddr) hosts->addr, hosts->addrlen); else - XdmcpFlush (socketFD, &broadcastBuffer, (XdmcpNetaddr) hosts->addr, hosts->addrlen); + XdmcpFlush (sfd, &broadcastBuffer, + (XdmcpNetaddr) hosts->addr, hosts->addrlen); } if (++pingTry < TRIES) XtAddTimeOut (PING_INTERVAL, PingHosts, (XtPointer) 0); @@ -321,6 +333,13 @@ AddHostname (ARRAY8Ptr hostname, ARRAY8Ptr status, struct sockaddr *addr, int wi hostAddr.length = 4; connectionType = FamilyInternet; break; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + hostAddr.data = (CARD8 *) &((struct sockaddr_in6 *) addr)->sin6_addr; + hostAddr.length = 16; + connectionType = FamilyInternet6; + break; +#endif default: hostAddr.data = (CARD8 *) ""; hostAddr.length = 0; @@ -350,11 +369,14 @@ AddHostname (ARRAY8Ptr hostname, ARRAY8Ptr status, struct sockaddr *addr, int wi switch (addr->sa_family) { case AF_INET: +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: +#endif { struct hostent *hostent; char *host; - hostent = gethostbyaddr ((char *)hostAddr.data, hostAddr.length, AF_INET); + hostent = gethostbyaddr ((char *)hostAddr.data, hostAddr.length, addr->sa_family); if (hostent) { XdmcpDisposeARRAY8 (hostname); @@ -464,11 +486,16 @@ ReceivePacket (XtPointer closure, int *source, XtInputId *id) ARRAY8 hostname; ARRAY8 status; int saveHostname = 0; +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_storage addr; +#else struct sockaddr addr; +#endif int addrlen; + int sfd = * (int *) closure; addrlen = sizeof (addr); - if (!XdmcpFill (socketFD, &buffer, (XdmcpNetaddr) &addr, &addrlen)) + if (!XdmcpFill (sfd, &buffer, (XdmcpNetaddr) &addr, &addrlen)) return; if (!XdmcpReadHeader (&buffer, &header)) return; @@ -486,7 +513,8 @@ ReceivePacket (XtPointer closure, int *source, XtInputId *id) if (header.length == 6 + authenticationName.length + hostname.length + status.length) { - if (AddHostname (&hostname, &status, &addr, header.opcode == (int) WILLING)) + if (AddHostname (&hostname, &status, (struct sockaddr *) &addr, + header.opcode == (int) WILLING)) saveHostname = 1; } } @@ -498,7 +526,8 @@ ReceivePacket (XtPointer closure, int *source, XtInputId *id) { if (header.length == 4 + hostname.length + status.length) { - if (AddHostname (&hostname, &status, &addr, header.opcode == (int) WILLING)) + if (AddHostname (&hostname, &status, (struct sockaddr *) &addr, + header.opcode == (int) WILLING)) saveHostname = 1; } @@ -558,7 +587,9 @@ RegisterHostaddr (struct sockaddr *addr, int len, xdmOpCode type) static void RegisterHostname (char *name) { +#if !defined(IPv6) || !defined(AF_INET6) struct hostent *hostent; +#endif struct sockaddr_in in_addr; struct ifconf ifc; register struct ifreq *ifr; @@ -673,13 +704,48 @@ RegisterHostname (char *name) } else { - - /* address as hex string, e.g., "12180022" (depreciated) */ + /* address as hex string, e.g., "12180022" (deprecated) */ if (strlen(name) == 8 && FromHex(name, (char *)&in_addr.sin_addr, strlen(name)) == 0) { in_addr.sin_family = AF_INET; + in_addr.sin_port = htons (XDM_UDP_PORT); +#ifdef BSD44SOCKETS + in_addr.sin_len = sizeof(in_addr); +#endif + RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), + QUERY); } +#if defined(IPv6) && defined(AF_INET6) + else { + char sport[8]; + struct addrinfo *ai, *nai, hints; + bzero(&hints,sizeof(hints)); + hints.ai_socktype = SOCK_DGRAM; + sprintf(sport, "%d", XDM_UDP_PORT); + if (getaddrinfo(name, sport, &hints, &ai) == 0) { + for (nai = ai ; nai != NULL ; nai = nai->ai_next) { + if ((nai->ai_family == AF_INET) || + (nai->ai_family == AF_INET6)) { + if (((nai->ai_family == AF_INET) && + IN_MULTICAST(((struct sockaddr_in *) nai->ai_addr) + ->sin_addr.s_addr)) + || ((nai->ai_family == AF_INET6) && + IN6_IS_ADDR_MULTICAST( + &((struct sockaddr_in6 *) nai->ai_addr) + ->sin6_addr))) + { + RegisterHostaddr(nai->ai_addr, nai->ai_addrlen, + BROADCAST_QUERY); + } else { + RegisterHostaddr(nai->ai_addr, nai->ai_addrlen, + QUERY); + } + } + } + } + } +#else /* Per RFC 1123, check first for IP address in dotted-decimal form */ else if ((in_addr.sin_addr.s_addr = inet_addr(name)) != -1) in_addr.sin_family = AF_INET; @@ -699,6 +765,7 @@ RegisterHostname (char *name) #endif RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), QUERY); +#endif /* IPv6 */ } } #else /* __GNU__ */ @@ -718,12 +785,30 @@ RegisterHostname (char *name) else { - /* address as hex string, e.g., "12180022" (depreciated) */ + /* address as hex string, e.g., "12180022" (deprecated) */ if (strlen(name) == 8 && FromHex(name, (char *)&in_addr.sin_addr, strlen(name)) == 0) { in_addr.sin_family = AF_INET; - } + in_addr.sin_port = htons (XDM_UDP_PORT); + RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), + QUERY); + } else { +#if defined(IPv6) && defined(AF_INET6) + char sport[8]; + struct addrinfo *ai, *nai, hints; + bzero(&hints,sizeof(hints)); + hints.ai_socktype = SOCK_DGRAM; + sprintf(sport, "%d", XDM_UDP_PORT); + if (getaddrinfo(name, sport, &hints, &ai) == 0) { + for (nai = ai ; nai != NULL ; nai = nai->ai_next) { + if ((nai->ai_family == AF_INET) || + (nai->ai_family == AF_INET6)) { + RegisterHostaddr(nai->ai_addr, nai->ai_addrlen, QUERY); + } + } + } +#else /* Per RFC 1123, check first for IP address in dotted-decimal form */ else if ((in_addr.sin_addr.s_addr = inet_addr(name)) != -1) in_addr.sin_family = AF_INET; @@ -740,6 +825,9 @@ RegisterHostname (char *name) in_addr.sin_port = htons (XDM_UDP_PORT); RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), QUERY); +#endif + } + } } #endif /* __GNU__ */ @@ -820,6 +908,9 @@ InitXDMCP (char **argv) #else if ((socketFD = socket (AF_INET, SOCK_DGRAM, 0)) < 0) return 0; +#if defined(IPv6) && defined(AF_INET6) + socket6FD = socket (AF_INET6, SOCK_DGRAM, 0); +#endif #endif #ifndef STREAMSCONN #ifdef SO_BROADCAST @@ -830,7 +921,11 @@ InitXDMCP (char **argv) #endif XtAddInput (socketFD, (XtPointer) XtInputReadMask, ReceivePacket, - (XtPointer) 0); + (XtPointer) &socketFD); +#if defined(IPv6) && defined(AF_INET6) + XtAddInput (socket6FD, (XtPointer) XtInputReadMask, ReceivePacket, + (XtPointer) &socket6FD); +#endif while (*argv) { RegisterHostname (*argv); @@ -847,6 +942,9 @@ Choose (HostName *h) if (app_resources.xdmAddress) { struct sockaddr_in in_addr; +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_in6 in6_addr; +#endif struct sockaddr *addr = NULL; int family; int len = 0; @@ -871,6 +969,19 @@ Choose (HostName *h) addr = (struct sockaddr *) &in_addr; len = sizeof (in_addr); break; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + bzero(&in6_addr, sizeof(in6_addr)); +#ifdef SIN6_LEN + in6_addr.sin6_len = sizeof(in6_addr); +#endif + in6_addr.sin6_family = family; + memmove( &in6_addr.sin6_port, xdm + 2, 2); + memmove( &in6_addr.sin6_addr, xdm + 4, 16); + addr = (struct sockaddr *) &in6_addr; + len = sizeof (in6_addr); + break; +#endif } #if defined(STREAMSCONN) if ((fd = t_open ("/dev/tcp", O_RDWR, NULL)) == -1) diff --git a/config/Xaccess b/config/Xaccess index c83cc18..bc2c6c3 100644 --- a/config/Xaccess +++ b/config/Xaccess @@ -1,4 +1,5 @@ # $Xorg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ +# $XFree86: xc/programs/xdm/config/Xaccess,v 1.4 2003/07/09 15:27:40 tsi Exp $ # # $XFree86: xc/programs/xdm/config/Xaccess,v 1.3 2001/01/17 23:45:24 dawes Exp $ # @@ -24,6 +25,10 @@ # # %name list of hosts ... # +# To control which addresses xdm listens for requests on: +# +# LISTEN address [list of multicast groups ... ] +# # The first form tells xdm which displays to respond to itself. # The second form tells xdm to forward indirect queries from hosts matching # the specified pattern to the indicated list of hosts. @@ -32,6 +37,9 @@ # address and display the results on the terminal. # The fourth form is similar to the third, except instead of using the # broadcast address, it sends DirectQuerys to each of the hosts in the list +# The fifth form tells xdm which addresses to listen for incoming connections +# on. If present, xdm will only listen for connections on the specified +# interfaces and/or multicast groups. # # In all cases, xdm uses the first entry which matches the terminal; # for IndirectQuery messages only entries with right hand sides can @@ -68,3 +76,17 @@ #%hostlist host-a host-b #* CHOOSER %hostlist # + +# +# If you have a machine with multiple network interfaces or IP addresses +# you can control which interfaces accept XDMCP packets by listing a LISTEN +# line for each interface you want to listen on. You can additionally list +# one or more multicast groups after each address to listen on those groups +# on that address. +# +# If no LISTEN is specified, the default is the same as "LISTEN *" - listen on +# all unicast interfaces, but not for multicast packets. If any LISTEN lines +# are specified, then only the listed interfaces will be listened on. +# + +#LISTEN * ff02::1 diff --git a/config/Xresources.cpp b/config/Xresources.cpp index d64de52..46d2cf0 100644 --- a/config/Xresources.cpp +++ b/config/Xresources.cpp @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.6 2003/01/04 03:11:31 dawes Exp $ +! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.7 2003/11/15 03:25:22 dawes Exp $ ! #define BS \ /* cpp can be trickier than m4 */ #define NLBS \n\ /* don't remove these comments */ @@ -28,19 +28,19 @@ xlogin*namePrompt: \040\040\040\040\040\040\040Login: #endif /* XPM */ xlogin*fail: Login incorrect #ifdef XPM -/**/#if WIDTH > 800 +XHASHif WIDTH > 800 xlogin*greetFont: -adobe-helvetica-bold-o-normal--24-240-75-75-p-138-iso8859-1 xlogin*font: -adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1 xlogin*promptFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 xlogin*failFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 -/**/#else +XHASHelse xlogin*greetFont: -adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso8859-1 xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1 xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1 xlogin*failFont: -adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859-1 -/**/#endif +XHASHendif #endif /* XPM */ -/**/#ifdef COLOR +XHASHifdef COLOR #ifndef XPM xlogin*greetColor: CadetBlue #else @@ -56,7 +56,7 @@ xlogin*greetColor: Blue3 xlogin*failColor: red *Foreground: black *Background: #fffff0 -/**/#else +XHASHelse #ifdef XPM xlogin*borderWidth: 3 xlogin*frameWidth: 0 @@ -68,13 +68,13 @@ xlogin*borderWidth: 3 xlogin*Foreground: black xlogin*Background: white #endif /* XPM */ -/**/#endif +XHASHendif #ifdef XPM -/**/#if PLANES >= 8 +XHASHif PLANES >= 8 xlogin*logoFileName: BITMAPDIR/**//XDM_PIXMAP -/**/#else +XHASHelse xlogin*logoFileName: BITMAPDIR/**//XDM_BWPIXMAP -/**/#endif +XHASHendif xlogin*useShape: true xlogin*logoPadding: 10 #endif /* XPM */ diff --git a/dm.c b/dm.c index 09834e6..c953b98 100644 --- a/dm.c +++ b/dm.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.c,v 3.21 2002/12/07 20:31:04 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.23 2003/09/17 05:48:32 herrb Exp $ */ /* * xdm - display manager daemon @@ -73,7 +73,7 @@ from The Open Group. #endif -#if defined(SVR4) && !defined(SCO) +#if defined(SVR4) && !defined(SCO) && !defined(sun) extern FILE *fdopen(); #endif @@ -86,7 +86,7 @@ static void SetConfigFileTime (void); static void StartDisplays (void); static void TerminateProcess (int pid, int signal); -int Rescan; +volatile int Rescan; static long ServersModTime, ConfigModTime, AccessFileModTime; int nofork_session = 0; @@ -157,7 +157,9 @@ main (int argc, char **argv) snprintf(cmdbuf, sizeof(cmdbuf), "/bin/rm -f %s/authdir/authfiles/A*", authDir); system(cmdbuf); } - +#if!defined(ARC4_RANDOM) && !defined(DEV_RANDOM) + AddOtherEntropy (); +#endif #ifdef XDMCP init_session_id (); CreateWellKnownSockets (); @@ -177,9 +179,13 @@ main (int argc, char **argv) SetAccessFileTime (); #ifdef XDMCP ScanAccessDatabase (); + UpdateListenSockets (); #endif ScanServers (); StartDisplays (); +#if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) + AddOtherEntropy(); +#endif (void) Signal (SIGHUP, RescanNotify); #ifndef UNRELIABLE_SIGNALS (void) Signal (SIGCHLD, ChildNotify); @@ -281,6 +287,7 @@ RescanServers (void) SetAccessFileTime (); #ifdef XDMCP ScanAccessDatabase (); + UpdateListenSockets (); #endif StartDisplays (); } @@ -339,6 +346,7 @@ RescanIfMod (void) LogInfo ("Rereading access file %s\n", accessFile); AccessFileModTime = statb.st_mtime; ScanAccessDatabase (); + UpdateListenSockets(); } } #endif @@ -517,6 +525,9 @@ WaitForChild (void) " removing display %s\n",d->name); LogError("Server crash rate too high:" " removing display %s\n",d->name); +#if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) + AddTimerEntropy(); +#endif RemoveDisplay (d); } else d->lastCrash = Time; diff --git a/dm.h b/dm.h index 1df6f88..483ce20 100644 --- a/dm.h +++ b/dm.h @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.h,v 3.29 2002/05/31 18:46:10 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.33 2003/11/19 03:57:10 dawes Exp $ */ /* * xdm - display manager daemon @@ -186,6 +186,7 @@ struct display { int useChooser; /* Run the chooser for this display */ ARRAY8 clientAddr; /* for chooser picking */ CARD16 connectionType; /* ... */ + int xdmcpFd; #endif /* server management resources */ int serverAttempts; /* number of attempts at running X */ @@ -279,6 +280,7 @@ struct greet_info { #endif typedef void (*ChooserFunc)(CARD16 connectionType, ARRAY8Ptr addr, char *closure); +typedef void (*ListenFunc)(ARRAY8Ptr addr, void **closure); struct verify_info { int uid; /* user id */ @@ -318,7 +320,12 @@ extern int removeDomainname; extern char *keyFile; extern char *accessFile; extern char **exportList; +#if !defined(ARC4_RANDOM) extern char *randomFile; +extern char *prngdSocket; +extern int prngdPort; +#endif + extern char *greeterLib; extern char *willing; extern int choiceTimeout; /* chooser choice timeout */ @@ -352,6 +359,8 @@ extern int ForEachMatchingIndirectHost (ARRAY8Ptr clientAddress, CARD16 connecti extern int ScanAccessDatabase (void); extern int UseChooser (ARRAY8Ptr clientAddress, CARD16 connectionType); extern void ForEachChooserHost (ARRAY8Ptr clientAddress, CARD16 connectionType, ChooserFunc function, char *closure); +extern void ForEachListenAddr(ListenFunc listenfunction, + ListenFunc mcastfcuntion, void **closure); /* in choose.c */ extern ARRAY8Ptr IndirectChoice (ARRAY8Ptr clientAddress, CARD16 connectionType); @@ -439,9 +448,12 @@ extern int StartServer (struct display *d); extern int WaitForServer (struct display *d); extern void ResetServer (struct display *d); -/* socket.c */ +/* socket.c or streams.c */ extern int GetChooserAddr (char *addr, int *lenp); extern void CreateWellKnownSockets (void); +extern void UpdateListenSockets (void); +extern void CloseListenSockets (void); +extern void ProcessListenSockets (fd_set *readmask); /* in util.c */ extern char *localHostname (void); @@ -467,6 +479,7 @@ extern void WaitForChild (void); extern void WaitForSomething (void); extern void init_session_id(void); extern void registerHostname(char *name, int namelen); +extern void ProcessRequestSocket(int fd); /* * CloseOnFork flags @@ -497,6 +510,11 @@ extern void registerHostname(char *name, int namelen); #define Jmp_buf sigjmp_buf #endif +#ifndef HAS_SNPRINTF +#include +#define snprintf XmuSnprintf +#endif + typedef SIGVAL (*SIGFUNC)(int); SIGVAL (*Signal(int, SIGFUNC Handler))(int); diff --git a/dm_auth.h b/dm_auth.h index 8f606ea..abbe93d 100644 --- a/dm_auth.h +++ b/dm_auth.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xdm/dm_auth.h,v 1.2 2000/05/31 07:15:11 eich Exp $ + * $XFree86: xc/programs/xdm/dm_auth.h,v 1.4 2003/10/27 21:39:06 herrb Exp $ */ /************************************************************ @@ -50,6 +50,9 @@ extern void XdmGetXdmcpAuth ( struct protoDisplay *pdpy, unsigned short authorizationNameLen, char *authorizationName); +extern int XdmCheckAuthentication (struct protoDisplay *pdpy, + ARRAY8Ptr displayID, ARRAY8Ptr authenticationName, + ARRAY8Ptr authenticationData); #else #define XdmGetXdmcpAuth NULL #endif @@ -87,6 +90,14 @@ extern void SetLocalAuthorization (struct display *d); extern void SetUserAuthorization (struct display *d, struct verify_info *verify); /* genauth.c */ -extern void GenerateAuthData (char *auth, int len); +extern int GenerateAuthData (char *auth, int len); +#if !defined(ARC4_RANDOM) +extern void AddPreGetEntropy (void); +extern void AddOtherEntropy (void); +extern void AddTimerEntropy (void); +#endif + +/* prngc.c */ +extern int get_prngd_bytes(char *, int, unsigned short, char *); #endif /* _DM_AUTH_H_ */ diff --git a/dpylist.c b/dpylist.c index cbd8009..3b749a1 100644 --- a/dpylist.c +++ b/dpylist.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dpylist.c,v 1.5 2001/12/14 20:01:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dpylist.c,v 1.6 2003/07/09 15:27:38 tsi Exp $ */ /* * xdm - display manager daemon @@ -258,6 +258,7 @@ NewDisplay (char *name, char *class) d->clientAddr.data = NULL; d->clientAddr.length = 0; d->connectionType = 0; + d->xdmcpFd = -1; #endif d->version = 1; /* registered with The Open Group */ displays = d; diff --git a/genauth.c b/genauth.c index 0568e6f..867ca69 100644 --- a/genauth.c +++ b/genauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.15 2002/10/06 18:12:29 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.20 2003/10/17 20:20:02 herrb Exp $ */ /* * xdm - display manager daemon @@ -45,7 +45,13 @@ from The Open Group. #include #define Time_t time_t +#ifdef HASXDMAUTH static unsigned char key[8]; +#endif + +#ifdef DEV_RANDOM +extern char *randomDevice; +#endif #ifdef HASXDMAUTH @@ -53,7 +59,10 @@ typedef unsigned char auth_cblock[8]; /* block size */ typedef struct auth_ks_struct { auth_cblock _; } auth_wrapper_schedule[16]; -extern void _XdmcpWrapperToOddParity(); +extern int _XdmcpAuthSetup(unsigned char *, auth_wrapper_schedule); +extern int _XdmcpAuthDoIt(unsigned char *, unsigned char *, + auth_wrapper_schedule, int); +extern void _XdmcpWrapperToOddParity(unsigned char *, unsigned char *); static void longtochars (long l, unsigned char *c) @@ -66,66 +75,294 @@ longtochars (long l, unsigned char *c) #endif -# define FILE_LIMIT 1024 /* no more than this many buffers */ +#ifdef POLL_DEV_RANDOM +#include +static int +pollRandomDevice (int fd) +{ + struct pollfd fds; + + fds.fd = fd; + fds.events = POLLIN | POLLRDNORM; + /* Wait up to 5 seconds for entropy to accumulate */ + return poll(&fds, 1, 5000); +} +#else +#define pollRandomDevice(fd) 1 +#endif + +#if !defined(ARC4_RANDOM) + +/* ####################################################################### */ + +/* + * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All + * rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, and the entire permission notice in its entirety, + * including the disclaimer of warranties. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF + * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + */ + +static unsigned int epool[32], erotate, eadd_ptr; + +static void +add_entropy (unsigned const int *in, int nwords) +{ + static unsigned const int twist_table[8] = { + 0, 0x3b6e20c8, 0x76dc4190, 0x4db26158, + 0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 }; + unsigned i, w; + int new_rotate; + + while (nwords--) { + w = *in++; + w = (w<>(32-erotate)) & 0xffffffff; + i = eadd_ptr = (eadd_ptr - 1) & 31; + new_rotate = erotate + 14; + if (i) + new_rotate = erotate + 7; + erotate = new_rotate & 31; + w ^= epool[(i + 26) & 31]; + w ^= epool[(i + 20) & 31]; + w ^= epool[(i + 14) & 31]; + w ^= epool[(i + 7) & 31]; + w ^= epool[(i + 1) & 31]; + w ^= epool[i]; + epool[i] = (w >> 3) ^ twist_table[w & 7]; + } +} + +/* ####################################################################### */ + +/* + * This code implements something close to the MD5 message-digest + * algorithm. This code is based on code written by Colin Plumb + * in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + */ + +/* The four core functions - F1 is optimized somewhat */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1 (z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define pmd5_step(f, w, x, y, z, data, s) \ + ( w += (f(x, y, z) + data) & 0xffffffff, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. + */ +static void +pmd5_hash (unsigned int *out, unsigned const int in[16]) +{ + unsigned int a, b, c, d; + + a = out[0]; + b = out[1]; + c = out[2]; + d = out[3]; + + pmd5_step(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + pmd5_step(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + pmd5_step(F1, c, d, a, b, in[2] + 0x242070db, 17); + pmd5_step(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + pmd5_step(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + pmd5_step(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + pmd5_step(F1, c, d, a, b, in[6] + 0xa8304613, 17); + pmd5_step(F1, b, c, d, a, in[7] + 0xfd469501, 22); + pmd5_step(F1, a, b, c, d, in[8] + 0x698098d8, 7); + pmd5_step(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + pmd5_step(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + pmd5_step(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + pmd5_step(F1, a, b, c, d, in[12] + 0x6b901122, 7); + pmd5_step(F1, d, a, b, c, in[13] + 0xfd987193, 12); + pmd5_step(F1, c, d, a, b, in[14] + 0xa679438e, 17); + pmd5_step(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + pmd5_step(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + pmd5_step(F2, d, a, b, c, in[6] + 0xc040b340, 9); + pmd5_step(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + pmd5_step(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + pmd5_step(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + pmd5_step(F2, d, a, b, c, in[10] + 0x02441453, 9); + pmd5_step(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + pmd5_step(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + pmd5_step(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + pmd5_step(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + pmd5_step(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + pmd5_step(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + pmd5_step(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + pmd5_step(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + pmd5_step(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + pmd5_step(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + pmd5_step(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + pmd5_step(F3, d, a, b, c, in[8] + 0x8771f681, 11); + pmd5_step(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + pmd5_step(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + pmd5_step(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + pmd5_step(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + pmd5_step(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + pmd5_step(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + pmd5_step(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + pmd5_step(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + pmd5_step(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + pmd5_step(F3, b, c, d, a, in[6] + 0x04881d05, 23); + pmd5_step(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + pmd5_step(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + pmd5_step(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + pmd5_step(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + pmd5_step(F4, a, b, c, d, in[0] + 0xf4292244, 6); + pmd5_step(F4, d, a, b, c, in[7] + 0x432aff97, 10); + pmd5_step(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + pmd5_step(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + pmd5_step(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + pmd5_step(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + pmd5_step(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + pmd5_step(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + pmd5_step(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + pmd5_step(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + pmd5_step(F4, c, d, a, b, in[6] + 0xa3014314, 15); + pmd5_step(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + pmd5_step(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + pmd5_step(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + pmd5_step(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + pmd5_step(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + out[0] += a; + out[1] += b; + out[2] += c; + out[3] += d; +} + +/* ####################################################################### */ + #if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) static int -sumFile (char *name, long sum[2]) +sumFile (const char *name, int len, int whence, off_t offset) { - long buf[1024*2]; - int cnt; - int fd; - int loops; - int reads; - int i; - int ret_status = 0; - - fd = open (name, O_RDONLY); - if (fd < 0) { - LogError("Cannot open randomFile \"%s\", errno = %d\n", name, errno); - return 0; + int fd, cnt, readlen = 0; + unsigned char buf[0x1000]; + + if ((fd = open (name, O_RDONLY)) < 0) { + Debug("cannot open entropy source \"%s\", errno=%d\n", name, errno); + return -1; } -#ifdef FRAGILE_DEV_MEM - if (strcmp(name, "/dev/mem") == 0) lseek (fd, (off_t) 0x100000, SEEK_SET); -#endif - reads = FILE_LIMIT; - sum[0] = 0; - sum[1] = 0; - while ((cnt = read (fd, (char *) buf, sizeof (buf))) > 0 && --reads > 0) { - loops = cnt / (2 * sizeof (long)); - for (i = 0; i < loops; i+= 2) { - sum[0] += buf[i]; - sum[1] += buf[i+1]; - ret_status = 1; + lseek (fd, offset, whence); + while (readlen < len) { + if (!(cnt = read (fd, buf, sizeof (buf)))) + break; + if (cnt < 0) { + close (fd); + Debug("cannot read entropy source \"%s\", errno=%d\n", + name, errno); + return -1; } + readlen += cnt; + add_entropy((unsigned*)buf, (cnt + 3) / 4); } - if (cnt < 0) - LogError("Cannot read randomFile \"%s\", errno = %d\n", name, errno); close (fd); - return ret_status; + Debug("read %d bytes from entropy source \"%s\"\n", readlen, name); + return readlen; +} + +void +AddTimerEntropy (void) +{ + struct timeval now; + X_GETTIMEOFDAY (&now); + add_entropy((unsigned*)&now, sizeof(now)/sizeof(unsigned)); +} + +#define BSIZ 0x10000 + +void +AddOtherEntropy (void) +{ + AddTimerEntropy(); + /* XXX -- setup-specific ... use some common ones */ + sumFile ("/var/log/messages", 0x1000, SEEK_END, -0x1000); + sumFile ("/var/log/syslog", 0x1000, SEEK_END, -0x1000); + sumFile ("/var/log/debug", 0x1000, SEEK_END, -0x1000); + sumFile ("/var/log/kern.log", 0x1000, SEEK_END, -0x1000); + sumFile ("/var/log/daemon.log", 0x1000, SEEK_END, -0x1000); } + +void +AddPreGetEntropy (void) +{ + static long offset; + long readlen; + + AddTimerEntropy(); + if ((readlen = sumFile (randomFile, BSIZ, SEEK_SET, offset)) == BSIZ) { + offset += readlen; +#ifdef FRAGILE_DEV_MEM + if (!strcmp (randomFile, "/dev/mem")) { + if (offset == 0xa0000) /* skip 640kB-1MB ROM mappings */ + offset = 0x100000; + else if (offset == 0xf00000) /* skip 15-16MB memory hole */ + offset = 0x1000000; + } #endif + return; + } else if (readlen >= 0 && offset) { + if ((offset = sumFile (randomFile, BSIZ, SEEK_SET, 0)) == BSIZ) + return; + } + LogError("Cannot read randomFile \"%s\"; X cookies may be easily guessable\n", randomFile); +} +#endif /* !ARC4_RANDOM && !DEV_RANDOM */ + #ifdef HASXDMAUTH static void InitXdmcpWrapper (void) { + u_int32_t sum[4]; #ifdef ARC4_RANDOM - u_int32_t sum[2]; - sum[0] = arc4random(); sum[1] = arc4random(); *(u_char *)sum = 0; - _XdmcpWrapperToOddParity(sum, key); + _XdmcpWrapperToOddParity((unsigned char *)sum, key); +#else + unsigned char tmpkey[8]; -#elif defined(DEV_RANDOM) +#ifdef DEV_RANDOM int fd; - unsigned char tmpkey[8]; - if ((fd = open(DEV_RANDOM, O_RDONLY)) >= 0) { - if (read(fd, tmpkey, 8) == 8) { + if ((fd = open(randomDevice, O_RDONLY)) >= 0) { + if (pollRandomDevice(fd) && read(fd, tmpkey, 8) == 8) { tmpkey[0] = 0; _XdmcpWrapperToOddParity(tmpkey, key); close(fd); @@ -133,15 +370,27 @@ InitXdmcpWrapper (void) } else { close(fd); } + } else { + LogError("Cannot open randomDevice \"%s\", errno = %d\n", + randomDevice, errno); } -#else - long sum[2]; - unsigned char tmpkey[8]; - - if (!sumFile (randomFile, sum)) { - sum[0] = time ((Time_t *) 0); - sum[1] = time ((Time_t *) 0); +#endif + /* Try some pseudo-random number genrator daemon next */ + if (prngdSocket != NULL || prngdPort != 0) { + if (get_prngd_bytes(tmpkey, sizeof(tmpkey), prngdPort, + prngdSocket) == 0) { + tmpkey[0] = 0; + _XdmcpWrapperToOddParity(tmpkey, key); + return; + } } + /* Fall back if no other source of random number was found */ + AddPreGetEntropy(); + pmd5_hash (sum, epool); + add_entropy (sum, 1); + pmd5_hash (sum, epool + 16); + add_entropy (sum + 2, 1); + longtochars (sum[0], tmpkey+0); longtochars (sum[1], tmpkey+4); tmpkey[0] = 0; @@ -151,115 +400,84 @@ InitXdmcpWrapper (void) #endif -#ifndef HASXDMAUTH -/* A random number generator that is more unpredictable - than that shipped with some systems. - This code is taken from the C standard. */ - -static unsigned long int next = 1; - -static int -xdm_rand(void) -{ - next = next * 1103515245 + 12345; - return (unsigned int)(next/65536) % 32768; -} - -static void -xdm_srand(unsigned int seed) -{ - next = seed; -} -#endif /* no HASXDMAUTH */ -void +int GenerateAuthData (char *auth, int len) { +#ifdef HASXDMAUTH + int i, bit; + auth_wrapper_schedule schedule; + unsigned char data[8]; + static int xdmcpAuthInited; long ldata[2]; #ifdef ITIMER_REAL - { - struct timeval now; + struct timeval now; - X_GETTIMEOFDAY (&now); - ldata[0] = now.tv_usec; - ldata[1] = now.tv_sec; - } + X_GETTIMEOFDAY (&now); + ldata[0] = now.tv_usec; + ldata[1] = now.tv_sec; #else - { -#ifndef __UNIXOS2__ - long time (); -#endif - - ldata[0] = time ((long *) 0); - ldata[1] = getpid (); - } + ldata[0] = time ((long *) 0); + ldata[1] = getpid (); #endif -#ifdef HASXDMAUTH - { - int bit; - int i; - auth_wrapper_schedule schedule; - unsigned char data[8]; - static int xdmcpAuthInited; - longtochars (ldata[0], data+0); - longtochars (ldata[1], data+4); - if (!xdmcpAuthInited) - { - InitXdmcpWrapper (); - xdmcpAuthInited = 1; + longtochars (ldata[0], data+0); + longtochars (ldata[1], data+4); + if (!xdmcpAuthInited) + { + InitXdmcpWrapper (); + xdmcpAuthInited = 1; + } + _XdmcpAuthSetup (key, schedule); + for (i = 0; i < len; i++) { + auth[i] = 0; + for (bit = 1; bit < 256; bit <<= 1) { + _XdmcpAuthDoIt (data, data, schedule, 1); + if ((data[0] + data[1]) & 0x4) + auth[i] |= bit; } - _XdmcpAuthSetup (key, schedule); - for (i = 0; i < len; i++) { - auth[i] = 0; - for (bit = 1; bit < 256; bit <<= 1) { - _XdmcpAuthDoIt (data, data, schedule, 1); - if ((data[0] + data[1]) & 0x4) - auth[i] |= bit; - } - } } -#else - { - int seed; - int value; - int i; - static long localkey[2] = {0,0}; - - if ( (localkey[0] == 0) && (localkey[1] == 0) ) { +#else /* !XDMAUTH */ #ifdef ARC4_RANDOM - localkey[0] = arc4random(); - localkey[1] = arc4random(); -#elif defined(DEV_RANDOM) - int fd; + unsigned int *rnd = (unsigned*)auth; + int i; + + for (i = 0; i < len; i += 4) + rnd[i / 4] = arc4random(); + return 1; +#else /* !ARC4_RANDOM */ + unsigned tmp[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; +#ifdef DEV_RANDOM + int fd; - if ((fd = open(DEV_RANDOM, O_RDONLY)) >= 0) { - if (read(fd, (char *)localkey, 8) != 8) { - localkey[0] = 1; - } - close(fd); - } else { - localkey[0] = 1; - } -#else - if (!sumFile (randomFile, localkey)) { - localkey[0] = 1; /* To keep from continually calling sumFile() */ - } -#endif + if ((fd = open(randomDevice, O_RDONLY)) >= 0) { + if (pollRandomDevice(fd) && + read(fd, auth, len) == len) { + close(fd); + return 1; } - - seed = (ldata[0]+localkey[0]) + ((ldata[1]+localkey[1]) << 16); - xdm_srand (seed); - for (i = 0; i < len; i++) - { - value = xdm_rand (); - auth[i] = (value & 0xff00) >> 8; - } - value = len; - if (value > sizeof (key)) - value = sizeof (key); - memmove( (char *) key, auth, value); + close(fd); + LogError("Cannot read randomDevice \"%s\", errno=%d\n", + randomDevice, errno); + } else + LogError("Cannot open randomDevice \"%s\", errno = %d\n", + randomDevice, errno); +#endif /* DEV_RANDOM */ + /* Try some pseudo-random number genrator daemon next */ + if (prngdSocket != NULL || prngdPort != 0) { + if (get_prngd_bytes(auth, len, prngdPort, prngdSocket) == 0) { + return 1; + } } -#endif + /* Fallback if not able to get from /dev/random */ + AddPreGetEntropy(); + pmd5_hash (tmp, epool); + add_entropy (tmp, 1); + pmd5_hash (tmp, epool + 16); + add_entropy (tmp + 2, 1); + memcpy (auth, tmp, len); + return 1; +#endif /* !ARC4_RANDOM */ +#endif /* !HASXDMAUTH */ } diff --git a/greet.h b/greet.h index e826d40..238d587 100644 --- a/greet.h +++ b/greet.h @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greet.h,v 1.8 2001/12/14 20:01:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greet.h,v 1.10 2003/09/21 13:03:03 herrb Exp $ */ /* * greet.h - interface to xdm's dynamically-loadable modular greeter @@ -37,7 +37,7 @@ from The Open Group. /* * Do this rather than break a build over a const-mismatch */ -#if defined(__linux__) || defined(CSRG_BASED) +#if defined(__linux__) || defined(CSRG_BASED) || (defined(sun) && defined(SVR4)) #define CRYPT_ARGS const char *s1, const char *s2 #define GETSPNAM_ARGS const char *name #define GETPWNAM_ARGS const char *name @@ -120,25 +120,11 @@ typedef enum { * option such as SECURE_RPC or K5AUTH. */ -extern greet_user_rtn GreetUser( -#if NeedFunctionPrototypes - struct display *d, - Display **dpy, - struct verify_info *verify, - struct greet_info *greet, - struct dlfuncs *dlfcns -#endif -); - -typedef greet_user_rtn (*GreetUserProc)( -#if NeedFunctionPrototypes - struct display *, - Display **, - struct verify_info *, - struct greet_info *, - struct dlfuncs *dlfcns -#endif -); +extern greet_user_rtn GreetUser(struct display *, Display **, + struct verify_info *, struct greet_info *, struct dlfuncs *); + +typedef greet_user_rtn (*GreetUserProc)(struct display *, Display **, + struct verify_info *, struct greet_info *, struct dlfuncs *dlfcns); #ifdef GREET_LIB /* diff --git a/greeter/Login.c b/greeter/Login.c index df91b0d..f8c983b 100644 --- a/greeter/Login.c +++ b/greeter/Login.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.16 2002/10/06 20:42:16 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.18 2003/07/09 15:27:40 tsi Exp $ */ /* * xdm - display manager daemon @@ -137,7 +137,12 @@ static XtResource resources[] = { {XtNpasswdPrompt, XtCPasswdPrompt, XtRString, sizeof (char *), offset(passwdPrompt), XtRString, "Password: "}, {XtNfail, XtCFail, XtRString, sizeof (char *), - offset(fail), XtRString, "Login incorrect"}, + offset(fail), XtRString, +#if defined(sun) && defined(SVR4) + "Login incorrect or not on system console if root"}, +#else + "Login incorrect"}, +#endif {XtNfailTimeout, XtCFailTimeout, XtRInt, sizeof (int), offset(failTimeout), XtRImmediate, (XtPointer) 10}, {XtNnotifyDone, XtCCallback, XtRFunction, sizeof (XtPointer), @@ -1108,7 +1113,6 @@ static void Initialize ( w->login.logoValid = False; goto SkipXpmLoad; } - else myAttributes.valuemask |= XpmReturnPixels; myAttributes.valuemask |= XpmReturnExtensions; diff --git a/greeter/Login.h b/greeter/Login.h index 08578f3..ecbb5d5 100644 --- a/greeter/Login.h +++ b/greeter/Login.h @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.7 2002/10/06 20:42:16 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.8 2003/11/19 04:44:00 dawes Exp $ */ /* * xdm - display manager daemon @@ -114,7 +114,15 @@ from The Open Group. /* notifyDone interface definition */ -#ifndef __OpenBSD__ +#ifdef __OpenBSD__ +#include +/* 2.8 (200012) doesn't have _PW_NAME_LEN */ +#if OpenBSD > 200012 +#define HAVE_PW_NAME_LEN +#endif +#endif + +#ifndef HAVE_PW_NAME_LEN #define NAME_LEN 32 #define PASSWORD_LEN 32 #else diff --git a/greeter/greet.c b/greeter/greet.c index 5af88e8..e0b9c06 100644 --- a/greeter/greet.c +++ b/greeter/greet.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.16 2002/10/06 20:42:16 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.17 2003/07/09 15:27:40 tsi Exp $ */ /* * xdm - display manager daemon @@ -145,8 +145,10 @@ GreetDone ( data->name, strlen (data->passwd)); switch (status) { case NOTIFY_OK: - strcpy (name, data->name); - strcpy (password, data->passwd); + strncpy (name, data->name, sizeof(name)); + name[sizeof(name)-1] = '\0'; + strncpy (password, data->passwd, sizeof(password)); + password[sizeof(password)-1] = '\0'; bzero (data->passwd, PASSWORD_LEN); code = 0; done = 1; @@ -280,6 +282,9 @@ CloseGreet (struct display *d) Debug ("Greet connection closed\n"); } +#define WHITESPACE 0 +#define ARGUMENT 1 + static int Greet (struct display *d, struct greet_info *greet) { @@ -306,7 +311,23 @@ Greet (struct display *d, struct greet_info *greet) Debug ("Done dispatch %s\n", d->name); if (code == 0) { - greet->name = name; + char *ptr; + unsigned int c,state = WHITESPACE; + + /* + * Process the name string to get rid of white spaces. + */ + for (ptr = name; state == WHITESPACE; ptr++) + { + c = (unsigned int)(*ptr); + if (c == ' ') + continue; + + state = ARGUMENT; + break; + } + + greet->name = ptr; greet->password = password; XtSetArg (arglist[0], XtNsessionArgument, (char *) &(greet->string)); XtSetArg (arglist[1], XtNallowNullPasswd, (char *) &(greet->allow_null_passwd)); diff --git a/greeter/verify.c b/greeter/verify.c index 182fef4..0fcb320 100644 --- a/greeter/verify.c +++ b/greeter/verify.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.24 2002/11/26 01:16:09 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.26 2003/11/19 04:44:00 dawes Exp $ */ /* * xdm - display manager daemon @@ -79,6 +79,10 @@ static char *envvars[] = { #ifdef KERBEROS #include #include +/* OpenBSD 2.8 needs this. */ +#ifdef OpenBSD && OpenBSD <= 200012 +#include +#endif static char krbtkfile[MAXPATHLEN]; #endif @@ -304,6 +308,47 @@ Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) char **argv; Debug ("Verify %s ...\n", greet->name); + +#if defined(sun) && defined(SVR4) + /* Solaris: If CONSOLE is set to /dev/console in /etc/default/login, + then root can only login on system console */ + +# define SOLARIS_LOGIN_DEFAULTS "/etc/default/login" + + if (strcmp(greet->name, "root") == 0) { + char *console = NULL, *tmp = NULL; + FILE *fs; + + if ((fs= fopen(SOLARIS_LOGIN_DEFAULTS, "r")) != NULL) + { + char str[120]; + while (!feof(fs)) + { + fgets(str, 120, fs); + if(str[0] == '#' || strlen(str) < 8) + continue; + if((tmp = strstr(str, "CONSOLE=")) != NULL) + console = strdup((tmp+8)); + } + fclose(fs); + if ( console != NULL && + (strncmp(console, "/dev/console", 12) == 0) && + (strncmp(d->name,":0",2) != 0) ) + { + Debug("Not on system console\n"); + bzero(greet->password, strlen(greet->password)); + XFree(console); + return 0; + } + Xfree(console); + } + else + { + Debug("Could not open %s\n", SOLARIS_LOGIN_DEFAULTS); + } + } +#endif + #ifndef USE_PAM p = getpwnam (greet->name); endpwent(); diff --git a/mitauth.c b/mitauth.c index 6c0ad9c..2b2dd31 100644 --- a/mitauth.c +++ b/mitauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/mitauth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/mitauth.c,v 1.6 2003/09/17 05:48:32 herrb Exp $ */ /* * xdm - display manager daemon @@ -45,14 +45,12 @@ from The Open Group. # define AUTH_DATA_LEN 16 /* bytes of authorization data */ static char auth_name[256]; -static int auth_name_len; void MitInitAuth (unsigned short name_len, char *name) { if (name_len > 256) name_len = 256; - auth_name_len = name_len; memmove( auth_name, name, name_len); } @@ -85,7 +83,13 @@ MitGetAuth (unsigned short namelen, char *name) } memmove( (char *)new->name, name, namelen); new->name_length = namelen; - GenerateAuthData (new->data, AUTH_DATA_LEN); + if (!GenerateAuthData (new->data, AUTH_DATA_LEN)) + { + free((char *) new->name); + free((char *) new->data); + free((char *) new); + return (Xauth *) 0; + } new->data_length = AUTH_DATA_LEN; return new; } diff --git a/netaddr.c b/netaddr.c index 02cde08..776e23a 100644 --- a/netaddr.c +++ b/netaddr.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/netaddr.c,v 3.6 2001/12/14 20:01:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/netaddr.c,v 3.8 2003/07/18 15:53:28 tsi Exp $ */ /* * xdm - X display manager @@ -85,6 +85,11 @@ char * NetaddrPort(XdmcpNetaddr netaddrp, int *lenp) case AF_INET: *lenp = 2; return (char *)&(((struct sockaddr_in *)netaddrp)->sin_port); +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + *lenp = 2; + return (char *)&(((struct sockaddr_in6 *)netaddrp)->sin6_port); +#endif default: *lenp = 0; return NULL; @@ -112,6 +117,19 @@ char * NetaddrAddress(XdmcpNetaddr netaddrp, int *lenp) case AF_INET: *lenp = sizeof (struct in_addr); return (char *) &(((struct sockaddr_in *)netaddrp)->sin_addr); +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + { + struct in6_addr *a = &(((struct sockaddr_in6 *)netaddrp)->sin6_addr); + if (IN6_IS_ADDR_V4MAPPED(a)) { + *lenp = sizeof (struct in_addr); + return ((char *) &(a->s6_addr))+12; + } else { + *lenp = sizeof (struct in6_addr); + return (char *) &(a->s6_addr); + } + } +#endif #endif #ifdef DNETCONN case AF_DECnet: @@ -163,6 +181,14 @@ int ConvertAddr (XdmcpNetaddr saddr, int *len, char **addr) case AF_INET: retval = FamilyInternet; break; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + if (*len == sizeof(struct in_addr)) + retval = FamilyInternet; + else + retval = FamilyInternet6; + break; +#endif #endif #ifdef DNETCONN case AF_DECnet: @@ -231,8 +257,21 @@ PrintSockAddr (struct sockaddr *a, int len) Debug ("port %d, host %d.%d.%d.%d\n", (p[0] << 8) + p[1], t[0], t[1], t[2], t[3]); break; +#endif +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + { + char astr[INET6_ADDRSTRLEN] = ""; + + inet_ntop(a->sa_family, &((struct sockaddr_in6 *) a)->sin6_addr, + astr, sizeof(astr)); + p = (unsigned char *) &((struct sockaddr_in6 *) a)->sin6_port; + + Debug ("port %d, host %s\n", (p[0] << 8) + p[1], astr); + break; } #endif + } } #endif diff --git a/prngc.c b/prngc.c new file mode 100644 index 0000000..268f983 --- /dev/null +++ b/prngc.c @@ -0,0 +1,195 @@ +/* $XFree86: xc/programs/xdm/prngc.c,v 1.4 2003/11/04 20:17:04 dawes Exp $ */ +/* + * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. + * Copyright (c) 2001-2002 Damien Miller. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#ifndef X_NO_SYS_UN +#ifndef Lynx +#include +#else +#include +#endif +#endif +#include +#include +#include +#include +#include +#include + +#include "dm_auth.h" +#include "dm_error.h" + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7F000001U +#endif + +static ssize_t atomicio(ssize_t (*)(), int, void *, size_t); + +#ifndef offsetof +# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + +/* + * Collect 'len' bytes of entropy into 'buf' from PRNGD/EGD daemon + * listening either on 'tcp_port', or via Unix domain socket at * + * 'socket_path'. + * Either a non-zero tcp_port or a non-null socket_path must be + * supplied. + * Returns 0 on success, -1 on error + */ +int +get_prngd_bytes(char *buf, int len, + unsigned short tcp_port, char *socket_path) +{ + int fd, addr_len, rval, errors; + char msg[2]; + struct sockaddr *addr; + struct sockaddr_in addr_in; + struct sockaddr_un addr_un; + int af; + void (*old_sigpipe)(int); + + /* Sanity checks */ + if (socket_path == NULL && tcp_port == 0) { + LogError("get_random_prngd: " + "You must specify a port or a socket\n"); + return -1; + } + if (socket_path != NULL && + strlen(socket_path) >= sizeof(addr_un.sun_path)) { + LogError("get_random_prngd: Random pool path is too long\n"); + return -1; + } + if (len > 255) { + LogError("get_random_prngd: " + "Too many bytes to read from PRNGD\n"); + return -1; + } + + memset(&addr_in, '\0', sizeof(addr)); + + if (tcp_port != 0) { + af = addr_in.sin_family = AF_INET; + addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + addr_in.sin_port = htons(tcp_port); + addr_len = sizeof(addr_in); + addr = (struct sockaddr *)&addr_in; + } else { + af = addr_un.sun_family = AF_UNIX; + strncpy(addr_un.sun_path, socket_path, + sizeof(addr_un.sun_path)); + addr_len = offsetof(struct sockaddr_un, sun_path) + + strlen(socket_path) + 1; + addr = (struct sockaddr *)&addr_un; + } + + old_sigpipe = signal(SIGPIPE, SIG_IGN); + + errors = 0; + rval = -1; +reopen: + fd = socket(af, SOCK_STREAM, 0); + if (fd == -1) { + LogInfo("Couldn't create socket: %s\n", strerror(errno)); + goto done; + } + + if (connect(fd, (struct sockaddr*)addr, addr_len) == -1) { + if (af == AF_INET) { + LogInfo("Couldn't connect to PRNGD port %d: %s\n", + tcp_port, strerror(errno)); + } else { + LogInfo("Couldn't connect to PRNGD socket" + " \"%s\": %s\n", + addr_un.sun_path, strerror(errno)); + } + goto done; + } + + /* Send blocking read request to PRNGD */ + msg[0] = 0x02; + msg[1] = len; + + if (atomicio(write, fd, msg, sizeof(msg)) != sizeof(msg)) { + if (errno == EPIPE && errors < 10) { + close(fd); + errors++; + goto reopen; + } + LogInfo("Couldn't write to PRNGD socket: %s\n", + strerror(errno)); + goto done; + } + + if (atomicio(read, fd, buf, len) != len) { + if (errno == EPIPE && errors < 10) { + close(fd); + errors++; + goto reopen; + } + LogInfo("Couldn't read from PRNGD socket: %s\n", + strerror(errno)); + goto done; + } + + rval = 0; +done: + signal(SIGPIPE, old_sigpipe); + if (fd != -1) + close(fd); + return rval; +} + +/* + * ensure all of data on socket comes through. f==read || f==write + */ +static ssize_t +atomicio(ssize_t (*f)(), int fd, void *_s, size_t n) +{ + char *s = _s; + ssize_t res, pos = 0; + + while (n > pos) { + res = (f) (fd, s + pos, n - pos); + switch (res) { + case -1: +#ifdef EWOULDBLOCK + if (errno == EINTR || errno == EAGAIN + || errno == EWOULDBLOCK) +#else + if (errno == EINTR || errno == EAGAIN) +#endif + continue; + case 0: + return (res); + default: + pos += res; + } + } + return (pos); +} diff --git a/resource.c b/resource.c index 982dd8e..9fb809f 100644 --- a/resource.c +++ b/resource.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/resource.c,v 3.10 2002/12/07 20:31:04 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/resource.c,v 3.12 2003/09/17 05:48:32 herrb Exp $ */ /* * xdm - display manager daemon @@ -57,7 +57,17 @@ int removeDomainname; char *keyFile; char *accessFile; char **exportList; +#if !defined(ARC4_RANDOM) char *randomFile; +#endif +#ifdef DEV_RANDOM +char *randomDevice; +#endif +#if !defined(ARC4_RANDOM) +char *prngdSocket; +int prngdPort; +#endif + char *greeterLib; char *willing; int choiceTimeout; /* chooser choice timeout */ @@ -72,6 +82,7 @@ int choiceTimeout; /* chooser choice timeout */ * parameters set util/imake.includes/site.def (or *.macros in that directory * if it is server-specific). DO NOT CHANGE THESE DEFINITIONS! */ +#ifndef __EMX__ #ifndef DEF_SERVER_LINE #define DEF_SERVER_LINE ":0 local /usr/bin/X11/X :0" #endif @@ -125,9 +136,72 @@ int choiceTimeout; /* chooser choice timeout */ # define DEF_RANDOM_FILE "/dev/mem" # endif #endif +#ifndef DEF_PRNGD_SOCKET +#define DEF_PRNGD_SOCKET "/tmp/entropy" +#endif +#ifndef DEF_PRNGD_PORT +#define DEF_PRNGD_PORT "0" +#endif #ifndef DEF_GREETER_LIB #define DEF_GREETER_LIB "/usr/lib/X11/xdm/libXdmGreet.so" #endif +#else +/* unfortunately I have to declare all of them, because there is a limit + * in argument size in OS/2 + * but everything needs to be fixed again + */ +#define DEF_SERVER_LINE ":0 local /XFree86/bin/X :0" +#ifndef XRDB_PROGRAM +#define XRDB_PROGRAM "/XFree86/bin/xrdb" +#endif +#ifndef DEF_SESSION +#define DEF_SESSION "/XFree86/bin/xterm -ls" +#endif +#ifndef DEF_USER_PATH +#define DEF_USER_PATH "c:\\os2;c:\\os2\apps;\\XFree86\\bin" +#endif +#ifndef DEF_SYSTEM_PATH +#define DEF_SYSTEM_PATH "c:\\os2;c:\\os2\apps;\\XFree86\\bin" +#endif +#ifndef DEF_SYSTEM_SHELL +#define DEF_SYSTEM_SHELL "sh" +#endif +#ifndef DEF_FAILSAFE_CLIENT +#define DEF_FAILSAFE_CLIENT "/XFree86/bin/xterm" +#endif +#ifndef DEF_XDM_CONFIG +#define DEF_XDM_CONFIG "/XFree86/lib/X11/xdm/xdm-config" +#endif +#ifndef DEF_CHOOSER +#define DEF_CHOOSER "/XFree86/lib/X11/xdm/chooser" +#endif +#ifndef DEF_AUTH_NAME +#ifdef HASXDMAUTH +#define DEF_AUTH_NAME "XDM-AUTHORIZATION-1 MIT-MAGIC-COOKIE-1" +#else +#define DEF_AUTH_NAME "MIT-MAGIC-COOKIE-1" +#endif +#endif +#ifndef DEF_AUTH_DIR +#define DEF_AUTH_DIR "/XFree86/lib/X11/xdm" +#endif +#ifndef DEF_USER_AUTH_DIR +#define DEF_USER_AUTH_DIR "/tmp" +#endif +#ifndef DEF_KEY_FILE +#define DEF_KEY_FILE "" +#endif +#ifndef DEF_ACCESS_FILE +#define DEF_ACCESS_FILE "" +#endif +#ifndef DEF_RANDOM_FILE +#define DEF_RANDOM_FILE "" +#endif +#ifndef DEF_GREETER_LIB +#define DEF_GREETER_LIB "/XFree86/lib/X11/xdm/libXdmGreet.so" +#endif + +#endif /* __EMX__ */ #define DEF_UDP_PORT "177" /* registered XDMCP port, dont change */ @@ -163,8 +237,18 @@ struct dmResources { DEF_ACCESS_FILE} , { "exportList", "ExportList", DM_ARGV, (char **) &exportList, ""} , +#if !defined(ARC4_RANDOM) { "randomFile", "RandomFile", DM_STRING, &randomFile, DEF_RANDOM_FILE} , +{ "prgndSocket", "PrngdSocket", DM_STRING, &prngdSocket, + DEF_PRNGD_SOCKET}, +{ "prngdPort", "PrngdPort", DM_INT, (char **) &prngdPort, + DEF_PRNGD_PORT}, +#endif +#ifdef DEV_RANDOM +{ "randomDevice", "RandomDevice", DM_STRING, &randomDevice, + DEV_RANDOM} , +#endif { "greeterLib", "GreeterLib", DM_STRING, &greeterLib, DEF_GREETER_LIB} , { "choiceTimeout","ChoiceTimeout",DM_INT, (char **) &choiceTimeout, diff --git a/server.c b/server.c index 2ee5bba..d537ddc 100644 --- a/server.c +++ b/server.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/server.c,v 3.13 2001/12/14 20:01:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/server.c,v 3.14 2003/04/12 16:42:14 herrb Exp $ */ /* * xdm - display manager daemon @@ -190,14 +190,26 @@ serverPause (unsigned t, int serverPid) #endif for (;;) { #if defined(SYSV) && defined(X_NOT_POSIX) + /* + * wait() is unsafe. Other Xserver or xdm processes may + * exit at this time and this will remove the wait status. + * This means the main loop will not restart the display. + */ pid = wait ((waitType *) 0); #else if (!receivedUsr1) - pid = wait ((waitType *) 0); - else #ifndef X_NOT_POSIX - pid = waitpid (-1, (int *) 0, WNOHANG); + pid = waitpid (serverPid, (int *) 0, 0); + else + pid = waitpid (serverPid, (int *) 0, WNOHANG); #else + /* + * If you have wait4() but not waitpid(), use that instead + * of wait() and wait3() to make this code safe. See + * above comment. + */ + pid = wait ((waitType *) 0); + else pid = wait3 ((waitType *) 0, WNOHANG, (struct rusage *) 0); #endif /* X_NOT_POSIX */ diff --git a/session.c b/session.c index 9befc15..c7928b2 100644 --- a/session.c +++ b/session.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/session.c,v 3.33 2001/12/14 20:01:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/session.c,v 3.36 2003/09/29 21:00:08 herrb Exp $ */ /* * xdm - display manager daemon @@ -54,23 +54,24 @@ from The Open Group. #ifdef SECURE_RPC # include # include +extern int key_setnet(struct key_netstarg *arg); #endif #ifdef K5AUTH # include #endif #ifndef GREET_USER_STATIC -#include -#ifndef RTLD_NOW -#define RTLD_NOW 1 -#endif +# include +# ifndef RTLD_NOW +# define RTLD_NOW 1 +# endif #endif static int runAndWait (char **args, char **environ); -#if defined(CSRG_BASED) || defined(__osf__) || defined(__DARWIN__) || defined(__QNXNTO__) -#include -#include +#if defined(CSRG_BASED) || defined(__osf__) || defined(__DARWIN__) || defined(__QNXNTO__) || defined(sun) || defined(__GLIBC__) +# include +# include #else /* should be in */ extern void setgrent(void); @@ -79,17 +80,21 @@ extern void endgrent(void); #endif #ifdef USESHADOW +# if defined(SVR4) +# include +# else extern struct spwd *getspnam(GETSPNAM_ARGS); extern void endspent(void); +# endif #endif -#if defined(CSRG_BASED) -#include -#include +#if defined(CSRG_BASED) || defined(__GLIBC__) +# include +# include #else extern struct passwd *getpwnam(GETPWNAM_ARGS); -#ifdef linux +# ifdef linux extern void endpwent(void); -#endif +# endif extern char *crypt(CRYPT_ARGS); #endif #ifdef USE_PAM @@ -99,7 +104,16 @@ pam_handle_t **thepamhp() return &pamh; } -pam_handle_t *thepamh() +#ifdef USE_PAM +pam_handle_t ** +thepamhp(void) +{ + static pam_handle_t *pamh = NULL; + return &pamh; +} + +pam_handle_t * +thepamh(void) { pam_handle_t **pamhp; @@ -136,12 +150,12 @@ static struct dlfuncs dlfuncs = { endgrent, #ifdef USESHADOW getspnam, -#ifndef QNX4 +# ifndef QNX4 endspent, -#endif /* QNX4 doesn't use endspent */ +# endif /* QNX4 doesn't use endspent */ #endif getpwnam, -#ifdef linux +#if defined(linux) || defined(__GLIBC__) endpwent, #endif crypt, @@ -189,7 +203,7 @@ waitAbort (int n) } #if defined(_POSIX_SOURCE) || defined(SYSV) || defined(SVR4) -#define killpg(pgrp, sig) kill(-(pgrp), sig) +# define killpg(pgrp, sig) kill(-(pgrp), sig) #endif static void @@ -226,8 +240,7 @@ AbortClient (int pid) void SessionPingFailed (struct display *d) { - if (clientPid > 1) - { + if (clientPid > 1) { AbortClient (clientPid); source (verify.systemEnviron, d->reset); } @@ -246,7 +259,7 @@ SessionPingFailed (struct display *d) static int IOErrorHandler (Display *dpy) { - LogError("fatal IO error %d (%s)\n", errno, _SysErrorMsg(errno)); + LogError ("fatal IO error %d (%s)\n", errno, _SysErrorMsg(errno)); exit(RESERVER_DISPLAY); /*NOTREACHED*/ return 0; @@ -255,7 +268,7 @@ IOErrorHandler (Display *dpy) static int ErrorHandler(Display *dpy, XErrorEvent *event) { - LogError("X error\n"); + LogError ("X error\n"); if (XmuPrintDefaultErrorMessage (dpy, event, stderr) == 0) return 0; exit(UNMANAGE_DISPLAY); /*NOTREACHED*/ @@ -266,7 +279,7 @@ ManageSession (struct display *d) { static int pid = 0; Display *dpy; - greet_user_rtn greet_stat; + greet_user_rtn greet_stat; static GreetUserProc greet_user_proc = NULL; #ifndef GREET_USER_STATIC void *greet_lib_handle; @@ -288,13 +301,12 @@ ManageSession (struct display *d) #ifdef GREET_USER_STATIC greet_user_proc = GreetUser; #else - Debug("ManageSession: loading greeter library %s\n", greeterLib); + Debug ("ManageSession: loading greeter library %s\n", greeterLib); greet_lib_handle = dlopen(greeterLib, RTLD_NOW); if (greet_lib_handle != NULL) greet_user_proc = (GreetUserProc)dlsym(greet_lib_handle, "GreetUser"); - if (greet_user_proc == NULL) - { - LogError("%s while loading %s\n", dlerror(), greeterLib); + if (greet_user_proc == NULL) { + LogError ("%s while loading %s\n", dlerror(), greeterLib); exit(UNMANAGE_DISPLAY); } #endif @@ -306,8 +318,7 @@ ManageSession (struct display *d) greet.version = 1; greet_stat = (*greet_user_proc)(d, &dpy, &verify, &greet, &dlfuncs); - if (greet_stat == Greet_Success) - { + if (greet_stat == Greet_Success) { clientPid = 0; if (!Setjmp (abortSession)) { (void) Signal (SIGTERM, catchTerm); @@ -322,29 +333,23 @@ ManageSession (struct display *d) /* Save memory; close library */ dlclose(greet_lib_handle); #endif - + /* * Wait for session to end, */ for (;;) { - if (d->pingInterval) - { - if (!Setjmp (pingTime)) - { + if (d->pingInterval) { + if (!Setjmp (pingTime)) { (void) Signal (SIGALRM, catchAlrm); (void) alarm (d->pingInterval * 60); pid = wait ((waitType *) 0); (void) alarm (0); - } - else - { + } else { (void) alarm (0); if (!PingServer (d, (Display *) NULL)) SessionPingFailed (d); } - } - else - { + } else { pid = wait ((waitType *) 0); } if (pid == clientPid) @@ -391,8 +396,7 @@ SetupDisplay (struct display *d) { char **env = 0; - if (d->setup && d->setup[0]) - { + if (d->setup && d->setup[0]) { env = systemEnv (d, (char *) 0, (char *) 0); (void) source (env, d->setup); freeEnv (env); @@ -436,8 +440,7 @@ SecureDisplay (struct display *d, Display *dpy) Debug ("Before XGrabServer %s\n", d->name); XGrabServer (dpy); if (XGrabKeyboard (dpy, DefaultRootWindow (dpy), True, GrabModeAsync, - GrabModeAsync, CurrentTime) != GrabSuccess) - { + GrabModeAsync, CurrentTime) != GrabSuccess) { (void) alarm (0); (void) Signal (SIGALRM, SIG_DFL); LogError ("WARNING: keyboard on display %s could not be secured\n", @@ -448,8 +451,7 @@ SecureDisplay (struct display *d, Display *dpy) (void) alarm (0); (void) Signal (SIGALRM, SIG_DFL); pseudoReset (dpy); - if (!d->grabServer) - { + if (!d->grabServer) { XUngrabServer (dpy); XSync (dpy, 0); } @@ -460,8 +462,7 @@ void UnsecureDisplay (struct display *d, Display *dpy) { Debug ("Unsecure display %s\n", d->name); - if (d->grabServer) - { + if (d->grabServer) { XUngrabServer (dpy); XSync (dpy, 0); } @@ -487,8 +488,7 @@ SessionExit (struct display *d, int status, int removeAuth) kill (d->serverPid, d->resetSignal); else ResetServer (d); - if (removeAuth) - { + if (removeAuth) { setgid (verify.gid); setuid (verify.uid); RemoveUserAuthorization (d, &verify); @@ -500,7 +500,7 @@ SessionExit (struct display *d, int status, int removeAuth) code = Krb5DisplayCCache(d->name, &ccache); if (code) - LogError("%s while getting Krb5 ccache to destroy\n", + LogError ("%s while getting Krb5 ccache to destroy\n", error_message(code)); else { code = krb5_cc_destroy(ccache); @@ -508,7 +508,7 @@ SessionExit (struct display *d, int status, int removeAuth) if (code == KRB5_FCC_NOFILE) { Debug ("No Kerberos ccache file found to destroy\n"); } else - LogError("%s while destroying Krb5 credentials cache\n", + LogError ("%s while destroying Krb5 credentials cache\n", error_message(code)); } else Debug ("Kerberos ccache destroyed\n"); @@ -535,8 +535,9 @@ StartClient ( #ifdef HAS_SETUSERCONTEXT struct passwd* pwd; #endif -#ifdef USE_PAM - pam_handle_t *pamh = thepamh(); +#ifdef USE_PAM + pam_handle_t *pamh = thepamh (); + int pam_error; #endif if (verify->argv) { @@ -552,7 +553,7 @@ StartClient ( } #ifdef USE_PAM if (pamh) pam_open_session(pamh, 0); -#endif +#endif switch (pid = fork ()) { case 0: CleanUpChild (); @@ -577,34 +578,34 @@ StartClient ( #ifndef AIXV3 #ifndef HAS_SETUSERCONTEXT - if (setgid(verify->gid) < 0) - { - LogError("setgid %d (user \"%s\") failed, errno=%d\n", + if (setgid(verify->gid) < 0) { + LogError ("setgid %d (user \"%s\") failed, errno=%d\n", verify->gid, name, errno); return (0); } #if defined(BSD) && (BSD >= 199103) - if (setlogin(name) < 0) - { - LogError("setlogin for \"%s\" failed, errno=%d", name, errno); + if (setlogin(name) < 0) { + LogError ("setlogin for \"%s\" failed, errno=%d", name, errno); return(0); } #endif #ifndef QNX4 - if (initgroups(name, verify->gid) < 0) - { - LogError("initgroups for \"%s\" failed, errno=%d\n", name, errno); + if (initgroups(name, verify->gid) < 0) { + LogError ("initgroups for \"%s\" failed, errno=%d\n", name, errno); return (0); } -#endif /* QNX4 doesn't support multi-groups, no initgroups() */ #ifdef USE_PAM - if (thepamh()) { - pam_setcred(thepamh(), PAM_ESTABLISH_CRED); + if (pamh) { + pam_error = pam_setcred (pamh, PAM_ESTABLISH_CRED); + if (pam_error != PAM_SUCCESS) { + LogError ("pam_setcred for \"%s\" failed: %s\n", + name, pam_strerror(pamh, pam_error)); + return(0); + } } #endif - if (setuid(verify->uid) < 0) - { - LogError("setuid %d (user \"%s\") failed, errno=%d\n", + if (setuid(verify->uid) < 0) { + LogError ("setuid %d (user \"%s\") failed, errno=%d\n", verify->uid, name, errno); return (0); } @@ -614,19 +615,15 @@ StartClient ( * environment variables, resource limits, and umask. */ pwd = getpwnam(name); - if (pwd) - { - if (setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL) < 0) - { - LogError("setusercontext for \"%s\" failed, errno=%d\n", name, + if (pwd) { + if (setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL) < 0) { + LogError ("setusercontext for \"%s\" failed, errno=%d\n", name, errno); return (0); } endpwent(); - } - else - { - LogError("getpwnam for \"%s\" failed, errno=%d\n", name, errno); + } else { + LogError ("getpwnam for \"%s\" failed, errno=%d\n", name, errno); return (0); } #endif /* HAS_SETUSERCONTEXT */ @@ -635,9 +632,8 @@ StartClient ( * Set the user's credentials: uid, gid, groups, * audit classes, user limits, and umask. */ - if (setpcred(name, NULL) == -1) - { - LogError("setpcred for \"%s\" failed, errno=%d\n", name, errno); + if (setpcred(name, NULL) == -1) { + LogError ("setpcred for \"%s\" failed, errno=%d\n", name, errno); return (0); } #endif /* AIXV3 */ @@ -652,6 +648,7 @@ StartClient ( char netname[MAXNETNAMELEN+1], secretkey[HEXKEYBYTES+1]; int nameret, keyret; int len; + struct key_netstarg netst; int key_set_ok = 0; nameret = getnetname (netname); @@ -662,34 +659,34 @@ StartClient ( keyret = getsecretkey(netname,secretkey,passwd); Debug ("getsecretkey returns %d, key length %d\n", keyret, strlen (secretkey)); + memcpy(&(netst.st_priv_key), secretkey, HEXKEYBYTES); + netst.st_netname = strdup(netname); + memset(netst.st_pub_key, 0, HEXKEYBYTES); + if (key_setnet(&netst) < 0) { + Debug ("Could not set secret key.\n"); + } + free(netst.st_netname); /* is there a key, and do we have the right password? */ - if (keyret == 1) - { - if (*secretkey) - { + if (keyret == 1) { + if (*secretkey) { keyret = key_setsecret(secretkey); Debug ("key_setsecret returns %d\n", keyret); if (keyret == -1) LogError ("failed to set NIS secret key\n"); else key_set_ok = 1; - } - else - { + } else { /* found a key, but couldn't interpret it */ LogError ("password incorrect for NIS principal \"%s\"\n", nameret ? netname : name); } } - if (!key_set_ok) - { + if (!key_set_ok) { /* remove SUN-DES-1 from authorizations list */ int i, j; - for (i = 0; i < d->authNum; i++) - { + for (i = 0; i < d->authNum; i++) { if (d->authorizations[i]->name_length == 9 && - memcmp(d->authorizations[i]->name, "SUN-DES-1", 9) == 0) - { + memcmp(d->authorizations[i]->name, "SUN-DES-1", 9) == 0) { for (j = i+1; j < d->authNum; j++) d->authorizations[j-1] = d->authorizations[j]; d->authNum--; @@ -714,11 +711,9 @@ StartClient ( setEnv(verify->userEnviron, "KRB5CCNAME", Krb5CCacheName(d->name)); } else { - for (i = 0; i < d->authNum; i++) - { + for (i = 0; i < d->authNum; i++) { if (d->authorizations[i]->name_length == 14 && - memcmp(d->authorizations[i]->name, "MIT-KERBEROS-5", 14) == 0) - { + memcmp(d->authorizations[i]->name, "MIT-KERBEROS-5", 14) == 0) { /* remove Kerberos from authorizations list */ for (j = i+1; j < d->authNum; j++) d->authorizations[j-1] = d->authorizations[j]; @@ -773,8 +768,7 @@ source (char **environ, char *file) if (file && file[0]) { Debug ("source %s\n", file); args = parseArgs ((char **) 0, file); - if (!args) - { + if (!args) { args = args_safe; args[0] = file; args[1] = NULL; @@ -841,8 +835,7 @@ execute (char **argv, char **environ) f = fopen (argv[0], "r"); if (!f) return; - if (fgets (program, sizeof (program) - 1, f) == NULL) - { + if (fgets (program, sizeof (program) - 1, f) == NULL) { fclose (f); return; } @@ -894,8 +887,7 @@ defaultEnv (void) char **env, **exp, *value; env = 0; - for (exp = exportList; exp && *exp; ++exp) - { + for (exp = exportList; exp && *exp; ++exp) { value = getenv (*exp); if (value) env = setEnv (env, *exp, value); @@ -907,13 +899,12 @@ char ** systemEnv (struct display *d, char *user, char *home) { char **env; - + env = defaultEnv (); env = setEnv (env, "DISPLAY", d->name); if (home) env = setEnv (env, "HOME", home); - if (user) - { + if (user) { env = setEnv (env, "USER", user); env = setEnv (env, "LOGNAME", user); } diff --git a/socket.c b/socket.c index 83dddf6..b472bfb 100644 --- a/socket.c +++ b/socket.c @@ -2,6 +2,7 @@ /* Copyright 1988, 1998 The Open Group +Copyright 2002 Sun Microsystems, Inc. All rights reserved. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -15,18 +16,18 @@ in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Except as contained in this notice, the name of The Open Group shall +Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization -from The Open Group. +from the copyright holder. */ -/* $XFree86: xc/programs/xdm/socket.c,v 3.10 2001/12/14 20:01:24 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/socket.c,v 3.13 2003/07/18 15:39:52 tsi Exp $ */ /* * xdm - display manager daemon @@ -52,9 +53,8 @@ from The Open Group. #endif #endif #include +#include - -extern int xdmcpFd; extern int chooserFd; extern FD_TYPE WellKnownSocketsMask; @@ -63,39 +63,14 @@ extern int WellKnownSocketsMax; void CreateWellKnownSockets (void) { - struct sockaddr_in sock_addr; - char *name; - - if (request_port == 0) - return; - Debug ("creating socket %d\n", request_port); - xdmcpFd = socket (AF_INET, SOCK_DGRAM, 0); - if (xdmcpFd == -1) { - LogError ("XDMCP socket creation failed, errno %d\n", errno); - return; - } - name = localHostname (); + char *name = localHostname (); registerHostname (name, strlen (name)); - RegisterCloseOnFork (xdmcpFd); - /* zero out the entire structure; this avoids 4.4 incompatibilities */ - bzero ((char *) &sock_addr, sizeof (sock_addr)); -#ifdef BSD44SOCKETS - sock_addr.sin_len = sizeof(sock_addr); -#endif - sock_addr.sin_family = AF_INET; - sock_addr.sin_port = htons ((short) request_port); - sock_addr.sin_addr.s_addr = htonl (INADDR_ANY); - if (bind (xdmcpFd, (struct sockaddr *)&sock_addr, sizeof (sock_addr)) == -1) - { - LogError ("error %d binding socket address %d\n", errno, request_port); - close (xdmcpFd); - xdmcpFd = -1; - return; - } - WellKnownSocketsMax = xdmcpFd; - FD_SET (xdmcpFd, &WellKnownSocketsMask); +#if defined(IPv6) && defined(AF_INET6) + chooserFd = socket (AF_INET6, SOCK_STREAM, 0); +#else chooserFd = socket (AF_INET, SOCK_STREAM, 0); +#endif Debug ("Created chooser socket %d\n", chooserFd); if (chooserFd == -1) { @@ -113,17 +88,425 @@ GetChooserAddr ( char *addr, int *lenp) { +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_storage in_addr; +#else struct sockaddr_in in_addr; +#endif int len; + int retval = 0; len = sizeof in_addr; + if (chooserFd < 0) + return -1; /* TODO check other listening sockets */ if (getsockname (chooserFd, (struct sockaddr *)&in_addr, (void *)&len) < 0) return -1; - Debug ("Chooser socket port: %d\n", ntohs(in_addr.sin_port)); - memmove( addr, (char *) &in_addr, len); +#if defined(IPv6) && defined(AF_INET6) + if (((struct sockaddr *)&in_addr)->sa_family == AF_INET6) + Debug ("Chooser socket port: %d (IPv6)\n", + ntohs(((struct sockaddr_in6 *) &in_addr)->sin6_port)); + else +#endif + Debug ("Chooser socket port: %d\n", + ntohs(((struct sockaddr_in *) &in_addr)->sin_port)); + if (*lenp < len) + retval = -2; + else + memmove( addr, (char *) &in_addr, len); *lenp = len; - return 0; + return retval; +} + +static int +CreateListeningSocket (struct sockaddr *sock_addr, int salen) +{ + int fd; + const char *addrstring = "unknown"; +#if defined(IPv6) && defined(AF_INET6) + char addrbuf[INET6_ADDRSTRLEN]; +#endif + + if (request_port == 0) + return -1; + + if (debugLevel > 0) { +#if defined(IPv6) && defined(AF_INET6) + void *ipaddr; + if (sock_addr->sa_family == AF_INET6) { + ipaddr = & ((struct sockaddr_in6 *) sock_addr)->sin6_addr; + } else { + ipaddr = & ((struct sockaddr_in *) sock_addr)->sin_addr; + } + addrstring = + inet_ntop(sock_addr->sa_family, ipaddr, addrbuf, sizeof(addrbuf)); + +#else + addrstring = inet_ntoa(((struct sockaddr_in *) sock_addr)->sin_addr); +#endif + + Debug ("creating socket to listen on port %d of address %s\n", + request_port,addrstring); + } + + fd = socket (sock_addr->sa_family, SOCK_DGRAM, 0); + + if (fd == -1) { + LogError ("XDMCP socket creation failed, errno %d\n", errno); + return fd; + } + RegisterCloseOnFork (fd); + + if (bind (fd, sock_addr, salen) == -1) + { + LogError ("error %d binding socket address %d\n", errno, request_port); + close (fd); + fd = -1; + return fd; + } + if (fd > WellKnownSocketsMax) + WellKnownSocketsMax = fd; + FD_SET (fd, &WellKnownSocketsMask); + return fd; +} + +struct socklist { + struct socklist * next; + struct socklist * mcastgroups; + struct sockaddr * addr; + int salen; + int addrlen; + int fd; + int ref; /* referenced bit - see UpdateListenSockets */ +}; + +static struct socklist *listensocks; + +static void +DestroyListeningSocket (struct socklist *s) +{ + if (s->fd >= 0) { + FD_CLR (s->fd, &WellKnownSocketsMask); + close(s->fd); + s->fd = -1; + } + if (s->addr) { + free(s->addr); + s->addr = NULL; + } + if (s->mcastgroups) { + struct socklist *g, *n; + + for (g = s->mcastgroups; g != NULL; g = n) { + n = g->next; + if (g->addr) + free(g->addr); + free(g); + } + s->mcastgroups = NULL; + } +} + +static struct socklist* +FindInList(struct socklist *list, ARRAY8Ptr addr) +{ + struct socklist *s; + + for (s = list; s != NULL; s = s->next) { + if (s->addrlen == addr->length) { + char *addrdata; + + switch (s->addr->sa_family) { + case AF_INET: + addrdata = (char *) + &(((struct sockaddr_in *)s->addr)->sin_addr.s_addr); + break; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + addrdata = (char *) + &(((struct sockaddr_in6 *)s->addr)->sin6_addr.s6_addr); + break; +#endif + default: + /* Unrecognized address family */ + continue; + } + if (memcmp(addrdata, addr->data, addr->length) == 0) { + return s; + } + } + } + return NULL; +} + +static struct socklist * +CreateSocklistEntry(ARRAY8Ptr addr) +{ + struct socklist *s = malloc (sizeof(struct socklist)); + if (s == NULL) + LogOutOfMem("CreateSocklistEntry"); + + bzero(s, sizeof(struct socklist)); + + if (addr->length == 4) /* IPv4 */ + { + struct sockaddr_in *sin; + sin = malloc (sizeof(struct sockaddr_in)); + if (sin == NULL) + LogOutOfMem("CreateSocklistEntry"); + s->addr = (struct sockaddr *) sin; + + bzero (sin, sizeof (struct sockaddr_in)); +#ifdef BSD44SOCKETS + sin->sin_len = sizeof(struct sockaddr_in); +#endif + s->salen = sizeof(struct sockaddr_in); + s->addrlen = sizeof(struct in_addr); + sin->sin_family = AF_INET; + sin->sin_port = htons ((short) request_port); + memcpy(&sin->sin_addr, addr->data, addr->length); + } +#if defined(IPv6) && defined(AF_INET6) + else if (addr->length == 16) /* IPv6 */ + { + struct sockaddr_in6 *sin6; + sin6 = malloc (sizeof(struct sockaddr_in6)); + if (sin6 == NULL) + LogOutOfMem("CreateSocklistEntry"); + s->addr = (struct sockaddr *) sin6; + + bzero (sin6, sizeof (struct sockaddr_in6)); +#ifdef SIN6_LEN + sin6->sin6_len = sizeof(struct sockaddr_in6); +#endif + s->salen = sizeof(struct sockaddr_in6); + s->addrlen = sizeof(struct in6_addr); + sin6->sin6_family = AF_INET6; + sin6->sin6_port = htons ((short) request_port); + memcpy(&sin6->sin6_addr, addr->data, addr->length); + } +#endif + else { + /* Unknown address type */ + free(s); + s = NULL; + } + return s; +} + +static void +UpdateListener(ARRAY8Ptr addr, void **closure) +{ + struct socklist *s; + ARRAY8 tmpaddr; + + *closure = NULL; + + if (addr == NULL || addr->length == 0) { +#if defined(IPv6) && defined(AF_INET6) + struct in6_addr in6 = in6addr_any; + tmpaddr.length = sizeof(in6); + tmpaddr.data = (CARD8Ptr) &in6; +#else + struct in_addr in; + in.s_addr = htonl (INADDR_ANY); + tmpaddr.length = sizeof(in); + tmpaddr.data = (CARD8Ptr) ∈ +#endif + addr = &tmpaddr; + } + + s = FindInList(listensocks, addr); + + if (s) { + *closure = (void *) s; + s->ref = 1; + return; + } + + s = CreateSocklistEntry(addr); + + if (s == NULL) + return; + + s->fd = CreateListeningSocket(s->addr, s->salen); + if (s->fd < 0) { + free(s->addr); + free(s); + return; + } + s->ref = 1; + s->next = listensocks; + listensocks = s; + *closure = (void *) s; +} + +#define JOIN_MCAST_GROUP 0 +#define LEAVE_MCAST_GROUP 1 + +static void +ChangeMcastMembership(struct socklist *s, struct socklist *g, int op) +{ + int sockopt; + + switch (s->addr->sa_family) + { + case AF_INET: + { + struct ip_mreq mreq; + memcpy(&mreq.imr_multiaddr, + &((struct sockaddr_in *) g->addr)->sin_addr, + sizeof(struct in_addr)); + memcpy(&mreq.imr_interface, + &((struct sockaddr_in *) s->addr)->sin_addr, + sizeof(struct in_addr)); + if (op == JOIN_MCAST_GROUP) { + sockopt = IP_ADD_MEMBERSHIP; + } else { + sockopt = IP_DROP_MEMBERSHIP; + } + if (setsockopt(s->fd, IPPROTO_IP, sockopt, + &mreq, sizeof(mreq)) < 0) { + LogError ("XDMCP socket multicast %s to %s failed, errno %d\n", + (op == JOIN_MCAST_GROUP) ? "join" : "drop", + inet_ntoa(((struct sockaddr_in *) g->addr)->sin_addr), + errno); + return; + } else if (debugLevel > 0) { + Debug ("XDMCP socket multicast %s to %s succeeded\n", + (op == JOIN_MCAST_GROUP) ? "join" : "drop", + inet_ntoa(((struct sockaddr_in *) g->addr)->sin_addr)); + } + } +#if defined(IPv6) && defined(AF_INET6) +#ifndef IPV6_JOIN_GROUP +#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP +#endif +#ifndef IPV6_LEAVE_GROUP +#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP +#endif + case AF_INET6: + { + struct ipv6_mreq mreq6; + memcpy(&mreq6.ipv6mr_multiaddr, + &((struct sockaddr_in6 *) g->addr)->sin6_addr, + sizeof(struct in6_addr)); + mreq6.ipv6mr_interface = 0; /* TODO: fix this */ + if (op == JOIN_MCAST_GROUP) { + sockopt = IPV6_JOIN_GROUP; + } else { + sockopt = IPV6_LEAVE_GROUP; + } + if (setsockopt(s->fd, IPPROTO_IPV6, sockopt, + &mreq6, sizeof(mreq6)) < 0) { + int saveerr = errno; + char addrbuf[INET6_ADDRSTRLEN]; + + inet_ntop(s->addr->sa_family, + &((struct sockaddr_in6 *) g->addr)->sin6_addr, + addrbuf, sizeof(addrbuf)); + + LogError ("XDMCP socket multicast %s to %s failed, errno %d\n", + (op == JOIN_MCAST_GROUP) ? "join" : "drop", addrbuf, + saveerr); + return; + } else if (debugLevel > 0) { + char addrbuf[INET6_ADDRSTRLEN]; + + inet_ntop(s->addr->sa_family, + &((struct sockaddr_in6 *) g->addr)->sin6_addr, + addrbuf, sizeof(addrbuf)); + + Debug ("XDMCP socket multicast %s to %s succeeded\n", + (op == JOIN_MCAST_GROUP) ? "join" : "drop", addrbuf); + } + } +#endif + } +} + +static void +UpdateMcastGroup(ARRAY8Ptr addr, void **closure) +{ + struct socklist *s = (struct socklist *) *closure; + struct socklist *g; + + g = FindInList(s->mcastgroups, addr); + + if (g) { /* Already in the group, mark & continue */ + g->ref = 1; + return; + } + + /* Need to join the group */ + g = CreateSocklistEntry(addr); + if (g == NULL) + return; + + ChangeMcastMembership(s, g, JOIN_MCAST_GROUP); +} + +/* Open or close listening sockets to match the current settings read in + from the access database. */ +void UpdateListenSockets (void) +{ + struct socklist *s, *g, **ls, **lg, *ns, *ng; + void *tmpPtr = NULL; + + /* Clear Ref bits - any not marked by UpdateCallback will be closed */ + for (s = listensocks; s != NULL; s = s->next) { + s->ref = 0; + for (g = s->mcastgroups; g != NULL ; g = g->next) { + g->ref = 0; + } + } + ForEachListenAddr(UpdateListener, UpdateMcastGroup, &tmpPtr); + for (s = listensocks, ls = &listensocks; s != NULL; s = ns) { + ns = s->next; + if (s->ref == 0) { + DestroyListeningSocket(s); + *ls = s->next; + free(s); + } else { + ls = &(s->next); + for (lg = &s->mcastgroups, g = *lg; g != NULL ; g = ng) { + ng = g->next; + if (g->ref == 0) { + ChangeMcastMembership(s,g,LEAVE_MCAST_GROUP); + *lg = g->next; + free(g); + } else { + lg = &(g->next); + } + } + } + } +} + +/* Close all additional listening sockets beyond the basic chooserFd and + remove them from the WellKnownSocketsMask. */ +void CloseListenSockets (void) +{ + struct socklist *s, *n; + + for (s = listensocks; s != NULL; s = n) { + n = s->next; + DestroyListeningSocket(s); + free(s); + } + listensocks = NULL; +} + +/* For each listening socket identified in readmask, process the incoming + XDMCP request */ +void ProcessListenSockets (fd_set *readmask) +{ + struct socklist *s; + + for (s = listensocks; s != NULL; s = s->next) { + if (FD_ISSET(s->fd, readmask)) + ProcessRequestSocket(s->fd); + } } #endif /* !STREAMSCONN */ diff --git a/streams.c b/streams.c index de6b41a..720b4cc 100644 --- a/streams.c +++ b/streams.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/streams.c,v 3.6 2001/12/14 20:01:24 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/streams.c,v 3.8 2003/10/27 21:39:08 herrb Exp $ */ /* * xdm - display manager daemon @@ -53,7 +53,7 @@ extern FD_TYPE WellKnownSocketsMask; extern int WellKnownSocketsMax; void -CreateWellKnownSockets () +CreateWellKnownSockets (void) { struct t_bind bind_addr; struct netconfig *nconf; @@ -127,9 +127,9 @@ CreateWellKnownSockets () FD_SET (chooserFd, &WellKnownSocketsMask); } -GetChooserAddr (addr, lenp) - char *addr; /* return */ - int *lenp; /* size of addr, returned as amt used */ +int +GetChooserAddr (char *addr, /* return */ + int *lenp) /* size of addr, returned as amt used */ { struct netbuf nbuf; int retval; @@ -146,5 +146,24 @@ GetChooserAddr (addr, lenp) return retval; } +/* TODO: Implement support for controlling which interfaces are listened on + and for listening to multicast addresses. See the sockets equivalent in + sockets.c for details. */ + +void UpdateListenSockets (void) +{ + return; +} + +void CloseListenSockets (void) +{ + return; +} + +void ProcessListenSockets (fd_set *readmask) +{ + return; +} + #endif /* STREAMSCONN */ #endif /* XDMCP */ diff --git a/xdm.man.cpp b/xdm.man.cpp index 07fd53f..9ad586e 100644 --- a/xdm.man.cpp +++ b/xdm.man.cpp @@ -1,15 +1,15 @@ .\" $Xorg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group -.\" +.\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. -.\" +.\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -17,14 +17,14 @@ .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. -.\" +.\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.22 2002/10/12 16:06:47 herrb Exp $ -.\" +.\" +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.26 2003/10/24 20:38:15 tsi Exp $ +.\" .TH XDM 1 __xorgversion__ .SH NAME xdm \- X Display Manager with support for XDMCP, host chooser @@ -92,6 +92,13 @@ by .I chooser or X terminals themselves. .PP +.I Xdm +can be configured to ignore BroadcastQuery messages from selected hosts. +This is useful when you don't want the host to appear in menus produced +by +.I chooser +or X terminals themselves. +.PP Because .I xdm provides the first interface that users will see, it is designed to be @@ -144,7 +151,7 @@ When the \fIXsession\fP script exits, the session is over. At the end of the session, the \fIXreset\fP script is run to clean up, the X server is reset, and the cycle starts over. .PP -The file \fI__projectroot__/lib/X11/xdm/xdm-errors\fP will contain error +The file \fI __projectroot__/lib/X11/xdm/xdm-errors\fP will contain error messages from .I xdm and anything output to stderr by \fIXsetup, Xstartup, Xsession\fP @@ -247,7 +254,7 @@ dots to separate resource name parts, .I xdm substitutes underscores for both dots and colons when generating the resource name. -For example, \fBDisplayManager.expo_x_org_0.startup\fP is the name of the +For example, \fBDisplayManager.expo_x_org_0.startup\fP is the name of the resource which defines the startup shell file for the ``expo.x.org:0'' display. .\" .IP "\fBDisplayManager.servers\fP" @@ -305,7 +312,7 @@ uses the \fIlockf\fP library call, while on BSD it uses \fIflock.\fP This names a directory under which .I xdm stores authorization files while initializing the session. The -default value is \fI__projectroot__/lib/X11/xdm.\fP +default value is \fI __projectroot__/lib/X11/xdm.\fP Can be overridden for specific displays by DisplayManager.\fIDISPLAY\fP.authFile. .IP \fBDisplayManager.autoRescan\fP @@ -349,10 +356,31 @@ to pass on to the \fIXsetup\fP, A file to checksum to generate the seed of authorization keys. This should be a file that changes frequently. The default is \fI/dev/mem\fP. +#ifdef DEV_RANDOM +.IP \fBDisplayManager.randomDevice\fP +A file to read 8 bytes from to generate the seed of authorization keys. +The default is \fI DEV_RANDOM \fP. If this file cannot be read, or if a +read blocks for more than 5 seconds, xdm falls back to using a checksum +of \fBDisplayManager.randomFile\fP to generate the seed. +#endif +#if !defined(ARC4_RANDOM) +.IP \fBDisplayManager.prngdSocket\fP +.IP \fBDisplayManager.prngPort\fP +A UNIX domain socket name or a TCP socket port number on local host on +which a Pseudo-Random Number Generator Daemon, like EGD +(http://egd.sourceforge.net) is listening, in order to generate the +autorization keys. Either a non null port or a valid socket name must +be specified. The default is to use the Unix-domain socket +\fI/tmp/entropy\fP. +.PP +On systems that don't have such a daemon, a fall-back entropy +gathering system, based on various log file contents hashed by the MD5 +algorithm is used instead. +#endif .IP \fBDisplayManager.greeterLib\fP On systems that support a dynamically-loadable greeter library, the name of the library. The default is -\fI__projectroot__/lib/X11/xdm/libXdmGreet.so\fP. +\fI __projectroot__/lib/X11/xdm/libXdmGreet.so\fP. .IP \fBDisplayManager.choiceTimeout\fP Number of seconds to wait for display to respond after user has selected a host from the chooser. If the display sends an XDMCP @@ -384,17 +412,17 @@ section which describes the various resources that are appropriate to place in this file. There is no default value for this resource, but -\fI__projectroot__/lib/X11/xdm/Xresources\fP +\fI __projectroot__/lib/X11/xdm/Xresources\fP is the conventional name. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.chooser\fP" Specifies the program run to offer a host menu for Indirect queries redirected to the special host name CHOOSER. -\fI__projectroot__/lib/X11/xdm/chooser\fP is the default. +\fI __projectroot__/lib/X11/xdm/chooser\fP is the default. See the sections \fBXDMCP Access Control\fP and \fBChooser\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.xrdb\fP" Specifies the program used to load the resources. By default, .I xdm -uses \fI__projectroot__/bin/xrdb\fP. +uses \fI __projectroot__/bin/xrdb\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.cpp\fP" This specifies the name of the C preprocessor which is used by \fIxrdb\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.setup\fP" @@ -412,7 +440,7 @@ file used here is \fIXstartup\fP. See the section \fBStartup Program.\fP .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.session\fP" This specifies the session to be executed (not running as root). -By default, \fI__projectroot__/bin/xterm\fP is +By default, \fI __projectroot__/bin/xterm\fP is run. The conventional name is \fIXsession\fP. See the section .B "Session Program." @@ -498,7 +526,7 @@ If the default session fails to execute, will fall back to this program. This program is executed with no arguments, but executes using the same environment variables as the session would have had (see the section \fBSession Program\fP). -By default, \fI__projectroot__/bin/xterm\fP is used. +By default, \fI __projectroot__/bin/xterm\fP is used. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.grabServer\fP" .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.grabTimeout\fP" To improve security, @@ -577,7 +605,7 @@ variable XAUTHORITY at the created file. It uses \fI/tmp\fP by default. First, the .I xdm configuration file should be set up. -Make a directory (usually \fI__projectroot__/lib/X11/xdm\fP) to contain all +Make a directory (usually \fI __projectroot__/lib/X11/xdm\fP) to contain all of the relevant files. .LP Here is a reasonable configuration file, which could be @@ -632,6 +660,11 @@ it can be followed by the optional ``NOBROADCAST'' keyword. This can be used to prevent an xdm server from appearing on menus based on Broadcast queries. .PP +To only respond to Direct queries for a host or pattern, +it can be followed by the optional ``NOBROADCAST'' keyword. +This can be used to prevent an xdm server from appearing on +menus based on Broadcast queries. +.PP An Indirect entry also contains a host name or pattern, but follows it with a list of host names or macros to which indirect queries should be sent. @@ -686,6 +719,23 @@ extract.lcs.mit.edu xenon.lcs.mit.edu #force extract to contact xenon !xtra.lcs.mit.edu dummy #disallow indirect access *.lcs.mit.edu %HOSTS #all others get to choose .fi +.PP +If compiled with IPv6 support, multicast address groups may also be included +in the list of addresses indirect queries are set to. Multicast addresses +may be followed by an optional / character and hop count. If no hop count is +specified, the multicast hop count defaults to 1, keeping the packet on the +local network. For IPv4 multicasting, the hop count is used as the TTL. +.PP +Examples: +.LP +.ta 2.1i 4.5i +.nf +rincewind.sample.net ff02::1 #IPv6 Multicast to ff02::1 +\& #with a hop count of 1 +ponder.sample.net CHOOSER 239.192.1.1/16 #Offer a menu of hosts +\& #who respond to IPv4 Multicast +\& # to 239.192.1.1 with a TTL of 16 +.fi .SH CHOOSER .PP For X terminals that do not offer a host menu for use with Broadcast @@ -725,6 +775,37 @@ and sends another \fBIndirect\fP XDMCP request. \fBDisplayManager.choiceTimeout\fP seconds) and forwards the request to the chosen host, which starts a session on that display. .\" +.SH LISTEN +The following configuration directive is also defined for the Xaccess +configuration file: +.IP "\fBLISTEN\fP \fIinterface\fP \fI[list of multicast group addresses]\fP" +\fIinterface\fP may be a hostname or IP addresss representing a +network interface on this machine, or the wildcard * to represent all +available network interfaces. +.PP +If one or more LISTEN lines are specified, xdm only listens for XDMCP +connections on the specified interfaces. If multicast group addresses +are listed on a listen line, xdm joins the multicast groups on the +given interface. +.PP +If no LISTEN lines are given, the original behavior of listening on +all interfaces is preserved for backwards compatibility. +Additionally, if no LISTEN is specified, xdm joins the default XDMCP +IPv6 multicast group, when compiled with IPv6 support. +.PP +To disable listening for XDMCP connections altogther, a line of LISTEN +with no addresses may be specified, or the previously supported method +of setting DisplayManager.requestPort to 0 may be used. +.PP +Examples: +.ta 2i 4i +.nf +LISTEN * ff02::1 # Listen on all interfaces and to the +\& # ff02::1 IPv6 multicast group. +LISTEN 10.11.12.13 # Listen only on this interface, as long +\& # as no other listen directives appear in +\& # file. +.fi .SH "LOCAL SERVER SPECIFICATION" .PP The resource \fBDisplayManager.servers\fP gives a server specification @@ -781,7 +862,7 @@ it at its authorization data. For XDMCP servers, \fIxdm\fP passes the authorization data to the server via the \fBAccept\fP XDMCP request. .SH RESOURCES FILE -The \fIXresources\fP file is +The \fIXresources\fP file is loaded onto the display as a resource database using .I xrdb. As the authentication @@ -830,6 +911,15 @@ the following environment variables are passed: SHELL the value of \fBDisplayManager.\fP\fIDISPLAY\fP\fB.systemShell\fP XAUTHORITY may be set to an authority file .fi +.IP "\fBxlogin.Login.allowRootLogin\fP" +If set to ``false'', don't allow root (and any other user with uid = 0) to +log in directly. +The default is ``true''. +.IP "\fBxlogin.Login.allowNullPasswd\fP" +If set to ``true'', allow an otherwise failing password match to succeed +if the account does not require a password at all. +The default is ``false'', so only users that have passwords assigned can +log in. .PP Note that since \fIxdm\fP grabs the keyboard, any other windows will not be able to receive keyboard input. They will be able to interact with @@ -985,7 +1075,7 @@ before doing this. .PP On some systems (OpenBSD) the user's shell must be listed in .I /etc/shells -to allow login through xdm. The normal password and account expiration +to allow login through xdm. The normal password and account expiration dates are enforced too. .SH "STARTUP PROGRAM" .PP @@ -1025,7 +1115,7 @@ cycle. .PP The sample \fIXstartup\fP file shown here prevents login while the file \fI/etc/nologin\fP -exists. +exists. Thus this is not a complete example, but simply a demonstration of the available functionality. .PP @@ -1100,7 +1190,7 @@ be executable so we don't have to guess what shell it wants to use. \& # \& # This is the program that is run as the client \& # for the display manager. - + case $# in 1) case $1 in @@ -1109,10 +1199,10 @@ be executable so we don't have to guess what shell it wants to use. ;; esac esac - + startup=$HOME/.xsession resources=$HOME/.Xresources - + if [ \-f "$startup" ]; then exec "$startup" else @@ -1230,7 +1320,7 @@ line: .nf .ta .5i - xdm \-server ":0 SUN-3/60CG4 local __projectroot__/bin/X :0" + xdm \-server \(lq:0 SUN-3/60CG4 local __projectroot__/bin/X :0\(rq .fi .PP diff --git a/xdmauth.c b/xdmauth.c index 7be4d3d..a42fcfb 100644 --- a/xdmauth.c +++ b/xdmauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.5 2001/12/14 20:01:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.7 2003/10/27 21:39:02 herrb Exp $ */ /* * xdm - display manager daemon * Author: Keith Packard, MIT X Consortium @@ -45,11 +45,8 @@ from The Open Group. static char auth_name[256]; static int auth_name_len; -void -XdmPrintDataHex (s, a, l) - char *s; - char *a; - int l; +static void +XdmPrintDataHex (char *s, char *a, int l) { int i; @@ -59,30 +56,16 @@ XdmPrintDataHex (s, a, l) Debug ("\n"); } -#ifdef notdef /* not used */ -void -XdmPrintKey (s, k) - char *s; - XdmAuthKeyRec *k; -{ - XdmPrintDataHex (s, (char *) k->data, 8); -} -#endif - #ifdef XDMCP -void -XdmPrintArray8Hex (s, a) - char *s; - ARRAY8Ptr a; +static void +XdmPrintArray8Hex (char *s, ARRAY8Ptr a) { XdmPrintDataHex (s, (char *) a->data, a->length); } #endif void -XdmInitAuth (name_len, name) - unsigned short name_len; - char *name; +XdmInitAuth (unsigned short name_len, char *name) { if (name_len > 256) name_len = 256; @@ -99,11 +82,8 @@ XdmInitAuth (name_len, name) * between xdm and the server (16 bytes total) */ -Xauth * -XdmGetAuthHelper (namelen, name, includeRho) - unsigned short namelen; - char *name; - int includeRho; +static Xauth * +XdmGetAuthHelper (unsigned short namelen, char *name, int includeRho) { Xauth *new; new = (Xauth *) malloc (sizeof (Xauth)); @@ -135,7 +115,13 @@ XdmGetAuthHelper (namelen, name, includeRho) } memmove( (char *)new->name, name, namelen); new->name_length = namelen; - GenerateAuthData ((char *)new->data, new->data_length); + if (!GenerateAuthData ((char *)new->data, new->data_length)) + { + free ((char *) new->name); + free ((char *) new->data); + free ((char *) new); + return (Xauth *) 0; + } /* * set the first byte of the session key to zero as it * is a DES key and only uses 56 bits @@ -146,9 +132,7 @@ XdmGetAuthHelper (namelen, name, includeRho) } Xauth * -XdmGetAuth (namelen, name) - unsigned short namelen; - char *name; +XdmGetAuth (unsigned short namelen, char *name) { return XdmGetAuthHelper (namelen, name, TRUE); } @@ -156,10 +140,8 @@ XdmGetAuth (namelen, name) #ifdef XDMCP void -XdmGetXdmcpAuth (pdpy,authorizationNameLen, authorizationName) - struct protoDisplay *pdpy; - unsigned short authorizationNameLen; - char *authorizationName; +XdmGetXdmcpAuth (struct protoDisplay *pdpy, + unsigned short authorizationNameLen, char *authorizationName) { Xauth *fileauth, *xdmcpauth; @@ -210,8 +192,7 @@ XdmGetXdmcpAuth (pdpy,authorizationNameLen, authorizationName) 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1) static int -HexToBinary (key) - char *key; +HexToBinary(char *key) { char *out, *in; int top, bottom; @@ -240,10 +221,8 @@ HexToBinary (key) * routine accepts either plain ascii strings for keys, or hex-encoded numbers */ -int -XdmGetKey (pdpy, displayID) - struct protoDisplay *pdpy; - ARRAY8Ptr displayID; +static int +XdmGetKey(struct protoDisplay *pdpy, ARRAY8Ptr displayID) { FILE *keys; char line[1024], id[1024], key[1024]; @@ -283,9 +262,8 @@ XdmGetKey (pdpy, displayID) /*ARGSUSED*/ int -XdmCheckAuthentication (pdpy, displayID, authenticationName, authenticationData) - struct protoDisplay *pdpy; - ARRAY8Ptr displayID, authenticationName, authenticationData; +XdmCheckAuthentication(struct protoDisplay *pdpy, ARRAY8Ptr displayID, + ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData) { XdmAuthKeyPtr incoming; diff --git a/xdmcp.c b/xdmcp.c index 726902f..d4a8e8b 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.21 2002/12/10 22:37:17 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.24 2003/11/16 15:50:38 herrb Exp $ */ /* * xdm - display manager daemon @@ -55,14 +55,10 @@ from The Open Group. #include #endif #endif -#if defined(__SVR4) && defined(__sun) - /* - * make sure we get the resolver's version of gethostbyname - * otherwise we may not get all the addresses! - */ -#define gethostbyname res_gethostbyname -#endif #include +#if defined(IPv6) && defined(AF_INET6) +#include +#endif #include #define Time_t time_t @@ -72,28 +68,32 @@ from The Open Group. /* * misc externs */ -extern int Rescan, ChildReady; -extern int sourceAddress; +extern volatile int Rescan; +extern int sourceAddress, ChildReady; /* * Forward reference */ -static void broadcast_respond (struct sockaddr *from, int fromlen, int length); -static void forward_respond (struct sockaddr *from, int fromlen, int length); -static void manage (struct sockaddr *from, int fromlen, int length); -static void query_respond (struct sockaddr *from, int fromlen, int length); -static void request_respond (struct sockaddr *from, int fromlen, int length); -static void send_accept (struct sockaddr *to, int tolen, CARD32 sessionID, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, ARRAY8Ptr authorizationData); -static void send_alive (struct sockaddr *from, int fromlen, int length); -static void send_decline (struct sockaddr *to, int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr status); -static void send_failed (struct sockaddr *from, int fromlen, char *name, CARD32 sessionID, char *reason); -static void send_refuse (struct sockaddr *from, int fromlen, CARD32 sessionID); -static void send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status); -static void send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status); - - +static void broadcast_respond (struct sockaddr *from, int fromlen, int length, int fd); +static void forward_respond (struct sockaddr *from, int fromlen, int length, int fd); +static void manage (struct sockaddr *from, int fromlen, int length, int fd); +static void query_respond (struct sockaddr *from, int fromlen, int length, int fd); +static void request_respond (struct sockaddr *from, int fromlen, int length, int fd); +static void send_accept (struct sockaddr *to, int tolen, CARD32 sessionID, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, ARRAY8Ptr authorizationData, int fd); +static void send_alive (struct sockaddr *from, int fromlen, int length, int fd); +static void send_decline (struct sockaddr *to, int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr status, int fd); +static void send_failed (struct sockaddr *from, int fromlen, char *name, CARD32 sessionID, char *reason, int fd); +static void send_refuse (struct sockaddr *from, int fromlen, CARD32 sessionID, int fd); +static void send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status, int fd); +static void send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status, int fd); + +#ifdef STREAMSCONN int xdmcpFd = -1; +#endif int chooserFd = -1; +#if defined(IPv6) && defined(AF_INET6) +int chooserFd6 = -1; +#endif FD_TYPE WellKnownSocketsMask; int WellKnownSocketsMax; @@ -103,22 +103,55 @@ int WellKnownSocketsMax; void DestroyWellKnownSockets (void) { +#ifdef STREAMSCONN if (xdmcpFd != -1) { close (xdmcpFd); + FD_CLR(xdmcpFd, &WellKnownSocketsMask); xdmcpFd = -1; } +#endif if (chooserFd != -1) { close (chooserFd); + FD_CLR(chooserFd, &WellKnownSocketsMask); chooserFd = -1; } +#if defined(IPv6) && defined(AF_INET6) + if (chooserFd6 != -1) + { + close (chooserFd6); + FD_CLR(chooserFd6, &WellKnownSocketsMask); + chooserFd6 = -1; + } +#endif + CloseListenSockets(); +} + +static int +FD_ANYSET(fd_set *fds) +{ + int i; + char *mask = (char *) fds; + + for (i = 0 ; i < sizeof(fds); i++) { + if (mask[i]) + return TRUE; + } + return FALSE; } int AnyWellKnownSockets (void) { - return xdmcpFd != -1 || chooserFd != -1; + return +#ifdef STREAMS_CONN + xdmcpFd != -1 || +#endif +#if defined(IPv6) && defined(AF_INET6) + chooserFd6 != -1 || +#endif + chooserFd != -1 || FD_ANYSET(&WellKnownSocketsMask); } static XdmcpBuffer buffer; @@ -133,6 +166,9 @@ sendForward ( #ifdef AF_INET struct sockaddr_in in_addr; #endif +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_in6 in6_addr; +#endif #ifdef AF_DECnet #endif struct sockaddr *addr; @@ -155,13 +191,28 @@ sendForward ( addrlen = sizeof (struct sockaddr_in); break; #endif +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: + addr = (struct sockaddr *) &in6_addr; + bzero ((char *) &in6_addr, sizeof (in6_addr)); +#ifdef SIN6_LEN + in6_addr.sin6_len = sizeof(in6_addr); +#endif + in6_addr.sin6_family = AF_INET6; + in6_addr.sin6_port = htons ((short) XDM_UDP_PORT); + if (address->length != 16) + return; + memmove( (char *) &in6_addr.sin6_addr, address->data, address->length); + addrlen = sizeof (struct sockaddr_in6); + break; +#endif #ifdef AF_DECnet case FamilyDECnet: #endif default: return; } - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) addr, addrlen); + XdmcpFlush (*((int *) closure), &buffer, (XdmcpNetaddr) addr, addrlen); return; } @@ -193,7 +244,8 @@ all_query_respond ( struct sockaddr *from, int fromlen, ARRAYofARRAY8Ptr authenticationNames, - xdmOpCode type) + xdmOpCode type, + int fd) { ARRAY8Ptr authenticationName; ARRAY8 status; @@ -217,10 +269,10 @@ all_query_respond ( authenticationName = ChooseAuthentication (authenticationNames); if (Willing (&addr, connectionType, authenticationName, &status, type)) - send_willing (from, fromlen, authenticationName, &status); + send_willing (from, fromlen, authenticationName, &status, fd); else if (type == QUERY) - send_unwilling (from, fromlen, authenticationName, &status); + send_unwilling (from, fromlen, authenticationName, &status, fd); XdmcpDisposeARRAY8 (&status); } @@ -228,7 +280,8 @@ static void indirect_respond ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { ARRAYofARRAY8 queryAuthenticationNames; ARRAY8 clientAddress; @@ -264,13 +317,13 @@ indirect_respond ( XdmcpWriteARRAY8 (&buffer, &clientPort); XdmcpWriteARRAYofARRAY8 (&buffer, &queryAuthenticationNames); - localHostAsWell = ForEachMatchingIndirectHost (&clientAddress, connectionType, sendForward, (char *) 0); + localHostAsWell = ForEachMatchingIndirectHost (&clientAddress, connectionType, sendForward, (char *) &fd); XdmcpDisposeARRAY8 (&clientAddress); XdmcpDisposeARRAY8 (&clientPort); if (localHostAsWell) all_query_respond (from, fromlen, &queryAuthenticationNames, - INDIRECT_QUERY); + INDIRECT_QUERY, fd); } else { @@ -279,16 +332,20 @@ indirect_respond ( XdmcpDisposeARRAYofARRAY8 (&queryAuthenticationNames); } -static void -ProcessRequestSocket (void) +void +ProcessRequestSocket (int fd) { XdmcpHeader header; +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_storage addr; +#else struct sockaddr addr; +#endif int addrlen = sizeof addr; Debug ("ProcessRequestSocket\n"); bzero ((char *) &addr, sizeof (addr)); - if (!XdmcpFill (xdmcpFd, &buffer, (XdmcpNetaddr) &addr, &addrlen)) { + if (!XdmcpFill (fd, &buffer, (XdmcpNetaddr) &addr, &addrlen)) { Debug ("XdmcpFill failed\n"); return; } @@ -305,25 +362,25 @@ ProcessRequestSocket (void) switch (header.opcode) { case BROADCAST_QUERY: - broadcast_respond (&addr, addrlen, header.length); + broadcast_respond ((struct sockaddr *) &addr, addrlen, header.length, fd); break; case QUERY: - query_respond (&addr, addrlen, header.length); + query_respond ((struct sockaddr *) &addr, addrlen, header.length, fd); break; case INDIRECT_QUERY: - indirect_respond (&addr, addrlen, header.length); + indirect_respond ((struct sockaddr *) &addr, addrlen, header.length, fd); break; case FORWARD_QUERY: - forward_respond (&addr, addrlen, header.length); + forward_respond ((struct sockaddr *) &addr, addrlen, header.length, fd); break; case REQUEST: - request_respond (&addr, addrlen, header.length); + request_respond ((struct sockaddr *) &addr, addrlen, header.length, fd); break; case MANAGE: - manage (&addr, addrlen, header.length); + manage ((struct sockaddr *) &addr, addrlen, header.length, fd); break; case KEEPALIVE: - send_alive (&addr, addrlen, header.length); + send_alive ((struct sockaddr *) &addr, addrlen, header.length, fd); break; } } @@ -342,15 +399,33 @@ WaitForSomething (void) nready, Rescan, ChildReady); if (nready > 0) { +#ifdef STREAMSCONN if (xdmcpFd >= 0 && FD_ISSET (xdmcpFd, &reads)) ProcessRequestSocket (); +#endif if (chooserFd >= 0 && FD_ISSET (chooserFd, &reads)) + { #ifdef ISC if (!ChildReady) { WaitForSomething (); } else #endif ProcessChooserSocket (chooserFd); + FD_CLR(chooserFd, &reads); + } +#if defined(IPv6) && defined(AF_INET6) + if (chooserFd6 >= 0 && FD_ISSET (chooserFd6, &reads)) + { +#ifdef ISC + if (!ChildReady) { + WaitForSomething (); + } else +#endif + ProcessChooserSocket (chooserFd6); + FD_CLR(chooserFd6, &reads); + } +#endif + ProcessListenSockets(&reads); } if (ChildReady) { @@ -384,7 +459,8 @@ direct_query_respond ( struct sockaddr *from, int fromlen, int length, - xdmOpCode type) + xdmOpCode type, + int fd) { ARRAYofARRAY8 queryAuthenticationNames; int expectedLen; @@ -396,7 +472,7 @@ direct_query_respond ( for (i = 0; i < (int)queryAuthenticationNames.length; i++) expectedLen += 2 + queryAuthenticationNames.data[i].length; if (length == expectedLen) - all_query_respond (from, fromlen, &queryAuthenticationNames, type); + all_query_respond (from, fromlen, &queryAuthenticationNames, type, fd); XdmcpDisposeARRAYofARRAY8 (&queryAuthenticationNames); } @@ -404,19 +480,21 @@ static void query_respond ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { Debug ("Query respond %d\n", length); - direct_query_respond (from, fromlen, length, QUERY); + direct_query_respond (from, fromlen, length, QUERY, fd); } static void broadcast_respond ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { - direct_query_respond (from, fromlen, length, BROADCAST_QUERY); + direct_query_respond (from, fromlen, length, BROADCAST_QUERY, fd); } /* computes an X display name */ @@ -431,6 +509,113 @@ NetworkAddressToName( switch (connectionType) { case FamilyInternet: +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: + { + CARD8 *data; + struct hostent *hostent; + char *hostname = NULL; + char *name; + char *localhost; + int multiHomed = 0; + struct addrinfo hints, *ai = NULL, *nai; + int type; + + if (connectionType == FamilyInternet6) + type = AF_INET6; + else + type = AF_INET; + + data = connectionAddress->data; + hostent = gethostbyaddr ((char *)data, + connectionAddress->length, type); + if (hostent) { + if (sourceAddress) { + bzero(&hints, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + if (getaddrinfo(hostent->h_name, NULL, &hints, &ai) == 0) { + hostname = ai->ai_canonname; + for (nai = ai->ai_next; nai!=NULL; nai=nai->ai_next) { + if ((ai->ai_protocol == nai->ai_protocol) && + (ai->ai_addrlen == nai->ai_addrlen) && + (memcmp(ai->ai_addr,nai->ai_addr, + ai->ai_addrlen) != 0) ) { + multiHomed = 1; + } + } + } + } else { + hostname = hostent->h_name; + } + } + + localhost = localHostname (); + + /* + * protect against bogus host names + */ + if (hostname && hostname[0] && (hostname[0] != '.') + && !multiHomed) + { + if (!strcmp (localhost, hostname)) + { + if (!getString (name, 10)) + return 0; + sprintf (name, ":%d", displayNumber); + } + else + { + if (removeDomainname) + { + char *localDot, *remoteDot; + + /* check for a common domain name. This + * could reduce names by recognising common + * super-domain names as well, but I don't think + * this is as useful, and will confuse more + * people + */ + if ((localDot = strchr(localhost, '.')) && + (remoteDot = strchr(hostname, '.'))) + { + /* smash the name in place; it won't + * be needed later. + */ + if (!strcmp (localDot+1, remoteDot+1)) + *remoteDot = '\0'; + } + } + + if (!getString (name, strlen (hostname) + 10)) + return 0; + sprintf (name, "%s:%d", hostname, displayNumber); + } + } + else + { + if (!getString (name, INET6_ADDRSTRLEN + 10)) + return 0; + if (multiHomed) { + if (connectionType == FamilyInternet) { + data = (CARD8 *) + &((struct sockaddr_in *)originalAddress)-> + sin_addr; + } else { + data = (CARD8 *) + &((struct sockaddr_in6 *)originalAddress)->sin6_addr; + } + } + if (inet_ntop(type, data, name, INET6_ADDRSTRLEN) == NULL) { + free(name); + return 0; + } + sprintf(name + strlen(name), ":%d", displayNumber); + } + if (ai) + freeaddrinfo(ai); + return name; + } +#else /* IPv6 */ { CARD8 *data; struct hostent *hostent; @@ -502,6 +687,7 @@ NetworkAddressToName( } return name; } +#endif /* IPv6 */ #ifdef DNET case FamilyDECnet: return NULL; @@ -516,7 +702,8 @@ static void forward_respond ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { ARRAY8 clientAddress; ARRAY8 clientPort; @@ -576,7 +763,31 @@ forward_respond ( client = (struct sockaddr *) &in_addr; clientlen = sizeof (in_addr); all_query_respond (client, clientlen, &authenticationNames, - FORWARD_QUERY); + FORWARD_QUERY, fd); + } + break; +#endif +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + { + struct sockaddr_in6 in6_addr; + + if (clientAddress.length != 16 || + clientPort.length != 2) + { + goto badAddress; + } + bzero ((char *) &in6_addr, sizeof (in6_addr)); +#ifdef SIN6_LEN + in6_addr.sin6_len = sizeof(in6_addr); +#endif + in6_addr.sin6_family = AF_INET6; + memmove(&in6_addr,clientAddress.data,clientAddress.length); + memmove((char *) &in6_addr.sin6_port, clientPort.data, 2); + client = (struct sockaddr *) &in6_addr; + clientlen = sizeof (in6_addr); + all_query_respond (client, clientlen, &authenticationNames, + FORWARD_QUERY, fd); } break; #endif @@ -599,7 +810,7 @@ forward_respond ( clientlen = sizeof (un_addr); #endif all_query_respond (client, clientlen, &authenticationNames, - FORWARD_QUERY); + FORWARD_QUERY, fd); } break; #endif @@ -629,7 +840,8 @@ send_willing ( struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, - ARRAY8Ptr status) + ARRAY8Ptr status, + int fd) { XdmcpHeader header; @@ -647,7 +859,7 @@ send_willing ( XdmcpWriteARRAY8 (&buffer, authenticationName); XdmcpWriteARRAY8 (&buffer, &Hostname); XdmcpWriteARRAY8 (&buffer, status); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) from, fromlen); } static void @@ -655,7 +867,8 @@ send_unwilling ( struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, - ARRAY8Ptr status) + ARRAY8Ptr status, + int fd) { XdmcpHeader header; @@ -671,7 +884,7 @@ send_unwilling ( XdmcpWriteHeader (&buffer, &header); XdmcpWriteARRAY8 (&buffer, &Hostname); XdmcpWriteARRAY8 (&buffer, status); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) from, fromlen); } static unsigned long globalSessionID; @@ -696,7 +909,8 @@ static void request_respond ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { CARD16 displayNumber; ARRAY16 connectionTypes; @@ -821,14 +1035,14 @@ request_respond ( &authenticationName, &authenticationData, &authorizationName, - &authorizationData); + &authorizationData, fd); } else { decline: ; send_decline (from, fromlen, &authenticationName, &authenticationData, - reason); + reason, fd); if (pdpy) DisposeProtoDisplay (pdpy); } @@ -850,7 +1064,8 @@ send_accept ( ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, - ARRAY8Ptr authorizationData) + ARRAY8Ptr authorizationData, + int fd) { XdmcpHeader header; @@ -868,7 +1083,7 @@ send_accept ( XdmcpWriteARRAY8 (&buffer, authenticationData); XdmcpWriteARRAY8 (&buffer, authorizationName); XdmcpWriteARRAY8 (&buffer, authorizationData); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) to, tolen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) to, tolen); } static void @@ -877,7 +1092,8 @@ send_decline ( int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, - ARRAY8Ptr status) + ARRAY8Ptr status, + int fd) { XdmcpHeader header; @@ -892,14 +1108,15 @@ send_decline ( XdmcpWriteARRAY8 (&buffer, status); XdmcpWriteARRAY8 (&buffer, authenticationName); XdmcpWriteARRAY8 (&buffer, authenticationData); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) to, tolen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) to, tolen); } static void manage ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { CARD32 sessionID; CARD16 displayNumber; @@ -949,7 +1166,7 @@ manage ( Debug ("Session ID %ld refused\n", (long) sessionID); if (pdpy) Debug ("Existing Session ID %ld\n", (long) pdpy->sessionID); - send_refuse (from, fromlen, sessionID); + send_refuse (from, fromlen, sessionID, fd); } else { @@ -960,7 +1177,8 @@ manage ( Debug ("Computed display name: %s\n", name); if (!name) { - send_failed (from, fromlen, "(no name)", sessionID, "out of memory"); + send_failed (from, fromlen, "(no name)", sessionID, + "out of memory", fd); goto abort; } d = FindDisplayByName (name); @@ -972,7 +1190,8 @@ manage ( class = malloc (displayClass.length + 1); if (!class) { - send_failed (from, fromlen, name, sessionID, "out of memory"); + send_failed (from, fromlen, name, sessionID, + "out of memory", fd); goto abort; } if (displayClass.length) @@ -988,7 +1207,8 @@ manage ( from_save = (XdmcpNetaddr) malloc (fromlen); if (!from_save) { - send_failed (from, fromlen, name, sessionID, "out of memory"); + send_failed (from, fromlen, name, sessionID, + "out of memory", fd); goto abort; } memmove( from_save, from, fromlen); @@ -996,7 +1216,8 @@ manage ( if (!d) { free ((char *) from_save); - send_failed (from, fromlen, name, sessionID, "out of memory"); + send_failed (from, fromlen, name, sessionID, + "out of memory", fd); goto abort; } d->displayType.location = Foreign; @@ -1008,6 +1229,7 @@ manage ( d->displayNumber = pdpy->displayNumber; ClientAddress (from, &clientAddress, &clientPort, &connectionType); d->useChooser = 0; + d->xdmcpFd = fd; if (IsIndirectClient (&clientAddress, connectionType)) { Debug ("IsIndirectClient\n"); @@ -1028,7 +1250,8 @@ manage ( { free ((char *) from_save); free ((char *) d); - send_failed (from, fromlen, name, sessionID, "out of memory"); + send_failed (from, fromlen, name, sessionID, + "out of memory", fd); goto abort; } d->authorizations[0] = pdpy->fileAuthorization; @@ -1052,7 +1275,8 @@ SendFailed ( char *reason) { Debug ("Display start failed, sending Failed\n"); - send_failed ((struct sockaddr *)(d->from), d->fromlen, d->name, d->sessionID, reason); + send_failed ((struct sockaddr *)(d->from), d->fromlen, d->name, + d->sessionID, reason, d->xdmcpFd); } static void @@ -1061,7 +1285,8 @@ send_failed ( int fromlen, char *name, CARD32 sessionID, - char *reason) + char *reason, + int fd) { static char buf[256]; XdmcpHeader header; @@ -1078,14 +1303,15 @@ send_failed ( XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD32 (&buffer, sessionID); XdmcpWriteARRAY8 (&buffer, &status); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) from, fromlen); } static void send_refuse ( struct sockaddr *from, int fromlen, - CARD32 sessionID) + CARD32 sessionID, + int fd) { XdmcpHeader header; @@ -1095,14 +1321,15 @@ send_refuse ( header.length = 4; XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD32 (&buffer, sessionID); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) from, fromlen); } static void send_alive ( struct sockaddr *from, int fromlen, - int length) + int length, + int fd) { CARD32 sessionID; CARD16 displayNumber; @@ -1136,7 +1363,7 @@ send_alive ( XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD8 (&buffer, sendRunning); XdmcpWriteCARD32 (&buffer, sendSessionID); - XdmcpFlush (xdmcpFd, &buffer, (XdmcpNetaddr) from, fromlen); + XdmcpFlush (fd, &buffer, (XdmcpNetaddr) from, fromlen); } } } @@ -1151,16 +1378,55 @@ NetworkAddressToHostname ( switch (connectionType) { case FamilyInternet: +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: +#endif { struct hostent *hostent = NULL; +#if defined(IPv6) && defined(AF_INET6) + char dotted[INET6_ADDRSTRLEN]; +#else char dotted[20]; +#endif char *local_name = ""; + int af_type; + +#if defined(IPv6) && defined(AF_INET6) + if (connectionType == FamilyInternet6) + af_type = AF_INET6; + else +#endif + af_type = AF_INET; hostent = gethostbyaddr ((char *)connectionAddress->data, - connectionAddress->length, AF_INET); + connectionAddress->length, af_type); if (hostent) { /* check for DNS spoofing */ +#if defined(IPv6) && defined(AF_INET6) + struct addrinfo *ai = NULL, *nai; + if (getaddrinfo(hostent->h_name, NULL, NULL, &ai) == 0) { + for (nai = ai; nai != NULL; nai = nai->ai_next) { + if ((af_type == nai->ai_family) && + (connectionAddress->length == nai->ai_addrlen) && + (memcmp(connectionAddress->data,nai->ai_addr, + nai->ai_addrlen) != 0) ) { + break; + } + } + if (ai == NULL) { + inet_ntop(af_type, connectionAddress->data, + dotted, sizeof(dotted)); + + LogError("Possible DNS spoof attempt %s->%s.", dotted, + hostent->h_name); + hostent = NULL; + } + freeaddrinfo(ai); + } else { + hostent = NULL; + } +#else char *s = strdup(hostent->h_name); /* fscking non-reentrancy of getXXX() */ if ((hostent = gethostbyname(s))) { if (memcmp((char*)connectionAddress->data, hostent->h_addr, @@ -1172,15 +1438,21 @@ NetworkAddressToHostname ( } } free(s); +#endif } if (!hostent) { /* can't get name, so use emergency fallback */ +#if defined(IPv6) && defined(AF_INET6) + inet_ntop(af_type, connectionAddress->data, + dotted, sizeof(dotted)); +#else sprintf(dotted, "%d.%d.%d.%d", connectionAddress->data[0], connectionAddress->data[1], connectionAddress->data[2], connectionAddress->data[3]); +#endif local_name = dotted; LogError ("Cannot convert Internet address %s to host name\n", dotted); -- cgit v1.2.3 From 756fc79c8b5df130b7cf0114d84d13449ec2603a Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Sat, 29 Nov 2003 14:53:33 +0000 Subject: xfree86 merge --- genauth.c | 1 - session.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/genauth.c b/genauth.c index 867ca69..0e50226 100644 --- a/genauth.c +++ b/genauth.c @@ -265,7 +265,6 @@ pmd5_hash (unsigned int *out, unsigned const int in[16]) /* ####################################################################### */ -#if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) static int sumFile (const char *name, int len, int whence, off_t offset) { diff --git a/session.c b/session.c index c7928b2..a0380fb 100644 --- a/session.c +++ b/session.c @@ -97,12 +97,6 @@ extern void endpwent(void); # endif extern char *crypt(CRYPT_ARGS); #endif -#ifdef USE_PAM -pam_handle_t **thepamhp() -{ - static pam_handle_t *pamh = NULL; - return &pamh; -} #ifdef USE_PAM pam_handle_t ** @@ -594,6 +588,7 @@ StartClient ( LogError ("initgroups for \"%s\" failed, errno=%d\n", name, errno); return (0); } +#endif /* QNX4 doesn't support multi-groups, no initgroups() */ #ifdef USE_PAM if (pamh) { pam_error = pam_setcred (pamh, PAM_ESTABLISH_CRED); -- cgit v1.2.3 From a2e62c87947571faa85e6e108e16409d69cc878d Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Sun, 30 Nov 2003 16:47:13 +0000 Subject: xfree86 merge --- auth.c | 9 --------- xdmcp.c | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/auth.c b/auth.c index 678a035..057580a 100644 --- a/auth.c +++ b/auth.c @@ -928,15 +928,6 @@ DefineSelf (int fd, FILE *file, Xauth *auth) #define ifr_size(p) (sizeof (ifr_type)) #endif -/* Handle variable length ifreq in BNR2 and later */ -#ifdef VARIABLE_IFREQ -#define ifr_size(p) (sizeof (struct ifreq) + \ - (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ - p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) -#else -#define ifr_size(p) (sizeof (struct ifreq)) -#endif - /* Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ diff --git a/xdmcp.c b/xdmcp.c index d4a8e8b..dcd28d1 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -1470,7 +1470,7 @@ NetworkAddressToHostname ( break; } return name; - } +} #if 0 static int -- cgit v1.2.3 From 521d8678870697e30e39ca6afda171a230e7b4a6 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Sat, 6 Dec 2003 13:24:29 +0000 Subject: merge XFree86 4.3.99.901 (RC1) from vendor branch --- access.c | 40 +++++++++++++++++++++++++++++---- auth.c | 15 ++++++++++++- chooser.c | 71 +++------------------------------------------------------- config/Xaccess | 17 ++++++++++---- genauth.c | 4 +++- resource.c | 7 ++---- session.c | 3 ++- socket.c | 8 +++++-- util.c | 5 +++-- xdm.man.cpp | 13 ++++++++++- xdmcp.c | 26 ++++++++++++++++----- 11 files changed, 115 insertions(+), 94 deletions(-) diff --git a/access.c b/access.c index 567129e..77b80f6 100644 --- a/access.c +++ b/access.c @@ -1,4 +1,5 @@ /* + * $XdotOrg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * $Xorg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -27,7 +28,7 @@ in this Software without prior written authorization from the copyright holder. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/access.c,v 3.12 2003/07/18 15:53:28 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/access.c,v 3.14 2003/11/23 22:02:07 herrb Exp $ */ /* * Access control for XDMCP - keep a database of allowable display addresses @@ -49,6 +50,10 @@ in this Software without prior written authorization from the copyright holder. # include +# if defined(IPv6) && defined(AF_INET6) +# include +# endif + #define ALIAS_CHARACTER '%' #define NEGATE_CHARACTER '!' #define CHOOSER_STRING "CHOOSER" @@ -330,7 +335,7 @@ tryagain: } #else if (hostent) { - addr = &(hostent->h_addr); + addr = hostent->h_addr; addr_length = hostent->h_length; } #endif @@ -440,9 +445,10 @@ ReadDisplayEntry (FILE *file) #else struct hostent *hostent; - if ((hostent = gethostbyname (displayOrAlias)) == NULL) + if ((hostent = gethostbyname (displayOrAlias)) != NULL) { - addr = &(hostent->h_addr); + Debug("ReadDisplayEntry: %s\n", displayOrAlias); + addr = hostent->h_addr; addrtype = hostent->h_addrtype; addr_length = hostent->h_length; } @@ -906,6 +912,32 @@ void ForEachListenAddr ( } if (!listenFound) { (*listenfunction) (NULL, closure); +#if defined(IPv6) && defined(AF_INET6) && defined(XDM_DEFAULT_MCAST_ADDR6) + { /* Join default IPv6 Multicast Group */ + + static ARRAY8 defaultMcastAddress; + + if (defaultMcastAddress.length == 0) { + struct in6_addr addr6; + + if (inet_pton(AF_INET6,XDM_DEFAULT_MCAST_ADDR6,&addr6) == 1) { + if (!XdmcpAllocARRAY8 (&defaultMcastAddress, + sizeof(struct in6_addr))) { + LogOutOfMem ("ReadHostEntry\n"); + defaultMcastAddress.length = -1; + } else { + memcpy(defaultMcastAddress.data, &addr6, + sizeof(struct in6_addr)); + } + } else { + defaultMcastAddress.length = -1; + } + } + if ( defaultMcastAddress.length == sizeof(struct in6_addr) ) { + (*mcastfunction) (&defaultMcastAddress, closure); + } + } +#endif } } diff --git a/auth.c b/auth.c index 057580a..bce6eb4 100644 --- a/auth.c +++ b/auth.c @@ -1,3 +1,4 @@ +/* $XdotOrg: auth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* $Xorg: auth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -26,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.30 2003/11/16 16:35:02 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.31 2003/12/02 22:55:05 herrb Exp $ */ /* * xdm - display manager daemon @@ -752,6 +753,12 @@ DefineSelf(int fd, FILE *file, Xauth *auth) Debug ("Skipping IPv6 localhost address\n"); continue; } + /* Also skip XDM-AUTHORIZATION-1 */ + if (auth->name_length == 19 && + strcmp(auth->name, "XDM-AUTHORIZATION-1") == 0) { + Debug ("Skipping IPv6 XDM-AUTHORIZATION-1\n"); + continue; + } } #endif writeAddr(family, len, addr, file, auth); @@ -1046,6 +1053,12 @@ DefineSelf (int fd, FILE *file, Xauth *auth) Debug ("Skipping IPv6 localhost address\n"); continue; } + /* Also skip XDM-AUTHORIZATION-1 */ + if (auth->name_length == 19 && + strcmp(auth->name, "XDM-AUTHORIZATION-1") == 0) { + Debug ("Skipping IPv6 XDM-AUTHORIZATION-1\n"); + continue; + } } #endif } diff --git a/chooser.c b/chooser.c index 4d47a12..e5c2457 100644 --- a/chooser.c +++ b/chooser.c @@ -1,4 +1,5 @@ /* + * $XdotOrg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -26,7 +27,7 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/chooser.c,v 3.26 2003/07/18 15:53:28 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/chooser.c,v 3.27 2003/11/23 22:57:31 herrb Exp $ */ /* * Chooser - display a menu of names and let the user select one @@ -130,9 +131,7 @@ in this Software without prior written authorization from The Open Group. # include # include #endif -#ifndef __GNU__ -# include -#endif /* __GNU__ */ +#include #endif /* hpux */ #include @@ -573,8 +572,6 @@ RegisterHostaddr (struct sockaddr *addr, int len, xdmOpCode type) * addresses on the local host. */ -#if !defined(__GNU__) - /* Handle variable length ifreq in BNR2 and later */ #ifdef VARIABLE_IFREQ #define ifr_size(p) (sizeof (struct ifreq) + \ @@ -768,68 +765,6 @@ RegisterHostname (char *name) #endif /* IPv6 */ } } -#else /* __GNU__ */ -static void -RegisterHostname (char *name) -{ - struct hostent *hostent; - struct sockaddr_in in_addr; - - if (!strcmp (name, BROADCAST_HOSTNAME)) - { - in_addr.sin_addr.s_addr= htonl(0xFFFFFFFF); - in_addr.sin_port = htons (XDM_UDP_PORT); - RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), - BROADCAST_QUERY); - } - else - { - - /* address as hex string, e.g., "12180022" (deprecated) */ - if (strlen(name) == 8 && - FromHex(name, (char *)&in_addr.sin_addr, strlen(name)) == 0) - { - in_addr.sin_family = AF_INET; - in_addr.sin_port = htons (XDM_UDP_PORT); - RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), - QUERY); - } else { -#if defined(IPv6) && defined(AF_INET6) - char sport[8]; - struct addrinfo *ai, *nai, hints; - bzero(&hints,sizeof(hints)); - hints.ai_socktype = SOCK_DGRAM; - sprintf(sport, "%d", XDM_UDP_PORT); - if (getaddrinfo(name, sport, &hints, &ai) == 0) { - for (nai = ai ; nai != NULL ; nai = nai->ai_next) { - if ((nai->ai_family == AF_INET) || - (nai->ai_family == AF_INET6)) { - RegisterHostaddr(nai->ai_addr, nai->ai_addrlen, QUERY); - } - } - } -#else - /* Per RFC 1123, check first for IP address in dotted-decimal form */ - else if ((in_addr.sin_addr.s_addr = inet_addr(name)) != -1) - in_addr.sin_family = AF_INET; - else - { - hostent = gethostbyname (name); - if (!hostent) - return; - if (hostent->h_addrtype != AF_INET || hostent->h_length != 4) - return; - in_addr.sin_family = hostent->h_addrtype; - memmove( &in_addr.sin_addr, hostent->h_addr, 4); - } - in_addr.sin_port = htons (XDM_UDP_PORT); - RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr), - QUERY); -#endif - } - - } -} #endif /* __GNU__ */ static ARRAYofARRAY8 AuthenticationNames; diff --git a/config/Xaccess b/config/Xaccess index bc2c6c3..903694c 100644 --- a/config/Xaccess +++ b/config/Xaccess @@ -1,7 +1,6 @@ +# $XdotOrg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # $Xorg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ -# $XFree86: xc/programs/xdm/config/Xaccess,v 1.4 2003/07/09 15:27:40 tsi Exp $ -# -# $XFree86: xc/programs/xdm/config/Xaccess,v 1.3 2001/01/17 23:45:24 dawes Exp $ +# $XFree86: xc/programs/xdm/config/Xaccess,v 1.5 2003/11/22 04:51:03 dawes Exp $ # # Access control file for XDMCP connections # @@ -88,5 +87,15 @@ # all unicast interfaces, but not for multicast packets. If any LISTEN lines # are specified, then only the listed interfaces will be listened on. # +# IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned +# multicast addresses for XDMCP, where X in the prefix may be replaced +# by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local, +# 5 for Site-Local, and so on. The default is equivalent to the example shown +# here using the Link-Local version to most closely match the old IPv4 subnet +# broadcast behavior. +# +# LISTEN * ff02:0:0:0:0:0:0:12b -#LISTEN * ff02::1 +# This example shows listening for multicast on all scopes up to site-local +# +# LISTEN * ff01:0:0:0:0:0:0:12b ff02:0:0:0:0:0:0:12b ff03:0:0:0:0:0:0:12b ff04:0:0:0:0:0:0:12b ff05:0:0:0:0:0:0:12b diff --git a/genauth.c b/genauth.c index 0e50226..20383c9 100644 --- a/genauth.c +++ b/genauth.c @@ -1,3 +1,4 @@ +/* $XdotOrg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* $Xorg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -26,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.20 2003/10/17 20:20:02 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.21 2003/11/26 07:33:10 herrb Exp $ */ /* * xdm - display manager daemon @@ -437,6 +438,7 @@ GenerateAuthData (char *auth, int len) auth[i] |= bit; } } + return 1; #else /* !XDMAUTH */ #ifdef ARC4_RANDOM unsigned int *rnd = (unsigned*)auth; diff --git a/resource.c b/resource.c index 9fb809f..11021cc 100644 --- a/resource.c +++ b/resource.c @@ -1,3 +1,4 @@ +/* $XdotOrg: resource.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* $Xorg: resource.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -130,11 +131,7 @@ int choiceTimeout; /* chooser choice timeout */ #define DEF_ACCESS_FILE "" #endif #ifndef DEF_RANDOM_FILE -# ifdef linux -# define DEF_RANDOM_FILE "/dev/urandom" -# else -# define DEF_RANDOM_FILE "/dev/mem" -# endif +#define DEF_RANDOM_FILE "/dev/mem" #endif #ifndef DEF_PRNGD_SOCKET #define DEF_PRNGD_SOCKET "/tmp/entropy" diff --git a/session.c b/session.c index a0380fb..5ee6da1 100644 --- a/session.c +++ b/session.c @@ -1,3 +1,4 @@ +/* $XdotOrg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */ /* $Xorg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -588,7 +589,7 @@ StartClient ( LogError ("initgroups for \"%s\" failed, errno=%d\n", name, errno); return (0); } -#endif /* QNX4 doesn't support multi-groups, no initgroups() */ +#endif /* QNX4 doesn't support multi-groups, no initgroups() */ #ifdef USE_PAM if (pamh) { pam_error = pam_setcred (pamh, PAM_ESTABLISH_CRED); diff --git a/socket.c b/socket.c index b472bfb..b40a76c 100644 --- a/socket.c +++ b/socket.c @@ -1,3 +1,4 @@ +/* $XdotOrg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* $Xorg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -27,7 +28,7 @@ other dealings in this Software without prior written authorization from the copyright holder. */ -/* $XFree86: xc/programs/xdm/socket.c,v 3.13 2003/07/18 15:39:52 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/socket.c,v 3.14 2003/11/25 22:21:08 herrb Exp $ */ /* * xdm - display manager daemon @@ -430,7 +431,10 @@ UpdateMcastGroup(ARRAY8Ptr addr, void **closure) { struct socklist *s = (struct socklist *) *closure; struct socklist *g; - + + if (s == NULL) + return; + g = FindInList(s->mcastgroups, addr); if (g) { /* Already in the group, mark & continue */ diff --git a/util.c b/util.c index 401d4ae..c7e6725 100644 --- a/util.c +++ b/util.c @@ -1,3 +1,4 @@ +/* $XdotOrg: util.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* $Xorg: util.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* @@ -26,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/util.c,v 3.20 2002/05/31 18:46:10 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/util.c,v 3.21 2003/11/22 04:09:26 dawes Exp $ */ /* * xdm - display manager daemon @@ -55,7 +56,7 @@ from The Open Group. #undef _POSIX_SOURCE #endif #endif -#if defined(__osf__) || defined(linux) || defined(__QNXNTO__) || defined(__GNU__) +#if defined(__osf__) || defined(linux) || defined(__QNXNTO__) || defined(__GLIBC__) #define setpgrp setpgid #endif diff --git a/xdm.man.cpp b/xdm.man.cpp index 9ad586e..21e13c9 100644 --- a/xdm.man.cpp +++ b/xdm.man.cpp @@ -1,3 +1,4 @@ +.\" $XdotOrg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" $Xorg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" @@ -23,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.26 2003/10/24 20:38:15 tsi Exp $ +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.27 2003/11/22 04:51:02 dawes Exp $ .\" .TH XDM 1 __xorgversion__ .SH NAME @@ -806,6 +807,16 @@ LISTEN 10.11.12.13 # Listen only on this interface, as long \& # as no other listen directives appear in \& # file. .fi +.SH "IPv6 MULTICAST ADDRESS SPECIFICATION" +.PP +The Internet Assigned Numbers Authority has has assigned +ff0\fIX\fP:0:0:0:0:0:0:12b as the permanently assigned range of +multicast addresses for XDMCP. The \fIX\fP in the prefix may be replaced +by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local, +5 for Site-Local, and so on. (See IETF RFC 2373 or its replacement for +further details and scope definitions.) xdm defaults to listening on the +Link-Local scope address ff02:0:0:0:0:0:0:12b to most closely match the +old IPv4 subnet broadcast behavior. .SH "LOCAL SERVER SPECIFICATION" .PP The resource \fBDisplayManager.servers\fP gives a server specification diff --git a/xdmcp.c b/xdmcp.c index dcd28d1..5225989 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -1,3 +1,4 @@ +/* $XdotOrg: xdmcp.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* $Xorg: xdmcp.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* @@ -26,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.24 2003/11/16 15:50:38 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.25 2003/11/23 22:36:03 herrb Exp $ */ /* * xdm - display manager daemon @@ -56,9 +57,7 @@ from The Open Group. #endif #endif #include -#if defined(IPv6) && defined(AF_INET6) #include -#endif #include #define Time_t time_t @@ -253,11 +252,28 @@ all_query_respond ( CARD16 connectionType; int family; int length; + const char *addrstring; +#if defined(IPv6) && defined(AF_INET6) + char addrbuf[INET6_ADDRSTRLEN] = ""; +#endif family = ConvertAddr((XdmcpNetaddr) from, &length, (char **)&(addr.data)); addr.length = length; /* convert int to short */ - Debug ("all_query_respond: conntype=%d, addr=%lx, len=%d\n", - family, (unsigned long) *(addr.data), addr.length); + if (debugLevel > 0) { +#if defined(IPv6) && defined(AF_INET6) + void *ipaddr; + if (family == AF_INET6) { + ipaddr = & ((struct sockaddr_in6 *) from)->sin6_addr; + } else { + ipaddr = & ((struct sockaddr_in *) from)->sin_addr; + } + addrstring = inet_ntop(family, ipaddr, addrbuf, sizeof(addrbuf)); +#else + addrstring = inet_ntoa(((struct sockaddr_in *)from)->sin_addr); +#endif + Debug("all_query_respond: conntype=%d, addr=%s, len=%d\n", + family, addrstring, addr.length); + } if (family < 0) return; connectionType = family; -- cgit v1.2.3 From 41bdef7f793b5c073776fbd3b23f6b33d7fdc04f Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Sat, 6 Dec 2003 18:51:45 +0000 Subject: fix bad merge --- chooser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chooser.c b/chooser.c index e5c2457..6e46fbf 100644 --- a/chooser.c +++ b/chooser.c @@ -1,5 +1,5 @@ /* - * $XdotOrg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ + * $XdotOrg: xc/programs/xdm/chooser.c,v 1.1.4.3 2003/12/06 13:24:29 kaleb Exp $ * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -765,7 +765,6 @@ RegisterHostname (char *name) #endif /* IPv6 */ } } -#endif /* __GNU__ */ static ARRAYofARRAY8 AuthenticationNames; -- cgit v1.2.3 From 569af565be9b32a3404c6ace94e13c9140188e05 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Thu, 18 Dec 2003 23:09:32 +0000 Subject: /home/kaleb/xin.commsg --- chooser.c | 15 +++++++-------- greeter/Login.c | 13 ++++++------- greeter/greet.c | 13 ++++++------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/chooser.c b/chooser.c index 6e46fbf..1b39c11 100644 --- a/chooser.c +++ b/chooser.c @@ -1,5 +1,5 @@ /* - * $XdotOrg: xc/programs/xdm/chooser.c,v 1.1.4.3 2003/12/06 13:24:29 kaleb Exp $ + * $XdotOrg: xc/programs/xdm/chooser.c,v 1.1.4.4 2003/12/06 18:51:45 kaleb Exp $ * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -1066,8 +1066,8 @@ main (int argc, char **argv) Dimension width, height; Position x, y; #ifdef USE_XINERAMA - XineramaScreenInfo *screens; - int s_num; + XRectangle *screens; + int s_num; #endif @@ -1099,12 +1099,11 @@ main (int argc, char **argv) XtGetValues (toplevel, position, (Cardinal) 2); #ifdef USE_XINERAMA if ( - XineramaIsActive(XtDisplay(toplevel)) && - (screens = XineramaQueryScreens(XtDisplay(toplevel), &s_num)) != NULL - ) + XineramaActive(XtDisplay(toplevel), XtWindow(toplevel)) && + XineramaGetData(XtDisplay(toplevel), XtWindow(toplevel), &screens, &s_num)) { - x = (Position)(screens[0].x_org + (screens[0].width - width) / 2); - y = (Position)(screens[0].y_org + (screens[0].height - height) / 3); + x = (Position)(screens[0].x + (screens[0].width - width) / 2); + y = (Position)(screens[0].y + (screens[0].height - height) / 3); XFree(screens); } diff --git a/greeter/Login.c b/greeter/Login.c index f8c983b..337316d 100644 --- a/greeter/Login.c +++ b/greeter/Login.c @@ -1025,8 +1025,8 @@ static void Initialize ( Arg position[2]; Position x, y; #ifdef USE_XINERAMA - XineramaScreenInfo *screens; - int s_num; + XRectangle *screens; + int s_num; #endif #ifdef XPM @@ -1167,14 +1167,13 @@ SkipXpmLoad: } #ifdef USE_XINERAMA if ( - XineramaIsActive(XtDisplay(w)) && - (screens = XineramaQueryScreens(XtDisplay(w), &s_num)) != NULL - ) + XineramaActive(XtDisplay(w), XtWindow(w)) && + XineramaGetData(XtDisplay(w), XtWindow(w), &screens, &s_num)) { if ((x = w->core.x) == -1) - x = screens[0].x_org + (int)(screens[0].width - w->core.width) / 2; + x = screens[0].x + (int)(screens[0].width - w->core.width) / 2; if ((y = w->core.y) == -1) - y = screens[0].y_org + (int)(screens[0].height - w->core.height) / 3; + y = screens[0].y + (int)(screens[0].height - w->core.height) / 3; XFree(screens); } diff --git a/greeter/greet.c b/greeter/greet.c index e0b9c06..fd1e9e1 100644 --- a/greeter/greet.c +++ b/greeter/greet.c @@ -181,8 +181,8 @@ InitGreet (struct display *d) static char *argv[] = { "xlogin", 0 }; Display *dpy; #ifdef USE_XINERAMA - XineramaScreenInfo *screens; - int s_num; + XRectangle *screens; + int s_num; #endif Debug ("greet %s\n", d->name); @@ -230,14 +230,13 @@ InitGreet (struct display *d) #ifdef USE_XINERAMA if ( - XineramaIsActive(dpy) && - (screens = XineramaQueryScreens(dpy, &s_num)) != NULL - ) + XineramaActive(dpy, XtWindow(login)) && + XineramaGetData(dpy, XtWindow(login), &screens, &s_num)) { XWarpPointer(dpy, None, XRootWindowOfScreen (scrn), 0, 0, 0, 0, - screens[0].x_org + screens[0].width / 2, - screens[0].y_org + screens[0].height / 2); + screens[0].x + screens[0].width / 2, + screens[0].y + screens[0].height / 2); XFree(screens); } -- cgit v1.2.3 From e883f9913649058f03372789611b15648cffa79d Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Sat, 20 Dec 2003 00:28:31 +0000 Subject: merge XFree86 RC2 (4.3.99.902) from vendor branch --- dm.h | 8 ++------ genauth.c | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dm.h b/dm.h index 483ce20..a784ed4 100644 --- a/dm.h +++ b/dm.h @@ -1,3 +1,4 @@ +/* $XdotOrg: dm.h,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* $Xorg: dm.h,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -26,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.h,v 3.33 2003/11/19 03:57:10 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.34 2003/12/12 03:20:45 dawes Exp $ */ /* * xdm - display manager daemon @@ -510,11 +511,6 @@ extern void ProcessRequestSocket(int fd); #define Jmp_buf sigjmp_buf #endif -#ifndef HAS_SNPRINTF -#include -#define snprintf XmuSnprintf -#endif - typedef SIGVAL (*SIGFUNC)(int); SIGVAL (*Signal(int, SIGFUNC Handler))(int); diff --git a/genauth.c b/genauth.c index 20383c9..247b6c0 100644 --- a/genauth.c +++ b/genauth.c @@ -1,4 +1,4 @@ -/* $XdotOrg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/genauth.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ /* $Xorg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.21 2003/11/26 07:33:10 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.22 2003/12/18 16:38:39 dawes Exp $ */ /* * xdm - display manager daemon @@ -347,7 +347,7 @@ AddPreGetEntropy (void) static void InitXdmcpWrapper (void) { - u_int32_t sum[4]; + uint32_t sum[4]; #ifdef ARC4_RANDOM sum[0] = arc4random(); -- cgit v1.2.3 From 05330aeecedbac7d42f9bbd20d1a653f10b5af23 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Mon, 23 Feb 2004 21:37:45 +0000 Subject: merge most of XFree86 RC3 (4.3.99.903) from vendor branch. bug #214 --- auth.c | 174 +++++++++++++++++++++++++++++++++----------------- config/xdm-config.cpp | 3 +- daemon.c | 143 ++++++++++++++++++----------------------- dm.c | 18 +++--- genauth.c | 30 ++++----- greeter/verify.c | 17 +++-- policy.c | 25 +++++++- session.c | 6 +- xdm.man.cpp | 49 ++++---------- xdmcp.c | 6 +- 10 files changed, 255 insertions(+), 216 deletions(-) diff --git a/auth.c b/auth.c index bce6eb4..99ffd44 100644 --- a/auth.c +++ b/auth.c @@ -1,4 +1,4 @@ -/* $XdotOrg: auth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/auth.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ /* $Xorg: auth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.31 2003/12/02 22:55:05 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.33 2004/01/16 00:03:54 herrb Exp $ */ /* * xdm - display manager daemon @@ -282,7 +282,7 @@ static char authdir1[] = "authdir"; static char authdir2[] = "authfiles"; static int -MakeServerAuthFile (struct display *d) +MakeServerAuthFile (struct display *d, FILE ** file) { int len; #if defined(SYSV) && !defined(SVR4) @@ -292,52 +292,74 @@ MakeServerAuthFile (struct display *d) #endif char cleanname[NAMELEN]; int r; +#ifdef HAS_MKSTEMP + int fd; +#endif struct stat statb; - if (d->clientAuthFile && *d->clientAuthFile) - len = strlen (d->clientAuthFile) + 1; - else - { - CleanUpFileName (d->name, cleanname, NAMELEN - 8); - len = strlen (authDir) + strlen (authdir1) + strlen (authdir2) - + strlen (cleanname) + 14; - } - if (d->authFile) - free (d->authFile); - d->authFile = malloc ((unsigned) len); - if (!d->authFile) - return FALSE; - if (d->clientAuthFile && *d->clientAuthFile) - strcpy (d->authFile, d->clientAuthFile); - else - { - sprintf (d->authFile, "%s/%s", authDir, authdir1); - r = stat(d->authFile, &statb); - if (r == 0) { - if (statb.st_uid != 0) - (void) chown(d->authFile, 0, statb.st_gid); - if ((statb.st_mode & 0077) != 0) - (void) chmod(d->authFile, statb.st_mode & 0700); - } else { - if (errno == ENOENT) - r = mkdir(d->authFile, 0700); - if (r < 0) { + *file = NULL; + + if (!d->authFile) { + if (d->clientAuthFile && *d->clientAuthFile) + len = strlen (d->clientAuthFile) + 1; + else + { + CleanUpFileName (d->name, cleanname, NAMELEN - 8); + len = strlen (authDir) + strlen (authdir1) + strlen (authdir2) + + strlen (cleanname) + 14; + } + d->authFile = malloc (len); + if (!d->authFile) + return FALSE; + if (d->clientAuthFile && *d->clientAuthFile) + strcpy (d->authFile, d->clientAuthFile); + else + { + sprintf (d->authFile, "%s/%s", authDir, authdir1); + r = stat(d->authFile, &statb); + if (r == 0) { + if (statb.st_uid != 0) + (void) chown(d->authFile, 0, statb.st_gid); + if ((statb.st_mode & 0077) != 0) + (void) chmod(d->authFile, statb.st_mode & 0700); + } else { + if (errno == ENOENT) + r = mkdir(d->authFile, 0700); + if (r < 0) { + free (d->authFile); + d->authFile = NULL; + return FALSE; + } + } + sprintf (d->authFile, "%s/%s/%s", authDir, authdir1, authdir2); + r = mkdir(d->authFile, 0700); + if (r < 0 && errno != EEXIST) { free (d->authFile); d->authFile = NULL; return FALSE; } + sprintf (d->authFile, "%s/%s/%s/A%s-XXXXXX", + authDir, authdir1, authdir2, cleanname); +#ifdef HAS_MKSTEMP + fd = mkstemp (d->authFile); + if (fd < 0) { + free (d->authFile); + d->authFile = NULL; + return FALSE; + } + + *file = fdopen(fd, "w"); + if (!*file) + (void) close (fd); + return TRUE; +#else + (void) mktemp (d->authFile); +#endif } - sprintf (d->authFile, "%s/%s/%s", authDir, authdir1, authdir2); - r = mkdir(d->authFile, 0700); - if (r < 0 && errno != EEXIST) { - free (d->authFile); - d->authFile = NULL; - return FALSE; - } - sprintf (d->authFile, "%s/%s/%s/A%s-XXXXXX", - authDir, authdir1, authdir2, cleanname); - (void) mktemp (d->authFile); } + + (void) unlink (d->authFile); + *file = fopen (d->authFile, "w"); return TRUE; } @@ -353,11 +375,10 @@ SaveServerAuthorizations ( int i; mask = umask (0077); - if (!d->authFile && !MakeServerAuthFile (d)) - return FALSE; - (void) unlink (d->authFile); - auth_file = fopen (d->authFile, "w"); + ret = MakeServerAuthFile(d, &auth_file); umask (mask); + if (!ret) + return FALSE; if (!auth_file) { Debug ("Can't creat auth file %s\n", d->authFile); LogError ("Cannot open server authorization file %s\n", d->authFile); @@ -484,7 +505,8 @@ openFiles (char *name, char *new_name, FILE **oldp, FILE **newp) Debug ("can't open new file %s\n", new_name); return 0; } - *oldp = fopen (name, "r"); + if (!*oldp) + *oldp = fopen (name, "r"); Debug ("opens succeeded %s %s\n", name, new_name); return 1; } @@ -1206,7 +1228,7 @@ writeRemoteAuth (FILE *file, Xauth *auth, XdmcpNetaddr peer, int peerlen, char * void SetUserAuthorization (struct display *d, struct verify_info *verify) { - FILE *old, *new; + FILE *old = NULL, *new; char home_name[1024], backup_name[1024], new_name[1024]; char *name = 0; char *home; @@ -1218,6 +1240,9 @@ SetUserAuthorization (struct display *d, struct verify_info *verify) int i; int magicCookie; int data_len; +#ifdef HAS_MKSTEMP + int fd; +#endif Debug ("SetUserAuthorization\n"); auths = d->authorizations; @@ -1230,29 +1255,61 @@ SetUserAuthorization (struct display *d, struct verify_info *verify) lockStatus = XauLockAuth (home_name, 1, 2, 10); Debug ("Lock is %d\n", lockStatus); if (lockStatus == LOCK_SUCCESS) { - if (openFiles (home_name, new_name, &old, &new)) { + if (openFiles (home_name, new_name, &old, &new) + && (old != NULL) && (new != NULL)) { name = home_name; setenv = 0; } else { Debug ("openFiles failed\n"); XauUnlockAuth (home_name); lockStatus = LOCK_ERROR; + if (old != NULL) { + (void) fclose (old); + old = NULL; + } + if (new != NULL) + (void) fclose (new); } } } if (lockStatus != LOCK_SUCCESS) { - snprintf (backup_name, sizeof(backup_name), "%s/.XauthXXXXXX", d->userAuthDir); + snprintf (backup_name, sizeof(backup_name), + "%s/.XauthXXXXXX", d->userAuthDir); +#ifdef HAS_MKSTEMP + fd = mkstemp (backup_name); + if (fd >= 0) { + old = fdopen (fd, "r"); + if (old == NULL) + (void) close(fd); + } + + if (old != NULL) +#else (void) mktemp (backup_name); - lockStatus = XauLockAuth (backup_name, 1, 2, 10); - Debug ("backup lock is %d\n", lockStatus); - if (lockStatus == LOCK_SUCCESS) { - if (openFiles (backup_name, new_name, &old, &new)) { - name = backup_name; - setenv = 1; +#endif + { + lockStatus = XauLockAuth (backup_name, 1, 2, 10); + Debug ("backup lock is %d\n", lockStatus); + if (lockStatus == LOCK_SUCCESS) { + if (openFiles (backup_name, new_name, &old, &new) + && (old != NULL) && (new != NULL)) { + name = backup_name; + setenv = 1; + } else { + XauUnlockAuth (backup_name); + lockStatus = LOCK_ERROR; + if (old != NULL) { + (void) fclose (old); + old = NULL; + } + if (new != NULL) + (void) fclose (new); + } +#ifdef HAS_MKSTEMP } else { - XauUnlockAuth (backup_name); - lockStatus = LOCK_ERROR; - } + (void) fclose (old); +#endif + } } } if (lockStatus != LOCK_SUCCESS) { @@ -1371,6 +1428,7 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify) Debug ("Lock is %d\n", lockStatus); if (lockStatus != LOCK_SUCCESS) return; + old = NULL; if (openFiles (name, new_name, &old, &new)) { initAddrs (); diff --git a/config/xdm-config.cpp b/config/xdm-config.cpp index b83ccb7..7ba9a5b 100644 --- a/config/xdm-config.cpp +++ b/config/xdm-config.cpp @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.10 2002/11/30 19:11:32 herrb Exp $ +! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.11 2004/01/09 00:25:25 dawes Exp $ ! DisplayManager.errorLogFile: XDMLOGDIR/xdm.log DisplayManager.pidFile: XDMPIDDIR/xdm.pid @@ -20,6 +20,7 @@ DisplayManager._0.setup: XDMDIR/Xsetup_0 DisplayManager._0.startup: XDMDIR/GiveConsole DisplayManager._0.reset: XDMDIR/TakeConsole ! +DisplayManager*chooser: CHOOSERPATH DisplayManager*resources: XDMDIR/Xresources DisplayManager*session: XDMDIR/Xsession DisplayManager*authComplain: true diff --git a/daemon.c b/daemon.c index 8bfa0de..902cf8e 100644 --- a/daemon.c +++ b/daemon.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/daemon.c,v 3.20 2002/12/04 16:53:39 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/daemon.c,v 3.22 2004/01/11 00:19:30 dawes Exp $ */ /* * xdm - display manager daemon @@ -39,16 +39,8 @@ from The Open Group. #include #include -#ifndef __GLIBC__ -# if defined(__osf__) || \ - defined(__GNU__) || \ - defined(__CYGWIN__) || \ - defined(linux) -# define setpgrp setpgid -# endif -#endif -#if defined(SVR4) || defined(USG) || defined(__GLIBC__) +#if defined(USG) # include #else # include @@ -66,101 +58,88 @@ from The Open Group. #include "dm.h" #include "dm_error.h" -void -BecomeOrphan (void) -{ - Pid_t child_id; +#if defined(__GLIBC__) || defined(CSRG_BASED) +#define HAS_DAEMON +#endif - /* - * fork so that the process goes into the background automatically. Also - * has a nice side effect of having the child process get inherited by - * init (pid 1). - * Separate the child into its own process group before the parent - * exits. This eliminates the possibility that the child might get - * killed when the init script that's running xdm exits. - */ +#ifndef X_NOT_POSIX +#define HAS_SETSID +#endif - child_id = fork (); - switch (child_id) { - case 0: - /* child */ - break; - case -1: - /* error */ - LogError ("daemon fork failed, errno = %d\n", errno); - break; - - default: { - /* parent */ - -#if defined(CSRG_BASED) || defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) || defined(__GLIBC__) -#if defined(SVR4) || defined(__QNXNTO__) - /* This gets error EPERM. Why? */ - int stat = setpgid(child_id, child_id); -#elif defined(SYSV) - /* don't know how to set child's process group */ - int stat = 0; -#elif defined(__GLIBC__) - int stat = setpgrp (); -#else - int stat = setpgrp (child_id, child_id); +#ifndef HAS_SETSID +#define setsid() MySetsid() + +static Pid_t +MySetsid(void) +{ +#if defined(TIOCNOTTY) || defined(TCCLRCTTY) || defined(TIOCTTY) + int fd; +#endif + int stat; + + fd = open("/dev/tty", O_RDWR); + if (fd >= 0) { +#if defined(USG) && defined(TCCLRCTTY) + int zero = 0; + (void) ioctl (fd, TCCLRCTTY, &zero); +#elif (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) + int zero = 0; + (void) ioctl (i, TIOCTTY, &zero); +#elif defined(TIOCNOTTY) + (void) ioctl (i, TIOCNOTTY, (char *) 0); /* detach, BSD style */ #endif - if (stat != 0) - LogError ("setting process group for daemon failed: %s\n", - strerror(errno)); -#endif /* ! (CSRG_BASED || SYSV || SVR4 || __QNXNTO__ || __GLIBC__) */ - } - exit (0); + close(fd); } + +#if defined(SYSV) || defined(__QNXNTO__) + return setpgrp(); +#else + return setpgid(0, getpid()); +#endif } +#endif /* !HAS_SETSID */ +/* detach */ void BecomeDaemon (void) { - /* - * Close standard file descriptors and get rid of controlling tty - */ /* If our C library has the daemon() function, just use it. */ -#if defined(__GLIBC__) || defined(CSRG_BASED) +#ifdef HAS_DAEMON daemon (0, 0); #else - int i; + switch (fork()) { + case -1: + /* error */ + LogError("daemon fork failed, %s\n", strerror(errno)); + exit(1); + break; + case 0: + /* child */ + break; + default: + /* parent */ + exit(0); + } + + if (setsid() == -1) { + LogError("setting session id for daemon failed: %s\n", + strerror(errno)); + exit(1); + } -# if defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) - setpgrp (); -# else - setpgrp (0, getpid ()); -# endif + chdir("/"); close (0); close (1); close (2); -# if !defined(__UNIXOS2__) && !defined(__CYGWIN__) -# if !((defined(SYSV) || defined(SVR4)) && defined(i386)) - if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ -# if defined(USG) && defined(TCCLRCTTY) - int zero = 0; - (void) ioctl (i, TCCLRCTTY, &zero); -# else -# if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) - int zero = 0; - (void) ioctl (i, TIOCTTY, &zero); -# else - (void) ioctl (i, TIOCNOTTY, (char *) 0); /* detach, BSD style */ -# endif -# endif - (void) close (i); - } -# endif /* !((SYSV || SVR4) && i386) */ -# endif /* !__UNIXOS2__ && !__CYGWIN__*/ /* * Set up the standard file descriptors. */ - (void) open ("/", O_RDONLY); /* root inode already in core */ + (void) open ("/dev/null", O_RDWR); (void) dup2 (0, 1); (void) dup2 (0, 2); -#endif +#endif /* HAS_DAEMON */ } diff --git a/dm.c b/dm.c index c953b98..8f78ca8 100644 --- a/dm.c +++ b/dm.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.c,v 3.23 2003/09/17 05:48:32 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.24 2004/01/10 21:26:29 herrb Exp $ */ /* * xdm - display manager daemon @@ -133,11 +133,9 @@ main (int argc, char **argv) exit (1); } if (debugLevel == 0 && daemonMode) - BecomeOrphan (); + BecomeDaemon (); if (debugLevel >= 10) nofork_session = 1; - if (debugLevel == 0 && daemonMode) - BecomeDaemon (); /* SUPPRESS 560 */ if ((oldpid = StorePid ())) { @@ -478,12 +476,6 @@ WaitForChild (void) else RestartDisplay (d, FALSE); break; - default: - Debug ("Display exited with unknown status %d\n", waitVal(status)); - LogError ("Unknown session exit code %d from process %d\n", - waitVal (status), pid); - StopDisplay (d); - break; case OPENFAILED_DISPLAY: Debug ("Display exited with OPENFAILED_DISPLAY, try %d of %d\n", d->startTries, d->startAttempts); @@ -556,6 +548,12 @@ WaitForChild (void) else RestartDisplay (d, FALSE); break; + default: + Debug ("Display exited with unknown status %d\n", waitVal(status)); + LogError ("Unknown session exit code %d from process %d\n", + waitVal (status), pid); + StopDisplay (d); + break; } } /* SUPPRESS 560 */ diff --git a/genauth.c b/genauth.c index 247b6c0..bb42250 100644 --- a/genauth.c +++ b/genauth.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/xdm/genauth.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ +/* $XdotOrg: xc/programs/xdm/genauth.c,v 1.1.4.5 2003/12/20 00:28:31 kaleb Exp $ */ /* $Xorg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.22 2003/12/18 16:38:39 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.24 2003/12/21 15:07:06 herrb Exp $ */ /* * xdm - display manager daemon @@ -127,15 +127,15 @@ pollRandomDevice (int fd) * DAMAGE. */ -static unsigned int epool[32], erotate, eadd_ptr; +static CARD32 epool[32], erotate, eadd_ptr; static void -add_entropy (unsigned const int *in, int nwords) +add_entropy (const CARD32 *in, int nwords) { - static unsigned const int twist_table[8] = { + static const CARD32 twist_table[8] = { 0, 0x3b6e20c8, 0x76dc4190, 0x4db26158, 0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 }; - unsigned i, w; + CARD32 i, w; int new_rotate; while (nwords--) { @@ -180,9 +180,9 @@ add_entropy (unsigned const int *in, int nwords) * reflect the addition of 16 longwords of new data. */ static void -pmd5_hash (unsigned int *out, unsigned const int in[16]) +pmd5_hash (CARD32 *out, const CARD32 in[16]) { - unsigned int a, b, c, d; + CARD32 a, b, c, d; a = out[0]; b = out[1]; @@ -287,7 +287,7 @@ sumFile (const char *name, int len, int whence, off_t offset) return -1; } readlen += cnt; - add_entropy((unsigned*)buf, (cnt + 3) / 4); + add_entropy((CARD32 *)buf, (cnt + 3) / 4); } close (fd); Debug("read %d bytes from entropy source \"%s\"\n", readlen, name); @@ -299,7 +299,7 @@ AddTimerEntropy (void) { struct timeval now; X_GETTIMEOFDAY (&now); - add_entropy((unsigned*)&now, sizeof(now)/sizeof(unsigned)); + add_entropy((CARD32 *)&now, sizeof(now)/sizeof(CARD32)); } #define BSIZ 0x10000 @@ -319,8 +319,8 @@ AddOtherEntropy (void) void AddPreGetEntropy (void) { - static long offset; - long readlen; + static off_t offset; + off_t readlen; AddTimerEntropy(); if ((readlen = sumFile (randomFile, BSIZ, SEEK_SET, offset)) == BSIZ) { @@ -347,7 +347,7 @@ AddPreGetEntropy (void) static void InitXdmcpWrapper (void) { - uint32_t sum[4]; + CARD32 sum[4]; #ifdef ARC4_RANDOM sum[0] = arc4random(); @@ -441,14 +441,14 @@ GenerateAuthData (char *auth, int len) return 1; #else /* !XDMAUTH */ #ifdef ARC4_RANDOM - unsigned int *rnd = (unsigned*)auth; + CARD32 *rnd = (CARD32 *)auth; int i; for (i = 0; i < len; i += 4) rnd[i / 4] = arc4random(); return 1; #else /* !ARC4_RANDOM */ - unsigned tmp[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; + CARD32 tmp[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; #ifdef DEV_RANDOM int fd; diff --git a/greeter/verify.c b/greeter/verify.c index 0fcb320..d12806c 100644 --- a/greeter/verify.c +++ b/greeter/verify.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.26 2003/11/19 04:44:00 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.27 2004/01/25 01:12:25 dawes Exp $ */ /* * xdm - display manager daemon @@ -41,14 +41,17 @@ from The Open Group. #include "dm_error.h" #include -#ifdef USE_PAM + +#if defined(USE_PAM) # include # include -#else -# ifdef USESHADOW -# include -# include -# endif +#elif defined(USESHADOW) +# include +# include +#elif defined(USE_BSDAUTH) +# include +# include +# include #endif # include "greet.h" diff --git a/policy.c b/policy.c index 29982cb..48097c5 100644 --- a/policy.c +++ b/policy.c @@ -33,7 +33,7 @@ from The Open Group. * * policy.c. Implement site-dependent policy for XDMCP connections */ -/* $XFree86: xc/programs/xdm/policy.c,v 3.8 2002/12/07 20:31:04 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/policy.c,v 3.9 2004/01/01 17:12:34 herrb Exp $ */ # include "dm.h" # include "dm_auth.h" @@ -179,7 +179,28 @@ SelectConnectionTypeIndex ( ARRAY16Ptr connectionTypes, ARRAYofARRAY8Ptr connectionAddresses) { - return 0; + int i; + + /* + * Select one supported connection type + */ + + for (i = 0; i < connectionTypes->length; i++) { + switch (connectionTypes->data[i]) { + case FamilyLocal: +#if defined(TCPCONN) + case FamilyInternet: +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: +#endif /* IPv6 */ +#endif /* TCPCONN */ +#if defined(DNETCONN) + case FamilyDECnet: +#endif /* DNETCONN */ + return i; + } + } /* for */ + return -1; } #endif /* XDMCP */ diff --git a/session.c b/session.c index 5ee6da1..0747ab6 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $XdotOrg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/session.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ /* $Xorg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/session.c,v 3.36 2003/09/29 21:00:08 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/session.c,v 3.37 2004/01/07 04:28:06 dawes Exp $ */ /* * xdm - display manager daemon @@ -88,7 +88,7 @@ extern struct spwd *getspnam(GETSPNAM_ARGS); extern void endspent(void); # endif #endif -#if defined(CSRG_BASED) || defined(__GLIBC__) +#if defined(CSRG_BASED) || defined(__GLIBC__) || defined(USL) # include # include #else diff --git a/xdm.man.cpp b/xdm.man.cpp index 21e13c9..47f1c9f 100644 --- a/xdm.man.cpp +++ b/xdm.man.cpp @@ -1,4 +1,4 @@ -.\" $XdotOrg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ +.\" $XdotOrg: xc/programs/xdm/xdm.man,v 1.1.4.3 2003/12/06 13:24:29 kaleb Exp $ .\" $Xorg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" @@ -24,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.27 2003/11/22 04:51:02 dawes Exp $ +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.29 2004/01/12 21:43:19 herrb Exp $ .\" .TH XDM 1 __xorgversion__ .SH NAME @@ -93,13 +93,6 @@ by .I chooser or X terminals themselves. .PP -.I Xdm -can be configured to ignore BroadcastQuery messages from selected hosts. -This is useful when you don't want the host to appear in menus produced -by -.I chooser -or X terminals themselves. -.PP Because .I xdm provides the first interface that users will see, it is designed to be @@ -418,7 +411,7 @@ is the conventional name. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.chooser\fP" Specifies the program run to offer a host menu for Indirect queries redirected to the special host name CHOOSER. -\fI __projectroot__/lib/X11/xdm/chooser\fP is the default. +\fI CHOOSERPATH \fP is the default. See the sections \fBXDMCP Access Control\fP and \fBChooser\fP. .IP "\fBDisplayManager.\fP\fIDISPLAY\fP\fB.xrdb\fP" Specifies the program used to load the resources. By default, @@ -661,11 +654,6 @@ it can be followed by the optional ``NOBROADCAST'' keyword. This can be used to prevent an xdm server from appearing on menus based on Broadcast queries. .PP -To only respond to Direct queries for a host or pattern, -it can be followed by the optional ``NOBROADCAST'' keyword. -This can be used to prevent an xdm server from appearing on -menus based on Broadcast queries. -.PP An Indirect entry also contains a host name or pattern, but follows it with a list of host names or macros to which indirect queries should be sent. @@ -922,15 +910,6 @@ the following environment variables are passed: SHELL the value of \fBDisplayManager.\fP\fIDISPLAY\fP\fB.systemShell\fP XAUTHORITY may be set to an authority file .fi -.IP "\fBxlogin.Login.allowRootLogin\fP" -If set to ``false'', don't allow root (and any other user with uid = 0) to -log in directly. -The default is ``true''. -.IP "\fBxlogin.Login.allowNullPasswd\fP" -If set to ``true'', allow an otherwise failing password match to succeed -if the account does not require a password at all. -The default is ``false'', so only users that have passwords assigned can -log in. .PP Note that since \fIxdm\fP grabs the keyboard, any other windows will not be able to receive keyboard input. They will be able to interact with @@ -999,6 +978,15 @@ The color used to display the failure message. .IP "\fBxlogin.Login.failTimeout\fP" The number of seconds that the failure message is displayed. The default is 30. +.IP "\fBxlogin.Login.allowRootLogin\fP" +If set to ``false'', don't allow root (and any other user with uid = 0) to +log in directly. +The default is ``true''. +.IP "\fBxlogin.Login.allowNullPasswd\fP" +If set to ``true'', allow an otherwise failing password match to succeed +if the account does not require a password at all. +The default is ``false'', so only users that have passwords assigned can +log in. .IP "\fBxlogin.Login.translations\fP" This specifies the translations used for the login widget. Refer to the X Toolkit documentation for a complete discussion on translations. The default @@ -1023,15 +1011,6 @@ translation table is: : insert-char() \\ .fi -.IP "\fBxlogin.Login.allowRootLogin\fP" -If set to ``false'', don't allow root (and any other user with uid = 0) to -log in directly. -The default is ``true''. -.IP "\fBxlogin.Login.allowNullPasswd\fP" -If set to ``true'', allow an otherwise failing password match to succeed -if the account does not require a password at all. -The default is ``false'', so only users that have passwords assigned can -log in. .PP The actions which are supported by the widget are: .IP "delete-previous-character" @@ -1352,7 +1331,7 @@ This directs to manage sessions on all three of these terminals. See the section \fBControlling Xdm\fP for a description of using signals to enable and disable these terminals in a manner reminiscent of -.IR init (8). +.IR init (__adminmansuffix__). .SH LIMITATIONS One thing that .I xdm @@ -1368,7 +1347,7 @@ the default configuration file .I $HOME/.Xauthority user authorization file where \fIxdm\fP stores keys for clients to read .TP 20 -.I __projectroot__/lib/X11/xdm/chooser +.I CHOOSERPATH the default chooser .TP 20 .I __projectroot__/bin/xrdb diff --git a/xdmcp.c b/xdmcp.c index 5225989..d0498c7 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xdmcp.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/xdmcp.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ /* $Xorg: xdmcp.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.25 2003/11/23 22:36:03 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.26 2004/01/07 04:28:06 dawes Exp $ */ /* * xdm - display manager daemon @@ -417,7 +417,7 @@ WaitForSomething (void) { #ifdef STREAMSCONN if (xdmcpFd >= 0 && FD_ISSET (xdmcpFd, &reads)) - ProcessRequestSocket (); + ProcessRequestSocket (xdmcpFd); #endif if (chooserFd >= 0 && FD_ISSET (chooserFd, &reads)) { -- cgit v1.2.3 From be98669d74b588aacf946cbf1c2d09421796d260 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Wed, 25 Feb 2004 21:47:13 +0000 Subject: bug #230 Revert to Xinerama 1.1 In order to make a "quick" release it has been decided that the priority is to preserve the server's internal API/ABI so that third-party drivers that depend on symbols like noPanoramiXExtension, etc., would not need to be recompiled. Too bad gcc on Linux doesn't support ELF's weak symbols as that would have been a reasonable solution for preserving the ABI. N.B.: While symbols, i.e. functions and variables revert to the old name, I did not revert build names, i.e. -DXINERAMA, to the old -DPANORAMIX. There was no need, and it's just a build issue that has no impact on the binary output of the build. --- chooser.c | 13 +++++++------ greeter/Login.c | 13 +++++++------ greeter/greet.c | 13 +++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/chooser.c b/chooser.c index 1b39c11..7db2de4 100644 --- a/chooser.c +++ b/chooser.c @@ -1066,8 +1066,8 @@ main (int argc, char **argv) Dimension width, height; Position x, y; #ifdef USE_XINERAMA - XRectangle *screens; - int s_num; + XineramaScreenInfo *screens; + int s_num; #endif @@ -1099,11 +1099,12 @@ main (int argc, char **argv) XtGetValues (toplevel, position, (Cardinal) 2); #ifdef USE_XINERAMA if ( - XineramaActive(XtDisplay(toplevel), XtWindow(toplevel)) && - XineramaGetData(XtDisplay(toplevel), XtWindow(toplevel), &screens, &s_num)) + XineramaIsActive(XtDisplay(toplevel)) && + (screens = XineramaQueryScreens(XtDisplay(toplevel), &s_num)) != NULL + ) { - x = (Position)(screens[0].x + (screens[0].width - width) / 2); - y = (Position)(screens[0].y + (screens[0].height - height) / 3); + x = (Position)(screens[0].x_org + (screens[0].width - width) / 2); + y = (Position)(screens[0].y_org + (screens[0].height - height) / 3); XFree(screens); } diff --git a/greeter/Login.c b/greeter/Login.c index 337316d..f8c983b 100644 --- a/greeter/Login.c +++ b/greeter/Login.c @@ -1025,8 +1025,8 @@ static void Initialize ( Arg position[2]; Position x, y; #ifdef USE_XINERAMA - XRectangle *screens; - int s_num; + XineramaScreenInfo *screens; + int s_num; #endif #ifdef XPM @@ -1167,13 +1167,14 @@ SkipXpmLoad: } #ifdef USE_XINERAMA if ( - XineramaActive(XtDisplay(w), XtWindow(w)) && - XineramaGetData(XtDisplay(w), XtWindow(w), &screens, &s_num)) + XineramaIsActive(XtDisplay(w)) && + (screens = XineramaQueryScreens(XtDisplay(w), &s_num)) != NULL + ) { if ((x = w->core.x) == -1) - x = screens[0].x + (int)(screens[0].width - w->core.width) / 2; + x = screens[0].x_org + (int)(screens[0].width - w->core.width) / 2; if ((y = w->core.y) == -1) - y = screens[0].y + (int)(screens[0].height - w->core.height) / 3; + y = screens[0].y_org + (int)(screens[0].height - w->core.height) / 3; XFree(screens); } diff --git a/greeter/greet.c b/greeter/greet.c index fd1e9e1..e0b9c06 100644 --- a/greeter/greet.c +++ b/greeter/greet.c @@ -181,8 +181,8 @@ InitGreet (struct display *d) static char *argv[] = { "xlogin", 0 }; Display *dpy; #ifdef USE_XINERAMA - XRectangle *screens; - int s_num; + XineramaScreenInfo *screens; + int s_num; #endif Debug ("greet %s\n", d->name); @@ -230,13 +230,14 @@ InitGreet (struct display *d) #ifdef USE_XINERAMA if ( - XineramaActive(dpy, XtWindow(login)) && - XineramaGetData(dpy, XtWindow(login), &screens, &s_num)) + XineramaIsActive(dpy) && + (screens = XineramaQueryScreens(dpy, &s_num)) != NULL + ) { XWarpPointer(dpy, None, XRootWindowOfScreen (scrn), 0, 0, 0, 0, - screens[0].x + screens[0].width / 2, - screens[0].y + screens[0].height / 2); + screens[0].x_org + screens[0].width / 2, + screens[0].y_org + screens[0].height / 2); XFree(screens); } -- cgit v1.2.3 From 4e28ae75ceb86e2e3b51125808cbeadc3dcaeb79 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Fri, 5 Mar 2004 13:41:21 +0000 Subject: 23. Merged with XFree86 4.4.0. Added changes that went into infected files. Reverted darwin/bundle/**/Credits.rtf to XFree86 versions to avoid future conflicts on ASCII but not humal readable files. (There should probably be separate CreditsXorg.rtf files) (Egbert Eich). --- Chooser.ad | 2 +- access.c | 2 +- auth.c | 2 +- choose.c | 2 +- chooser.c | 2 +- config/Xaccess | 2 +- config/Xresources.cpp | 2 +- config/Xwilling | 2 +- config/xdm-config.cpp | 2 +- daemon.c | 2 +- dm.c | 2 +- dm.h | 2 +- dm_auth.h | 2 +- dm_error.h | 2 +- dm_socket.h | 2 +- dpylist.c | 2 +- error.c | 2 +- file.c | 2 +- genauth.c | 2 +- greet.h | 2 +- greeter/Login.c | 2 +- greeter/Login.h | 2 +- greeter/LoginP.h | 2 +- greeter/greet.c | 2 +- greeter/verify.c | 2 +- krb5auth.c | 2 +- mitauth.c | 2 +- netaddr.c | 2 +- policy.c | 2 +- prngc.c | 2 +- protodpy.c | 2 +- reset.c | 2 +- resource.c | 2 +- rpcauth.c | 2 +- server.c | 2 +- session.c | 2 +- socket.c | 2 +- streams.c | 2 +- util.c | 2 +- xdm.man.cpp | 2 +- xdmauth.c | 2 +- xdmcp.c | 2 +- xdmshell.c | 2 +- 43 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Chooser.ad b/Chooser.ad index 66dcf7f..1970c22 100644 --- a/Chooser.ad +++ b/Chooser.ad @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xdm/Chooser.ad,v 1.2 2001/04/06 02:16:25 dawes Exp $ +! $XFree86$ ! *ShapeStyle: Oval *cursor: left_ptr diff --git a/access.c b/access.c index 77b80f6..beffb81 100644 --- a/access.c +++ b/access.c @@ -28,7 +28,7 @@ in this Software without prior written authorization from the copyright holder. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/access.c,v 3.14 2003/11/23 22:02:07 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/access.c,v 3.13 2003/11/22 04:51:02 dawes Exp $ */ /* * Access control for XDMCP - keep a database of allowable display addresses diff --git a/auth.c b/auth.c index 99ffd44..22a7ba1 100644 --- a/auth.c +++ b/auth.c @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.33 2004/01/16 00:03:54 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.32 2003/12/22 17:48:12 tsi Exp $ */ /* * xdm - display manager daemon diff --git a/choose.c b/choose.c index 24bc596..1678787 100644 --- a/choose.c +++ b/choose.c @@ -26,7 +26,7 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/choose.c,v 3.17 2003/07/09 15:27:38 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/choose.c,v 3.16tsi Exp $ */ /* * choose.c diff --git a/chooser.c b/chooser.c index 7db2de4..23a4a07 100644 --- a/chooser.c +++ b/chooser.c @@ -27,7 +27,7 @@ in this Software without prior written authorization from The Open Group. * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/chooser.c,v 3.27 2003/11/23 22:57:31 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/chooser.c,v 3.26 2003/07/18 15:53:28 tsi Exp $ */ /* * Chooser - display a menu of names and let the user select one diff --git a/config/Xaccess b/config/Xaccess index 903694c..580409c 100644 --- a/config/Xaccess +++ b/config/Xaccess @@ -1,6 +1,6 @@ # $XdotOrg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # $Xorg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ -# $XFree86: xc/programs/xdm/config/Xaccess,v 1.5 2003/11/22 04:51:03 dawes Exp $ +# $XFree86: xc/programs/xdm/config/Xaccess,v 1.4 2003/07/09 15:27:40 tsi Exp $ # # Access control file for XDMCP connections # diff --git a/config/Xresources.cpp b/config/Xresources.cpp index 46d2cf0..b666c58 100644 --- a/config/Xresources.cpp +++ b/config/Xresources.cpp @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.7 2003/11/15 03:25:22 dawes Exp $ +! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.6 2003/01/04 03:11:31 dawes Exp $ ! #define BS \ /* cpp can be trickier than m4 */ #define NLBS \n\ /* don't remove these comments */ diff --git a/config/Xwilling b/config/Xwilling index cd92a3d..c886df2 100644 --- a/config/Xwilling +++ b/config/Xwilling @@ -1,6 +1,6 @@ #!/bin/sh # -# $XFree86: xc/programs/xdm/config/Xwilling,v 1.1 1998/12/06 06:08:51 dawes Exp $ +# $XFree86$ # The output of this script is displayed in the chooser window. # (instead of "Willing to manage") diff --git a/config/xdm-config.cpp b/config/xdm-config.cpp index 7ba9a5b..1ccba8a 100644 --- a/config/xdm-config.cpp +++ b/config/xdm-config.cpp @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.11 2004/01/09 00:25:25 dawes Exp $ +! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.10 2002/11/30 19:11:32 herrb Exp $ ! DisplayManager.errorLogFile: XDMLOGDIR/xdm.log DisplayManager.pidFile: XDMPIDDIR/xdm.pid diff --git a/daemon.c b/daemon.c index 902cf8e..5071a75 100644 --- a/daemon.c +++ b/daemon.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/daemon.c,v 3.22 2004/01/11 00:19:30 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/daemon.c,v 3.21 2004/01/10 21:26:29 herrb Exp $ */ /* * xdm - display manager daemon diff --git a/dm.c b/dm.c index 8f78ca8..6f41dc4 100644 --- a/dm.c +++ b/dm.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.c,v 3.24 2004/01/10 21:26:29 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.23 2003/09/17 05:48:32 herrb Exp $ */ /* * xdm - display manager daemon diff --git a/dm.h b/dm.h index a784ed4..96d35f3 100644 --- a/dm.h +++ b/dm.h @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.h,v 3.34 2003/12/12 03:20:45 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.33 2003/11/19 03:57:10 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/dm_auth.h b/dm_auth.h index abbe93d..ea578ae 100644 --- a/dm_auth.h +++ b/dm_auth.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xdm/dm_auth.h,v 1.4 2003/10/27 21:39:06 herrb Exp $ + * $XFree86: xc/programs/xdm/dm_auth.h,v 1.3 2003/09/17 05:48:32 herrb Exp $ */ /************************************************************ diff --git a/dm_error.h b/dm_error.h index 03aa228..102daa3 100644 --- a/dm_error.h +++ b/dm_error.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xdm/dm_error.h,v 1.1 1998/10/10 15:25:33 dawes Exp $ + * $XFree86$ */ /************************************************************ diff --git a/dm_socket.h b/dm_socket.h index 470cdd4..c2e131b 100644 --- a/dm_socket.h +++ b/dm_socket.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xdm/dm_socket.h,v 1.2 2001/07/23 13:15:52 dawes Exp $ + * $XFree86: xc/programs/xdm/dm_socket.h,v 1.1 1998/10/10 15:25:33 dawes Exp $ */ /************************************************************ diff --git a/dpylist.c b/dpylist.c index 3b749a1..437cfce 100644 --- a/dpylist.c +++ b/dpylist.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/dpylist.c,v 1.6 2003/07/09 15:27:38 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/dpylist.c,v 1.5tsi Exp $ */ /* * xdm - display manager daemon diff --git a/error.c b/error.c index 6c53ec6..49cbd8e 100644 --- a/error.c +++ b/error.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/error.c,v 1.7 2002/10/09 16:38:20 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/error.c,v 1.6tsi Exp $ */ /* * xdm - display manager daemon diff --git a/file.c b/file.c index 49b2217..a15239f 100644 --- a/file.c +++ b/file.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/file.c,v 1.6 2001/12/14 20:01:21 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/file.c,v 1.5 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/genauth.c b/genauth.c index bb42250..0b54b8d 100644 --- a/genauth.c +++ b/genauth.c @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.24 2003/12/21 15:07:06 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.23 2003/12/20 19:45:12 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/greet.h b/greet.h index 238d587..ca0d882 100644 --- a/greet.h +++ b/greet.h @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greet.h,v 1.10 2003/09/21 13:03:03 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/greet.h,v 1.9 2003/07/09 15:27:38 tsi Exp $ */ /* * greet.h - interface to xdm's dynamically-loadable modular greeter diff --git a/greeter/Login.c b/greeter/Login.c index f8c983b..4324666 100644 --- a/greeter/Login.c +++ b/greeter/Login.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.18 2003/07/09 15:27:40 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.17tsi Exp $ */ /* * xdm - display manager daemon diff --git a/greeter/Login.h b/greeter/Login.h index ecbb5d5..3da7fb2 100644 --- a/greeter/Login.h +++ b/greeter/Login.h @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.8 2003/11/19 04:44:00 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.7 2002/10/06 20:42:16 herrb Exp $ */ /* * xdm - display manager daemon diff --git a/greeter/LoginP.h b/greeter/LoginP.h index 0f88d79..9fc2640 100644 --- a/greeter/LoginP.h +++ b/greeter/LoginP.h @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.8 2001/12/14 20:01:29 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.7 2001/01/17 23:45:25 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/greeter/greet.c b/greeter/greet.c index e0b9c06..e9a8feb 100644 --- a/greeter/greet.c +++ b/greeter/greet.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.17 2003/07/09 15:27:40 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.16tsi Exp $ */ /* * xdm - display manager daemon diff --git a/greeter/verify.c b/greeter/verify.c index d12806c..d68b2ba 100644 --- a/greeter/verify.c +++ b/greeter/verify.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.27 2004/01/25 01:12:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.26 2003/11/19 04:44:00 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/krb5auth.c b/krb5auth.c index d6f57da..a2191b8 100644 --- a/krb5auth.c +++ b/krb5auth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.4 2001/12/14 20:01:22 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/mitauth.c b/mitauth.c index 2b2dd31..d1ff17b 100644 --- a/mitauth.c +++ b/mitauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/mitauth.c,v 1.6 2003/09/17 05:48:32 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/mitauth.c,v 1.5 2003/05/27 22:27:00 tsi Exp $ */ /* * xdm - display manager daemon diff --git a/netaddr.c b/netaddr.c index 776e23a..ec419e9 100644 --- a/netaddr.c +++ b/netaddr.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/netaddr.c,v 3.8 2003/07/18 15:53:28 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/netaddr.c,v 3.7 2003/07/09 15:27:39 tsi Exp $ */ /* * xdm - X display manager diff --git a/policy.c b/policy.c index 48097c5..9237b5d 100644 --- a/policy.c +++ b/policy.c @@ -33,7 +33,7 @@ from The Open Group. * * policy.c. Implement site-dependent policy for XDMCP connections */ -/* $XFree86: xc/programs/xdm/policy.c,v 3.9 2004/01/01 17:12:34 herrb Exp $ */ +/* $XFree86: policy.c,v 3.8 2002/12/07 20:31:04 herrb Exp $ */ # include "dm.h" # include "dm_auth.h" diff --git a/prngc.c b/prngc.c index 268f983..529fb27 100644 --- a/prngc.c +++ b/prngc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xdm/prngc.c,v 1.4 2003/11/04 20:17:04 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/prngc.c,v 1.3 2003/10/17 21:23:07 herrb Exp $ */ /* * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. * Copyright (c) 2001-2002 Damien Miller. All rights reserved. diff --git a/protodpy.c b/protodpy.c index 47c25e4..d2df151 100644 --- a/protodpy.c +++ b/protodpy.c @@ -25,7 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/protodpy.c,v 1.5 2001/12/14 20:01:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/protodpy.c,v 1.4 2001/07/25 15:05:19 dawes Exp $ */ /* * protodpy.c diff --git a/reset.c b/reset.c index d5c49ca..c28ccb3 100644 --- a/reset.c +++ b/reset.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/reset.c,v 1.4 2001/12/14 20:01:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/reset.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/resource.c b/resource.c index 11021cc..1137c00 100644 --- a/resource.c +++ b/resource.c @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/resource.c,v 3.12 2003/09/17 05:48:32 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/resource.c,v 3.11 2003/07/09 15:27:39 tsi Exp $ */ /* * xdm - display manager daemon diff --git a/rpcauth.c b/rpcauth.c index 399ebb6..75e465b 100644 --- a/rpcauth.c +++ b/rpcauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.4 2001/12/14 20:01:23 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.3 2001/01/17 23:45:22 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/server.c b/server.c index d537ddc..3f72623 100644 --- a/server.c +++ b/server.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/server.c,v 3.14 2003/04/12 16:42:14 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/server.c,v 3.13 2001/12/14 20:01:23 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/session.c b/session.c index 0747ab6..66d7696 100644 --- a/session.c +++ b/session.c @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/session.c,v 3.37 2004/01/07 04:28:06 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/session.c,v 3.36 2003/09/29 21:00:08 herrb Exp $ */ /* * xdm - display manager daemon diff --git a/socket.c b/socket.c index b40a76c..6e01cdb 100644 --- a/socket.c +++ b/socket.c @@ -28,7 +28,7 @@ other dealings in this Software without prior written authorization from the copyright holder. */ -/* $XFree86: xc/programs/xdm/socket.c,v 3.14 2003/11/25 22:21:08 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/socket.c,v 3.13 2003/07/18 15:39:52 tsi Exp $ */ /* * xdm - display manager daemon diff --git a/streams.c b/streams.c index 720b4cc..c09ce6e 100644 --- a/streams.c +++ b/streams.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/streams.c,v 3.8 2003/10/27 21:39:08 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/streams.c,v 3.7 2003/07/09 15:27:39 tsi Exp $ */ /* * xdm - display manager daemon diff --git a/util.c b/util.c index c7e6725..cea100c 100644 --- a/util.c +++ b/util.c @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/util.c,v 3.21 2003/11/22 04:09:26 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/util.c,v 3.20 2002/05/31 18:46:10 dawes Exp $ */ /* * xdm - display manager daemon diff --git a/xdm.man.cpp b/xdm.man.cpp index 47f1c9f..f37da82 100644 --- a/xdm.man.cpp +++ b/xdm.man.cpp @@ -24,7 +24,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.29 2004/01/12 21:43:19 herrb Exp $ +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.28 2004/01/09 00:25:23 dawes Exp $ .\" .TH XDM 1 __xorgversion__ .SH NAME diff --git a/xdmauth.c b/xdmauth.c index a42fcfb..d2c3e9d 100644 --- a/xdmauth.c +++ b/xdmauth.c @@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.7 2003/10/27 21:39:02 herrb Exp $ */ +/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.6 2003/09/17 05:48:33 herrb Exp $ */ /* * xdm - display manager daemon * Author: Keith Packard, MIT X Consortium diff --git a/xdmcp.c b/xdmcp.c index d0498c7..ea273e4 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -27,7 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.26 2004/01/07 04:28:06 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.25 2003/11/23 22:36:03 herrb Exp $ */ /* * xdm - display manager daemon diff --git a/xdmshell.c b/xdmshell.c index 30f6345..9c7e14d 100644 --- a/xdmshell.c +++ b/xdmshell.c @@ -36,7 +36,7 @@ in this Software without prior written authorization from The Open Group. * bring down X when you are finished. */ -/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.7 2001/12/14 20:01:26 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.6 2001/07/25 15:05:19 dawes Exp $ */ #include #include "dm.h" -- cgit v1.2.3 From bbfdbf2a32e0b33811a100e7b74dc2a94b6e4051 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Thu, 15 Apr 2004 10:17:40 +0000 Subject: Merged changes from RELEASE-1 branch --- access.c | 8 +- chooser.c | 3 +- config/xorg-bw.xpm | 264 ++++++++++++++++++++ config/xorg.xpm | 701 +++++++++++++++++++++++++++++++++++++++++++++++++++++ socket.c | 6 +- 5 files changed, 974 insertions(+), 8 deletions(-) create mode 100644 config/xorg-bw.xpm create mode 100644 config/xorg.xpm diff --git a/access.c b/access.c index beffb81..0e612a1 100644 --- a/access.c +++ b/access.c @@ -1,5 +1,5 @@ /* - * $XdotOrg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ + * $XdotOrg$ * $Xorg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -904,9 +904,9 @@ void ForEachListenAddr ( h = d->hosts; if (h != NULL) { (*listenfunction) (&h->entry.hostAddress, closure); - } - for (h = h->next; h != NULL; h = h->next) { - (*mcastfunction) (&h->entry.hostAddress, closure); + for (h = h->next; h != NULL; h = h->next) { + (*mcastfunction) (&h->entry.hostAddress, closure); + } } } } diff --git a/chooser.c b/chooser.c index 23a4a07..7d30e10 100644 --- a/chooser.c +++ b/chooser.c @@ -1,5 +1,5 @@ /* - * $XdotOrg: xc/programs/xdm/chooser.c,v 1.1.4.4 2003/12/06 18:51:45 kaleb Exp $ + * $XdotOrg$ * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -857,6 +857,7 @@ InitXDMCP (char **argv) XtAddInput (socketFD, (XtPointer) XtInputReadMask, ReceivePacket, (XtPointer) &socketFD); #if defined(IPv6) && defined(AF_INET6) + if (socket6FD != -1) XtAddInput (socket6FD, (XtPointer) XtInputReadMask, ReceivePacket, (XtPointer) &socket6FD); #endif diff --git a/config/xorg-bw.xpm b/config/xorg-bw.xpm new file mode 100644 index 0000000..1353918 --- /dev/null +++ b/config/xorg-bw.xpm @@ -0,0 +1,264 @@ +/* XPM */ +static char * xorg_new_site_background_26mar_200_bw_xpm[] = { +"114 200 61 1", +" c None", +". c #000000", +"+ c #FFFFFF", +"@ c #FDFDFD", +"# c #4E4E4E", +"$ c #F5F5F5", +"% c #2F2F2F", +"& c #FEFEFE", +"* c #F7F7F7", +"= c #F9F9F9", +"- c #F6F6F6", +"; c #8E8E8E", +"> c #FBFBFB", +", c #AFAFAF", +"' c #FCFCFC", +") c #FAFAFA", +"! c #F2F2F2", +"~ c #F4F4F4", +"{ c #F3F3F3", +"] c #6E6E6E", +"^ c #F0F0F0", +"/ c #F8F8F8", +"( c #F1F1F1", +"_ c #CFCFCF", +": c #101010", +"< c #F9FAFA", +"[ c #6E7073", +"} c #FEFEFF", +"| c #F3F7FB", +"1 c #F6F8FA", +"2 c #F0F2F3", +"3 c #FDFEFE", +"4 c #F3F5F7", +"5 c #F9FBFD", +"6 c #F6F9FC", +"7 c #F9FAFB", +"8 c #CFD3D9", +"9 c #F2F2F3", +"0 c #FAFBFC", +"a c #AFB0B2", +"b c #F5F8FB", +"c c #F7F9FB", +"d c #8E9195", +"e c #F4F6F8", +"f c #FDFDFE", +"g c #F5F6F7", +"h c #F8FAFD", +"i c #F2F4F6", +"j c #F1F0F0", +"k c #FBFCFD", +"l c #FCFDFE", +"m c #F0F1F2", +"n c #6E7071", +"o c #F3F4F6", +"p c #F0F4F9", +"q c #F3F4F7", +"r c #FCFCFD", +"s c #F1F2F4", +"t c #AFB1B6", +"u c #CFD1D3", +"v c #F5F7F9", +".........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...........", +"..........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++............", +"..........................@++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#............", +"...........................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.............", +"............................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++..............", +"............................$++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...............", +".............................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%...............", +"..............................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&................", +"...............................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.................", +"...............................*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++..................", +"................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...................", +".................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++@...................", +"..................................++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++....................", +"..................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.....................", +"...................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++++......................", +"....................................+++++++++++++++++++++++++++++++++++++++++++++++++++++++=......................", +"....................................-++++++++++++++++++++++++++++++++++++++++++++++++++++++.......................", +".....................................+++++++++++++++++++++++++++++++++++++++++++++++++++++........................", +"......................................+++++++++++++++++++++++++++++++++++++++++++++++++++.........................", +".......................................+++++++++++++++++++++++++++++++++++++++++++++++++..........................", +".......................................&++++++++++++++++++++++++++++++++++++++++++++++++..........................", +"........................................+++++++++++++++++++++++++++++++++++++++++++++++...........................", +".........................................+++++++++++++++++++++++++++++++++++++++++++++............................", +".........................................;+++++++++++++++++++++++++++++++++++++++++++.............................", +"..........................................++++++++++++++++++++++++++++++++++++++++++>.............................", +"...........................................+++++++++++++++++++++++++++++++++++++++++..............................", +"............................................+++++++++++++++++++++++++++++++++++++++...............................", +"............................................,+++++++++++++++++++++++++++++++++++++................................", +".............................................++++++++++++++++++++++++++++++++++++'................................", +"..............................................+++++++++++++++++++++++++++++++++++.................................", +"..............................................%+++++++++++++++++++++++++++++++++.................................+", +"...............................................@+++++++++++++++++++++++++++++++.................................++", +"................................................++++++++++++++++++++++++++++++)................................+++", +".................................................+++++++++++++++++++++++++++++................................*+++", +".................................................!+++++++++++++++++++++++++++.................................++++", +"..................................................++++++++++++++++++++++++++.................................+++++", +"...................................................++++++++++++++++++++++++~................................++++++", +"....................................................+++++++++++++++++++++++................................'++++++", +"....................................................{+++++++++++++++++++++................................]+++++++", +".....................................................++++++++++++++++++++.................................++++++++", +"......................................................++++++++++++++++++.................................+++++++++", +"......................................................^+++++++++++++++++................................&+++++++++", +".......................................................&+++++++++++++++................................;++++++++++", +"........................................................++++++++++++++.................................+++++++++++", +".........................................................++++++++++++.................................++++++++++++", +".........................................................=++++++++++=................................&++++++++++++", +"..........................................................++++++++++................................^+++++++++++++", +"...........................................................++++++++.................................++++++++++++++", +"............................................................++++++.................................+++++++++++++++", +"............................................................-++++=................................++++++++++++++++", +"............................................................/+++&................................(++++++++++++++++", +"...........................................................$++++.................................+++++++++++++++++", +"...........................................................++++.................................++++++++++++++++++", +"..........................................................++++^................................+++++++++++++++++++", +".........................................................++++&................................@+++++++++++++++++++", +"........................................................*++++................................~++++++++++++++++++++", +"........................................................++++.................................+++++++++++++++++++++", +".......................................................++++,................................++++++++++++++++++++++", +"......................................................++++)................................+++++++++++++++++++++++", +".....................................................+++++................................-+++++++++++++++++++++++", +".....................................................++++.................................++++++++++++++++++++++++", +"....................................................++++.................................+++++++++++++++++++++++++", +"...................................................+++++................................++++++++++++++++++++++++++", +"..................................................+++++................................-++++++++++++++++++++++++++", +".................................................~++++.................................+++++++++++++++++++++++++++", +".................................................++++.................................++++++++++++++++++++++++++++", +"................................................++++$................................+++++++++++++++++++++++++++++", +"...............................................+++++................................*+++++++++++++++++++++++++++++", +"..............................................>++++.................................++++++++++++++++++++++++++++++", +"..............................................++++.................................+++++++++++++++++++++++++++++++", +".............................................++++~................................++++++++++++++++++++++++++++++++", +"............................................++++'................................+++++++++++++++++++++++++++++++++", +"...........................................&++++................................]+++++++++++++++++++++++++++++++++", +"...........................................++++.................................++++++++++++++++++++++++++++++++++", +"..........................................++++#................................+++++++++++++++++++++++++++++++++++", +".........................................++++>.................................+++++++++++++++++++++++++++++++++++", +"........................................&++++...................................++++++++++++++++++++++++++++++++++", +".......................................;++++.....................................+++++++++++++++++++++++++++++++++", +".......................................++++......................................'++++++++++++++++++++++++++++++++", +"......................................++++*.......................................++++++++++++++++++++++++++++++++", +".....................................+++++.........................................+++++++++++++++++++++++++++++++", +"....................................>++++...........................................++++++++++++++++++++++++++++++", +"....................................++++............................................)+++++++++++++++++++++++++++++", +"...................................++++@.............................................+++++++++++++++++++++++++++++", +"..................................+++++...............................................++++++++++++++++++++++++++++", +".................................&++++................................................^+++++++++++++++++++++++++++", +"................................;++++..................................................+++++++++++++++++++++++++++", +"................................++++(...................................................++++++++++++++++++++++++++", +"...............................++++).....................................................+++++++++++++++++++++++++", +"..............................+++++......................................................'++++++++++++++++++++++++", +".............................^++++........................................................++++++++++++++++++++++++", +".............................++++_.........................................................+++++++++++++++++++++++", +"............................++++)...........................................................++++++++++++++++++++++", +"...........................+++++............................................................'+++++++++++++++++++++", +"..........................~++++..............................................................+++++++++++++++++++++", +"..........................++++................................................................++++++++++++++++++++", +".........................++++/................................................................^+++++++++++++++++++", +"........................+++++..................................................................+++++++++++++++++++", +".......................-++++....................................................................++++++++++++++++++", +".......................++++......................................................................+++++++++++++++++", +"......................++++{......................................................................(++++++++++++++++", +".....................+++++........................................................................++++++++++++++++", +"....................+++++..........................................................................+++++++++++++++", +"...................:++++...........................................................................;++++++++++++++", +"...................++++]............................................................................++++++++++++++", +"..................+++++..............................................................................+++++++++++++", +".................+++++................................................................................++++++++++++", +"................*++++.................................................................................-+++++++++++", +"................++++]..................................................................................+++++++++++", +"...............++++*....................................................................................++++++++++", +"..............+++++......................................................................................+++++++++", +".............=++++.......................................................................................*++++++++", +".............++++.........................................................................................++++++++", +"............++++*..........................................................................................+++++++", +"...........++++/...........................................................................................!++++++", +"..........>++++.............................................................................................++++++", +"..........+++++$.............................................................................................+++++", +".........+++++++;.............................................................................................++++", +"........+++++++++.............................................................................................=+++", +".......@++++++++++.............................................................................................+++", +"......!+++++++++++&.............................................................................................++", +"......+++++++++++++..............................................................................................+", +".....+++++++++++++++.............................................................................................)", +"....+++++++++++++++++.............................................................................................", +"...{+++++++++++++++++)............................................................................................", +"...+++++++++++++++++++............................................................................................", +"..+++++++++++++++++++++...........................................................................................", +".++++++++++++<++++++++++..........................................................................................", +"&++++++++++++[.+++++++++^.........................................................................................", +"+++++++++++++}.%+++++++++.........................................................................................", +"++++++++++++++|.1+++++++++........................................................................................", +"+++++++++++++++..++++++++++.......................................................................................", +"++++++++++++++++..+++++++++.......................................................................................", +"++++++++++++++++|.2+++++++++......................................................................................", +"+++++++++++++++++..}+++++++++.....................................................................................", +"+++++++++++++++++3..+++++++++>....................................................................................", +"++++++++++++++++++...+++++++++....................................................................................", +"+++++++++++++++++++..4+++++++++...................................................................................", +"+++++++++++++++++++5..+++++++++'..................................................................................", +"++++++++++++++++++++...+++++++++_.................................................................................", +"+++++++++++++++++++++...+++++++++.................................................................................", +"+++++++++++++++++++++6..7+++++++++................................................................................", +"++++++++++++++++++++++...+++++++++@...............................................................................", +"+++++++++++++++++++++++...++++++++++..............................................................................", +"+++++++++++++++++++++++8..9++++++++++.............................................................................", +"++++++++++++++++++++++++...0+++++++++.............................................................................", +"+++++++++++++++++++++++++...++++++++++............................................................................", +"+++++++++++++++++++++++++....++++++++++...........................................................................", +"++++++++++++++++++++++++++...a+++++++++=..........................................................................", +"++++++++++++++++++++++++++b...c+++++++++..........................................................................", +"+++++++++++++++++++++++++++....++++++++++.........................................................................", +"++++++++++++++++++++++++++++....++++++++++........................................................................", +"++++++++++++++++++++++++++++d...e+++++++++(.......................................................................", +"+++++++++++++++++++++++++++++....f+++++++++.......................................................................", +"++++++++++++++++++++++++++++++....++++++++++......................................................................", +"++++++++++++++++++++++++++++++.....++++++++++.....................................................................", +"+++++++++++++++++++++++++++++++....g+++++++++.....................................................................", +"+++++++++++++++++++++++++++++++h....++++++++++....................................................................", +"++++++++++++++++++++++++++++++++.....++++++++++...................................................................", +"+++++++++++++++++++++++++++++++++.....+++++++++!..................................................................", +"+++++++++++++++++++++++++++++++++6....i+++++++++..................................................................", +"++++++++++++++++++++++++++++++++++.....++++++++++.................................................................", +"++++++++++++++++++++++++++++++++++3.....++++++++++................................................................", +"+++++++++++++++++++++++++++++++++++.....j+++++++++................................................................", +"++++++++++++++++++++++++++++++++++++.....k+++++++++...............................................................", +"++++++++++++++++++++++++++++++++++++l.....++++++++++..............................................................", +"+++++++++++++++++++++++++++++++++++++......+++++++++~.............................................................", +"++++++++++++++++++++++++++++++++++++++.....m+++++++++.............................................................", +"++++++++++++++++++++++++++++++++++++++8.....l+++++++++............................................................", +"+++++++++++++++++++++++++++++++++++++++......+++++++++)...........................................................", +"++++++++++++++++++++++++++++++++++++++++......+++++++++#..........................................................", +"++++++++++++++++++++++++++++++++++++++++......n+++++++++..........................................................", +"+++++++++++++++++++++++++++++++++++++++++......++++++++++.........................................................", +"++++++++++++++++++++++++++++++++++++++++++......+++++++++)........................................................", +"++++++++++++++++++++++++++++++++++++++++++.......+++++++++........................................................", +"+++++++++++++++++++++++++++++++++++++++++++......o+++++++++.......................................................", +"+++++++++++++++++++++++++++++++++++++++++++5......3+++++++++......................................................", +"++++++++++++++++++++++++++++++++++++++++++++.......+++++++++(.....................................................", +"+++++++++++++++++++++++++++++++++++++++++++++.......+++++++++.....................................................", +"+++++++++++++++++++++++++++++++++++++++++++++p......q+++++++++....................................................", +"++++++++++++++++++++++++++++++++++++++++++++++.......+++++++++*...................................................", +"++++++++++++++++++++++++++++++++++++++++++++++3.......+++++++++...................................................", +"+++++++++++++++++++++++++++++++++++++++++++++++........+++++++++..................................................", +"++++++++++++++++++++++++++++++++++++++++++++++++.......&+++++++++.................................................", +"++++++++++++++++++++++++++++++++++++++++++++++++5.......+++++++++.................................................", +"+++++++++++++++++++++++++++++++++++++++++++++++++........++++++++*................................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++.......,++++++++................................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++d.......r++++++++...............................................", +"+++++++++++++++++++++++++++++++++++++++++++++++++++........++++++++'..............................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++........++++++++..............................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++........s++++++++.............................................", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++........+++++++++............................................", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++t........+++++++++...........................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++.........++++++++...........................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++.........u++++++++..........................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++..........+++++++++.........................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++...........+++++++++........................................", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++r............++++++++........................................", +"+++++++++++++++++++++++++++++++++++++++++++++++++++++.............v++++++++.......................................", +"++++++++++++++++++++++++++++++++++++++++++++++++++++...............}++++++++......................................"}; diff --git a/config/xorg.xpm b/config/xorg.xpm new file mode 100644 index 0000000..d83d5c6 --- /dev/null +++ b/config/xorg.xpm @@ -0,0 +1,701 @@ +/* XPM */ +static char * xorg_new_site_background_26mar_200_xpm[] = { +"114 200 498 2", +" c None", +". c #000000", +"+ c #0D0D0D", +"@ c #B9B9B9", +"# c #FAFAFA", +"$ c #9D9D9D", +"% c #030303", +"& c #222222", +"* c #E1E1E1", +"= c #D3D3D3", +"- c #0E0E0E", +"; c #454545", +"> c #F7F7F7", +", c #F9F9F9", +"' c #E5E5E5", +") c #2F2F2F", +"! c #969696", +"~ c #686868", +"{ c #0F0F0F", +"] c #C4C4C4", +"^ c #999999", +"/ c #040404", +"( c #373737", +"_ c #EEEEEE", +": c #F8F8F8", +"< c #C0C0C0", +"[ c #0B0B0B", +"} c #646464", +"| c #E4E4E4", +"1 c #202020", +"2 c #010101", +"3 c #9E9E9E", +"4 c #F6F6F6", +"5 c #565656", +"6 c #151515", +"7 c #D7D7D7", +"8 c #8A8A8A", +"9 c #BDBDBD", +"0 c #868686", +"a c #DEDEDE", +"b c #262626", +"c c #BBBBBB", +"d c #F4F4F4", +"e c #414141", +"f c #272727", +"g c #DCDCDC", +"h c #F5F5F5", +"i c #7C7C7C", +"j c #4D4D4D", +"k c #A5A5A5", +"l c #CDCDCD", +"m c #131313", +"n c #C5C5C5", +"o c #3A3A3A", +"p c #3D3D3D", +"q c #EAEAEA", +"r c #F3F3F3", +"s c #636363", +"t c #6C6C6C", +"u c #A0A0A0", +"v c #A7A7A7", +"w c #F2F2F2", +"x c #C8C8C8", +"y c #111111", +"z c #282828", +"A c #F0F0F0", +"B c #F1F1F1", +"C c #5F5F5F", +"D c #818181", +"E c #8E8E8E", +"F c #020202", +"G c #B1B1B1", +"H c #C3C3C3", +"I c #080808", +"J c #DFDFDF", +"K c #D9D9D9", +"L c #575757", +"M c #EFEFEF", +"N c #EBEBEB", +"O c #4C4C4C", +"P c #7F7F7F", +"Q c #101010", +"R c #C7C7C7", +"S c #AFAFAF", +"T c #070707", +"U c #D5D5D5", +"V c #181818", +"W c #6E6E6E", +"X c #EDEDED", +"Y c #484848", +"Z c #5C5C5C", +"` c #717171", +" . c #303030", +".. c #191919", +"+. c #ECECEC", +"@. c #585858", +"#. c #CFCFCF", +"$. c #1E1E1E", +"%. c #848484", +"&. c #E6E6E6", +"*. c #353535", +"=. c #666666", +"-. c #090909", +";. c #B0B0B0", +">. c #404040", +",. c #E3E3E3", +"'. c #2D2D2D", +"). c #959595", +"!. c #5E5E5E", +"~. c #E9E9E9", +"{. c #E8E8E8", +"]. c #555555", +"^. c #474747", +"/. c #DDDDDD", +"(. c #8F8F8F", +"_. c #242424", +":. c #747474", +"<. c #E7E7E7", +"[. c #B7B7B7", +"}. c #0C0C0C", +"|. c #050505", +"1. c #A6A6A6", +"2. c #CCCCCC", +"3. c #1F1F1F", +"4. c #D8D8D8", +"5. c #515151", +"6. c #5A5A5A", +"7. c #7E7E7E", +"8. c #898989", +"9. c #B3B3B3", +"0. c #B5B5B5", +"a. c #C9C9C9", +"b. c #1D1D1D", +"c. c #8C8C8C", +"d. c #3F3F3F", +"e. c #E2E2E2", +"f. c #6F6F6F", +"g. c #393939", +"h. c #D6D6D6", +"i. c #A4A4A4", +"j. c #121212", +"k. c #161616", +"l. c #C2C2C2", +"m. c #383838", +"n. c #3B3B3B", +"o. c #545454", +"p. c #DADADA", +"q. c #E0E0E0", +"r. c #626262", +"s. c #3C3C3C", +"t. c #D4D4D4", +"u. c #363636", +"v. c #8D8D8D", +"w. c #1C1C1C", +"x. c #BEBEBE", +"y. c #171717", +"z. c #D1D1D1", +"A. c #2B2B2B", +"B. c #737373", +"C. c #696969", +"D. c #505050", +"E. c #838383", +"F. c #2C2C2C", +"G. c #1A1A1A", +"H. c #ACACAC", +"I. c #A8A8A8", +"J. c #A9A9A9", +"K. c #767676", +"L. c #DBDBDB", +"M. c #4B4B4B", +"N. c #D2D2D2", +"O. c #C1C1C1", +"P. c #B8B8B8", +"Q. c #0A0A0A", +"R. c #929292", +"S. c #858585", +"T. c #313131", +"U. c #D0D0D0", +"V. c #CECECE", +"W. c #919191", +"X. c #B6B6B6", +"Y. c #333333", +"Z. c #656565", +"`. c #616161", +" + c #444444", +".+ c #343434", +"++ c #8B8B8B", +"@+ c #A3A3A3", +"#+ c #CACACA", +"$+ c #232323", +"%+ c #7A7A7A", +"&+ c #525252", +"*+ c #7B7B7B", +"=+ c #9F9F9F", +"-+ c #212121", +";+ c #3E3E3E", +">+ c #4A4A4A", +",+ c #BFBFBF", +"'+ c #ADADAD", +")+ c #CBCBCB", +"!+ c #C6C6C6", +"~+ c #909090", +"{+ c #757575", +"]+ c #5D5D5D", +"^+ c #A2A2A2", +"/+ c #7D7D7D", +"(+ c #BCBCBC", +"_+ c #252525", +":+ c #464646", +"<+ c #292929", +"[+ c #888888", +"}+ c #1B1B1B", +"|+ c #B2B2B2", +"1+ c #777777", +"2+ c #A1A1A1", +"3+ c #ABABAB", +"4+ c #323232", +"5+ c #606060", +"6+ c #AAAAAA", +"7+ c #9B9B9B", +"8+ c #B4B4B4", +"9+ c #6B6B6B", +"0+ c #5B5B5B", +"a+ c #424242", +"b+ c #808080", +"c+ c #BABABA", +"d+ c #939393", +"e+ c #707070", +"f+ c #494949", +"g+ c #060606", +"h+ c #797979", +"i+ c #AEAEAE", +"j+ c #141414", +"k+ c #535353", +"l+ c #4F4F4F", +"m+ c #2A2A2A", +"n+ c #828282", +"o+ c #949494", +"p+ c #989898", +"q+ c #727272", +"r+ c #858586", +"s+ c #9C9C9C", +"t+ c #8F9499", +"u+ c #7E7C79", +"v+ c #A4A5A5", +"w+ c #807F7F", +"x+ c #818283", +"y+ c #9A9FA3", +"z+ c #827D78", +"A+ c #8D8F91", +"B+ c #8B9198", +"C+ c #897765", +"D+ c #827A72", +"E+ c #999DA1", +"F+ c #A8815A", +"G+ c #828485", +"H+ c #7A848F", +"I+ c #BD8852", +"J+ c #959696", +"K+ c #9FA0A0", +"L+ c #98836D", +"M+ c #9B7F62", +"N+ c #868F99", +"O+ c #DB954B", +"P+ c #807871", +"Q+ c #7A8087", +"R+ c #E09648", +"S+ c #858688", +"T+ c #999C9E", +"U+ c #A58869", +"V+ c #B68753", +"W+ c #85909B", +"X+ c #E1994D", +"Y+ c #8F7C69", +"Z+ c #7C7F83", +"`+ c #F19F46", +" @ c #807E7D", +".@ c #94989B", +"+@ c #B28C62", +"@@ c #DF974A", +"#@ c #868788", +"$@ c #7B8692", +"%@ c #F6A145", +"&@ c #AB835A", +"*@ c #9A9A9A", +"=@ c #2E2E2E", +"-@ c #86807A", +";@ c #F7A245", +">@ c #8B7D6D", +",@ c #8D9298", +"'@ c #D19655", +")@ c #E79B49", +"!@ c #788089", +"~@ c #C59054", +"{@ c #8C8D8F", +"]@ c #979797", +"^@ c #AA8965", +"/@ c #F7A346", +"(@ c #A58662", +"_@ c #7D8791", +":@ c #E19C4F", +"<@ c #F5A246", +"[@ c #837E79", +"}@ c #84807C", +"|@ c #E59D4A", +"1@ c #828487", +"2@ c #8B8E92", +"3@ c #C39159", +"4@ c #F7A446", +"5@ c #C09059", +"6@ c #898C8E", +"7@ c #7B838D", +"8@ c #F2A248", +"9@ c #9C8368", +"0@ c #968571", +"a@ c #EFA248", +"b@ c #827E79", +"c@ c #858A91", +"d@ c #D39854", +"e@ c #F7A547", +"f@ c #E39D4D", +"g@ c #7B8084", +"h@ c #F4A448", +"i@ c #B98E5C", +"j@ c #8A8B8C", +"k@ c #9B866F", +"l@ c #F7A647", +"m@ c #9D8568", +"n@ c #7C848D", +"o@ c #E39F4F", +"p@ c #F8A647", +"q@ c #837F79", +"r@ c #7C7F82", +"s@ c #DF9D4E", +"t@ c #818284", +"u@ c #8A8C8E", +"v@ c #BD9260", +"w@ c #F8A747", +"x@ c #BD915B", +"y@ c #73808E", +"z@ c #E7A14E", +"A@ c #F7A748", +"B@ c #93826F", +"C@ c #80807F", +"D@ c #F8A748", +"E@ c #F0A54B", +"F@ c #817F7C", +"G@ c #878A8E", +"H@ c #B18F67", +"I@ c #F8A848", +"J@ c #E19F4F", +"K@ c #808284", +"L@ c #747E8A", +"M@ c #F7A848", +"N@ c #B79060", +"O@ c #878787", +"P@ c #898A8A", +"Q@ c #8C8379", +"R@ c #F5A849", +"S@ c #96846F", +"T@ c #7D838B", +"U@ c #DD9E53", +"V@ c #F8A948", +"W@ c #EEA54B", +"X@ c #787D84", +"Y@ c #CF9957", +"Z@ c #828384", +"`@ c #868789", +" # c #A88D6B", +".# c #F8A949", +"+# c #F8AA49", +"@# c #A38A6C", +"## c #797F87", +"$# c #EDA54C", +"%# c #F7AA49", +"&# c #88827A", +"*# c #8A837A", +"=# c #E8A34F", +"-# c #7F8081", +";# c #7D8287", +"># c #C49760", +",# c #F9AB49", +"'# c #CA995C", +")# c #4E4E4E", +"!# c #747C87", +"~# c #F5A84B", +"{# c #A38C6E", +"]# c #948676", +"^# c #F6AA4A", +"/# c #84817D", +"(# c #767E87", +"_# c #D09C5B", +":# c #F9AC49", +"<# c #E3A353", +"[# c #7A7E82", +"}# c #F8AB49", +"|# c #F9AC4A", +"1# c #C49860", +"2# c #B09169", +"3# c #9B8A73", +"4# c #747B85", +"5# c #F1A94D", +"6# c #F9AD4A", +"7# c #F4AB4C", +"8# c #86827D", +"9# c #676767", +"0# c #7D7F81", +"a# c #E6A652", +"b# c #7E7F80", +"c# c #7C7E80", +"d# c #BD9664", +"e# c #C29962", +"f# c #7E7F7F", +"g# c #757B84", +"h# c #F3AB4C", +"i# c #F9AE4A", +"j# c #9A8A75", +"k# c #8A837B", +"l# c #F9AE4B", +"m# c #EFAA50", +"n# c #81807F", +"o# c #767A80", +"p# c #C69A61", +"q# c #E1A656", +"r# c #6D7886", +"s# c #F9AF4B", +"t# c #C29B64", +"u# c #7A7B7B", +"v# c #A58E70", +"w# c #FAAF4B", +"x# c #90877A", +"y# c #717881", +"z# c #DEA457", +"A# c #F2AD4F", +"B# c #7C7E81", +"C# c #FAB04B", +"D# c #D5A25D", +"E# c #7C7D7D", +"F# c #787878", +"G# c #757779", +"H# c #AF926C", +"I# c #B7976C", +"J# c #F2AC4F", +"K# c #FAB04C", +"L# c #FAB14C", +"M# c #91887B", +"N# c #8B847C", +"O# c #F1AE51", +"P# c #71767C", +"Q# c #D4A25D", +"R# c #D7A45E", +"S# c #7C7C7D", +"T# c #757A81", +"U# c #F9B04B", +"V# c #BC9B6C", +"W# c #9B8B76", +"X# c #FAB24C", +"Y# c #8E877D", +"Z# c #6C737B", +"`# c #D9A45B", +" $ c #EAAC56", +".$ c #7B7C7E", +"+$ c #595959", +"@$ c #7F7F80", +"#$ c #C9A065", +"$$ c #6F7379", +"%$ c #E3A858", +"&$ c #FAB34D", +"*$ c #A29177", +"=$ c #9A8C77", +"-$ c #F8B24E", +";$ c #87847F", +">$ c #FAB34C", +",$ c #EAAD57", +"'$ c #787A7D", +")$ c #948A7C", +"!$ c #FAB44D", +"~$ c #CCA267", +"{$ c #BE9D6F", +"]$ c #FBB44D", +"^$ c #A29179", +"/$ c #7B7B7C", +"($ c #E4AB5A", +"_$ c #F5B251", +":$ c #838280", +"<$ c #6D6D6D", +"[$ c #B79B74", +"}$ c #E4AD5C", +"|$ c #76787A", +"1$ c #A0927E", +"2$ c #EEAD52", +"3$ c #ECAC52", +"4$ c #ECAD52", +"5$ c #ECAD53", +"6$ c #ECAE53", +"7$ c #ECAF53", +"8$ c #EDAF53", +"9$ c #B89A70", +". . . . . . . . . . . . . . . . . . . . . . . + @ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $ % . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . & * # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # = - . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . ; > , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ' ) . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . ! , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ~ . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . { ] , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ^ / . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . ( _ : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : < [ . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . } : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : | 1 . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 4 5 . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 8 . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; _ 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 [ . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 a b . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + c 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 d e . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f g h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h i . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h k . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d l m . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - n d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d _ o . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . p q r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r s . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . t r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r u . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / v w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w x y . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7 w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w g z . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j A B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B C . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B E F . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F G A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A H I . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . z J A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A K b . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . L M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M N O . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q R _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ S T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) a _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ U V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X q Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Z ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I k X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ` . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .K ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..K +.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . m n +.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @.q +.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.#.$.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $ +.+.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . %.N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N &.*.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . =.N N N ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -.;.q q q q q q q q q q q q q q q q q q q q q q q q q q q q q t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . >.,.q q q ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . '.a q q q q q q q q q q q q q q q q q q q q q q q q q q q ).. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 R q q q q ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . !.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.9 - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / u ~.~.~.~.~.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 u ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.J .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D ~.~.~.~.~.~.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V ] {.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.].. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ^.' {.{.{.{.{.{.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ( /.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.(.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _.7 {.{.{.{.{.{.{.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.[.}.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . |.1.<.<.<.<.<.<.<.<.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I k &.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . %.&.&.&.&.&.&.&.&.&.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.5.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . L ' &.&.&.&.&.&.&.&.&.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.| ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 7.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f U ' ' ' ' ' ' ' ' ' ' ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.' ' ' ' ' ' ' ' ' ' ' ' ' ' 9.|.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q 0.' ' ' ' ' ' ' ' ' ' ' ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I S | | | | | | | | | | | | a.b.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . c.| | | | | | | | | | | | ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *.a ,.,.,.,.,.,.,.,.,.,.a d.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.e.,.,.,.,.,.,.,.,.,.,.,.,.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . s ,.,.,.,.,.,.,.,.,.,.f.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . g.h.,.,.,.,.,.,.,.,.,.,.,.,.,.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i.e.e.e.e.e.e.e.e.3 / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j.n e.e.e.e.e.e.e.e.e.e.e.e.e.e.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . k.l.e.e.e.e.e.e.n m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |.$ e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . m.K * * * * g n.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ~ * * * * * * * * * * * * * * * * ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . o.p.q.q.q.J r.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . s.t.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . u.7 q.q.q.q.v.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . w.R q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.q.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q x.J J J J x.y.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . / k J J J J J J J J J J J J J J J J J J ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % ! a a a a z.A.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.a a a a a a a a a a a a a a a a a a a ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.a a a a /.O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.g a a a a a a a a a a a a a a a a a a a ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . o h././././.E.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F.= /./././././././././././././././././././.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.< g g g g H.-.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . -.I.g g g g g g g g g g g g g g g g g g g g g ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % J.g g g g l f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 g g g g g g g g g g g g g g g g g g g g g g ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K.L.L.L.L.7 ^.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . o.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M.p.p.p.p.p.C.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .N.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . b.O.p.p.p.p.i./ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 P.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q.H.K K K K c V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . R.K K K K K K K K K K K K K K K K K K K K K K K K K ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S.4.4.4.4.4.; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . r.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.4.4.4.4.4.t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T.U.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . '.V.7 7 7 7 W.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . y.@ 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + S h.h.h.h.X.- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -.u h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 h.h.h.h.V.Y.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Z.U U U U U `.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +V.U U U U U U U U U U U U U U U U U U U U U U U U U U U U U ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .+z.t.t.t.t.++F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G.l.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . b.9 t.t.t.t.k }.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q.@+t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W.= = = = #+$+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . %+= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.N.N.N.N.U.&+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . &+N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; U.z.z.z.z.*+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . b O.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..x.z.z.z.z.H.y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [ v z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.z.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q.=+U.U.U.U.< -+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 %+U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :.#.#.#.#.2.;+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . >+V.#.#.#.#.` . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . %.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f ,+V.V.V.V.^ / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . { H.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [ '+l l l l c 3.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . u.)+l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % D 2.2.2.2.!+n.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 2.2.2.2.2.@.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8 2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . u.x )+)+)+)+R.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . k.@ )+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+)+", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 S #+#+#+#+J.y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;+!+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ~+#+#+#+#+x m.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . {+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ]+a.a.a.a.a.]+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . y ^+a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . s.R x x x x /+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . b (+x x x x x x x x x x x x x x x x x x x x x x x x x x x ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _+@ R R R R i.-.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :+R R R R R R R R R R R R R R R R R R R R R R R R R R R ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / ).R R R R (+<+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [+R R R R R R R R R R R R R R R R R R R R R R R R R R ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ` !+!+!+!+l.Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . m 1.!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . >.n n n n n W . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . g.H n n n n n n n n n n n n n n n n n n n n n n n n ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . <+P.] ] ] ] W.-.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . Q @+] ] ] ] P.}+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |.v.] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . %+H H H H ,+:+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..|+H H H H H H H H H H H H H H H H H H H H H H ", +". . . . . . . . . . . . . . . . . . . . . . . . . . ].l.l.l.l.l.} . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; < l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.", +". . . . . . . . . . . . . . . . . . . . . . . . . _.@ O.O.O.O.++F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1+O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.", +". . . . . . . . . . . . . . . . . . . . . . . . y 2+< < < < 3+... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q u < < < < < < < < < < < < < < < < < < < < ", +". . . . . . . . . . . . . . . . . . . . . . . I 0 < < < < c 4+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <+0.< < < < < < < < < < < < < < < < < < < ", +". . . . . . . . . . . . . . . . . . . . . . . 5+,+,+,+,+,+5+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . >+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+", +". . . . . . . . . . . . . . . . . . . . . . Y.[.x.x.x.x.S.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 [+x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.", +". . . . . . . . . . . . . . . . . . . . . 6 6+9 9 9 9 7++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j.^+9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +". . . . . . . . . . . . . . . . . . . . I [+9 9 9 9 8+'.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9.9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +". . . . . . . . . . . . . . . . . . . . 9+(+(+(+(+(+>+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0+(+(+(+(+(+(+(+(+(+(+(+(+(+(+(+(+", +". . . . . . . . . . . . . . . . . . . a+c c c c c b+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I E c c c c c c c c c c c c c c c ", +". . . . . . . . . . . . . . . . . . 1 6+c+c+c+c+! }.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..'+c+c+c+c+c+c+c+c+c+c+c+c+c+c+", +". . . . . . . . . . . . . . . . . |.d+@ @ @ @ 3+-+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . >+@ @ @ @ @ @ @ @ @ @ @ @ @ @ ", +". . . . . . . . . . . . . . . . . ~ @ @ @ @ @ Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . e+@ @ @ @ @ @ @ @ @ @ @ @ @ ", +". . . . . . . . . . . . . . . . f+P.P.P.P.P.t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T d+P.P.P.P.P.P.P.P.P.P.P.P.", +". . . . . . . . . . . . . . . ) G [.[.[.[.~+g+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f G [.[.[.[.[.[.[.[.[.[.[.", +". . . . . . . . . . . . . . [ ).X.X.X.X.I.3.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.X.X.X.X.X.X.X.X.X.X.X.", +". . . . . . . . . . . . . 2 h+X.X.X.X.;.s.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / %.X.X.X.X.X.X.X.X.X.X.", +". . . . . . . . . . . . . j 0.0.0.0.0.!.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 u 0.0.0.0.0.0.0.0.0.", +". . . . . . . . . . . . .+;.8+8+8+8+7.g+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) i+8+8+8+8+8+8+8+8+", +". . . . . . . . . . . ..=+9.9.9.9.i.j+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C 9.9.9.9.9.9.9.9.", +". . . . . . . . . . / 7.|+|+|+|+H.m.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q.[+|+|+|+|+|+|+|+", +". . . . . . . . . . C G G G G H.k+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . w.I.G G G G G G ", +". . . . . . . . . ) i+G G G G c.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . l+G G G G G G ", +". . . . . . . . }+=+;.;.;.;.;.J.a+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f.;.;.;.;.;.", +". . . . . . . - 8.S S S S S S S @+$+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . }.v.S S S S ", +". . . . . . . ~ i+i+i+i+i+i+i+i+i+E g+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . m+6+i+i+i+", +". . . . . . d.H.'+'+'+'+'+'+'+'+'+'+@.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . k+'+'+'+", +". . . . . m+i.'+'+'+'+'+'+'+'+'+'+'+H..+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % n+'+'+", +". . . . { o+H.H.H.H.H.H.H.H.H.H.H.H.H.o+j.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..p+H.", +". . . % q+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+*+2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .+I.", +". . . M.6+6+6+6+6+6+6+6+6+6+6+6+6+6+6+6+6+D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . `.", +". . F.2+J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.1.$+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q.", +". y d+J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.v.-.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"/ *+I.I.I.I.I.I.I.I.I.I.I.v I.I.I.I.I.I.I.I.I.} . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"k+v v v v v v v v v v v v r+s+v v v v v v v v v u.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"k 1.1.1.1.1.1.1.1.1.1.1.1.t+u+i.1.1.1.1.1.1.1.1.s+G.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"k k k k k k k k k k k k k v+w+x+k k k k k k k k k S.% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"i.i.i.i.i.i.i.i.i.i.i.i.i.i.y+z+A+i.i.i.i.i.i.i.i.i.].. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.B+C+$ i.i.i.i.i.i.i.i.i.A.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+@+w+D+@+@+@+@+@+@+@+@+@+(.}.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"^+^+^+^+^+^+^+^+^+^+^+^+^+^+^+^+E+F+G+^+^+^+^+^+^+^+^+^+` . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+H+I+J+2+2+2+2+2+2+2+2+2+f+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"u u u u u u u u u u u u u u u u u K+L+M+7+u u u u u u u u $ }+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"u u u u u u u u u u u u u u u u u u N+O+P+u u u u u u u u u n+g+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+Q+R+S+=+=+=+=+=+=+=+=+=+5+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 T+U+V+W.3 3 3 3 3 3 3 3 s+*.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ W+X+Y+s+$ $ $ $ $ $ $ $ d+j+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+s+Z+`+ @s+s+s+s+s+s+s+s+s+*+F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+.@+@@@#@7+7+7+7+7+7+7+7+7+l+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+7+$@%@&@d+7+7+7+7+7+7+7+7+*@=@. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@-@;@>@p+*@*@*@*@*@*@*@*@*@r.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ,@'@)@b+^ ^ ^ ^ ^ ^ ^ ^ ^ ^ s.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+p+!@;@~@{@p+p+p+p+p+p+p+p+p+++y.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@]@! ^@/@(@o+]@]@]@]@]@]@]@]@]@q+F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! _@:@<@[@! ! ! ! ! ! ! ! ! ! Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! }@/@|@1@! ! ! ! ! ! ! ! ! R.b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +").).).).).).).).).).).).).).).).).).).).).).).).).).2@3@4@5@6@).).).).).).).).).P j.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+7@8@4@9@d+o+o+o+o+o+o+o+o+o+5+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+0@4@a@b@d+d+d+d+d+d+d+d+d+d+m.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.c@d@e@f@G+R.R.R.R.R.R.R.R.R.8 3.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.g@h@e@i@j@R.R.R.R.R.R.R.R.R.K./ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.W.k@e@l@m@(.W.W.W.W.W.W.W.W.W.j . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+n@o@p@h@q@~+~+~+~+~+~+~+~+~+~+A.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.r@p@p@s@t@(.(.(.(.(.(.(.(.(.1+[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E u@v@p@w@x@8 E E E E E E E E E `.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.y@z@w@A@B@c.v.v.v.v.v.v.v.v.v.d.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.C@D@D@E@F@v.v.v.v.v.v.v.v.v.0 }+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.c.G@H@D@I@J@K@c.c.c.c.c.c.c.c.c.f.I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++L@M@I@I@N@O@++++++++++++++++++l+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 P@Q@I@I@R@S@8 8 8 8 8 8 8 8 8 8 4+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.T@U@V@V@W@w+8.8.8.8.8.8.8.8.8.h+{ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.X@V@V@V@Y@Z@8.8.8.8.8.8.8.8.8.r.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+`@ #V@.#+#@#O@[+[+[+[+[+[+[+[+[+o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@O@##$#+#+#%#&#O@O@O@O@O@O@O@O@O@D w.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *#+#+#+#=#-#0 0 0 0 0 0 0 0 0 q++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.S.;#>#+#+#,#'#Z@S.S.S.S.S.S.S.S.S.)#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.!#~#,#,#,#{#%.%.%.%.%.%.%.%.%.D ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.]#,#,#,#^#/#%.%.%.%.%.%.%.%.%.%+- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.(#_#,#,#:#<#r@E.E.E.E.E.E.E.E.E.@.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+n+[#}#:#|#|#1#D n+n+n+n+n+n+n+n+n+>.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D 2#|#|#|#|#3#D D D D D D D D D 7.-+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+b+4#5#|#|#6#7#8#b+b+b+b+b+b+b+b+b+9#-.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 0#|#6#6#6#a#b#P P P P P P P P P 5.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P c#d#6#6#6#6#e#f#P P P P P P P P P T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.g#h#6#6#i#i#j#7.7.7.7.7.7.7.7.7.1+j+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+k#6#6#i#l#m#n#/+/+/+/+/+/+/+/+/+!./ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i o#p#i#i#l#l#q#c#i i i i i i i i i ;+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+r#i#l#l#s#s#t#i *+*+*+*+*+*+*+*+1+$.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+u#v#l#l#s#s#w#x#*+*+*+*+*+*+*+*+*+~ Q.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+%+y#z#s#s#s#w#A#n#%+%+%+%+%+%+%+%+%+o.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+B#s#s#w#w#C#D#E#h+h+h+h+h+h+h+h+h+F.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#F#G#H#w#w#C#C#C#I#%+F#F#F#F#F#F#F#F#C.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+y#J#C#C#C#K#L#M#1+1+1+1+1+1+1+1+B.O T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+N#C#C#C#K#L#O#P 1+1+1+1+1+1+1+1+r.'.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.P#Q#C#K#L#L#L#R#S#K.K.K.K.K.K.K.K.f+G.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+{+T#U#K#L#L#L#L#V#1+{+{+{+{+{+{+{+:.F.g+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +":.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.W#L#L#L#L#X#X#Y#:.:.:.:.:.:.:.:.~ y.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.Z#`#L#L#X#X#X# $.$B.B.B.B.B.B.B.B.+$Q.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.@$L#L#X#X#X#X##$1+B.B.B.B.B.B.B.B.;+|.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+q+$$%$X#X#X#X#X#&$*$B.q+q+q+q+q+q+q+q+b.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` =$X#X#X#X#&$&$-$;$` ` ` ` ` ` ` ` =.-.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+@$X#X#X#>$&$&$&$,$'$e+e+e+e+e+e+e+e++$F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+e+)$X#X#X#&$&$&$&$!$~$1+e+e+e+e+e+e+e+e+n.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.` {$X#X#>$&$&$&$!$]$]$^$` f.f.f.f.f.f.f.f.}+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W /$($X#X#&$&$&$&$!$]$]$_$:$W W W W W W W W Z.}.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<$<${+[$X#X#&$&$&$&$!$]$]$]$]$}$|$<$<$<$<$<$<$<$<$l+/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +"t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t {+1$2$3$4$5$5$5$5$6$6$6$6$7$8$9$` t t t t t t t t >.F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/socket.c b/socket.c index 6e01cdb..a5a4dc7 100644 --- a/socket.c +++ b/socket.c @@ -1,4 +1,4 @@ -/* $XdotOrg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ +/* $XdotOrg$ */ /* $Xorg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -69,9 +69,9 @@ CreateWellKnownSockets (void) #if defined(IPv6) && defined(AF_INET6) chooserFd = socket (AF_INET6, SOCK_STREAM, 0); -#else - chooserFd = socket (AF_INET, SOCK_STREAM, 0); + if (chooserFd == -1) #endif + chooserFd = socket (AF_INET, SOCK_STREAM, 0); Debug ("Created chooser socket %d\n", chooserFd); if (chooserFd == -1) { -- cgit v1.2.3 From be1cd11312eafee912cb42b38de404a3b65ce106 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 4 May 2004 19:44:06 +0000 Subject: Merge the new release from HEAD --- access.c | 2 +- auth.c | 2 +- chooser.c | 2 +- config/Xaccess | 2 +- dm.h | 2 +- genauth.c | 2 +- greeter/verify.c | 3 ++- resource.c | 2 +- session.c | 2 +- socket.c | 2 +- util.c | 2 +- xdm.man.cpp | 2 +- xdmcp.c | 2 +- 13 files changed, 14 insertions(+), 13 deletions(-) diff --git a/access.c b/access.c index 0e612a1..8a667bc 100644 --- a/access.c +++ b/access.c @@ -1,5 +1,5 @@ /* - * $XdotOrg$ + * $XdotOrg: xc/programs/xdm/access.c,v 1.2 2004/04/23 19:54:42 eich Exp $ * $Xorg: access.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group diff --git a/auth.c b/auth.c index 22a7ba1..5f9df4c 100644 --- a/auth.c +++ b/auth.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/xdm/auth.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ +/* $XdotOrg: xc/programs/xdm/auth.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: auth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* diff --git a/chooser.c b/chooser.c index 7d30e10..55f2eb4 100644 --- a/chooser.c +++ b/chooser.c @@ -1,5 +1,5 @@ /* - * $XdotOrg$ + * $XdotOrg: xc/programs/xdm/chooser.c,v 1.2 2004/04/23 19:54:42 eich Exp $ * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group diff --git a/config/Xaccess b/config/Xaccess index 580409c..eca6952 100644 --- a/config/Xaccess +++ b/config/Xaccess @@ -1,4 +1,4 @@ -# $XdotOrg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ +# $XdotOrg: xc/programs/xdm/config/Xaccess,v 1.2 2004/04/23 19:54:43 eich Exp $ # $Xorg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # $XFree86: xc/programs/xdm/config/Xaccess,v 1.4 2003/07/09 15:27:40 tsi Exp $ # diff --git a/dm.h b/dm.h index 96d35f3..0bcad1f 100644 --- a/dm.h +++ b/dm.h @@ -1,4 +1,4 @@ -/* $XdotOrg: dm.h,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/dm.h,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: dm.h,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* diff --git a/genauth.c b/genauth.c index 0b54b8d..14dc1b4 100644 --- a/genauth.c +++ b/genauth.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/xdm/genauth.c,v 1.1.4.5 2003/12/20 00:28:31 kaleb Exp $ */ +/* $XdotOrg: xc/programs/xdm/genauth.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: genauth.c,v 1.5 2001/02/09 02:05:40 xorgcvs Exp $ */ /* diff --git a/greeter/verify.c b/greeter/verify.c index d68b2ba..f3ff9a9 100644 --- a/greeter/verify.c +++ b/greeter/verify.c @@ -1,4 +1,5 @@ /* $Xorg: verify.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/greeter/verify.c,v 1.3 2004/04/24 23:28:17 alanc Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -343,7 +344,7 @@ Verify (struct display *d, struct greet_info *greet, struct verify_info *verify) XFree(console); return 0; } - Xfree(console); + XFree(console); } else { diff --git a/resource.c b/resource.c index 1137c00..883f963 100644 --- a/resource.c +++ b/resource.c @@ -1,4 +1,4 @@ -/* $XdotOrg: resource.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/resource.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: resource.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* diff --git a/session.c b/session.c index 66d7696..86bb601 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/xdm/session.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ +/* $XdotOrg: xc/programs/xdm/session.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */ /* diff --git a/socket.c b/socket.c index a5a4dc7..cf5edf9 100644 --- a/socket.c +++ b/socket.c @@ -1,4 +1,4 @@ -/* $XdotOrg$ */ +/* $XdotOrg: xc/programs/xdm/socket.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* diff --git a/util.c b/util.c index cea100c..b60ddff 100644 --- a/util.c +++ b/util.c @@ -1,4 +1,4 @@ -/* $XdotOrg: util.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/xdm/util.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: util.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* diff --git a/xdm.man.cpp b/xdm.man.cpp index f37da82..f6d4f4e 100644 --- a/xdm.man.cpp +++ b/xdm.man.cpp @@ -1,4 +1,4 @@ -.\" $XdotOrg: xc/programs/xdm/xdm.man,v 1.1.4.3 2003/12/06 13:24:29 kaleb Exp $ +.\" $XdotOrg: xc/programs/xdm/xdm.man,v 1.2 2004/04/23 19:54:42 eich Exp $ .\" $Xorg: xdm.man,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" diff --git a/xdmcp.c b/xdmcp.c index ea273e4..f8c5bfc 100644 --- a/xdmcp.c +++ b/xdmcp.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/xdm/xdmcp.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */ +/* $XdotOrg: xc/programs/xdm/xdmcp.c,v 1.2 2004/04/23 19:54:42 eich Exp $ */ /* $Xorg: xdmcp.c,v 1.4 2001/02/09 02:05:41 xorgcvs Exp $ */ /* -- cgit v1.2.3