Re: Allowing password-less connexions
Milan Bouchet-Valat <[email protected]> Tue, 20 May 2008 17:59:29 +0200
| Newsgroups | gmane.comp.gnome.system-tools |
|---|---|
| Message-ID | <1211299169.28180.3.camel__47921.4785191745$1211299292$gmane$org@milan> |
--=-gtej4tO2VoPlUTyzRRaj
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Will somebody answer ? ;-)
Wiating for comments, I made a second version so that:
- I use Glade 2 and provide a clean patch for the GUI
- I only use GConf to enable/disable the password-less feature (not for
the name of the group, which is hard-coded)
Cheers
--=-gtej4tO2VoPlUTyzRRaj
Content-Disposition: attachment; filename=passwordless.diff
Content-Type: text/x-patch; name=passwordless.diff; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Index: interfaces/users.glade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- interfaces/users.glade (r=C3=A9vision 4234)
+++ interfaces/users.glade (copie de travail)
@@ -1213,7 +1213,7 @@
<child>
<widget class=3D"GtkTable" id=3D"table50">
<property name=3D"visible">True</property>
- <property name=3D"n_rows">7</property>
+ <property name=3D"n_rows">8</property>
<property name=3D"n_columns">4</property>
<property name=3D"homogeneous">False</property>
<property name=3D"row_spacing">6</property>
@@ -1459,34 +1459,6 @@
</child>
=20
<child>
- <widget class=3D"GtkLabel" id=3D"label237">
- <property name=3D"visible">True</property>
- <property name=3D"label" translatable=3D"yes"></property>
- <property name=3D"use_underline">False</property>
- <property name=3D"use_markup">False</property>
- <property name=3D"justify">GTK_JUSTIFY_LEFT</property>
- <property name=3D"wrap">False</property>
- <property name=3D"selectable">False</property>
- <property name=3D"xalign">0</property>
- <property name=3D"yalign">0.5</property>
- <property name=3D"xpad">0</property>
- <property name=3D"ypad">0</property>
- <property name=3D"ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name=3D"width_chars">-1</property>
- <property name=3D"single_line_mode">False</property>
- <property name=3D"angle">0</property>
- </widget>
- <packing>
- <property name=3D"left_attach">0</property>
- <property name=3D"right_attach">1</property>
- <property name=3D"top_attach">1</property>
- <property name=3D"bottom_attach">7</property>
- <property name=3D"x_options">fill</property>
- <property name=3D"y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class=3D"GtkLabel" id=3D"label238">
<property name=3D"visible">True</property>
<property name=3D"label" translatable=3D"yes"></property>
@@ -1608,6 +1580,57 @@
<property name=3D"y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class=3D"GtkCheckButton" id=3D"user_passwd_passwdless">
+ <property name=3D"visible">True</property>
+ <property name=3D"can_focus">True</property>
+ <property name=3D"label" translatable=3D"yes">Don't ask for pass=
word at _login</property>
+ <property name=3D"use_underline">True</property>
+ <property name=3D"relief">GTK_RELIEF_NORMAL</property>
+ <property name=3D"focus_on_click">True</property>
+ <property name=3D"active">False</property>
+ <property name=3D"sensitive">False</property>
+ <property name=3D"inconsistent">False</property>
+ <property name=3D"draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name=3D"left_attach">1</property>
+ <property name=3D"right_attach">4</property>
+ <property name=3D"top_attach">7</property>
+ <property name=3D"bottom_attach">8</property>
+ <property name=3D"x_options">fill</property>
+ <property name=3D"y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class=3D"GtkLabel" id=3D"label237">
+ <property name=3D"visible">True</property>
+ <property name=3D"label" translatable=3D"yes"></property>
+ <property name=3D"use_underline">False</property>
+ <property name=3D"use_markup">False</property>
+ <property name=3D"justify">GTK_JUSTIFY_LEFT</property>
+ <property name=3D"wrap">False</property>
+ <property name=3D"selectable">False</property>
+ <property name=3D"xalign">0</property>
+ <property name=3D"yalign">0.5</property>
+ <property name=3D"xpad">0</property>
+ <property name=3D"ypad">0</property>
+ <property name=3D"ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name=3D"width_chars">-1</property>
+ <property name=3D"single_line_mode">False</property>
+ <property name=3D"angle">0</property>
+ </widget>
+ <packing>
+ <property name=3D"left_attach">0</property>
+ <property name=3D"right_attach">1</property>
+ <property name=3D"top_attach">1</property>
+ <property name=3D"bottom_attach">8</property>
+ <property name=3D"x_options">fill</property>
+ <property name=3D"y_options"></property>
+ </packing>
+ </child>
</widget>
<packing>
<property name=3D"padding">0</property>
Index: src/users/privileges-table.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/users/privileges-table.c (r=C3=A9vision 4234)
+++ src/users/privileges-table.c (copie de travail)
@@ -219,29 +219,6 @@
}
}
=20
-static gboolean
-find_group_in_profile (OobsGroup *group,
- GstUserProfile *profile)
-{
- gchar **groups;
- const gchar *name;
-
- if (!profile->groups)
- return FALSE;
-
- groups =3D profile->groups;
- name =3D oobs_group_get_name (group);
-
- while (*groups) {
- if (strcmp (*groups, name) =3D=3D 0)
- return TRUE;
-
- groups++;
- }
-
- return FALSE;
-}
-
void
privileges_table_set_from_profile (GstUserProfile *profile)
{
@@ -262,7 +239,7 @@
-1);
=20
gtk_list_store_set (GTK_LIST_STORE (child_model), &iter,
- COL_MEMBER, find_group_in_profile (group, profile),
+ COL_MEMBER, gst_user_profiles_find_group (group, profile),
-1);
=20
valid =3D gtk_tree_model_iter_next (child_model, &iter);
Index: src/users/user-profiles.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/users/user-profiles.c (r=C3=A9vision 4234)
+++ src/users/user-profiles.c (copie de travail)
@@ -202,3 +202,26 @@
=20
return priv->default_profile;
}
+
+gboolean
+gst_user_profiles_find_group (OobsGroup *group,
+ GstUserProfile *profile)
+{
+ gchar **groups;
+ const gchar *name;
+
+ if (!profile->groups)
+ return FALSE;
+
+ groups =3D profile->groups;
+ name =3D oobs_group_get_name (group);
+
+ while (*groups) {
+ if (strcmp (*groups, name) =3D=3D 0)
+ return TRUE;
+
+ groups++;
+ }
+
+ return FALSE;
+}
Index: src/users/user-profiles.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/users/user-profiles.h (r=C3=A9vision 4234)
+++ src/users/user-profiles.h (copie de travail)
@@ -68,6 +68,8 @@
const gchar *profile);
GstUserProfile* gst_user_profiles_get_current (GstUserProfiles *profile=
s);
GstUserProfile* gst_user_profiles_get_default_profile (GstUserProfiles =
*profiles);
+gboolean gst_user_profiles_find_group (OobsGroup *group,
+ GstUserProfile *profile);
=20
=20
G_END_DECLS
Index: src/users/user-settings.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/users/user-settings.c (r=C3=A9vision 4234)
+++ src/users/user-settings.c (copie de travail)
@@ -312,6 +312,7 @@
user_settings_dialog_new (OobsUser *user)
{
OobsUsersConfig *config;
+ OobsGroup passwdless_group;
GtkWidget *dialog, *widget;
const gchar *login =3D NULL;
gchar *title;
@@ -389,6 +390,15 @@
widget =3D gst_dialog_get_widget (tool->main_dialog, "user_passwd_manua=
l");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
=20
+ /* set password-less login */
+ if (gstconf_get_bool (users, "enable_passwordless")) {
+ widget =3D gst_dialog_get_widget (tool->main_dialog, "user_passwd_pass=
wdless");
+ gtk_widget_set_sensitive (widget, TRUE);
+ passwdless_group =3D oobs_group_new (PASSWDLESS_GROUP);
+ if (gst_profile_find_group (passwdless_group, user)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), TRUE);
+ }
+
if (!login)
table_set_default_profile (GST_USERS_TOOL (tool));
=20
@@ -638,6 +648,7 @@
{
GtkWidget *widget;
OobsGroup *group;
+ OobsGroup *passwdless_group;
OobsUser *user;
const gchar *str;
gboolean password_changed;
@@ -690,6 +701,15 @@
oobs_user_set_password (user, gtk_entry_get_text (GTK_ENTRY (widget)))=
;
}
=20
+ /* allowed to login without password? */
+ widget =3D gst_dialog_get_widget (tool->main_dialog, "user_passwd_passw=
dless");
+ passwdless_group =3D oobs_group_new (PASSWDLESS_GROUP);
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)))
+ oobs_group_add_user (passwdless_group, user);
+ else
+ oobs_group_remove_user (passwdless_group, user);
+ }
+
group =3D get_main_group (oobs_user_get_login_name (user));
oobs_user_set_main_group (user, group);
g_object_unref (group);
Index: src/users/user-settings.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/users/user-settings.h (r=C3=A9vision 4234)
+++ src/users/user-settings.h (copie de travail)
@@ -24,6 +24,8 @@
#ifndef __USER_SETTINGS_H
#define __USER_SETTINGS_H
=20
+#define PASSWDLESS_GROUP "passwordless"
+
gboolean user_delete (GtkTreeModel *model,
GtkTreePath *path);
GtkWidget * user_settings_dialog_new (OobsUser *user);
--=-gtej4tO2VoPlUTyzRRaj
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
system-tools-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/system-tools-list
--=-gtej4tO2VoPlUTyzRRaj--