summaryrefslogtreecommitdiff
path: root/source4/gtk/common
diff options
context:
space:
mode:
Diffstat (limited to 'source4/gtk/common')
-rw-r--r--source4/gtk/common/gtk-smb.c34
-rw-r--r--source4/gtk/common/gtk-smb.h5
-rw-r--r--source4/gtk/common/select.c6
3 files changed, 27 insertions, 18 deletions
diff --git a/source4/gtk/common/gtk-smb.c b/source4/gtk/common/gtk-smb.c
index 06bca9bf86..e03c4096f0 100644
--- a/source4/gtk/common/gtk-smb.c
+++ b/source4/gtk/common/gtk-smb.c
@@ -2,7 +2,7 @@
Unix SMB/CIFS implementation.
SMB-related GTK+ functions
- Copyright (C) Jelmer Vernooij 2004
+ Copyright (C) Jelmer Vernooij 2004-2005
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
@@ -23,25 +23,25 @@
#include "gtk/common/select.h"
#include "gtk/common/gtk-smb.h"
-void gtk_show_werror(GtkWidget *win, WERROR err)
+void gtk_show_werror(GtkWidget *win, const char *message, WERROR err)
{
GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(win),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- "Windows error: %s\n",
+ "%s: %s\n", message?message: "Windows error",
win_errstr(err));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
-void gtk_show_ntstatus(GtkWidget *win, NTSTATUS status)
+void gtk_show_ntstatus(GtkWidget *win, const char *message, NTSTATUS status)
{
GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(win),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- "Windows error: %s\n",
+ "%s: %s\n", message?message:"Windows error",
nt_errstr(status));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -94,6 +94,10 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
GSList *transport_smb_group = NULL;
gtk_rpc_binding_dialog->mem_ctx = talloc_init("gtk_rcp_binding_dialog");
+
+ gtk_rpc_binding_dialog->credentials = talloc(gtk_rpc_binding_dialog->mem_ctx, struct cli_credentials);
+
+ cli_credentials_guess(gtk_rpc_binding_dialog->credentials);
gtk_window_set_title (GTK_WINDOW (gtk_rpc_binding_dialog), "Connect");
@@ -205,14 +209,16 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
- gtk_entry_set_text(GTK_ENTRY(gtk_rpc_binding_dialog->entry_username), getenv("LOGNAME"));
+ gtk_entry_set_text(GTK_ENTRY(gtk_rpc_binding_dialog->entry_username),
+ cli_credentials_get_username(gtk_rpc_binding_dialog->credentials));
gtk_rpc_binding_dialog->entry_userdomain = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table1), gtk_rpc_binding_dialog->entry_userdomain, 1,2, 1,2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
- gtk_entry_set_text(GTK_ENTRY(gtk_rpc_binding_dialog->entry_userdomain), lp_workgroup());
+ gtk_entry_set_text(GTK_ENTRY(gtk_rpc_binding_dialog->entry_userdomain),
+ cli_credentials_get_domain(gtk_rpc_binding_dialog->credentials));
gtk_rpc_binding_dialog->entry_password = gtk_entry_new ();
gtk_entry_set_visibility (GTK_ENTRY (gtk_rpc_binding_dialog->entry_password), FALSE);
@@ -220,6 +226,9 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+ gtk_entry_set_text(GTK_ENTRY(gtk_rpc_binding_dialog->entry_password),
+ cli_credentials_get_password(gtk_rpc_binding_dialog->credentials));
+
gtk_rpc_binding_dialog->krb5_chk_button = gtk_check_button_new_with_mnemonic ("_Use kerberos");
gtk_table_attach (GTK_TABLE (table1), gtk_rpc_binding_dialog->krb5_chk_button, 1,2, 3,4,
(GtkAttachOptions) (GTK_FILL),
@@ -299,12 +308,11 @@ GtkWidget *gtk_rpc_binding_dialog_new (BOOL nocredentials, struct sam_pipe *sam_
struct cli_credentials *gtk_rpc_binding_dialog_get_credentials(GtkRpcBindingDialog *d)
{
- struct cli_credentials *ret = talloc(d->mem_ctx, struct cli_credentials);
- cli_credentials_set_username(ret, gtk_entry_get_text(GTK_ENTRY(d->entry_username)), CRED_SPECIFIED);
- cli_credentials_set_password(ret, gtk_entry_get_text(GTK_ENTRY(d->entry_password)), CRED_SPECIFIED);
- cli_credentials_set_domain(ret, gtk_entry_get_text(GTK_ENTRY(d->entry_userdomain)), CRED_SPECIFIED);
+ cli_credentials_set_username(d->credentials, gtk_entry_get_text(GTK_ENTRY(d->entry_username)), CRED_SPECIFIED);
+ cli_credentials_set_password(d->credentials, gtk_entry_get_text(GTK_ENTRY(d->entry_password)), CRED_SPECIFIED);
+ cli_credentials_set_domain(d->credentials, gtk_entry_get_text(GTK_ENTRY(d->entry_userdomain)), CRED_SPECIFIED);
- return ret;
+ return d->credentials;
}
const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d)
@@ -378,7 +386,7 @@ GtkWidget *create_gtk_samba_about_dialog (const char *appname)
label3 = gtk_label_new_with_mnemonic ("Part of Samba <http://www.samba.org/>");
gtk_box_pack_start (GTK_BOX (dialog_vbox1), label3, FALSE, FALSE, 0);
- label4 = gtk_label_new ("\302\251 1992-2004 The Samba Team");
+ label4 = gtk_label_new ("\302\251 1992-2005 The Samba Team");
gtk_box_pack_start (GTK_BOX (dialog_vbox1), label4, FALSE, FALSE, 0);
dialog_action_area1 = GTK_DIALOG (samba_about_dialog)->action_area;
diff --git a/source4/gtk/common/gtk-smb.h b/source4/gtk/common/gtk-smb.h
index e78e8541f8..0a7bbcba00 100644
--- a/source4/gtk/common/gtk-smb.h
+++ b/source4/gtk/common/gtk-smb.h
@@ -45,6 +45,7 @@ struct _GtkRpcBindingDialog
GtkWidget *frame_credentials;
TALLOC_CTX *mem_ctx;
struct sam_pipe *sam_pipe;
+ struct cli_credentials *credentials;
};
typedef struct _GtkRpcBindingDialogClass GtkRpcBindingDialogClass;
@@ -62,14 +63,14 @@ struct _GtkRpcBindingDialogClass
/* subsystem prototypes */
GtkWidget *create_gtk_samba_about_dialog (const char *appname);
-void gtk_show_ntstatus(GtkWidget *win, NTSTATUS status);
+void gtk_show_ntstatus(GtkWidget *win, const char *, NTSTATUS status);
GtkWidget *gtk_rpc_binding_dialog_new (BOOL nocredentials, struct sam_pipe *sam_pipe);
GType gtk_rpc_binding_dialog_get_type (void);
struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx);
GtkWidget *gtk_select_host_dialog_new (struct sam_pipe *sam_pipe, BOOL nocredentials);
const char *gtk_select_host_dialog_get_host (GtkSelectHostDialog *d);
GType gtk_select_host_dialog_get_type (void);
-void gtk_show_werror(GtkWidget *win, WERROR err);
+void gtk_show_werror(GtkWidget *win, const char *, WERROR err);
const char *gtk_rpc_binding_dialog_get_binding_string(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx);
struct cli_credentials *gtk_rpc_binding_dialog_get_credentials(GtkRpcBindingDialog *d);
const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d);
diff --git a/source4/gtk/common/select.c b/source4/gtk/common/select.c
index 082f449a0c..269a840220 100644
--- a/source4/gtk/common/select.c
+++ b/source4/gtk/common/select.c
@@ -141,7 +141,7 @@ GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe)
status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &cr);
if (!NT_STATUS_IS_OK(status)) {
- gtk_show_ntstatus(NULL, status);
+ gtk_show_ntstatus(NULL, "Running Connect on SAMR", status);
talloc_free(mem_ctx);
return GTK_WIDGET(d);
}
@@ -153,7 +153,7 @@ GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe)
status = dcerpc_samr_EnumDomains(sam_pipe, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
- gtk_show_ntstatus(NULL, status);
+ gtk_show_ntstatus(NULL, "Enumerating domains", status);
} else if (r.out.sam) {
for (i=0;i<r.out.sam->count;i++) {
GtkTreeIter iter;
@@ -167,7 +167,7 @@ GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe)
status = dcerpc_samr_Close(sam_pipe, mem_ctx, &dr);
if (!NT_STATUS_IS_OK(status)) {
- gtk_show_ntstatus(NULL, status);
+ gtk_show_ntstatus(NULL, "Closing SAMR connection", status);
talloc_free(mem_ctx);
return GTK_WIDGET ( d );
}