From c8e6129f3b26a261264f0dfd9b932c88dae1f09e Mon Sep 17 00:00:00 2001 From: George Lebl Date: Tue, 3 Jul 2001 09:13:33 +0000 Subject: Hosts,Broadcast were in the wrong section Tue Jul 03 02:14:41 2001 George Lebl * daemon/gdm.h: Hosts,Broadcast were in the wrong section * daemon/xdmcp.c: check for current displays BEFORE we check the number of pending and allocate a new display, this way we'll remove it if it itself has been pending, also don't just dispose, the display may be already managed, in which case we want to unmanage it to avoid a process leak. * gdm.spec.in: fix pam prefix stuff and file listing * config/Makefile.am: fix pam installation stuff --- ChangeLog | 14 +++++++++ NEWS | 7 +++-- config/Makefile.am | 12 ++++---- daemon/gdm.h | 4 +-- daemon/xdmcp.c | 87 ++++++++++++++++++++++++++++++++++-------------------- gdm.spec.in | 10 +++++-- 6 files changed, 89 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index dfe3f6ea..d31efb46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Tue Jul 03 02:14:41 2001 George Lebl + + * daemon/gdm.h: Hosts,Broadcast were in the wrong section + + * daemon/xdmcp.c: check for current displays BEFORE we check the + number of pending and allocate a new display, this way we'll remove + it if it itself has been pending, also don't just dispose, the + display may be already managed, in which case we want to unmanage + it to avoid a process leak. + + * gdm.spec.in: fix pam prefix stuff and file listing + + * config/Makefile.am: fix pam installation stuff + Mon Jul 02 14:36:57 2001 George Lebl * gui/gdmlogin.c: In remote (xdmcp) mode, allow killing of the diff --git a/NEWS b/NEWS index 8542ff0e..e7e91011 100644 --- a/NEWS +++ b/NEWS @@ -22,8 +22,11 @@ Ahh news... - An option to always restart server rather then just reinitializing it when a user logs out -- Now handles (at least in XFree86 3 case for sure) busy server by notifying - the user instead of treating it as a server crash +- XDMCP login box has a "Quit" menu item which kills the connection, + useful if you chose a box you don't know the login to. + +- Now handles busy server by notifying the user instead of treating it + as a server crash - Docs and configurator up to date to all new configuration keys (Trevor Curtis, me) diff --git a/config/Makefile.am b/config/Makefile.am index 53a99864..ff650eb2 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -107,14 +107,14 @@ install-data-hook: gdm.conf gnomerc Gnome system=`uname`; \ if test -f /usr/include/security/pam_appl.h; then \ - if test '!' -d $(sysconfdir)/pam.d; then \ - $(mkinstalldirs) $(sysconfdir)/pam.d; \ - chmod 755 $(sysconfdir)/pam.d; \ + if test '!' -d $(PAM_PREFIX)/pam.d; then \ + $(mkinstalldirs) $(PAM_PREFIX)/pam.d; \ + chmod 755 $(PAM_PREFIX)/pam.d; \ fi; \ - if test $$system = Linux && test '!' -f $(sysconfdir)/pam.d/gdm; then \ - $(INSTALL_DATA) gdm $(sysconfdir)/pam.d/gdm; \ + if test $$system = Linux && test '!' -f $(PAM_PREFIX)/pam.d/gdm; then \ + $(INSTALL_DATA) gdm $(PAM_PREFIX)/pam.d/gdm; \ fi; \ if test $$system = SunOS; then \ - echo "Please add PAM authentication for gdm in $(sysconfdir)/pam.conf!"; \ + echo "Please add PAM authentication for gdm in $(PAM_PREFIX)/pam.conf!"; \ fi; \ fi diff --git a/daemon/gdm.h b/daemon/gdm.h index 7d7b87bf..62501e1f 100644 --- a/daemon/gdm.h +++ b/daemon/gdm.h @@ -194,8 +194,8 @@ #define GDM_KEY_SCAN "chooser/ScanTime=3" #define GDM_KEY_HOST "chooser/DefaultHostImg=" EXPANDED_PIXMAPDIR "/nohost.png" #define GDM_KEY_HOSTDIR "chooser/HostImageDir=" EXPANDED_DATADIR "/hosts/" -#define GDM_KEY_HOSTS "xdmcp/Hosts=" -#define GDM_KEY_BROADCAST "xdmcp/Broadcast=true" +#define GDM_KEY_HOSTS "chooser/Hosts=" +#define GDM_KEY_BROADCAST "chooser/Broadcast=true" #define GDM_KEY_DEBUG "debug/Enable=false" diff --git a/daemon/xdmcp.c b/daemon/xdmcp.c index e521ac86..f24fb449 100644 --- a/daemon/xdmcp.c +++ b/daemon/xdmcp.c @@ -146,13 +146,13 @@ static void gdm_xdmcp_handle_manage (struct sockaddr_in *clnt_sa, gint len); static void gdm_xdmcp_handle_keepalive (struct sockaddr_in *clnt_sa, gint len); static void gdm_xdmcp_send_willing (struct sockaddr_in *clnt_sa); static void gdm_xdmcp_send_unwilling (struct sockaddr_in *clnt_sa, gint type); -static void gdm_xdmcp_send_accept (struct sockaddr_in *clnt_sa, gint displaynum); +static void gdm_xdmcp_send_accept (const char *hostname, struct sockaddr_in *clnt_sa, gint displaynum); static void gdm_xdmcp_send_decline (struct sockaddr_in *clnt_sa); static void gdm_xdmcp_send_refuse (struct sockaddr_in *clnt_sa, CARD32 sessid); static void gdm_xdmcp_send_failed (struct sockaddr_in *clnt_sa, CARD32 sessid); static void gdm_xdmcp_send_alive (struct sockaddr_in *clnt_sa, CARD32 sessid); static gboolean gdm_xdmcp_host_allow (struct sockaddr_in *cnlt_sa); -static GdmDisplay *gdm_xdmcp_display_alloc (struct sockaddr_in *, gint); +static GdmDisplay *gdm_xdmcp_display_alloc (const char *hostname, gint); static GdmDisplay *gdm_xdmcp_display_lookup (CARD32 sessid); static void gdm_xdmcp_display_dispose_check (const gchar *name); static void gdm_xdmcp_displays_check (void); @@ -788,6 +788,24 @@ gdm_xdmcp_send_unwilling (struct sockaddr_in *clnt_sa, gint type) XdmcpFlush (xdmcpfd, &buf, clnt_sa, (int)sizeof (struct sockaddr_in)); } +static char * +get_host_from_addr (struct sockaddr_in *clnt_sa) +{ + char *hostname; + struct hostent *he; + + /* Find client hostname */ + he = gethostbyaddr ((gchar *) &clnt_sa->sin_addr, + sizeof (struct in_addr), + AF_INET); + + if (he != NULL) { + hostname = g_strdup (he->h_name); + } else { + hostname = g_strdup (inet_ntoa (clnt_sa->sin_addr)); + } + return hostname; +} static void gdm_xdmcp_handle_request (struct sockaddr_in *clnt_sa, gint len) @@ -902,14 +920,29 @@ gdm_xdmcp_handle_request (struct sockaddr_in *clnt_sa, gint len) gdm_debug ("gdm_xdmcp_handle_request: pending=%d, MaxPending=%d, sessions=%d, MaxSessions=%d", pending, GdmMaxPending, sessions, GdmMaxSessions); - + /* Check if ok to manage display */ if (mitauth && - pending < GdmMaxPending && - sessions < GdmMaxSessions) - gdm_xdmcp_send_accept (clnt_sa, clnt_dspnum); - else - gdm_xdmcp_send_decline (clnt_sa); + sessions < GdmMaxSessions) { + char *disp; + char *hostname = get_host_from_addr (clnt_sa); + disp = g_strdup_printf ("%s:%d", hostname, clnt_dspnum); + + /* Check if we are already talking to this host */ + gdm_xdmcp_display_dispose_check (disp); + g_free (disp); + + if (pending >= GdmMaxPending) { + gdm_debug ("gdm_xdmcp_handle_request: maximum pending"); + gdm_xdmcp_send_decline (clnt_sa); + } else { + gdm_xdmcp_send_accept (hostname, clnt_sa, clnt_dspnum); + } + + g_free (hostname); + } else { + gdm_xdmcp_send_decline (clnt_sa); + } XdmcpDisposeARRAY8 (&clnt_authname); XdmcpDisposeARRAY8 (&clnt_authdata); @@ -921,7 +954,9 @@ gdm_xdmcp_handle_request (struct sockaddr_in *clnt_sa, gint len) static void -gdm_xdmcp_send_accept (struct sockaddr_in *clnt_sa, gint displaynum) +gdm_xdmcp_send_accept (const char *hostname, + struct sockaddr_in *clnt_sa, + gint displaynum) { XdmcpHeader header; ARRAY8 authentype; @@ -930,7 +965,7 @@ gdm_xdmcp_send_accept (struct sockaddr_in *clnt_sa, gint displaynum) ARRAY8 authdata; GdmDisplay *d; - d = gdm_xdmcp_display_alloc (clnt_sa, displaynum); + d = gdm_xdmcp_display_alloc (hostname, displaynum); authentype.data = (CARD8 *) 0; authentype.length = (CARD16) 0; @@ -1086,7 +1121,7 @@ gdm_xdmcp_handle_manage (struct sockaddr_in *clnt_sa, gint len) d->dispstat = XDMCP_MANAGED; sessions++; pending--; - + /* Start greeter/session */ if (!gdm_display_manage (d)) { gdm_xdmcp_send_failed (clnt_sa, clnt_sessid); @@ -1224,10 +1259,9 @@ gdm_xdmcp_host_allow (struct sockaddr_in *clnt_sa) static GdmDisplay * -gdm_xdmcp_display_alloc (struct sockaddr_in *clnt_sa, gint displaynum) +gdm_xdmcp_display_alloc (const char *hostname, gint displaynum) { GdmDisplay *d = NULL; - struct hostent *client_he = NULL; d = g_new0 (GdmDisplay, 1); d->authfile = NULL; @@ -1254,24 +1288,9 @@ gdm_xdmcp_display_alloc (struct sockaddr_in *clnt_sa, gint displaynum) d->timed_login_ok = FALSE; } - /* Find client hostname */ - client_he = gethostbyaddr ((gchar *) &clnt_sa->sin_addr, - sizeof (struct in_addr), - AF_INET); - - if (client_he) { - d->name = g_strdup_printf ("%s:%d", client_he->h_name, - displaynum); - d->hostname = g_strdup (client_he->h_name); - } - else { - d->name = g_strdup_printf ("%s:%d", inet_ntoa (clnt_sa->sin_addr), - displaynum); - d->hostname = g_strdup (inet_ntoa (clnt_sa->sin_addr)); - } - - /* Check if we are already talking to this host */ - gdm_xdmcp_display_dispose_check (d->name); + d->name = g_strdup_printf ("%s:%d", hostname, + displaynum); + d->hostname = g_strdup (hostname); /* Secure display with cookie */ if (! gdm_auth_secure_display (d)) @@ -1325,8 +1344,12 @@ gdm_xdmcp_display_dispose_check (const gchar *name) GdmDisplay *d = dlist->data; if (d != NULL && + d->type == TYPE_XDMCP && strcmp (d->name, name) == 0) { - gdm_display_dispose (d); + if (d->dispstat == XDMCP_MANAGED) + gdm_display_unmanage (d); + else + gdm_display_dispose (d); /* restart as the list is now fucked */ dlist = displays; diff --git a/gdm.spec.in b/gdm.spec.in index 05e6be92..7fad201a 100644 --- a/gdm.spec.in +++ b/gdm.spec.in @@ -28,7 +28,7 @@ several different X sessions on your local machine at the same time. CFLAGS="-g $RPM_OPT_FLAGS" ./configure --localstatedir=%{localstatedir} \ --prefix=%{_prefix} --sysconfdir=%{sysconfdir}/X11 \ --bindir=%{_bindir} --datadir=%{_datadir} --sbindir=%{_sbindir} \ - --enable-console-helper --with-pam-prefix=/etc + --enable-console-helper --with-pam-prefix=%{sysconfdir} make @@ -43,7 +43,7 @@ make sysconfdir=$RPM_BUILD_ROOT%{sysconfdir}/X11 \ datadir=$RPM_BUILD_ROOT%{_datadir} \ localstatedir=$RPM_BUILD_ROOT%{localstatedir} \ sbindir=$RPM_BUILD_ROOT%{_sbindir} \ - PAM_PREFIX=$RPM_BUILD_ROOT%/etc \ + PAM_PREFIX=$RPM_BUILD_ROOT%{sysconfdir} \ install @@ -85,12 +85,13 @@ exit 0 %{_sbindir}/* %config %{sysconfdir}/pam.d/* %config %{sysconfdir}/X11/* -%config %{sysconfdir}/gdm +%config %{sysconfdir}/security/console.apps/* %{_datadir}/pixmaps/* %{_datadir}/gdm %{_datadir}/gnome/apps/*/* %{_datadir}/gnome/help/* %{_datadir}/omf/gdm +%{_datadir}/locale/*/*/* # %config %{sysconfdir}/security/console.apps/gdmconfig # %config %{sysconfdir}/X11/gdm/gnomerc # %config %{sysconfdir}/X11/gdm/gdm.conf @@ -111,6 +112,9 @@ exit 0 %changelog +* Sun Jul 01 2001 George Lebl +- Fixed file listing + * Sun May 24 2001 George Lebl - Hmmm, simplified the file listing, dunno why normally people list things file by file/dir by dir, but the old file list was out of date -- cgit v1.2.1