diff -Naur gnome-commander-1.2.3.orig/src/gnome-smb-auth.c gnome-commander-1.2.3.new/src/gnome-smb-auth.c --- gnome-commander-1.2.3.orig/src/gnome-smb-auth.c 1970-01-01 01:00:00.000000000 +0100 +++ gnome-commander-1.2.3.new/src/gnome-smb-auth.c 2007-01-17 17:33:58.000000000 +0100 @@ -0,0 +1,53 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +#include +#include +// #include +#include + + +void /* GnomeVFSModuleCallback */ +vfs_full_authentication_callback (const GnomeVFSModuleCallbackFullAuthenticationIn *in_args, size_t in_size, + GnomeVFSModuleCallbackFullAuthenticationOut *out_args, size_t out_size, + gpointer user_data) +{ + static int counter = 0; + // static GnomePasswordDialogRemember remember; + gboolean canc = FALSE; + static char *username; + static char *password; + static char *domain; + static GtkWidget *gpwd = NULL; + gpwd = GNOME_PASSWORD_DIALOG (gnome_password_dialog_new ("Enter password", + "Problem: access not permitted\n\n please supply user credentials\n\nRemember: wrong credentials may lead to account locking", + "", + "",FALSE)); + gnome_password_dialog_set_show_domain(gpwd, in_args->flags & GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_DOMAIN); + gnome_password_dialog_set_domain (gpwd, in_args->domain ); + gnome_password_dialog_set_show_remember (gpwd, FALSE); + gnome_password_dialog_set_show_username (gpwd, in_args->flags & GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_USERNAME); + gnome_password_dialog_set_username (gpwd, in_args->username ); + gnome_password_dialog_set_show_userpass_buttons (gpwd, in_args->flags & GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_ANON_SUPPORTED); + gnome_password_dialog_set_show_password (gpwd, in_args->flags & GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_PASSWORD); + canc = gnome_password_dialog_run_and_block (GNOME_PASSWORD_DIALOG (gpwd)); + username = gnome_password_dialog_get_username (gpwd); + password = gnome_password_dialog_get_password (gpwd); + domain = gnome_password_dialog_get_domain (gpwd); + if (!canc) { + out_args->abort_auth = TRUE; + } else { + out_args->username = g_strdup ( username ); + out_args->password = g_strdup ( password ); + out_args->domain = g_strdup ( domain ); + } + if ( counter == 2 ) { + counter = 0 ; + out_args->abort_auth = TRUE; + } + counter ++; +/* + g_free (username); + g_free (password); + g_free (domain); +*/ +} + diff -Naur gnome-commander-1.2.3.orig/src/gnome-smb-auth.h gnome-commander-1.2.3.new/src/gnome-smb-auth.h --- gnome-commander-1.2.3.orig/src/gnome-smb-auth.h 1970-01-01 01:00:00.000000000 +0100 +++ gnome-commander-1.2.3.new/src/gnome-smb-auth.h 2007-01-17 17:33:58.000000000 +0100 @@ -0,0 +1,18 @@ + +#ifndef __GNOME_AUTH_H__ +#define __GNOME_AUTH_H__ + +#include +#include +#include +#include + +G_BEGIN_DECLS + + +void vfs_full_authentication_callback (const GnomeVFSModuleCallbackFullAuthenticationIn *in_args, size_t in_size, GnomeVFSModuleCallbackFullAuthenticationOut *out_args, size_t out_size, gpointer user_data); + + +G_END_DECLS + +#endif // __GNOME_AUTH_H__ diff -Naur gnome-commander-1.2.3.orig/src/main.c gnome-commander-1.2.3.new/src/main.c --- gnome-commander-1.2.3.orig/src/main.c 2006-08-08 22:50:47.000000000 +0200 +++ gnome-commander-1.2.3.new/src/main.c 2007-01-17 17:33:58.000000000 +0100 @@ -30,6 +30,8 @@ #include "imageloader.h" #include "plugin_manager.h" +#include "gnome-smb-auth.h" + GnomeCmdMainWin *main_win; GtkWidget *main_win_widget; gchar *start_dir_left; @@ -107,6 +109,10 @@ ls_colors_init (); gdk_rgb_init (); gnome_vfs_init (); + gnome_vfs_module_callback_set_default (GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION, + vfs_full_authentication_callback, + GINT_TO_POINTER (0), + NULL); conf_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir(), ".gnome-commander", NULL); create_dir_if_needed (conf_dir); g_free (conf_dir); diff -Naur gnome-commander-1.2.3.orig/src/Makefile.in gnome-commander-1.2.3.new/src/Makefile.in --- gnome-commander-1.2.3.orig/src/Makefile.in 2006-12-11 22:11:02.000000000 +0100 +++ gnome-commander-1.2.3.new/src/Makefile.in 2007-01-17 17:33:58.000000000 +0100 @@ -54,7 +54,7 @@ am_gcmd_block_OBJECTS = block.$(OBJEXT) gcmd_block_OBJECTS = $(am_gcmd_block_OBJECTS) gcmd_block_LDADD = $(LDADD) -am_gnome_commander_OBJECTS = main.$(OBJEXT) handle.$(OBJEXT) \ +am_gnome_commander_OBJECTS = main.$(OBJEXT) gnome-smb-auth.$(OBJEXT) handle.$(OBJEXT) \ plugin_manager.$(OBJEXT) dirlist.$(OBJEXT) \ widget-factory.$(OBJEXT) gnome-cmd-about-plugin.$(OBJEXT) \ gnome-cmd-smb-net.$(OBJEXT) gnome-cmd-con.$(OBJEXT) \ @@ -328,6 +328,7 @@ gnome_commander_SOURCES = \ main.c \ + gnome-smb-auth.c\ handle.h handle.c \ plugin_manager.h plugin_manager.c \ dirlist.h dirlist.c \