summaryrefslogtreecommitdiff
path: root/gui/gdmuser.c
diff options
context:
space:
mode:
authorBrian Cameron <Brian.Cameron@sun.com>2005-11-22 07:49:43 +0000
committerBrian Cameron <bcameron@src.gnome.org>2005-11-22 07:49:43 +0000
commitb68ffea6d293f7c453fb9b42c6c8b637d17ea326 (patch)
treef352faccc11772611193fe7fec8e8fa5ceeea8a9 /gui/gdmuser.c
parentb370db3d95e3df789286f5c44b8c0014d1c653ca (diff)
downloadgdm-b68ffea6d293f7c453fb9b42c6c8b637d17ea326.tar.gz
This further improves GDM configuration so that now only the GDM daemon
2005-11-21 Brian Cameron <Brian.Cameron@sun.com> This further improves GDM configuration so that now only the GDM daemon parses and manages the configuration file. Most client programs use the GET_CONFIG command to access needed data. This simplifies the configuration logic and puts all configuration parsing in one place and gets rid of a lot of global variables that were making the code look messy. This also gets rid of several places where gnome_config deprecated functions were being used. I have cleaned up the code so that the vicious-extensions code is more localized in gui/gdmconfig.[ch]. Some work is left to do: gdmflexiserver still uses gnome_config functions and gdmconfig should use the new functions for reading from the configuration file. Some compile issues fixed as highlghted by dmacks@netspace.org to fix bug #322083. * NEWS: Fixed comment. * daemon/gdm.h: Further cleanup of #define's so that they better match the names of the config keys. * daemon/gdm.c: Now GET_CONFIG returns "OK" if the key is valid but has no value when it is a string. Now free return value from gdm_config_to_string. * daemon/Makefile.am, gui/greeter/Makefile.am: Now the daemon validates the greeter's theme directory, so pass the default value into the daemon and not the greeter. * daemon/gdmconfig.h: Added gdm_is_valid_key and corrected prototype for gdm_set_user_session_lang. * daemon/slave.c: Fix warning and compile errors. * daemon/gdmconfig.c: Further fleshed out. Now it supports a few additional keys I overlooked. It now validates all keys used by the slaves. Now handles translated string. Further refactored the code. * gui/Makefile.am: Added gdmconfig.[ch] to common library. * gui/gdmconfig.[ch]: New functions for accessing configuration data for slaves. * gui/gdmXnestchooser.c, gui/gdmlanguages.c, gui/gdmsession.h, gui/gdmuser.h, gui/gdmwm.c, gui/misc.c, gui/greeter/greeter_item_capslock.c: gui/greeter/greeter_item_pam.c: No longer include vicious.h/viciousui.h, instead gdmconfig.h. * gui/gdmcomm.c: Fix gdm_check_comm to no longer require passing in the config file name. * gui/gdmcommon.[ch]: Get rid of old gdm_common_*_same functions that are replaced with new gui/gdmconfig logic. Now functions that access config data use the new functions. * gui/gdmflexiserver.c: Now displays the localized string when you use GET_CONFIG to access a translatable string. * gui/gdmconfig.c: Now calls update_key in addition to update_greeters when updating greeter config data, since the daemon needs to update the values now when they change. * gui/gdmchooser.c, gui/gdmdynamic.c, gui/gdmlogin.c, gui/gdmphotosetup.c, gui/gdmsession.c, gui/gdmuser.c, gui/gdm/gdmXnestchooser.c, gui/greeter/greeter.c, gui/greeter/greeter_action_language.c, gui/greeter/greeter_canvas_item.c, gui/greeter/greeter_item.c, gui/greeter/greeter_item_customlist.c, gui/greeter/greeter_item_timed.c, gui/greeter/greeter_item_list.c, gui/greeter/greeter_parser.c, gui/greeter/greeter_session.c, gui/greeter/greeter_system.c: Updated to use new configuration functions. * vicious-extensions/glade-helper.c: Now include stdlib.h to avoid compiler warnings. * gui/greeter/greeter.c: Remove unused gdm_kill_thingies function.
Diffstat (limited to 'gui/gdmuser.c')
-rw-r--r--gui/gdmuser.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/gui/gdmuser.c b/gui/gdmuser.c
index 87536d56..8ad71bd4 100644
--- a/gui/gdmuser.c
+++ b/gui/gdmuser.c
@@ -26,26 +26,15 @@
#include <libgnome/libgnome.h>
#include <libgnomeui/libgnomeui.h>
#include <string.h>
-#include <syslog.h>
-
-#include <vicious.h>
-#include "viciousui.h"
#include <pwd.h>
#include "gdm.h"
#include "gdmcommon.h"
#include "gdmuser.h"
+#include "gdmconfig.h"
static time_t time_started;
-extern gint GdmIconMaxHeight;
-extern gint GdmIconMaxWidth;
-extern gint GdmMinimalUID;
-extern gchar *GdmInclude;
-extern gchar *GdmExclude;
-extern gboolean GdmIncludeAll;
-extern gboolean GdmAllowRoot;
-extern gboolean GdmAllowRemoteRoot;
static GdmUser *
gdm_user_alloc (const gchar *logname,
@@ -158,8 +147,8 @@ gdm_user_alloc (const gchar *logname,
} else if (access (&buf[1], R_OK) == 0) {
img = gdm_common_get_face (&buf[1],
NULL,
- GdmIconMaxWidth,
- GdmIconMaxHeight);
+ gdm_config_get_int (GDM_KEY_MAX_ICON_WIDTH),
+ gdm_config_get_int (GDM_KEY_MAX_ICON_HEIGHT));
} else {
img = NULL;
}
@@ -184,13 +173,13 @@ gdm_check_exclude (struct passwd *pwent, char **excludes, gboolean is_local)
const char * const lockout_passes[] = { "!!", NULL };
gint i;
- if ( ! GdmAllowRoot && pwent->pw_uid == 0)
+ if ( ! gdm_config_get_bool (GDM_KEY_ALLOW_ROOT) && pwent->pw_uid == 0)
return TRUE;
- if ( ! GdmAllowRemoteRoot && ! is_local && pwent->pw_uid == 0)
+ if ( ! gdm_config_get_bool (GDM_KEY_ALLOW_REMOTE_ROOT) && ! is_local && pwent->pw_uid == 0)
return TRUE;
- if (pwent->pw_uid < GdmMinimalUID)
+ if (pwent->pw_uid < gdm_config_get_int (GDM_KEY_MINIMAL_UID))
return TRUE;
for (i=0 ; lockout_passes[i] != NULL ; i++) {
@@ -278,7 +267,7 @@ setup_user (struct passwd *pwent,
*size_of_users +=
gdk_pixbuf_get_height (user->picture) + 2;
} else {
- *size_of_users += GdmIconMaxHeight;
+ *size_of_users += gdm_config_get_int (GDM_KEY_MAX_ICON_HEIGHT);
}
}
@@ -322,18 +311,18 @@ gdm_users_init (GList **users,
time_started = time (NULL);
- includes = g_strsplit (GdmInclude, ",", 0);
+ includes = g_strsplit (gdm_config_get_string (GDM_KEY_INCLUDE), ",", 0);
for (i=0 ; includes != NULL && includes[i] != NULL ; i++) {
g_strstrip (includes[i]);
if (includes[i] != NULL)
found_include = TRUE;
}
- excludes = g_strsplit (GdmExclude, ",", 0);
+ excludes = g_strsplit (gdm_config_get_string (GDM_KEY_EXCLUDE), ",", 0);
for (i=0 ; excludes != NULL && excludes[i] != NULL ; i++)
g_strstrip (excludes[i]);
- if (GdmIncludeAll == TRUE) {
+ if (gdm_config_get_bool (GDM_KEY_INCLUDE_ALL) == TRUE) {
setpwent ();
pwent = getpwent();
while (pwent != NULL) {