.gitignore | 4 COPYING | 175 +++++++++++++++++++++- Makefile.am | 17 +- README | 30 +++ access.c | 162 ++++++++++---------- acinclude.m4 | 32 +--- app-defaults/Chooser.ad | 2 auth.c | 317 +++++++++++++++++++++------------------- choose.c | 122 +++++++-------- chooser.c | 185 +++++++++++------------ config/GiveConsole | 1 config/Makefile.am | 5 config/README | 1 config/TakeConsole | 1 config/Xaccess | 3 config/Xreset.cpp | 4 config/Xresources.cpp | 2 config/Xservers.fs | 1 config/Xservers.ws.cpp | 1 config/Xsession.cpp | 3 config/Xsetup_0 | 1 config/Xstartup.cpp | 4 config/Xwilling | 1 config/xdm-config.cpp | 4 configure.ac | 83 ++++++++-- cpprules.in | 9 + daemon.c | 9 - dm.c | 154 ++++++++++--------- dm.h | 247 ++++++++++++++++--------------- dm_auth.h | 42 ++--- dm_error.h | 27 +-- dm_socket.h | 18 -- dpylist.c | 16 -- error.c | 120 +++++++-------- file.c | 13 - genauth.c | 89 +++++------ greet.h | 124 +++++++-------- greeter/Login.c | 300 +++++++++++++++++--------------------- greeter/Login.h | 83 +++++----- greeter/LoginP.h | 61 +++---- greeter/Makefile.am | 6 greeter/greet.c | 129 +++++++++------- greeter/verify.c | 110 ++++++-------- krb5auth.c | 4 mitauth.c | 10 - netaddr.c | 122 +++++++-------- policy.c | 45 ++--- prngc.c | 21 +- protodpy.c | 18 -- reset.c | 14 - resource.c | 150 +++++-------------- rpcauth.c | 14 - server.c | 41 ++--- session.c | 103 ++++++------- socket.c | 148 +++++++++--------- streams.c | 16 -- util.c | 76 ++++++--- xdm.man.cpp | 70 ++++---- xdmauth.c | 21 +- xdmcp.c | 375 ++++++++++++++++++++++-------------------------- xdmshell.c | 81 +--------- 61 files changed, 2046 insertions(+), 2001 deletions(-)
New commits: commit 6061722888eab858888dac2499194393299872e4 Author: Alan Coopersmith <[email protected]> Date: Fri Sep 18 15:31:50 2009 -0700 Version bump: 1.1.9 Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/configure.ac b/configure.ac index b0b4fea..b123a1f 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) -AC_INIT(xdm,[1.1.8],[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xdm) +AC_INIT(xdm,[1.1.9],[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xdm) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE commit c058aa698b6ddddd4c11608ca412b73d1ffd78d2 Author: Alan Coopersmith <[email protected]> Date: Thu Sep 17 19:41:10 2009 -0700 Fill in COPYING file Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/COPYING b/COPYING index 7f33cbf..b65badb 100644 --- a/COPYING +++ b/COPYING @@ -1,12 +1,171 @@ -This is a stub file. This package has not yet had its complete licensing -information compiled. Please see the individual source files for details on -your rights to use and modify this software. +Copyright 1988, 1989, 1990, 1991, 1994, 1998 The Open Group -Please submit updated COPYING files to the Xorg bugzilla: +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. -https://bugs.freedesktop.org/enter_bug.cgi?product=xorg +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. -All licensing questions regarding this software should be directed at the -Xorg mailing list: +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 +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. + + ------------------------------------------------------------ + +Copyright 1988, 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 +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. IN NO EVENT SHALL THE +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 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 copyright holder. + + ------------------------------------------------------------ + +Copyright 1998 by Thomas E. Dickey <[email protected]> + + All Rights Reserved + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +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. +IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + + ------------------------------------------------------------ + +Copyright 2006, 2009 Sun Microsystems, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL +INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING +FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +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 +of the copyright holder. + + ------------------------------------------------------------ + +md5 code in genauth.c 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. + + ------------------------------------------------------------ + +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. + + ------------------------------------------------------------ + +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. -http://lists.freedesktop.org/mailman/listinfo/xorg commit 3a87227bb357ac9523f853fca84ebde3129e2f05 Author: Alan Coopersmith <[email protected]> Date: Thu Sep 17 19:11:52 2009 -0700 Log errors when failing to make authentication dirs/files Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/auth.c b/auth.c index dc372a0..a2cd9d6 100644 --- a/auth.c +++ b/auth.c @@ -312,8 +312,16 @@ MakeServerAuthFile (struct display *d, FILE ** file) if ((statb.st_mode & 0077) != 0) (void) chmod(d->authFile, statb.st_mode & 0700); } else { - if (errno == ENOENT) + if (errno == ENOENT) { r = mkdir(d->authFile, 0700); + if (r < 0) { + LogError ("cannot make authentication directory %s: " + "%s\n", d->authFile, _SysErrorMsg (errno)); + } + } else { + LogError ("cannot access authentication directory %s: " + "%s\n", d->authFile, _SysErrorMsg (errno)); + } if (r < 0) { free (d->authFile); d->authFile = NULL; @@ -324,6 +332,8 @@ MakeServerAuthFile (struct display *d, FILE ** file) authDir, authdir1, authdir2); r = mkdir(d->authFile, 0700); if (r < 0 && errno != EEXIST) { + LogError ("cannot make authentication directory %s: %s\n", + d->authFile, _SysErrorMsg (errno)); free (d->authFile); d->authFile = NULL; return FALSE; @@ -333,6 +343,8 @@ MakeServerAuthFile (struct display *d, FILE ** file) #ifdef HAS_MKSTEMP fd = mkstemp (d->authFile); if (fd < 0) { + LogError ("cannot make authentication file %s: %s\n", + d->authFile, _SysErrorMsg (errno)); free (d->authFile); d->authFile = NULL; return FALSE; commit da3cfcdd197bd900633c563412685315316804f4 Author: Alan Coopersmith <[email protected]> Date: Thu Sep 17 18:33:54 2009 -0700 Refactor & constify error logging code Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/dm_error.h b/dm_error.h index e32ba0b..739da7b 100644 --- a/dm_error.h +++ b/dm_error.h @@ -40,13 +40,13 @@ authorization. # define GCC_PRINTFLIKE(fmt,var) /*nothing*/ # endif -extern void Debug (char * fmt, ...) GCC_PRINTFLIKE(1,2); +extern void Debug (const char * fmt, ...) GCC_PRINTFLIKE(1,2); extern void InitErrorLog (void); -extern void LogAppend (char * fmt, ...) GCC_PRINTFLIKE(1,2); -extern void LogError (char * fmt, ...) GCC_PRINTFLIKE(1,2); -extern void LogInfo (char * fmt, ...) GCC_PRINTFLIKE(1,2); -extern void LogOutOfMem (char * fmt, ...) GCC_PRINTFLIKE(1,2); -extern void LogPanic (char * fmt, ...) GCC_PRINTFLIKE(1,2); +extern void LogAppend (const char * fmt, ...) GCC_PRINTFLIKE(1,2); +extern void LogError (const char * fmt, ...) GCC_PRINTFLIKE(1,2); +extern void LogInfo (const char * fmt, ...) GCC_PRINTFLIKE(1,2); +extern void LogOutOfMem (const char * fmt, ...) GCC_PRINTFLIKE(1,2); +extern void LogPanic (const char * fmt, ...) GCC_PRINTFLIKE(1,2); #endif /* _DM_ERROR_H_ */ diff --git a/error.c b/error.c index f1cb951..d1bd16e 100644 --- a/error.c +++ b/error.c @@ -42,70 +42,63 @@ from The Open Group. #include "dm.h" #include "dm_error.h" -#define WRITES(fd, buf) write(fd, buf, strlen(buf)) - -/* Append more text to the log without a new header, right after - having called LogInfo or LogError */ -void LogAppend(char * fmt, ...) +/* This function does the actual log message writes. */ +static inline void +LogVWrite(const char *fmt, va_list args) { char buf[1024]; + int len; - { - va_list args; - va_start(args, fmt); - vsnprintf (buf, sizeof buf, fmt, args); - va_end(args); + len = vsnprintf (buf, sizeof(buf), fmt, args); + if (len >= sizeof(buf)) { + len = sizeof(buf) - 1; } - WRITES(STDERR_FILENO, buf); + write(STDERR_FILENO, buf, len); } -void LogInfo(char * fmt, ...) -{ - char buf[1024]; +#define LogVarArgsWrite(fmt) \ + do { \ + va_list args; \ + va_start(args, fmt); \ + LogVWrite(fmt, args); \ + va_end(args); \ + } while(0) - snprintf(buf, sizeof buf, "xdm info (pid %ld): ", (long)getpid()); - WRITES(STDERR_FILENO, buf); - { - va_list args; - va_start(args, fmt); - vsnprintf (buf, sizeof buf, fmt, args); - va_end(args); - } - WRITES(STDERR_FILENO, buf); -} +#define LogHeader(type) \ + LogAppend("xdm %s (pid %ld): ", type, (long)getpid()) -void LogError (char * fmt, ...) +/* Append more text to the log without a new header, right after + having called LogInfo or LogError */ +void +LogAppend(const char * fmt, ...) { - char buf[1024]; + LogVarArgsWrite(fmt); +} - snprintf (buf, sizeof buf, "xdm error (pid %ld): ", (long)getpid()); - WRITES(STDERR_FILENO, buf); - { - va_list args; - va_start(args, fmt); - vsnprintf (buf, sizeof buf, fmt, args); - va_end(args); - } - WRITES(STDERR_FILENO, buf); +void +LogInfo(const char * fmt, ...) +{ + LogHeader("info"); + LogVarArgsWrite(fmt); } -void LogPanic (char * fmt, ...) +void +LogError (const char * fmt, ...) { - char buf[1024]; + LogHeader("error"); + LogVarArgsWrite(fmt); +} - snprintf (buf, sizeof buf, "xdm panic (pid %ld): ", (long)getpid()); - WRITES(STDERR_FILENO, buf); - { - va_list args; - va_start(args, fmt); - vsnprintf (buf, sizeof buf, fmt, args); - va_end(args); - } - WRITES(STDERR_FILENO, buf); +void +LogPanic (const char * fmt, ...) +{ + LogHeader("panic"); + LogVarArgsWrite(fmt); _exit (1); } -void LogOutOfMem (char * fmt, ...) +void +LogOutOfMem (const char * fmt, ...) { fprintf (stderr, "xdm: out of memory in routine "); { @@ -117,31 +110,29 @@ void LogOutOfMem (char * fmt, ...) fflush (stderr); } -void Debug (char * fmt, ...) +void +Debug (const char * fmt, ...) { char buf[1024]; if (debugLevel > 0) { - va_list args; - va_start(args, fmt); - vsnprintf (buf, sizeof buf, fmt, args); - va_end(args); - WRITES(STDOUT_FILENO, buf); + LogVarArgsWrite(fmt); } } -void InitErrorLog (void) +void +InitErrorLog (void) { - int i; - if (errorLogFile[0]) { - i = creat (errorLogFile, 0666); - if (i != -1) { - if (i != 2) { - dup2 (i, 2); - close (i); - } - } else - LogError ("Cannot open errorLogFile %s\n", errorLogFile); - } + int i; + if (errorLogFile[0]) { + i = creat (errorLogFile, 0666); + if (i != -1) { + if (i != STDERR_FILENO) { + dup2 (i, STDERR_FILENO); + close (i); + } + } else + LogError ("Cannot open errorLogFile %s\n", errorLogFile); + } } diff --git a/greet.h b/greet.h index ca6ee73..bf3ddd1 100644 --- a/greet.h +++ b/greet.h @@ -54,13 +54,13 @@ from The Open Group. struct dlfuncs { int (*_PingServer)(struct display *d, Display *alternateDpy); void (*_SessionPingFailed)(struct display *d); - void (*_Debug)(char * fmt, ...); + void (*_Debug)(const 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 (*_LogError)(const char * fmt, ...); void (*_SessionExit)(struct display *d, int status, int removeAuth); void (*_DeleteXloginResources)(struct display *d, Display *dpy); int (*_source)(char **environ, char *file); @@ -70,7 +70,7 @@ struct dlfuncs { char **(*_parseArgs)(char **argv, char *string); void (*_printEnv)(char **e); char **(*_systemEnv)(struct display *d, char *user, char *home); - void (*_LogOutOfMem)(char * fmt, ...); + void (*_LogOutOfMem)(const char * fmt, ...); SETGRENT_TYPE (*_setgrent)(void); /* no longer used */ struct group *(*_getgrent)(void); /* no longer used */ void (*_endgrent)(void); /* no longer used */ @@ -138,13 +138,13 @@ typedef greet_user_rtn (*GreetUserProc)(struct display *, Display **, 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_Debug)(const 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_LogError)(const 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); @@ -154,7 +154,7 @@ 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_LogOutOfMem)(const char * fmt, ...); extern void (*__xdm_setgrent)(void); extern struct group *(*__xdm_getgrent)(void); extern void (*__xdm_endgrent)(void); diff --git a/greeter/greet.c b/greeter/greet.c index a4e799c..17d21c8 100644 --- a/greeter/greet.c +++ b/greeter/greet.c @@ -105,13 +105,13 @@ extern int getdomainname(char *name, size_t len); int (*__xdm_PingServer)(struct display *d, Display *alternateDpy) = NULL; void (*__xdm_SessionPingFailed)(struct display *d) = NULL; -void (*__xdm_Debug)(char * fmt, ...) = NULL; +void (*__xdm_Debug)(const 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_LogError)(const 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; @@ -121,7 +121,7 @@ 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_LogOutOfMem)(const char * fmt, ...) = NULL; void (*__xdm_setgrent)(void) = NULL; struct group *(*__xdm_getgrent)(void) = NULL; void (*__xdm_endgrent)(void) = NULL; commit a7e166298a94c012420713dbfcd0b1628f5c7062 Author: Alan Coopersmith <[email protected]> Date: Thu Sep 17 18:08:06 2009 -0700 Unrecognized argument errors shouldn't print xdm error header repeatedly Add LogAppend function to append to previous LogError/LogInfo without repeating the xdm error message header. Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/dm_error.h b/dm_error.h index d1f749d..e32ba0b 100644 --- a/dm_error.h +++ b/dm_error.h @@ -42,6 +42,7 @@ authorization. extern void Debug (char * fmt, ...) GCC_PRINTFLIKE(1,2); extern void InitErrorLog (void); +extern void LogAppend (char * fmt, ...) GCC_PRINTFLIKE(1,2); extern void LogError (char * fmt, ...) GCC_PRINTFLIKE(1,2); extern void LogInfo (char * fmt, ...) GCC_PRINTFLIKE(1,2); extern void LogOutOfMem (char * fmt, ...) GCC_PRINTFLIKE(1,2); diff --git a/error.c b/error.c index 9b43420..f1cb951 100644 --- a/error.c +++ b/error.c @@ -44,6 +44,21 @@ from The Open Group. #define WRITES(fd, buf) write(fd, buf, strlen(buf)) +/* Append more text to the log without a new header, right after + having called LogInfo or LogError */ +void LogAppend(char * fmt, ...) +{ + char buf[1024]; + + { + va_list args; + va_start(args, fmt); + vsnprintf (buf, sizeof buf, fmt, args); + va_end(args); + } + WRITES(STDERR_FILENO, buf); +} + void LogInfo(char * fmt, ...) { char buf[1024]; diff --git a/resource.c b/resource.c index 2ccfd4b..5c02da7 100644 --- a/resource.c +++ b/resource.c @@ -432,8 +432,8 @@ ReinitResources (void) { LogError ("extra arguments on command line:"); for (a = argv + 1; *a; a++) - LogError (" \"%s\"", *a); - LogError ("\n"); + LogAppend (" \"%s\"", *a); + LogAppend ("\n"); } free (argv); } commit e60cf4a084951e697516a6c26dcb5ad14e6f14b8 Author: Alan Coopersmith <[email protected]> Date: Fri Sep 11 10:40:05 2009 -0700 Replace -D_XOPEN_SOURCE & -D_BSD_SOURCE with AC_USE_SYSTEM_EXTENSIONS Signed-off-by: Alan Coopersmith <[email protected]> Acked-by: Julien Cristau <[email protected]> diff --git a/configure.ac b/configure.ac index 655eae6..b0b4fea 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ dnl dnl Process this file with autoconf to create configure. -AC_PREREQ([2.57]) +AC_PREREQ([2.60]) AC_INIT(xdm,[1.1.8],[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xdm) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE @@ -32,6 +32,7 @@ XORG_MACROS_VERSION(1.3) AM_CONFIG_HEADER(config.h) +AC_USE_SYSTEM_EXTENSIONS AC_PROG_CC AM_PROG_CC_C_O AC_C_INLINE @@ -135,7 +136,7 @@ fi case $host_os in linux*|gnu*|*-gnu) - OS_CFLAGS="-D_XOPEN_SOURCE -D_BSD_SOURCE" + OS_CFLAGS="" SU="su" ;; darwin*) @@ -454,7 +455,7 @@ AC_SUBST(XDMSHELL_LIBS) # Chooser # -CHOOSER_CFLAGS="-D_BSD_SOURCE $CHOOSER_CFLAGS $XDM_PRINT_CFLAGS $XLIB_CFLAGS $DMCP_CFLAGS $AUTH_CFLAGS" +CHOOSER_CFLAGS="$CHOOSER_CFLAGS $XDM_PRINT_CFLAGS $XLIB_CFLAGS $DMCP_CFLAGS $AUTH_CFLAGS" CHOOSER_LIBS="$CHOOSER_LIBS $XDM_PRINT_LIBS $DMCP_LIBS" AC_SUBST(CHOOSER_CFLAGS) commit 69fc0647bed461a19cf99f4d362a44df8c18de38 Author: Alan Coopersmith <[email protected]> Date: Fri Sep 11 09:15:31 2009 -0700 Add support for AM_SILENT_RULES for building files with cpp Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/Makefile.am b/Makefile.am index e90f7bd..1b21b9c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,7 +133,7 @@ CPP_FILES_FLAGS = $(MANDEFS) $(RANDOMMANDEFS) $(EXTRAMANDEFS) SUFFIXES += .$(APP_MAN_SUFFIX) .man.cpp .man.cpp.$(APP_MAN_SUFFIX): - $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ + $(cpp_verbose)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ # # xdmshell diff --git a/config/Makefile.am b/config/Makefile.am index 7682725..d13645f 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -59,4 +59,4 @@ CPP_FILES_FLAGS = -DBINDIR="$(bindir)" -DDEFAULTVT="$(DEFAULTVT)" \ -DSHELL_CMD="$(SHELL_CMD)" $(MKTEMP_DEFINES) Xservers.ws: $(srcdir)/Xservers.ws.cpp - $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/Xservers.ws.cpp | $(CPP_SED_MAGIC) > $@ + $(cpp_verbose)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/Xservers.ws.cpp | $(CPP_SED_MAGIC) > $@ diff --git a/configure.ac b/configure.ac index 6e05acc..655eae6 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,9 @@ XORG_PROG_RAWCPP XORG_DEFAULT_OPTIONS XORG_WITH_LINT +m4_ifdef([AM_SILENT_RULES],[HAVE_AM_SILENT_RULES=yes]) +AM_CONDITIONAL(HAVE_AM_SILENT_RULES, test x$HAVE_AM_SILENT_RULES != x) + XDM_CFLAGS="$XDM_CFLAGS" GREETER_CFLAGS="$GREETER_CFLAGS" CHOOSER_CFLAGS="$CHOOSER_CFLAGS" diff --git a/cpprules.in b/cpprules.in index 09b7567..eb7ef5e 100644 --- a/cpprules.in +++ b/cpprules.in @@ -22,5 +22,12 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ -e '/^[ ]*XHASH/s/XHASH/\#/' \ -e '/\...@\@$$/s/\...@\@$$/\\/' +if HAVE_AM_SILENT_RULES +# Support for automake 1.11 AM_SILENT_RULES +cpp_verbose = $(cpp_verbose_$(V)) +cpp_verbose_ = $(cpp_verbose_$(AM_DEFAULT_VERBOSITY)) +cpp_verbose_0 = @echo " CPP " $@; +endif HAVE_AM_SILENT_RULES + .cpp: - $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ + $(cpp_verbose)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ commit 3d51edf9d96f8adcb6f2ab50f4960aa9ecc76afe Author: Alan Coopersmith <[email protected]> Date: Fri Sep 11 08:31:55 2009 -0700 Update to using xorg-macros 1.3, including XORG_DEFAULT_OPTIONS Also move CWARNFLAGS addition to CFLAGS from configure.ac to Makefile.am's Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/Makefile.am b/Makefile.am index 09c57f4..e90f7bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,8 @@ bin_PROGRAMS = xdm xdmshell xdmlibdir = $(XDMLIBDIR) xdmlib_PROGRAMS = chooser +AM_CFLAGS = $(CWARNFLAGS) + # # xdm # @@ -174,7 +176,7 @@ EXTRA_DIST += $(APPDEFAULTFILES:%=%.ad) if LINT ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) + $(AM_CPPFLAGS) $(CPPFLAGS) lint: $(LINT) $(ALL_LINT_FLAGS) $(xdm_CFLAGS) $(xdm_SOURCES) $(xdm_LDADD) diff --git a/configure.ac b/configure.ac index fb46901..6e05acc 100644 --- a/configure.ac +++ b/configure.ac @@ -26,9 +26,9 @@ AC_INIT(xdm,[1.1.8],[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xd AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE -# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG +# Require xorg-macros: XORG_DEFAULT_OPTIONS, XORG_CWARNFLAGS, XORG_CHANGELOG m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])]) -XORG_MACROS_VERSION(1.2) +XORG_MACROS_VERSION(1.3) AM_CONFIG_HEADER(config.h) @@ -40,11 +40,12 @@ AM_PROG_LIBTOOL AC_PROG_INSTALL XORG_PROG_RAWCPP -XORG_CWARNFLAGS +XORG_DEFAULT_OPTIONS +XORG_WITH_LINT -XDM_CFLAGS="$CWARNFLAGS $XDM_CFLAGS" -GREETER_CFLAGS="$CWARNFLAGS $GREETER_CFLAGS" -CHOOSER_CFLAGS="$CWARNFLAGS $CHOOSER_CFLAGS" +XDM_CFLAGS="$XDM_CFLAGS" +GREETER_CFLAGS="$GREETER_CFLAGS" +CHOOSER_CFLAGS="$CHOOSER_CFLAGS" # Check for mktemp to prevent security issue noted in Xorg bug #5898 # See https://bugs.freedesktop.org/show_bug.cgi?id=5898 for details. @@ -581,9 +582,4 @@ AC_SUBST(appdefaultdir) AC_SUBST(MKTEMP_COMMAND) -XORG_WITH_LINT -XORG_MANPAGE_SECTIONS -XORG_RELEASE_VERSION -XORG_CHANGELOG - AC_OUTPUT([Makefile config/Makefile greeter/Makefile]) diff --git a/greeter/Makefile.am b/greeter/Makefile.am index f5ceaac..70fa5df 100644 --- a/greeter/Makefile.am +++ b/greeter/Makefile.am @@ -1,4 +1,3 @@ - if DYNAMIC_GREETER xdmlibdir = $(XDMLIBDIR) @@ -11,14 +10,14 @@ libXdmGreet_la_SOURCES = \ libXdmGreet_la_LIBADD = $(XDMGREET_LIBS) -AM_CFLAGS = $(XDMGREET_CFLAGS) -I$(top_srcdir) +AM_CFLAGS = $(CWARNFLAGS) $(XDMGREET_CFLAGS) -I$(top_srcdir) libXdmGreet_la_LDFLAGS = -module -avoid-version endif if LINT ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) + $(AM_CPPFLAGS) $(CPPFLAGS) lint: $(LINT) $(ALL_LINT_FLAGS) $(libXdmGreet_la_SOURCES) commit a57a7be5962f6f9536ab97751b177575a4884bd0 Author: Alan Coopersmith <[email protected]> Date: Tue Aug 18 21:03:54 2009 -0700 Treat all 127.0.0.0/8 addresses as localhost Similar fix to http://bugs.freedesktop.org/show_bug.cgi?id=23329 Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/auth.c b/auth.c index 38191f8..dc372a0 100644 --- a/auth.c +++ b/auth.c @@ -731,9 +731,7 @@ DefineSelf(int fd, FILE *file, Xauth *auth) * 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) + if (family == FamilyInternet && len == 4 && addr[0] == 127) { Debug ("Skipping localhost address\n"); continue; commit a9040b281062ddabcfb2cfdfc37e431b047531b2 Author: Alan Coopersmith <[email protected]> Date: Wed Jul 29 11:16:29 2009 -0700 Set utmp/wtmp paths via configure instead of hardcoding them Signed-off-by: Alan Coopersmith <[email protected]> diff --git a/config/Makefile.am b/config/Makefile.am index 86eb0b3..7682725 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -50,6 +50,7 @@ MKTEMP_DEFINES = -DMKTEMP_COMMAND=$(MKTEMP_COMMAND) #endif CPP_FILES_FLAGS = -DBINDIR="$(bindir)" -DDEFAULTVT="$(DEFAULTVT)" \ + -DUTMP_FILE="$(UTMP_FILE)" -DWTMP_FILE="$(WTMP_FILE)" \ -DXDMDIR="$(XDMLIBDIR)" -DXDMLOGDIR="$(XDMLOGDIR)" \ -DXDMXAUTHDIR="$(XDMXAUTHDIR)" \ -DXDMPIDDIR="$(XDMPIDDIR)" -DXDMCONFIGDIR="$(XDMCONFIGDIR)" \ diff --git a/config/Xreset.cpp b/config/Xreset.cpp index d64df0d..321cd89 100644 --- a/config/Xreset.cpp +++ b/config/Xreset.cpp @@ -1,5 +1,5 @@ XCOMM!/bin/sh XCOMM Deregister a login. (Derived from TakeConsole as follows:) XCOMM -BINDIR/sessreg -d -w "/var/log/wtmp" -u "/var/run/utmp" \ +BINDIR/sessreg -d -w WTMP_FILE -u UTMP_FILE \ -x XDMCONFIGDIR/Xservers -l $DISPLAY -h "" $USER diff --git a/config/Xstartup.cpp b/config/Xstartup.cpp index 3d513f6..d837359 100644 --- a/config/Xstartup.cpp +++ b/config/Xstartup.cpp @@ -1,5 +1,5 @@ XCOMM!/bin/sh XCOMM Register a login (derived from GiveConsole as follows:) XCOMM -BINDIR/sessreg -a -w "/var/log/wtmp" -u "/var/run/utmp" \ +BINDIR/sessreg -a -w WTMP_FILE -u UTMP_FILE \ -x XDMCONFIGDIR/Xservers -l $DISPLAY -h "" $USER diff --git a/configure.ac b/configure.ac index 19b3c26..fb46901 100644 --- a/configure.ac +++ b/configure.ac @@ -236,6 +236,46 @@ AC_ARG_WITH(config-type, [SERVERSTYPE="$withval"], [SERVERSTYPE="ws"]) AC_SUBST(SERVERSTYPE) +# Ideally we'd just pull out UTMP_FILE & WTMP_FILE from <utmp.h> +# but that's not easy to do in autoconf +AC_ARG_WITH(utmp_file, + AC_HELP_STRING([--with-utmp-file=<pathname>], + [specify file to pass to sessreg -u for current logins]), + [UTMP_FILE="$withval"]) +if test "x$UTMP_FILE" = "xyes" ; then + AC_MSG_ERROR([path was not specified to --with-utmp-file]) +fi +if test "x$UTMP_FILE" = "x" ; then + for UTMP_FILE in /var/adm/utmpx /var/run/utmp /var/log/utmp /var/adm/utmp /usr/adm/utmp /etc/utmp ; do + AC_CHECK_FILE([$UTMP_FILE], [break], [UTMP_FILE=""]) + done + if test "x$UTMP_FILE" = "x" ; then + UTMP_FILE="/var/run/utmp" + fi +fi +AC_MSG_CHECKING([for path to file listing current logins for sessreg]) +AC_MSG_RESULT([$UTMP_FILE]) +AC_SUBST(UTMP_FILE) + +AC_ARG_WITH(wtmp_file, + AC_HELP_STRING([--with-wtmp-file=<pathname>], + [specify file to pass to sessreg -w for login history]), + [WTMP_FILE="$withval"]) +if test "x$WTMP_FILE" = "xyes" ; then + AC_MSG_ERROR([path was not specified to --with-wtmp-file]) +fi +if test "x$WTMP_FILE" = "x" ; then + for WTMP_FILE in /var/adm/wtmpx /var/log/wtmp /var/adm/wtmp /usr/adm/wtmp /etc/wtmp ; do + AC_CHECK_FILE([$WTMP_FILE], [break], [WTMP_FILE=""]) + done + if test "x$WTMP_FILE" = "x" ; then + WTMP_FILE="/var/log/wtmp" + fi +fi +AC_MSG_CHECKING([for path to file listing login history for sessreg]) -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

