* New generalised authentication dialog using plugable module for

different authentication types.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1906 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Antony Mee
2006-08-02 18:58:17 +00:00
parent 8500b5c26d
commit a4db4b538c
12 changed files with 2603 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src auth-dialog properties po
SUBDIRS = src auth-dialog auth-dialog-general properties po
dbusservicedir = $(sysconfdir)/dbus-1/system.d
dbusservice_DATA = nm-ppp-starter.conf

View File

@@ -0,0 +1,3 @@
Makefile.in
Makefile
nm-ppp-auth-dialog

View File

@@ -0,0 +1,115 @@
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils
libexec_PROGRAMS = nm-ppp-auth-dialog-general
nm_ppp_auth_dialog_general_CPPFLAGS = \
$(GTHREAD_CFLAGS) \
$(GTK_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DGLADEDIR=\""$(gladedir)"\" \
-DAUTH_MODULES_DIR=\""$(libgenericauthmodulesdir)"\" \
-DBINDIR=\""$(bindir)"\" \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\" \
$(NULL)
nm_ppp_auth_dialog_general_SOURCES = \
main.c \
gnome-generic-auth-dialog.c \
gnome-generic-auth-dialog.h \
$(NULL)
nm_ppp_auth_dialog_general_LDADD = \
$(GTK_LIBS) \
$(LIBGNOMEUI_LIBS) \
$(GNOMEKEYRING_LIBS) \
$(NULL)
libgenericauthmodulesdir=$(libdir)/NetworkManager/gnome-generic-auth
libgenericauthmodules_LTLIBRARIES = \
libanonymous-auth-module.la \
libchap-auth-module.la \
libmschapv2-auth-module.la
libanonymous_auth_module_la_SOURCES = \
anonymous-auth-module.c
libmschapv2_auth_module_la_SOURCES = \
mschapv2-auth-module.c
libchap_auth_module_la_SOURCES = \
chap-auth-module.c
gladedir = $(datadir)/gnome-generic-auth
glade_DATA = nm-ppp-auth.glade
libanonymous_auth_module_la_CFLAGS = \
$(GLADE_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DGLADEDIR=\""$(gladedir)"\" \
-DAUTH_MODULES_DIR=\""$(libgenericauthmodulesdir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\"
libanonymous_auth_module_la_LIBADD = \
$(GLADE_LIBS) \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(LIBGNOMEUI_LIBS)
libchap_auth_module_la_CFLAGS = \
$(GLADE_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DGLADEDIR=\""$(gladedir)"\" \
-DAUTH_MODULES_DIR=\""$(libgenericauthmodulesdir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\"
libmschapv2_auth_module_la_CFLAGS = \
$(GLADE_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DGLADEDIR=\""$(gladedir)"\" \
-DAUTH_MODULES_DIR=\""$(libgenericauthmodulesdir)"\" \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\"
libchap_auth_module_la_LIBADD = \
$(GLADE_LIBS) \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(LIBGNOMEUI_LIBS)
libmschapv2_auth_module_la_LIBADD = \
$(GLADE_LIBS) \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(LIBGNOMEUI_LIBS)
EXTRA_DIST = \
$(glade_DATA)
CLEANFILES = *.bak *.gladep *~

View File

@@ -0,0 +1,149 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n-lib.h>
#include <string.h>
#include <glade/glade.h>
#define GNOME_GENERIC_AUTH_MODULE_SUBJECT_TO_CHANGE
#include "gnome-generic-auth-module.h"
/* Stuff to be provided by the specific instance */
typedef struct _GnomeGenericAuthModuleImpl GnomeGenericAuthModuleImpl;
struct _GnomeGenericAuthModuleImpl {
GnomeGenericAuthModule parent;
GladeXML *xml;
GtkWidget *widget;
// GtkEntry *w_connection_name;
// GtkEntry *w_remote;
};
#define GLADE_FILE "nm-ppp-auth.glade"
#define GLADE_WIDGET "auth-none-widget"
#define AUTH_TYPE "NONE"
#define AUTH_TYPE_DISPLAY_NAME "None (Anonymous)"
void
impl_clear_widget (GnomeGenericAuthModuleImpl *impl)
{
// g_return_if_fail(impl!=NULL);
}
static const char *
impl_get_display_name (GnomeGenericAuthModule *self)
{
return AUTH_TYPE_DISPLAY_NAME;
}
static const char *
impl_get_auth_type (GnomeGenericAuthModule *self)
{
return AUTH_TYPE;
}
static GtkWidget *
impl_get_widget (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
impl_clear_widget (impl);
//
// if (connection_name != NULL) {
// if ((opt = impl->connection_name_opt) != NULL) {
// vpnui_opt_set(opt,connection_name);
// }
// }
//
// for (item=properties; item != NULL; item = g_slist_next(g_slist_next(item)))
// {
// if (item->data==NULL) continue;
// if ((g_slist_next(item))->data==NULL) continue;
// opt = impl_opt_bygconf(impl,(char *)item->data);
// if (opt==NULL) continue;
// vpnui_opt_set(opt, (char *)(g_slist_next(item))->data);
// }
//
// if (routes != NULL) {
// GString *route_str;
// char *str;
//
// route_str = g_string_new ("");
// for (item = routes; item != NULL; item = g_slist_next (item)) {
// if (item != routes) g_string_append_c(route_str, ' ');
// g_string_append(route_str, (const char *) item->data);
// }
// str = g_string_free (route_str, FALSE);
//
// vpnui_opt_set(impl->routes_opt,str);
// vpnui_opt_set(impl->routes_toggle_opt,"yes");
// g_free (str);
// }
//
// vpnui_expand_reset_all(impl);
//
return impl->widget;
}
static GnomeGenericAuthModule*
impl_get_object (void)
{
char *glade_file;
GnomeGenericAuthModuleImpl *impl;
impl = g_new0 (GnomeGenericAuthModuleImpl, 1);
glade_file = g_strdup_printf ("%s/%s", GLADEDIR, GLADE_FILE);
impl->xml = glade_xml_new (glade_file, NULL, GETTEXT_PACKAGE);
g_free( glade_file );
if (impl->xml != NULL) {
impl->widget = glade_xml_get_widget(impl->xml, GLADE_WIDGET);
// impl_setup(impl);
// impl->callback = NULL;
// if (impl->w_import_button!=NULL) {
// gtk_signal_connect (GTK_OBJECT (impl->w_import_button),
// "clicked", GTK_SIGNAL_FUNC (import_button_clicked), impl);
// }
//
// /* make the widget reusable */
// gtk_signal_connect (GTK_OBJECT (impl->widget), "delete-event",
// GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL);
//
impl_clear_widget (impl);
impl->parent.get_display_name = impl_get_display_name;
impl->parent.get_auth_type = impl_get_auth_type;
impl->parent.get_widget = impl_get_widget;
impl->parent.data = impl;
return &(impl->parent);
} else {
g_free (impl);
return NULL;
}
}
const char *
get_auth_type (void)
{
return AUTH_TYPE;
}
GnomeGenericAuthModule*
gnome_generic_auth_module_factory (void)
{
return impl_get_object();
}

View File

@@ -0,0 +1,205 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n-lib.h>
#include <string.h>
#include <glade/glade.h>
#define GNOME_GENERIC_AUTH_MODULE_SUBJECT_TO_CHANGE
#include "gnome-generic-auth-module.h"
/* Stuff to be provided by the specific instance */
typedef struct _GnomeGenericAuthModuleImpl GnomeGenericAuthModuleImpl;
struct _GnomeGenericAuthModuleImpl {
GnomeGenericAuthModule parent;
GladeXML *xml;
GtkWidget *widget;
GtkEntry *w_username;
GtkEntry *w_password;
};
#define GLADE_FILE "nm-ppp-auth.glade"
//#define GLADE_WIDGET "auth-chap-widget"
#define GLADE_WIDGET "table1"
#define AUTH_TYPE "CHAP"
#define AUTH_TYPE_DISPLAY_NAME "CHAP Version 1"
static void
entry_changed (GtkWidget *widget,gpointer data)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) data;
g_warning("Entry: %s",gtk_entry_get_text(GTK_ENTRY(widget)));
}
static void
clear_widget (GnomeGenericAuthModuleImpl *impl)
{
GList *children;
GList *i;
GtkWidget *w;
g_warning("Clearing widget");
gtk_entry_set_text(impl->w_username,"");
gtk_entry_set_text(impl->w_password,"");
// gtk_widget_grab_focus (GTK_WIDGET(impl->w_username));
g_warning("Username %s", GTK_WIDGET_CAN_FOCUS(impl->widget) ? "Can focus" : "Can't focus" );
g_warning("Username %s", GTK_WIDGET_VISIBLE(impl->widget) ? "Is visible" : "Is not visible");
g_warning("Username %s", GTK_WIDGET_SENSITIVE(impl->widget) ? "Is sensitive" : "Is not sensitive");
g_warning("Widget: %s",gtk_widget_get_name(impl->widget));
impl->w_username = GTK_ENTRY(glade_xml_get_widget(impl->xml, "username"));
g_signal_connect (impl->w_username, "changed", G_CALLBACK (entry_changed), impl);
// gtk_widget_grab_focus (GTK_WIDGET(impl->w_username));
gtk_widget_child_focus (GTK_WIDGET(impl->w_username),GTK_DIR_TAB_FORWARD);
children = gtk_container_get_children (GTK_CONTAINER (impl->widget));
for (i = children; i != NULL; i = g_list_next (i)) {
w = GTK_WIDGET (i->data);
g_warning("Has child: %s",gtk_widget_get_name(w));
}
g_list_free (children);
}
static void
goto_next (GtkWidget *widget,gpointer data)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) data;
g_warning("Goto next!");
if (strcmp(gtk_widget_get_name(widget),"username")==0) {
gtk_widget_grab_focus (GTK_WIDGET(impl->w_password));
} else if (strcmp(gtk_widget_get_name(widget),"password")==0) {
}
}
static gboolean
impl_set_user (GnomeGenericAuthModule *self, const char *user)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
gtk_entry_set_text(impl->w_username,user);
return TRUE;
}
static const char *
impl_get_user (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
return gtk_entry_get_text(impl->w_username);
}
static gboolean
impl_set_secret (GnomeGenericAuthModule *self, const char *object, const char *secret)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
g_warning("Setting secret: %s=%s",object,secret);
if (strcmp(object,"password")==0) {
gtk_entry_set_text(impl->w_password,secret);
} else {
return FALSE;
}
return TRUE;
}
static GSList *
impl_get_secrets (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
GSList *secrets=NULL;
secrets =
g_slist_append(secrets, g_strdup("password"));
secrets =
g_slist_append(secrets, g_strdup(gtk_entry_get_text(impl->w_password)));
return secrets;
}
static const char *
impl_get_display_name (GnomeGenericAuthModule *self)
{
return AUTH_TYPE_DISPLAY_NAME;
}
static const char *
impl_get_auth_type (GnomeGenericAuthModule *self)
{
return AUTH_TYPE;
}
static GtkWidget *
impl_get_widget (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
clear_widget (impl);
return impl->widget;
}
static GnomeGenericAuthModule*
impl_get_object (void)
{
char *glade_file;
GnomeGenericAuthModuleImpl *impl;
GtkWidget *w;
impl = g_new0 (GnomeGenericAuthModuleImpl, 1);
glade_file = g_strdup_printf ("%s/%s", GLADEDIR, GLADE_FILE);
impl->xml = glade_xml_new (glade_file, NULL, GETTEXT_PACKAGE);
g_free( glade_file );
if (impl->xml != NULL) {
impl->widget = glade_xml_get_widget(impl->xml, GLADE_WIDGET);
/* make the widget reusable */
gtk_signal_connect (GTK_OBJECT (impl->widget), "delete-event",
GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL);
impl->w_username = GTK_ENTRY(glade_xml_get_widget(impl->xml,"username"));
impl->w_password = GTK_ENTRY(glade_xml_get_widget(impl->xml,"password"));
g_signal_connect (impl->w_username, "activate", G_CALLBACK (goto_next), impl);
g_signal_connect (impl->w_password, "activate", G_CALLBACK (goto_next), impl);
gtk_widget_show_all(impl->widget);
clear_widget (impl);
impl->parent.get_user = impl_get_user;
impl->parent.set_user = impl_set_user;
impl->parent.get_secrets = impl_get_secrets;
impl->parent.set_secret = impl_set_secret;
impl->parent.get_display_name = impl_get_display_name;
impl->parent.get_auth_type = impl_get_auth_type;
impl->parent.get_widget = impl_get_widget;
impl->parent.data = impl;
return &(impl->parent);
} else {
g_free (impl);
return NULL;
}
}
const char *
get_auth_type (void)
{
return AUTH_TYPE;
}
GnomeGenericAuthModule*
gnome_generic_auth_module_factory (void)
{
return impl_get_object();
}

View File

@@ -0,0 +1,939 @@
/* gnome-password-dialog.c - A use password prompting dialog widget.
Copyright (C) 2006
This is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this package; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Antony J Mee <eemynotna@gmail.com>
Based loosely on the gnome-two-password-dialog code by:
Ramiro Estrugo <ramiro@eazel.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
//#include "gnome-i18nP.h"
#define GNOME_GENERIC_AUTH_MODULE_SUBJECT_TO_CHANGE
#include "gnome-generic-auth-module.h"
#include "gnome-generic-auth-dialog.h"
//#include <gtk/gtkbox.h>
//#include <gtk/gtkcheckbutton.h>
//#include <gtk/gtkentry.h>
//#include <gtk/gtkhbox.h>
//#include <gtk/gtkimage.h>
//#include <gtk/gtklabel.h>
//#include <gtk/gtkmain.h>
//#include <gtk/gtksignal.h>
//#include <gtk/gtkstock.h>
//#include <gtk/gtktable.h>
//#include <gtk/gtkvbox.h>
//#include <gtk/gtkradiobutton.h>
//#include <gtk/gtkstock.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GNOME_GENERIC_AUTH_DIALOG_MODULES_DIR AUTH_MODULES_DIR
/* Layout constants */
static const guint DIALOG_BORDER_WIDTH = 6;
//static const guint CAPTION_TABLE_BORDER_WIDTH = 4;
struct GnomeGenericAuthDialogDetails
{
/* Attributes */
GSList *allowed_auth_types;
/* Attributes */
GSList *auth_modules;
GnomeGenericAuthModule *current_module;
GtkWidget *remember_session_button;
GtkWidget *remember_forever_button;
GtkWidget *current_widget;
GtkWidget *widget_holder;
GtkComboBox *auth_type_combo;
char *user;
char *domain;
char *server;
char *protocol;
guint32 port;
gboolean found_multiple_types;
/* TODO: */
// gboolean can_remember_1;
// char *remember_label_text2;
// gboolean can_remember_2;
// char *remember_label_text2;
};
/* GnomeGenericAuthDialogClass methods */
static void gnome_generic_auth_dialog_class_init (GnomeGenericAuthDialogClass *dialog);
static void gnome_generic_auth_dialog_init (GnomeGenericAuthDialog *dialog);
/* GObjectClass methods */
static void gnome_generic_auth_dialog_finalize (GObject *object);
/* GtkDialog callbacks */
static void dialog_show_callback (GtkWidget *widget,
gpointer callback_data);
static void dialog_close_callback (GtkWidget *widget,
gpointer callback_data);
static gpointer parent_class;
GtkType
gnome_generic_auth_dialog_get_type (void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo info = {
sizeof (GnomeGenericAuthDialogClass),
NULL, NULL,
(GClassInitFunc) gnome_generic_auth_dialog_class_init,
NULL, NULL,
sizeof (GnomeGenericAuthDialog), 0,
(GInstanceInitFunc) gnome_generic_auth_dialog_init,
NULL
};
type = g_type_register_static (gtk_dialog_get_type(),
"GnomeGenericAuthDialog",
&info, 0);
parent_class = g_type_class_ref (gtk_dialog_get_type());
}
return type;
}
static void save_to_keyring_as_needed(GnomeGenericAuthDialog *dialog)
{
switch (gnome_generic_auth_dialog_get_remember (dialog))
{
case GNOME_GENERIC_AUTH_DIALOG_REMEMBER_SESSION:
// save_auth_info (connection_name, service_name, "session", auth_type, username, password);
break;
case GNOME_GENERIC_AUTH_DIALOG_REMEMBER_FOREVER:
// save_auth_info (connection_name, service_name, NULL, auth_type, username, password);
break;
default:
break;
}
}
static void load_module (GnomeGenericAuthDialog *dialog, const char *path)
{
GModule *module;
GnomeGenericAuthModule* (*module_factory) (void) = NULL;
const char* (*module_get_auth_type) (void) = NULL;
GnomeGenericAuthModule* impl;
gboolean allowed = FALSE;
const char *provided_auth_type;
module = g_module_open (path, G_MODULE_BIND_LAZY);
if (module == NULL) {
g_warning ("Cannot open module '%s'", path);
goto out;
}
if (!g_module_symbol (module, "get_auth_type",
(gpointer) &module_get_auth_type)) {
g_warning ("Cannot locate function 'get_auth_type' in '%s': %s",
path, g_module_error ());
g_module_close (module);
goto out;
}
provided_auth_type = module_get_auth_type ();
if (dialog->details->allowed_auth_types==NULL) {
allowed=TRUE;
} else {
GSList *item;
for (item=dialog->details->allowed_auth_types; item!=NULL; item=g_slist_next(item)) {
if ((item->data!=NULL) && (strcmp(item->data,provided_auth_type)==0)) {
allowed=TRUE;
break;
}
}
}
if (!allowed) goto out;
if (!g_module_symbol (module, "gnome_generic_auth_module_factory",
(gpointer) &module_factory)) {
g_warning ("Cannot locate function 'gnome_generic_auth_module_factory' in '%s': %s",
path, g_module_error ());
g_module_close (module);
goto out;
}
impl = module_factory ();
if (impl == NULL) {
g_warning ("Function 'gnome_generic_auth_widget_factory' in '%s' returned NULL", path);
g_module_close (module);
goto out;
}
// Inflict some state upon the module!
impl->override_user=(dialog->details->user!=NULL);
impl->override_domain=(dialog->details->user!=NULL);
impl->override_server=(dialog->details->user!=NULL);
impl->override_protocol=(dialog->details->user!=NULL);
impl->override_port=(dialog->details->port!=0);
dialog->details->auth_modules = g_slist_append (dialog->details->auth_modules, impl);
out:
;
}
static void
load_all_modules (GnomeGenericAuthDialog *dialog)
{
GDir *dir;
/* Load all VPN UI modules by inspecting .name files */
if ((dir = g_dir_open (GNOME_GENERIC_AUTH_DIALOG_MODULES_DIR, 0, NULL)) != NULL) {
const char *f;
while ((f = g_dir_read_name (dir)) != NULL) {
char *so_path;
GKeyFile *keyfile;
if (!g_str_has_suffix (f, ".so"))
continue;
so_path = g_strdup_printf ("%s/%s", GNOME_GENERIC_AUTH_DIALOG_MODULES_DIR, f);
load_module (dialog, so_path);
g_free (so_path);
}
g_dir_close (dir);
}
}
static void
gnome_generic_auth_dialog_class_init (GnomeGenericAuthDialogClass * klass)
{
G_OBJECT_CLASS (klass)->finalize = gnome_generic_auth_dialog_finalize;
}
static void
gnome_generic_auth_dialog_init (GnomeGenericAuthDialog *dialog)
{
dialog->details = g_new0 (GnomeGenericAuthDialogDetails, 1);
dialog->details->auth_modules = NULL;
dialog->details->allowed_auth_types = NULL;
// dialog->details->secondary_password_label = g_strdup ( _("_Secondary Password:") );
}
/* GObjectClass methods */
static void
gnome_generic_auth_dialog_finalize (GObject *object)
{
GnomeGenericAuthDialog *dialog;
dialog = GNOME_GENERIC_AUTH_DIALOG (object);
// g_object_unref (dialog->details->username_entry);
// g_object_unref (dialog->details->domain_entry);
// g_object_unref (dialog->details->password_entry);
// g_object_unref (dialog->details->password_entry_secondary);
if (dialog->details->allowed_auth_types != NULL) {
g_slist_foreach(dialog->details->allowed_auth_types,(GFunc)g_free,NULL);
g_slist_free(dialog->details->allowed_auth_types);
}
// g_slist_foreach(dialog->details->auth_modules,(GFunc)destroy_auth_method,NULL)
if (dialog->details->auth_modules != NULL) {
g_slist_foreach(dialog->details->auth_modules,(GFunc)g_free,NULL);
g_slist_free(dialog->details->auth_modules);
}
if (G_OBJECT_CLASS (parent_class)->finalize != NULL)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
static void
dialog_close_callback (GtkWidget *widget, gpointer callback_data)
{
gtk_widget_hide (widget);
}
static void
auth_type_changed_callback (GtkWidget *widget, gpointer user_data)
{
GnomeGenericAuthDialog *dialog = (GnomeGenericAuthDialog *) user_data;
GnomeGenericAuthModule *module;
GList *i;
GList *children;
GtkWidget *w;
GSList *auth_modules;
GtkWidget *widget_holder;
GtkWidget *widget_holder_parent;
GtkComboBox *auth_type_combo;
auth_modules=dialog->details->auth_modules;
widget_holder = dialog->details->widget_holder;
auth_type_combo = dialog->details->auth_type_combo;
g_return_if_fail(widget_holder!=NULL);
g_return_if_fail(GTK_IS_CONTAINER(widget_holder));
// g_object_ref (G_OBJECT (widget_holder));
if (dialog->details->current_widget!=NULL) {
gtk_widget_hide_all(dialog->details->current_widget);
/* remove existing VPN widget */
children = gtk_container_get_children (GTK_CONTAINER (widget_holder));
for (i = children; i != NULL; i = g_list_next (i)) {
w = GTK_WIDGET (i->data);
g_object_ref (G_OBJECT (w));
gtk_widget_hide_all (w);
gtk_container_remove (GTK_CONTAINER (widget_holder), w);
}
g_list_free (children);
}
/* show appropriate child */
module = (GnomeGenericAuthModule *)
g_slist_nth_data (auth_modules,
gtk_combo_box_get_active (GTK_COMBO_BOX(auth_type_combo)));
if (module == NULL) return;
w = module->get_widget (module);
if (w != NULL) {
GtkWidget *old_parent;
gtk_widget_ref (w);
gtk_widget_hide_all (w);
old_parent = gtk_widget_get_parent (w);
if (old_parent != NULL)
gtk_container_remove (GTK_CONTAINER (old_parent), w);
gtk_container_add (GTK_CONTAINER (widget_holder), w);
gtk_widget_unref (w);
gtk_widget_show_all (w);
gtk_widget_grab_focus (w);
}
dialog->details->current_module=module;
dialog->details->current_widget=w;
// widget_holder_parent = gtk_widget_get_parent (widget_holder);
// if (widget_holder_parent != NULL)
// gtk_container_resize_children (GTK_CONTAINER (widget_holder_parent));
// gtk_container_resize_children (GTK_CONTAINER (widget_holder));
// gtk_container_resize_children (GTK_CONTAINER (dialog));
// g_object_unref (G_OBJECT (widget_holder));
// vpn_ui->set_validity_changed_callback (vpn_ui, vpn_druid_vpn_validity_changed, NULL);
}
gboolean
gnome_generic_auth_dialog_set_secret (GnomeGenericAuthDialog *dialog, const char *object, const char *secret)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_secret!=NULL,FALSE);
return module->set_secret(module,object,secret);
}
const char *
gnome_generic_auth_dialog_get_secret (GnomeGenericAuthDialog *dialog, const char *object)
{
GnomeGenericAuthModule *module;
GSList *item;
GSList *secrets;
const char *secret=NULL;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,NULL);
g_return_val_if_fail(module->get_secrets!=NULL,NULL);
secrets=module->get_secrets(module);
for(item=secrets;
(item!=NULL) && (g_slist_next(item)!=NULL) ;
item=g_slist_next(g_slist_next(item))) {
if (strcmp(object,(const char *)item->data)==0) {
secret=(const char *)(g_slist_next(item)->data);
break;
}
}
g_slist_free(secrets);
return secret;
}
gboolean
gnome_generic_auth_dialog_set_secrets (GnomeGenericAuthDialog *dialog, GSList *secrets)
{
GnomeGenericAuthModule *module;
GSList *item;
gboolean result = TRUE;
const char *object;
const char *secret;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_secret!=NULL,FALSE);
for(item=secrets;
(item!=NULL) && (g_slist_next(item)!=NULL) ;
item=g_slist_next(g_slist_next(item))) {
object=(const char *)(item->data);
secret=(const char *)(g_slist_next(item)->data);
result &= module->set_secret(module,object,secret);
}
return result;
}
GSList *
gnome_generic_auth_dialog_get_secrets (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,NULL);
g_return_val_if_fail(module->get_secrets!=NULL,NULL);
return module->get_secrets(module);
}
gboolean
gnome_generic_auth_dialog_set_user (GnomeGenericAuthDialog *dialog, const char *user)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
if (dialog->details->user!=NULL) return FALSE;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_user!=NULL,FALSE);
return module->set_user(module,user);
}
const char *
gnome_generic_auth_dialog_get_user (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
if (dialog->details->user!=NULL) return dialog->details->user;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,NULL);
g_return_val_if_fail(module->get_user!=NULL,NULL);
return module->get_user(module);
}
gboolean
gnome_generic_auth_dialog_set_domain (GnomeGenericAuthDialog *dialog, const char *domain)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
if (dialog->details->domain!=NULL) return FALSE;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_domain!=NULL,FALSE);
return module->set_domain(module,domain);
}
const char *
gnome_generic_auth_dialog_get_domain (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
if (dialog->details->domain!=NULL) return dialog->details->domain;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,NULL);
g_return_val_if_fail(module->get_domain!=NULL,NULL);
return module->get_domain(module);
}
gboolean
gnome_generic_auth_dialog_set_server (GnomeGenericAuthDialog *dialog, const char *server)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
if (dialog->details->server!=NULL) return FALSE;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_server!=NULL,FALSE);
return module->set_server(module,server);
}
const char *
gnome_generic_auth_dialog_get_server (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
if (dialog->details->server!=NULL) return dialog->details->server;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,NULL);
g_return_val_if_fail(module->get_server!=NULL,NULL);
return module->get_server(module);
}
gboolean
gnome_generic_auth_dialog_set_port (GnomeGenericAuthDialog *dialog, guint32 port)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
if (dialog->details->port!=0) return FALSE;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_port!=NULL,FALSE);
return module->set_port(module,port);
}
guint32
gnome_generic_auth_dialog_get_port (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,0);
g_return_val_if_fail(dialog->details!=NULL,0);
if (dialog->details->port!=0) return dialog->details->port;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,0);
g_return_val_if_fail(module->get_port!=NULL,0);
return module->get_port(module);
}
gboolean
gnome_generic_auth_dialog_set_protocol (GnomeGenericAuthDialog *dialog, const char *protocol)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,FALSE);
g_return_val_if_fail(dialog->details!=NULL,FALSE);
if (dialog->details->protocol!=NULL) return FALSE;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,FALSE);
g_return_val_if_fail(module->set_protocol!=NULL,FALSE);
return module->set_protocol(module,protocol);
}
const char *
gnome_generic_auth_dialog_get_protocol (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
if (dialog->details->protocol!=NULL) return dialog->details->protocol;
module = dialog->details->current_module;
g_return_val_if_fail(module!=NULL,NULL);
g_return_val_if_fail(module->get_protocol!=NULL,NULL);
return module->get_protocol(module);
}
const char *
gnome_generic_auth_dialog_get_auth_type (GnomeGenericAuthDialog *dialog)
{
GnomeGenericAuthModule *module;
g_return_val_if_fail(dialog!=NULL,NULL);
g_return_val_if_fail(dialog->details!=NULL,NULL);
module = dialog->details->current_module;
g_return_val_if_fail(dialog->details->current_module!=NULL,NULL);
return module->get_auth_type(module);
}
gboolean
gnome_generic_auth_dialog_set_auth_type (GnomeGenericAuthDialog *dialog,
const char *auth_type)
{
GSList *item;
int i=0;
g_return_val_if_fail (GNOME_IS_GENERIC_AUTH_DIALOG (dialog),FALSE);
g_return_val_if_fail (dialog->details->auth_type_combo != NULL,FALSE);
for (item = dialog->details->auth_modules; item != NULL; item = g_slist_next (item)) {
GnomeGenericAuthModule *auth_module = (GnomeGenericAuthModule *)item->data;
if (strcmp(auth_type,auth_module->get_auth_type(auth_module))==0) {
gtk_combo_box_set_active (dialog->details->auth_type_combo, i);
return TRUE;
}
i++;
}
return FALSE;
}
gboolean
gnome_generic_auth_dialog_lookup_in_keyring (GnomeGenericAuthDialog *dialog) {
GList *keyring_result;
GList *item;
const char *auth_type=NULL;
GnomeKeyringNetworkPasswordData *data;
const char *previous_auth_type=NULL;
const char *first_auth_type=NULL;
GnomeGenericAuthModule *module;
g_return_val_if_fail (GNOME_IS_GENERIC_AUTH_DIALOG (dialog),FALSE);
if (dialog->details->current_module!=NULL)
auth_type = gnome_generic_auth_dialog_get_auth_type(dialog);
if (auth_type==NULL) dialog->details->found_multiple_types=FALSE;
if (gnome_keyring_find_network_password_sync (dialog->details->user,
dialog->details->domain,
dialog->details->server,
NULL, /* object */
dialog->details->protocol,
auth_type,
dialog->details->port,
&keyring_result) != GNOME_KEYRING_RESULT_OK)
return FALSE;
// if (dialog->details->found_keys != NULL)
// gnome_keyring_network_password_list_free (dialog->details->found_keys);
// found_keys=NULL;
// Find the first auth_type we are allowed to use
first_auth_type=NULL;
for (item = keyring_result; item != NULL; item=g_list_next(item)) {
data = (GnomeKeyringNetworkPasswordData *)item->data;
if (gnome_generic_auth_dialog_set_auth_type(dialog,data->authtype)) {
if (first_auth_type==NULL) first_auth_type=data->authtype;
if ((previous_auth_type!=NULL) &&
(strcmp(previous_auth_type,data->authtype)!=0)) {
dialog->details->found_multiple_types=TRUE;
break;
}
}
}
if (first_auth_type==NULL) {
gnome_keyring_network_password_list_free (keyring_result);
return FALSE;
}
gnome_generic_auth_dialog_set_auth_type(dialog,first_auth_type);
module = dialog->details->current_module;
for (item = keyring_result; item != NULL; item=g_list_next(item)) {
data = (GnomeKeyringNetworkPasswordData *)item->data;
if (strcmp(data->authtype,first_auth_type)==0) {
g_warning("Setting: '%s' '%s' '%s' '%s' '%d' '%s' '%s'",data->user,data->server,data->domain,data->protocol,data->port,data->object,data->password);
if (data->user!=NULL) gnome_generic_auth_dialog_set_user(dialog, data->user);
if (data->server!=NULL) gnome_generic_auth_dialog_set_server(dialog, data->server);
if (data->domain!=NULL) gnome_generic_auth_dialog_set_domain(dialog, data->domain);
if (data->protocol!=NULL) gnome_generic_auth_dialog_set_protocol(dialog, data->protocol);
if (data->port!=0) gnome_generic_auth_dialog_set_port(dialog, data->port);
if (data->object!=NULL || data->password!=NULL)
gnome_generic_auth_dialog_set_secret(dialog, data->object, data->password);
if (strcmp(data->keyring,"session")==0)
gnome_generic_auth_dialog_set_remember (dialog, GNOME_GENERIC_AUTH_DIALOG_REMEMBER_SESSION);
else
gnome_generic_auth_dialog_set_remember (dialog, GNOME_GENERIC_AUTH_DIALOG_REMEMBER_FOREVER);
}
}
gnome_keyring_network_password_list_free (keyring_result);
return TRUE;
}
/* Public GnomeGenericAuthDialog methods */
GtkWidget *
gnome_generic_auth_dialog_new (const char *dialog_title,
const char *message,
const char *user,
const char *domain,
const char *server,
const char *protocol,
guint32 port,
const char **allowed_types)
{
GnomeGenericAuthDialog *dialog;
GtkWidget *widget_holder;
GtkLabel *message_label;
GtkLabel *auth_type_label;
GtkWidget *auth_type_hbox;
GtkComboBox *auth_type_combo_box;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *dialog_icon;
GSList *allowed_auth_types=NULL;
GSList *item;
const char **types;
dialog = GNOME_GENERIC_AUTH_DIALOG (gtk_widget_new (gnome_generic_auth_dialog_get_type (), NULL));
dialog->details->user=NULL;
dialog->details->server=NULL;
dialog->details->protocol=NULL;
dialog->details->domain=NULL;
dialog->details->port=0;
if (user!=NULL) dialog->details->user=g_strdup(user);
if (server!=NULL) dialog->details->server=g_strdup(server);
if (protocol!=NULL) dialog->details->protocol=g_strdup(protocol);
if (domain!=NULL) dialog->details->domain=g_strdup(domain);
if (port!=0) dialog->details->port=port;
if (allowed_types!=NULL) {
for (types=allowed_types; *types !=NULL; *types++) {
allowed_auth_types=g_slist_append(allowed_auth_types,g_strdup(*types));
}
dialog->details->allowed_auth_types = allowed_auth_types;
}
load_all_modules(dialog);
if (dialog->details->auth_modules==NULL) {
g_warning("gnome-generic-auth-dialog: Cannot find any authentication modules!");
g_free(dialog);
return NULL;
}
gtk_window_set_title (GTK_WINDOW (dialog), dialog_title);
gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
/* Setup the dialog */
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), DIALOG_BORDER_WIDTH);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
// g_signal_connect (dialog, "show",
// G_CALLBACK (dialog_show_callback), dialog);
g_signal_connect (dialog, "close",
G_CALLBACK (dialog_close_callback), dialog);
/* The table that holds the captions */
// Get the current auth_widget.
widget_holder = gtk_hbox_new(FALSE,0);
g_object_ref (widget_holder);
dialog->details->widget_holder = GTK_WIDGET(widget_holder);
/* fill in possibly choices in the druid when adding a connection */
auth_type_hbox = gtk_hbox_new(FALSE,6);
auth_type_label = GTK_LABEL (gtk_label_new (_("Authentication Type:")));
gtk_label_set_justify (auth_type_label, GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap (auth_type_label, TRUE);
gtk_box_pack_start (GTK_BOX (auth_type_hbox),
GTK_WIDGET (auth_type_label),
TRUE, /* expand */
TRUE, /* fill */
5); /* padding */
auth_type_combo_box = GTK_COMBO_BOX(gtk_combo_box_new_text ());
dialog->details->auth_type_combo = auth_type_combo_box;
for (item = dialog->details->auth_modules; item != NULL; item = g_slist_next (item)) {
GnomeGenericAuthModule *auth_module = (GnomeGenericAuthModule *)item->data;
gtk_combo_box_append_text (GTK_COMBO_BOX(auth_type_combo_box), auth_module->get_display_name(auth_module));
}
g_signal_connect (auth_type_combo_box, "changed",
G_CALLBACK (auth_type_changed_callback), (gpointer) dialog);
gtk_box_pack_end (GTK_BOX (auth_type_hbox), GTK_WIDGET(auth_type_combo_box), TRUE, TRUE, 0);
//g_object_unref (widget_holder);
/* Adds some eye-candy to the dialog */
hbox = gtk_hbox_new (FALSE, 12);
dialog_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (dialog_icon), 0.5, 0.0);
gtk_box_pack_start (GTK_BOX (hbox), dialog_icon, FALSE, FALSE, 0);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG(dialog)->vbox), 12);
gtk_container_set_border_width (GTK_CONTAINER(hbox), 6);
gtk_box_set_spacing (GTK_BOX (hbox), 12);
/* Fills the vbox */
vbox = gtk_vbox_new (FALSE, 0);
if (message) {
message_label = GTK_LABEL (gtk_label_new (message));
gtk_label_set_justify (message_label, GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap (message_label, TRUE);
gtk_box_pack_start (GTK_BOX (vbox),
GTK_WIDGET (message_label),
TRUE, /* expand */
TRUE, /* fill */
5); /* padding */
}
// THe following will be the widget from the plugin!
gtk_box_pack_start (GTK_BOX (vbox), auth_type_hbox,
TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox), widget_holder,
TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
hbox,
TRUE, /* expand */
TRUE, /* fill */
0); /* padding */
gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
dialog->details->remember_session_button =
gtk_check_button_new_with_mnemonic (_("_Remember for this session"));
dialog->details->remember_forever_button =
gtk_check_button_new_with_mnemonic (_("_Save in keyring"));
gtk_box_pack_start (GTK_BOX (vbox), dialog->details->remember_session_button,
TRUE, TRUE, 6);
gtk_box_pack_start (GTK_BOX (vbox), dialog->details->remember_forever_button,
TRUE, TRUE, 0);
if (!gnome_generic_auth_dialog_lookup_in_keyring(dialog)) {
g_warning("Lookup failed");
gtk_combo_box_set_active (auth_type_combo_box, 0);
}
return GTK_WIDGET (dialog);
}
gboolean
gnome_generic_auth_dialog_run_and_block (GnomeGenericAuthDialog *dialog)
{
gint button_clicked;
g_return_val_if_fail (dialog != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_GENERIC_AUTH_DIALOG (dialog), FALSE);
button_clicked = gtk_dialog_run (GTK_DIALOG (dialog));
save_to_keyring_as_needed(dialog);
gtk_widget_hide (GTK_WIDGET (dialog));
return button_clicked == GTK_RESPONSE_OK;
}
GnomeKeyringNetworkPasswordData *
gnome_generic_auth_dialog_get_password_data (GnomeGenericAuthDialog *dialog)
{
g_return_val_if_fail (GNOME_IS_GENERIC_AUTH_DIALOG (dialog), NULL);
// return g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->details->username_entry)));
return NULL;
}
void
gnome_generic_auth_dialog_set_show_remember (GnomeGenericAuthDialog *dialog,
gboolean show_remember)
{
if (show_remember) {
gtk_widget_show (dialog->details->remember_session_button);
gtk_widget_show (dialog->details->remember_forever_button);
} else {
gtk_widget_hide (dialog->details->remember_session_button);
gtk_widget_hide (dialog->details->remember_forever_button);
}
}
void
gnome_generic_auth_dialog_set_remember (GnomeGenericAuthDialog *dialog,
GnomeGenericAuthDialogRemember remember)
{
gboolean session, forever;
session = FALSE;
forever = FALSE;
if (remember == GNOME_GENERIC_AUTH_DIALOG_REMEMBER_SESSION) {
session = TRUE;
} else if (remember == GNOME_GENERIC_AUTH_DIALOG_REMEMBER_FOREVER){
forever = TRUE;
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->details->remember_session_button),
session);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->details->remember_forever_button),
forever);
}
GnomeGenericAuthDialogRemember
gnome_generic_auth_dialog_get_remember (GnomeGenericAuthDialog *dialog)
{
gboolean session, forever;
session = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->details->remember_session_button));
forever = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->details->remember_forever_button));
if (forever) {
return GNOME_GENERIC_AUTH_DIALOG_REMEMBER_FOREVER;
} else if (session) {
return GNOME_GENERIC_AUTH_DIALOG_REMEMBER_SESSION;
}
return GNOME_GENERIC_AUTH_DIALOG_REMEMBER_NOTHING;
}

View File

@@ -0,0 +1,105 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-generic-auth-dialog.h - A use a dialog widget with a combo
* selection box to choose a sub-widget
* which in turn then provides appropriate
* widgets for a particular type of
* authentication
Based of gnome-two-password-dialog.[ch]
from the Gnome Library.
This is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Antony J Mee <eemynotna at gmail dot com>
*/
#ifndef GNOME_GENERIC_AUTH_DIALOG_H
#define GNOME_GENERIC_AUTH_DIALOG_H
#include <gtk/gtkdialog.h>
G_BEGIN_DECLS
#define GNOME_TYPE_GENERIC_AUTH_DIALOG (gnome_generic_auth_dialog_get_type ())
#define GNOME_GENERIC_AUTH_DIALOG(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_GENERIC_AUTH_DIALOG, GnomeGenericAuthDialog))
#define GNOME_GENERIC_AUTH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_GENERIC_AUTH_DIALOG, GnomeGenericAuthDialogClass))
#define GNOME_IS_GENERIC_AUTH_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_GENERIC_AUTH_DIALOG))
#define GNOME_IS_GENERIC_AUTH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_GENERIC_AUTH_DIALOG))
typedef struct GnomeGenericAuthDialog GnomeGenericAuthDialog;
typedef struct GnomeGenericAuthDialogClass GnomeGenericAuthDialogClass;
typedef struct GnomeGenericAuthDialogDetails GnomeGenericAuthDialogDetails;
struct GnomeGenericAuthDialog
{
GtkDialog gtk_dialog;
GnomeGenericAuthDialogDetails *details;
};
struct GnomeGenericAuthDialogClass
{
GtkDialogClass parent_class;
};
typedef enum {
GNOME_GENERIC_AUTH_DIALOG_REMEMBER_NOTHING,
GNOME_GENERIC_AUTH_DIALOG_REMEMBER_SESSION,
GNOME_GENERIC_AUTH_DIALOG_REMEMBER_FOREVER
} GnomeGenericAuthDialogRemember;
GtkType gnome_generic_auth_dialog_get_type (void);
GtkWidget *gnome_generic_auth_dialog_new (const char *dialog_title,
const char *message,
const char *user,
const char *domain,
const char *server,
const char *protocol,
guint32 port,
const char **allowed_types);
gboolean gnome_generic_auth_dialog_run_and_block (GnomeGenericAuthDialog *dialog);
/* Attribute mutators */
gboolean gnome_generic_auth_dialog_set_auth_type (GnomeGenericAuthDialog *dialog, const char *auth_type);
gboolean gnome_generic_auth_dialog_set_user (GnomeGenericAuthDialog *dialog, const char *user);
gboolean gnome_generic_auth_dialog_set_server (GnomeGenericAuthDialog *dialog, const char *server);
gboolean gnome_generic_auth_dialog_set_domain (GnomeGenericAuthDialog *dialog, const char *domain);
gboolean gnome_generic_auth_dialog_set_protocol (GnomeGenericAuthDialog *dialog, const char *protocol);
gboolean gnome_generic_auth_dialog_set_port (GnomeGenericAuthDialog *dialog, guint32 port);
//void gnome_generic_auth_dialog_set_allowed_auth_types (GnomeGenericAuthDialog *dialog,
// GSList *allowed_auth_types);
void gnome_generic_auth_dialog_set_show_remember (GnomeGenericAuthDialog *dialog,
gboolean show_remember);
void gnome_generic_auth_dialog_set_remember (GnomeGenericAuthDialog *dialog,
GnomeGenericAuthDialogRemember remember);
GnomeGenericAuthDialogRemember gnome_generic_auth_dialog_get_remember (GnomeGenericAuthDialog *dialog);
/* Attribute accessors */
const char *gnome_generic_auth_dialog_get_auth_type (GnomeGenericAuthDialog *dialog);
const char *gnome_generic_auth_dialog_get_user (GnomeGenericAuthDialog *dialog);
const char *gnome_generic_auth_dialog_get_domain (GnomeGenericAuthDialog *dialog);
const char *gnome_generic_auth_dialog_get_server (GnomeGenericAuthDialog *dialog);
const char *gnome_generic_auth_dialog_get_protocol (GnomeGenericAuthDialog *dialog);
guint32 gnome_generic_auth_dialog_get_port (GnomeGenericAuthDialog *dialog);
GSList *gnome_generic_auth_dialog_get_secrets (GnomeGenericAuthDialog *dialog);
G_END_DECLS
#endif /* GNOME_GENERIC_AUTH_DIALOG_H */

View File

@@ -0,0 +1,106 @@
/***************************************************************************
* CVSID: $Id$
*
* gnome-generic-auth-widget.h : Public interface for generic auth widgets
*
* Copyright (C) 2006 Antony J Mee, <eemynotna at gmail dot com>
*
* ===
* NOTE NOTE NOTE: All source for nm-vpn-properties is licensed to you
* under your choice of the Academic Free License version 2.0, or the
* GNU General Public License version 2.
* ===
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef GNOME_GENERIC_AUTH_MODULE_H
#define GNOME_GENERIC_AUTH_MODULE_H
#ifndef GNOME_GENERIC_AUTH_MODULE_SUBJECT_TO_CHANGE
#error "Please define GNOME_GENERIC_AUTH_MODULE_SUBJECT_TO_CHANGE to acknowledge your understanding that NetworkManager hasn't reached 1.0 and is subject to protocol and API churn. See the README for a full explanation."
#endif
#include <gnome-keyring.h>
#include <gtk/gtk.h>
struct _GnomeGenericAuthModule;
typedef struct _GnomeGenericAuthModule GnomeGenericAuthModule;
typedef void (*GnomeGenericAuthModuleValidityCallback) (GnomeGenericAuthModule *self,
gboolean is_valid,
gpointer user_data);
struct _GnomeGenericAuthModule {
const char *(*get_display_name) (GnomeGenericAuthModule *self);
const char *(*get_auth_type) (GnomeGenericAuthModule *self);
const char *(*get_domain) (GnomeGenericAuthModule *self);
const char *(*get_server) (GnomeGenericAuthModule *self);
const char *(*get_protocol) (GnomeGenericAuthModule *self);
const char *(*get_user) (GnomeGenericAuthModule *self);
GSList *(*get_secrets) (GnomeGenericAuthModule *self);
guint32 (*get_port) (GnomeGenericAuthModule *self);
gboolean (*set_domain) (GnomeGenericAuthModule *self, const char *domain);
gboolean (*set_user) (GnomeGenericAuthModule *self, const char *user);
gboolean (*set_server) (GnomeGenericAuthModule *self, const char *server);
gboolean (*set_protocol) (GnomeGenericAuthModule *self, const char *protocol);
gboolean (*set_port) (GnomeGenericAuthModule *self, guint32 port);
gboolean (*set_secret) (GnomeGenericAuthModule *self, const char *object, const char *secret);
GtkWidget *(*get_widget) (GnomeGenericAuthModule *self);
gboolean override_user;
gboolean override_domain;
gboolean override_server;
gboolean override_protocol;
gboolean override_port;
// void (*set_validity_changed_callback) (GnomeGenericAuthModule *self,
// GnomeGenericAuthModuleValidityCallback cb,
// gpointer user_data);
// gboolean (*is_valid) (GnomeGenericAuthModule *self);
/*
* get_confirmation_details:
* retval is allocated and must be freed
*/
// void (*get_confirmation_details)(GnomeGenericAuthModule *self, gchar **retval);
// char *(*get_connection_name) (GnomeGenericAuthModule *self);
// GSList *(*get_properties) (GnomeGenericAuthModule *self);
// GSList *(*get_routes) (GnomeGenericAuthModule *self);
// gboolean (*can_export) (GnomeGenericAuthModule *self);
// gboolean (*import_file) (GnomeGenericAuthModule *self, const char *path);
// gboolean (*export) (GnomeGenericAuthModule *self, GSList *properties, GSList *routes, const char *connection_name);
gpointer data;
};
#endif /* GNOME_GENERIC_AUTH_MODULE_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,198 @@
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libgnomeui/libgnomeui.h>
#include <gnome-keyring.h>
#include "gnome-generic-auth-dialog.h"
#define SERVICE_NAME "org.freedesktop.NetworkManager.ppp_starter"
static void save_auth_info (const char *connection_name, const char *service_name, const char *keyring,
const char *auth_type, const char *username, const char *password)
{
guint32 item_id;
GnomeKeyringResult keyring_result;
keyring_result = gnome_keyring_set_network_password_sync (keyring,
username,
NULL,
connection_name,
"password",
service_name,
auth_type,
0,
password,
&item_id);
if (keyring_result != GNOME_KEYRING_RESULT_OK)
{
g_warning ("Couldn't store authentication information in keyring, code %d", (int) keyring_result);
}
}
static GSList *
get_passwords (const char *connection_name, const char *service_name, gboolean retry)
{
GSList *result;
char *prompt;
GnomeGenericAuthDialog *dialog;
GnomeGenericAuthDialogRemember remember;
result = NULL;
g_return_val_if_fail (connection_name != NULL, NULL);
prompt = g_strdup_printf (_("You need to authenticate to access '%s'."), connection_name);
dialog = GNOME_GENERIC_AUTH_DIALOG(
gnome_generic_auth_dialog_new (
_("Authenticate Connection"),
prompt,
NULL, /* User */
NULL, /* Domain */
connection_name, /* Server - fixed */
service_name, /* Protocol - Fixed */
0, /* Port - can vary */
NULL /* Allowed auth types */
));
if (dialog==NULL) {
return NULL;
}
g_free (prompt);
gnome_generic_auth_dialog_set_show_remember (dialog, TRUE);
//gnome_generic_auth_dialog_set_remember (dialog, GNOME_GENERIC_AUTH_DIALOG_REMEMBER_NOTHING);
gtk_widget_show (GTK_WIDGET(dialog));
if (gnome_generic_auth_dialog_run_and_block (dialog))
{
GSList *secrets;
GSList *item;
const char *username;
char *password;
const char *auth_type;
username = gnome_generic_auth_dialog_get_user (dialog);
secrets = gnome_generic_auth_dialog_get_secrets (dialog);
auth_type = gnome_generic_auth_dialog_get_auth_type (dialog);
// DEBUG: Force auth_type, username, password
// result = g_slist_append (result, g_strdup("CHAP"));
// result = g_slist_append (result, g_strdup("username"));
// result = g_slist_append (result, g_strdup("password"));
result = g_slist_append (result, g_strdup(auth_type));
g_warning("Secret: %s",auth_type);
result = g_slist_append (result, g_strdup(username));
g_warning("Secret: %s",username);
for (item=secrets; item!=NULL; item=g_slist_next(item))
{
g_free(item->data);
item = g_slist_next(item);
g_warning("Secret: %s",item->data);
result = g_slist_append (result, item->data);
}
g_slist_free(secrets);
}
gtk_widget_destroy (GTK_WIDGET(dialog));
return result;
}
int
main (int argc, char *argv[])
{
GSList *i;
GSList *passwords;
static gboolean retry = FALSE;
static gchar *connection_name = NULL;
static gchar *auth_types = NULL;
static gchar *service_name = NULL;
GError *error = NULL;
GOptionContext *context;
static GOptionEntry entries[] =
{
{ "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL},
{ "name", 'n', 0, G_OPTION_ARG_STRING, &connection_name, "Name of connection", NULL},
{ "service", 's', 0, G_OPTION_ARG_STRING, &service_name, "Service type", NULL},
{ "authtype", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &auth_types, "Authentication Types", NULL},
{ NULL }
};
char buf[1];
bindtextdomain (GETTEXT_PACKAGE, NULL);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
passwords = NULL;
context = g_option_context_new ("- ppp auth dialog");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_parse (context, &argc, &argv, &error);
if (connection_name == NULL || service_name == NULL) {
fprintf (stderr, "Have to supply both name and service\n");
goto out;
}
if (strcmp (service_name, SERVICE_NAME) != 0) {
fprintf (stderr, "This dialog only works with the '%s' service\n", SERVICE_NAME);
goto out;
}
gnome_program_init ("nm-ppp-auth-dialog", VERSION, LIBGNOMEUI_MODULE,
argc, argv,
GNOME_PARAM_NONE);
passwords = get_passwords (connection_name, service_name, retry);
if (passwords == NULL)
goto out;
/* dump the passwords to stdout */
for (i = passwords; i != NULL; i = g_slist_next (i)) {
char *password = (char *) i->data;
printf ("%s\n", password);
}
printf ("\n\n");
/* for good measure, flush stdout since Kansas is going Bye-Bye */
fflush (stdout);
g_slist_foreach (passwords, (GFunc)g_free, NULL);
g_slist_free (passwords);
/* wait for data on stdin */
fread (buf, sizeof (char), sizeof (buf), stdin);
out:
g_option_context_free (context);
return passwords != NULL ? 0 : 1;
}

View File

@@ -0,0 +1,190 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n-lib.h>
#include <string.h>
#include <glade/glade.h>
#define GNOME_GENERIC_AUTH_MODULE_SUBJECT_TO_CHANGE
#include "gnome-generic-auth-module.h"
/* Stuff to be provided by the specific instance */
typedef struct _GnomeGenericAuthModuleImpl GnomeGenericAuthModuleImpl;
struct _GnomeGenericAuthModuleImpl {
GnomeGenericAuthModule parent;
GladeXML *xml;
GtkWidget *widget;
GtkEntry *w_remotename;
GtkEntry *w_username;
GtkEntry *w_password;
};
#define GLADE_FILE "nm-ppp-auth.glade"
#define GLADE_WIDGET "auth-mschapv2-widget"
#define AUTH_TYPE "MSCHAPV2"
#define AUTH_TYPE_DISPLAY_NAME "MS CHAP V2"
static void
clear_widget (GnomeGenericAuthModuleImpl *impl)
{
gtk_entry_set_text(impl->w_username,"");
gtk_entry_set_text(impl->w_password,"");
gtk_widget_grab_focus (GTK_WIDGET(impl->w_username));
}
static void
goto_next (GtkWidget *widget,gpointer data)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) data;
g_warning("Goto next!");
if (strcmp(gtk_widget_get_name(widget),"remotename")==0) {
gtk_widget_grab_focus (GTK_WIDGET(impl->w_username));
} else if (strcmp(gtk_widget_get_name(widget),"username")==0) {
gtk_widget_grab_focus (GTK_WIDGET(impl->w_password));
} else if (strcmp(gtk_widget_get_name(widget),"password")==0) {
}
}
static gboolean
impl_set_user (GnomeGenericAuthModule *self, const char *user)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
gtk_entry_set_text(impl->w_username,user);
return TRUE;
}
static const char *
impl_get_user (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
return gtk_entry_get_text(impl->w_username);
}
static gboolean
impl_set_secret (GnomeGenericAuthModule *self, const char *object, const char *secret)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
g_warning("Setting secret: %s=%s",object,secret);
if (strcmp(object,"remotename")==0) {
gtk_entry_set_text(impl->w_remotename,secret);
} else if (strcmp(object,"password")==0) {
gtk_entry_set_text(impl->w_password,secret);
} else {
return FALSE;
}
return TRUE;
}
static GSList *
impl_get_secrets (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
GSList *secrets=NULL;
secrets =
g_slist_append(secrets, g_strdup("password"));
secrets =
g_slist_append(secrets, g_strdup(gtk_entry_get_text(impl->w_password)));
secrets =
g_slist_append(secrets, g_strdup("remotename"));
secrets =
g_slist_append(secrets, g_strdup(gtk_entry_get_text(impl->w_remotename)));
return secrets;
}
static const char *
impl_get_display_name (GnomeGenericAuthModule *self)
{
return AUTH_TYPE_DISPLAY_NAME;
}
static const char *
impl_get_auth_type (GnomeGenericAuthModule *self)
{
return AUTH_TYPE;
}
static GtkWidget *
impl_get_widget (GnomeGenericAuthModule *self)
{
GnomeGenericAuthModuleImpl *impl = (GnomeGenericAuthModuleImpl *) self->data;
clear_widget (impl);
return impl->widget;
}
static GnomeGenericAuthModule*
impl_get_object (void)
{
char *glade_file;
GnomeGenericAuthModuleImpl *impl;
GtkWidget *w;
impl = g_new0 (GnomeGenericAuthModuleImpl, 1);
glade_file = g_strdup_printf ("%s/%s", GLADEDIR, GLADE_FILE);
impl->xml = glade_xml_new (glade_file, NULL, GETTEXT_PACKAGE);
g_free( glade_file );
if (impl->xml != NULL) {
impl->widget = glade_xml_get_widget(impl->xml, GLADE_WIDGET);
/* make the widget reusable */
gtk_signal_connect (GTK_OBJECT (impl->widget), "delete-event",
GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL);
impl->w_remotename = GTK_ENTRY(glade_xml_get_widget(impl->xml,"remotename"));
impl->w_username = GTK_ENTRY(glade_xml_get_widget(impl->xml,"username"));
impl->w_password = GTK_ENTRY(glade_xml_get_widget(impl->xml,"password"));
g_signal_connect (impl->w_remotename, "activate", G_CALLBACK (goto_next), impl);
g_signal_connect (impl->w_username, "activate", G_CALLBACK (goto_next), impl);
g_signal_connect (impl->w_password, "activate", G_CALLBACK (goto_next), impl);
gtk_widget_show_all(impl->widget);
clear_widget (impl);
impl->parent.get_user = impl_get_user;
impl->parent.set_user = impl_set_user;
impl->parent.get_secrets = impl_get_secrets;
impl->parent.set_secret = impl_set_secret;
impl->parent.get_display_name = impl_get_display_name;
impl->parent.get_auth_type = impl_get_auth_type;
impl->parent.get_widget = impl_get_widget;
impl->parent.data = impl;
return &(impl->parent);
} else {
g_free (impl);
return NULL;
}
}
const char *
get_auth_type (void)
{
return AUTH_TYPE;
}
GnomeGenericAuthModule*
gnome_generic_auth_module_factory (void)
{
return impl_get_object();
}

View File

@@ -0,0 +1,592 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="nm-ppp-auth">
<property name="border_width">5</property>
<property name="title" translatable="yes">Authentication Required</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="okbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="main_vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Authentication Information&lt;/span&gt;
The connection '%s' may need some form of authentication.
Please select an appropriate authentication type and provide the necessary credentials below:
</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Authentication Type:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="auth-type">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">80</property>
<property name="right_padding">21</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="remember_for_session">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Remember for this session</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="save_in_keyring">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Save in keyring</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="auth-none-window">
<property name="border_width">2</property>
<property name="width_request">82</property>
<property name="height_request">116</property>
<property name="title" translatable="yes">auth-none-window</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkLabel" id="auth-cone-widget">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="auth-chap-window">
<property name="border_width">12</property>
<property name="title" translatable="yes">auth-chap-window</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkVBox" id="auth-chap-widget">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">_Username:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">username</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">_Password:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">password</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="username">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="password">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="auth-mschapv2-window">
<property name="title" translatable="yes">auth-mschapv2-window</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkVBox" id="auth-mschapv2-widget">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes">_Password:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">password</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="password">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="username">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">_Username:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">username</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">_Remote name:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">remotename</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="remotename">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>