Package: gdm
Version: 2.6.0.8-2
Severity: wishlist
Tags: patch

Hello,

  Some very large institutions use gdm, so for them the face listing is
  pretty unusable. However, some of them can configure very easily each
  post so that gdm displays only the usual users of the computers (let's
  say all the people in the same office). This requires a very simple
  option (IncludeOnly) which works rather like Exclude, but in reverse.
  I made such a patch for 2.6.0.8-1 (included). This patch has been
  tested only on i386 and I did not make patches for documentation,
  since it was not included.

  Please consider this patch for inclusion.

Jean-Christophe Dubacq

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (499, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages gdm depends on:
ii  adduser              3.67.0              Add and remove users and groups
ii  debconf              1.4.58              Debian configuration management sy
ii  dpkg                 1.13.11             package maintenance system for Deb
ii  gksu                 1.3.4-1             graphical frontend to su
ii  gnome-session        2.10.0-7            The GNOME 2 Session Manager
ii  gnome-terminal [x-te 2.10.0-2            The GNOME 2 terminal emulator appl
ii  libart-2.0-2         2.3.17-1            Library of functions for 2D graphi
ii  libatk1.0-0          1.10.1-2            The ATK accessibility toolkit
ii  libattr1             2.4.21-1.0.1        Extended attribute shared library
ii  libbonobo2-0         2.10.0-1            Bonobo CORBA interfaces library
ii  libbonoboui2-0       2.10.0-1            The Bonobo UI library
ii  libc6                2.3.5-6             GNU C Library: Shared libraries an
ii  libgconf2-4          2.10.1-2            GNOME configuration database syste
ii  libglade2-0          1:2.5.1-2           library to load .glade files at ru
ii  libglib2.0-0         2.8.0-1             The GLib library of C routines
ii  libgnome2-0          2.10.1-1            The GNOME 2 library - runtime file
ii  libgnomecanvas2-0    2.10.2-2            A powerful object-oriented display
ii  libgnomeui-0         2.10.1-1            The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0       2.10.1-5            The GNOME virtual file-system libr
ii  libgtk2.0-0          2.6.10-1            The GTK+ graphical user interface 
ii  libice6              6.8.2.dfsg.1-6      Inter-Client Exchange library
ii  liborbit2            1:2.12.2-3          libraries for ORBit2 - a CORBA ORB
ii  libpam-modules       0.76-23             Pluggable Authentication Modules f
ii  libpam-runtime       0.76-23             Runtime support for the PAM librar
ii  libpam0g             0.76-23             Pluggable Authentication Modules l
ii  libpango1.0-0        1.8.2-1             Layout and rendering of internatio
ii  libpopt0             1.7-5               lib for parsing cmdline parameters
ii  librsvg2-2           2.9.5-4             SAX-based renderer library for SVG
ii  libselinux1          1.24-4              SELinux shared libraries
ii  libsm6               6.8.2.dfsg.1-6      X Window System Session Management
ii  libx11-6             6.8.2.dfsg.1-6      X Window System protocol client li
ii  libxau6              6.8.2.dfsg.1-6      X Authentication library
ii  libxext6             6.8.2.dfsg.1-6      X Window System miscellaneous exte
ii  libxi6               6.8.2.dfsg.1-6      X Window System Input extension li
ii  libxml2              2.6.21-1            GNOME XML library
ii  metacity [x-window-m 1:2.10.3-2          A lightweight GTK2 based Window Ma
ii  sawfish [x-window-ma 1:1.3+cvs20050709-4 a window manager for X11
ii  twm [x-window-manage 6.8.2.dfsg.1-6      Tab window manager
ii  xbase-clients        6.8.2.dfsg.1-6      miscellaneous X clients
ii  xlibs                6.8.2.dfsg.1-6      X Window System client libraries m
ii  xterm [x-terminal-em 6.8.2.dfsg.1-6      X terminal emulator
ii  zlib1g               1:1.2.3-4           compression library - runtime

Versions of packages gdm recommends:
ii  dialog                    1.0-20050306-1 Displays user-friendly dialog boxe
ii  zenity                    2.10.0-2       Display graphical dialog boxes fro

-- debconf information:
  gdm/daemon_name: /usr/bin/gdm
* shared/default-x-display-manager: gdm
diff -ru gdm-2.6.0.8-orig/daemon/gdm.h gdm-2.6.0.8/daemon/gdm.h
--- gdm-2.6.0.8-orig/daemon/gdm.h	2005-09-10 10:37:25.000000000 +0200
+++ gdm-2.6.0.8/daemon/gdm.h	2005-09-10 10:51:30.000000000 +0200
@@ -227,6 +227,7 @@
 
 #define GDM_KEY_BROWSER "greeter/Browser=false"
 #define GDM_KEY_EXCLUDE "greeter/Exclude=bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm,nfsnobody,pcap"
+#define GDM_KEY_INCLUDEONLY "greeter/IncludeOnly="
 #define GDM_KEY_MINIMALUID "greeter/MinimalUID=100"
 #define GDM_KEY_FACE "greeter/DefaultFace=" EXPANDED_PIXMAPDIR "/nobody.png"
 #define GDM_KEY_FACEDIR "greeter/GlobalFaceDir=" EXPANDED_DATADIR "/faces/"
diff -ru gdm-2.6.0.8-orig/debian/changelog gdm-2.6.0.8/debian/changelog
--- gdm-2.6.0.8-orig/debian/changelog	2005-09-10 10:37:25.000000000 +0200
+++ gdm-2.6.0.8/debian/changelog	2005-09-10 10:52:36.000000000 +0200
@@ -1,3 +1,9 @@
+gdm (2.6.0.8-2) unstable; urgency=low
+
+  * Add IncludeOnly functionality
+
+ -- Jean-Christophe Dubacq <[EMAIL PROTECTED]>  Sat, 10 Sep 2005 10:52:16 +0200
+
 gdm (2.6.0.8-1) unstable; urgency=low
 
   * New upstream release (closes: #300738)
diff -ru gdm-2.6.0.8-orig/gui/gdmlogin.c gdm-2.6.0.8/gui/gdmlogin.c
--- gdm-2.6.0.8-orig/gui/gdmlogin.c	2005-09-10 10:37:25.000000000 +0200
+++ gdm-2.6.0.8/gui/gdmlogin.c	2005-09-10 10:51:30.000000000 +0200
@@ -113,6 +113,7 @@
 static gchar *GdmDefaultSession;
 static gchar *GdmLocaleFile;
 static gchar *GdmExclude;
+static gchar *GdmIncludeOnly;
 static int GdmMinimalUID;
 static gchar *GdmGlobalFaceDir;
 static gchar *GdmDefaultFace;
@@ -697,6 +698,7 @@
     GdmBackgroundRemoteOnlyColor = ve_config_get_bool (config, GDM_KEY_BACKGROUNDREMOTEONLYCOLOR);
     GdmGtkRC = ve_config_get_string (config, GDM_KEY_GTKRC);
     GdmExclude = ve_config_get_string (config, GDM_KEY_EXCLUDE);
+    GdmExclude = ve_config_get_string (config, GDM_KEY_INCLUDEONLY);
     GdmMinimalUID = ve_config_get_int (config, GDM_KEY_MINIMALUID);
     GdmGlobalFaceDir = ve_config_get_string (config, GDM_KEY_FACEDIR);
     GdmDefaultFace = ve_config_get_string (config, GDM_KEY_FACE);
@@ -3361,6 +3363,23 @@
 		g_strfreev (excludes);
 	}
 
+	if (GdmIncludeOnly != NULL &&
+	    GdmIncludeOnly[0] != '\0') {
+		char **includes;
+		gboolean notfound=TRUE;
+		includes = g_strsplit (GdmIncludeOnly, ",", 0);
+
+		for (i=0 ; includes[i] != NULL ; i++)  {
+			g_strstrip (includes[i]);
+			if (g_ascii_strcasecmp (includes[i],
+						pwent->pw_name) == 0) {
+				notfound=FALSE;
+			}
+		}
+		g_strfreev (includes);
+		return notfound;
+	}
+
 	return FALSE;
 }
 
diff -ru gdm-2.6.0.8-orig/gui/gdmsetup.c gdm-2.6.0.8/gui/gdmsetup.c
--- gdm-2.6.0.8-orig/gui/gdmsetup.c	2005-09-10 10:37:25.000000000 +0200
+++ gdm-2.6.0.8/gui/gdmsetup.c	2005-09-10 10:52:05.000000000 +0200
@@ -52,6 +52,7 @@
 static gboolean gdm_running = FALSE;
 static int GdmMinimalUID = 100;
 static char *GdmExclude = NULL;
+static char *GdmIncludeOnly = NULL;
 static char *GdmSoundProgram = NULL;
 
 static GladeXML *xml;
@@ -495,7 +496,7 @@
 }
 
 static gboolean
-check_exclude (struct passwd *pwent, char **excludes)
+check_exclude (struct passwd *pwent, char **excludes, char **includes)
 {
 	const char * const lockout_passes[] = { "!!", NULL };
 	gint i;
@@ -521,6 +522,16 @@
 		}
 	}
 
+	if (includes != NULL) {
+		for (i=0 ; includes[i] != NULL ; i++)  {
+			if (g_ascii_strcasecmp (includes[i],
+						pwent->pw_name) == 0) {
+				return FALSE;
+			}
+		}
+		return TRUE;
+	}
+
 	return FALSE;
 }
 
@@ -535,6 +546,7 @@
 	int cnt;
 	time_t time_started;
 	char **excludes;
+	char **includes;
 	int i;
 
 	str = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE), key);
@@ -556,8 +568,12 @@
 	for (i=0 ; excludes != NULL && excludes[i] != NULL ; i++)
 		g_strstrip (excludes[i]);
 	
+	includes = g_strsplit (GdmIncludeOnly, ",", 0);
+	for (i=0 ; includes != NULL && includes[i] != NULL ; i++)
+		g_strstrip (includes[i]);
+	
 	while (pwent != NULL) {
-		if ( ! check_exclude (pwent, excludes) &&
+		if ( ! check_exclude (pwent, excludes, includes) &&
 		    strcmp (ve_sure_string (str), pwent->pw_name) != 0) {
 			cnt ++;
 			users = g_list_prepend (users,
@@ -579,6 +595,9 @@
 	g_strfreev (excludes);
 	excludes = NULL;
 
+	g_strfreev (includes);
+	includes = NULL;
+
 	users = g_list_reverse (users);
 
 	gtk_combo_set_popdown_strings (GTK_COMBO (combo), users);
@@ -2811,6 +2830,8 @@
 					   GDM_KEY_MINIMALUID);
 	GdmExclude = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE),
 					   GDM_KEY_EXCLUDE);
+	GdmIncludeOnly = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE),
+					   GDM_KEY_EXCLUDE);
 	GdmSoundProgram = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE),
 						GDM_KEY_SOUND_PROGRAM);
 	if (ve_string_empty (GdmSoundProgram) ||
diff -ru gdm-2.6.0.8-orig/gui/greeter/greeter.c gdm-2.6.0.8/gui/greeter/greeter.c
--- gdm-2.6.0.8-orig/gui/greeter/greeter.c	2005-09-10 10:37:25.000000000 +0200
+++ gdm-2.6.0.8/gui/greeter/greeter.c	2005-09-10 10:51:30.000000000 +0200
@@ -71,6 +71,7 @@
 gchar *GdmGtkTheme;
 gint GdmTimedLoginDelay;
 gchar *GdmExclude;
+gchar *GdmIncludeOnly;
 int GdmMinimalUID;
 gboolean GdmAllowRoot;
 gboolean GdmAllowRemoteRoot;
@@ -173,6 +174,7 @@
 
     GdmTimedLoginEnable = ve_config_get_bool (config, GDM_KEY_TIMED_LOGIN_ENABLE);
     GdmExclude = ve_config_get_string (config, GDM_KEY_EXCLUDE);
+    GdmIncludeOnly = ve_config_get_string (config, GDM_KEY_INCLUDEONLY);
     GdmMinimalUID = ve_config_get_int (config, GDM_KEY_MINIMALUID);
     GdmAllowRoot = ve_config_get_bool (config, GDM_KEY_ALLOWROOT);
     GdmAllowRemoteRoot = ve_config_get_bool (config, GDM_KEY_ALLOWREMOTEROOT);
diff -ru gdm-2.6.0.8-orig/gui/greeter/greeter_configuration.h gdm-2.6.0.8/gui/greeter/greeter_configuration.h
--- gdm-2.6.0.8-orig/gui/greeter/greeter_configuration.h	2005-09-10 10:37:25.000000000 +0200
+++ gdm-2.6.0.8/gui/greeter/greeter_configuration.h	2005-09-10 10:51:30.000000000 +0200
@@ -31,6 +31,7 @@
 extern gint  GdmIconMaxHeight;
 extern gint  GdmIconMaxWidth;
 extern gchar *GdmExclude;
+extern gchar *GdmIncludeOnly;
 extern int GdmMinimalUID;
 extern gboolean GdmAllowRoot;
 extern gboolean GdmAllowRemoteRoot;
diff -ru gdm-2.6.0.8-orig/gui/greeter/greeter_item_ulist.c gdm-2.6.0.8/gui/greeter/greeter_item_ulist.c
--- gdm-2.6.0.8-orig/gui/greeter/greeter_item_ulist.c	2005-02-15 21:44:47.000000000 +0100
+++ gdm-2.6.0.8/gui/greeter/greeter_item_ulist.c	2005-09-10 10:51:30.000000000 +0200
@@ -250,6 +250,23 @@
 		g_strfreev (excludes);
 	}
 
+	if (GdmIncludeOnly != NULL &&
+	    GdmIncludeOnly[0] != '\0') {
+		char **includes;
+		gboolean notfound=TRUE;
+		includes = g_strsplit (GdmIncludeOnly, ",", 0);
+
+		for (i=0 ; includes[i] != NULL ; i++)  {
+			g_strstrip (includes[i]);
+			if (g_ascii_strcasecmp (includes[i],
+						pwent->pw_name) == 0) {
+				notfound=FALSE;
+			}
+		}
+		g_strfreev (includes);
+		return notfound;
+	}
+
 	return FALSE;
 }
 

Reply via email to