r5932: Use cli_credentials somewhat more in the Gtk+ code
authorJelmer Vernooij <jelmer@samba.org>
Tue, 22 Mar 2005 01:35:12 +0000 (01:35 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:11:10 +0000 (13:11 -0500)
Support ncacn_spx in DCE/RPC bindings.
(This used to be commit a0233a3a9a83176ae46873d3a25ed601758a1511)

source4/gtk/common/gtk-smb.c
source4/gtk/common/gtk-smb.h
source4/gtk/common/select.c
source4/gtk/tools/gepdump.c
source4/gtk/tools/gregedit.c
source4/gtk/tools/gwcrontab.c
source4/gtk/tools/gwsam.c
source4/lib/cmdline/popt_common.c
source4/librpc/rpc/dcerpc_util.c

index 06bca9bf864d2c3f16355833e62754017939e00a..e03c4096f002fb7027f7eb5e3a4fa8a03cf196c7 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/CIFS implementation.
    SMB-related GTK+ functions
    
    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
 
    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
 #include "gtk/common/select.h"
 #include "gtk/common/gtk-smb.h"
 
 #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,
 {
        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);
 }
                    
                                                    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,
 {
        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);
                                                    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");
        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");
 
        
        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);
 
                                          (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_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);
 
        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);
 
                                          (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),
        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 *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)
 }
 
 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);
 
        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;
        gtk_box_pack_start (GTK_BOX (dialog_vbox1), label4, FALSE, FALSE, 0);
 
        dialog_action_area1 = GTK_DIALOG (samba_about_dialog)->action_area;
index e78e8541f82f57b86218fe86fdef121007837112..0a7bbcba0080c23259f7d6552ef1a6adf5511b95 100644 (file)
@@ -45,6 +45,7 @@ struct _GtkRpcBindingDialog
        GtkWidget *frame_credentials;
        TALLOC_CTX *mem_ctx;
        struct sam_pipe *sam_pipe;
        GtkWidget *frame_credentials;
        TALLOC_CTX *mem_ctx;
        struct sam_pipe *sam_pipe;
+       struct cli_credentials *credentials;
 };
 
 typedef struct _GtkRpcBindingDialogClass GtkRpcBindingDialogClass;
 };
 
 typedef struct _GtkRpcBindingDialogClass GtkRpcBindingDialogClass;
@@ -62,14 +63,14 @@ struct _GtkRpcBindingDialogClass
 
 /* subsystem prototypes */
 GtkWidget *create_gtk_samba_about_dialog (const char *appname);
 
 /* 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);
 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);
 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);
index 082f449a0cef4c6720687f5cf7db8bb5cfd48bf8..269a84022035f3e6fdca2eea9f9dbea6514b5487 100644 (file)
@@ -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)) {
 
        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);
        }
                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)) {
 
        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;
        } 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)) {
 
        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 );
        }
                talloc_free(mem_ctx);
                return GTK_WIDGET ( d );
        }
index 9a7d363a5e2cf241f15902b1fb7bfb6f026262e3..28234c006e0e9baf4dc88c16adfbc78812905654 100644 (file)
@@ -85,7 +85,7 @@ static void add_epm_entry(TALLOC_CTX *mem_ctx, const char *annotation, struct ep
 
        status = dcerpc_binding_from_tower(mem_ctx, t, &bd);
        if (!NT_STATUS_IS_OK(status)) {
 
        status = dcerpc_binding_from_tower(mem_ctx, t, &bd);
        if (!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "Error creating binding from tower", status);
                return;
        }
        
                return;
        }
        
@@ -155,7 +155,7 @@ static void refresh_eps(void)
                 r.out.num_ents == r.in.max_ents);
 
        if (!NT_STATUS_IS_OK(status)) {
                 r.out.num_ents == r.in.max_ents);
 
        if (!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "Error adding endpoint mapper entry", status);
                talloc_free(mem_ctx);
                return;
        }
                talloc_free(mem_ctx);
                return;
        }
@@ -193,7 +193,7 @@ static void on_connect_clicked(GtkButton *btn, gpointer         user_data)
                                     cmdline_credentials);
 
        if (NT_STATUS_IS_ERR(status)) {
                                     cmdline_credentials);
 
        if (NT_STATUS_IS_ERR(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "Error connecting to endpoint mapper", status);
                goto fail;
        }
 
                goto fail;
        }
 
@@ -203,7 +203,7 @@ static void on_connect_clicked(GtkButton *btn, gpointer         user_data)
 
        if (NT_STATUS_IS_ERR(status)) {
                mgmt_pipe = NULL;
 
        if (NT_STATUS_IS_ERR(status)) {
                mgmt_pipe = NULL;
-               gtk_show_ntstatus(NULL, status);
+               gtk_show_ntstatus(NULL, "Error connecting to mgmt interface over secondary connection", status);
                goto fail;
        }
 
                goto fail;
        }
 
@@ -231,7 +231,7 @@ static gboolean on_eps_select(GtkTreeSelection *selection,
 
                status = dcerpc_mgmt_inq_stats(mgmt_pipe, mem_ctx, &r);
                if (NT_STATUS_IS_ERR(status)) {
 
                status = dcerpc_mgmt_inq_stats(mgmt_pipe, mem_ctx, &r);
                if (NT_STATUS_IS_ERR(status)) {
-                       gtk_show_ntstatus(NULL, status);
+                       gtk_show_ntstatus(NULL, "Error inquiring statistics", status);
                        return TRUE;
                }
 
                        return TRUE;
                }
 
index ec4be2f57c08a49e96844cbf4cc50691a182bb2f..28423040bf686b848cf49076f48dc06b1faf3148 100644 (file)
@@ -292,7 +292,9 @@ static void expand_key(GtkTreeView *treeview, GtkTreeIter *parent, GtkTreePath *
                        gtk_tree_store_append(store_keys, &tmpiter, &iter);
        }
 
                        gtk_tree_store_append(store_keys, &tmpiter, &iter);
        }
 
-       if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) gtk_show_werror(mainwin, error);
+       if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { 
+               gtk_show_werror(mainwin, "While enumerating subkeys", error);
+       }
 }
 
 static void registry_load_hive(struct registry_key *root)
 }
 
 static void registry_load_hive(struct registry_key *root)
@@ -349,7 +351,7 @@ static void on_open_file_activate (GtkMenuItem *menuitem, gpointer user_data)
                filename = strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(openfilewin)));
                error = reg_open_hive(NULL, user_data, filename, NULL, &root);
                if(!W_ERROR_IS_OK(error)) {
                filename = strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(openfilewin)));
                error = reg_open_hive(NULL, user_data, filename, NULL, &root);
                if(!W_ERROR_IS_OK(error)) {
-                       gtk_show_werror(mainwin, error);
+                       gtk_show_werror(mainwin, "Error while opening hive", error);
                        break;
                }
 
                        break;
                }
 
@@ -371,7 +373,7 @@ static void on_open_gconf_activate(GtkMenuItem *menuitem, gpointer user_data)
        struct registry_key *root;
        WERROR error = reg_open_hive(NULL, "gconf", NULL, NULL, &root);
        if(!W_ERROR_IS_OK(error)) {
        struct registry_key *root;
        WERROR error = reg_open_hive(NULL, "gconf", NULL, NULL, &root);
        if(!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(mainwin, error);
+               gtk_show_werror(mainwin, "Error while opening GConf", error);
                return;
        }
 
                return;
        }
 
@@ -385,7 +387,7 @@ static void on_open_local_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
        WERROR error = reg_open_local(&registry);
        if(!W_ERROR_IS_OK(error)) {
 {
        WERROR error = reg_open_local(&registry);
        if(!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(mainwin, error);
+               gtk_show_werror(mainwin, "Error while opening local registry", error);
                return;
        }
        registry_load_root();
                return;
        }
        registry_load_root();
@@ -409,7 +411,7 @@ static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data)
                        gtk_rpc_binding_dialog_get_binding_string(GTK_RPC_BINDING_DIALOG(rpcwin), mem_ctx));
 
        if(!W_ERROR_IS_OK(error)) {
                        gtk_rpc_binding_dialog_get_binding_string(GTK_RPC_BINDING_DIALOG(rpcwin), mem_ctx));
 
        if(!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(mainwin, error);
+               gtk_show_werror(mainwin, "Error while opening remote registry", error);
                gtk_widget_destroy(rpcwin);
                return;
        }
                gtk_widget_destroy(rpcwin);
                return;
        }
@@ -429,7 +431,7 @@ static void on_save_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
        WERROR error = reg_save(registry, NULL);
        if(!W_ERROR_IS_OK(error)) {
 {
        WERROR error = reg_save(registry, NULL);
        if(!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(mainwin, error);
+               gtk_show_werror(mainwin, "Error while saving", error);
        }
 }
 
        }
 }
 
@@ -444,7 +446,7 @@ static void on_save_as_activate(GtkMenuItem *menuitem, gpointer user_data)
        case GTK_RESPONSE_OK:
                error = reg_save(registry, gtk_file_selection_get_filename(GTK_FILE_SELECTION(savefilewin)));
                if(!W_ERROR_IS_OK(error)) {
        case GTK_RESPONSE_OK:
                error = reg_save(registry, gtk_file_selection_get_filename(GTK_FILE_SELECTION(savefilewin)));
                if(!W_ERROR_IS_OK(error)) {
-                       gtk_show_werror(mainwin, error);
+                       gtk_show_werror(mainwin, "Error while saving as", error);
                }
                break;
 
                }
                break;
 
@@ -477,7 +479,7 @@ static void on_delete_value_activate(GtkMenuItem *menuitem, gpointer user_data)
        error = reg_del_value(current_key, value);
 
        if (!W_ERROR_IS_OK(error)) {
        error = reg_del_value(current_key, value);
 
        if (!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(NULL, error);
+               gtk_show_werror(NULL, "Error while deleting value", error);
                return;
        }
 }
                return;
        }
 }
@@ -501,7 +503,7 @@ static void on_delete_key_activate(GtkMenuItem *menuitem, gpointer user_data)
        error = reg_key_del(parent_key, current_key->name);
 
        if (!W_ERROR_IS_OK(error)) {
        error = reg_key_del(parent_key, current_key->name);
 
        if (!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(NULL, error);
+               gtk_show_werror(NULL, "Error while deleting key", error);
                return;
        }
 }
                return;
        }
 }
@@ -518,7 +520,7 @@ static void on_add_key_activate(GtkMenuItem *menuitem, gpointer user_data)
                WERROR error = reg_key_add_name(mem_ctx, current_key, gtk_entry_get_text(GTK_ENTRY(entry)), 0, NULL, &newkey);
 
                if (!W_ERROR_IS_OK(error)) {
                WERROR error = reg_key_add_name(mem_ctx, current_key, gtk_entry_get_text(GTK_ENTRY(entry)), 0, NULL, &newkey);
 
                if (!W_ERROR_IS_OK(error)) {
-                       gtk_show_werror(NULL, error);
+                       gtk_show_werror(NULL, "Error while adding key", error);
                }
        }
 
                }
        }
 
@@ -554,7 +556,7 @@ static void on_value_activate(GtkTreeView *treeview, GtkTreePath *arg1,
                error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data_blk, val->data_len);
 
                if (!W_ERROR_IS_OK(error)) {
                error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data_blk, val->data_len);
 
                if (!W_ERROR_IS_OK(error)) {
-                       gtk_show_werror(NULL, error);
+                       gtk_show_werror(NULL, "Error while setting value", error);
                }
        }
        gtk_widget_destroy(GTK_WIDGET(addwin));
                }
        }
        gtk_widget_destroy(GTK_WIDGET(addwin));
@@ -575,7 +577,7 @@ static void on_set_value_activate(GtkMenuItem *menuitem, gpointer user_data)
                error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data_blk, val->data_len);
 
                if (!W_ERROR_IS_OK(error)) {
                error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data_blk, val->data_len);
 
                if (!W_ERROR_IS_OK(error)) {
-                       gtk_show_werror(NULL, error);
+                       gtk_show_werror(NULL, "Error while setting value", error);
                }
        }
        gtk_widget_destroy(GTK_WIDGET(addwin));
                }
        }
        gtk_widget_destroy(GTK_WIDGET(addwin));
@@ -645,7 +647,7 @@ static gboolean on_key_activate(GtkTreeSelection *selection,
        }
 
        if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
        }
 
        if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
-                gtk_show_werror(mainwin, error);
+                gtk_show_werror(mainwin, "Error while enumerating values",  error);
                 return FALSE;
        }
        return TRUE;
                 return FALSE;
        }
        return TRUE;
@@ -952,7 +954,7 @@ static int gregedit_load_defaults(void)
 {
        WERROR error = reg_open_local(&registry);
        if(!W_ERROR_IS_OK(error)) {
 {
        WERROR error = reg_open_local(&registry);
        if(!W_ERROR_IS_OK(error)) {
-               gtk_show_werror(mainwin, error);
+               gtk_show_werror(mainwin, "Error while loading local registry", error);
                return -1;
        }
        registry_load_root();
                return -1;
        }
        registry_load_root();
@@ -984,5 +986,3 @@ failed:
        talloc_free(mem_ctx);
        return ret;
 }
        talloc_free(mem_ctx);
        return ret;
 }
-
-
index ad3c58ca833b47ec027f1256c2bea3f489cad721..47a7d68dc96977cc20849bb8750d71fcec9fe249 100644 (file)
@@ -54,7 +54,7 @@ void update_joblist(void)
        
        status = dcerpc_atsvc_JobEnum(at_pipe, mem_ctx, &r);
        if(!NT_STATUS_IS_OK(status)) {
        
        status = dcerpc_atsvc_JobEnum(at_pipe, mem_ctx, &r);
        if(!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "Error while enumerating first job", status);
                return;
        }
 
                return;
        }
 
@@ -110,7 +110,7 @@ on_connect_activate                    (GtkMenuItem     *menuitem,
                                       gtk_rpc_binding_dialog_get_credentials(d));
 
        if(!NT_STATUS_IS_OK(status)) {
                                       gtk_rpc_binding_dialog_get_credentials(d));
 
        if(!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "Error while connecting to at service", status);
                at_pipe = NULL;
                gtk_widget_destroy(GTK_WIDGET(d));
                talloc_free(mem_ctx);
                at_pipe = NULL;
                gtk_widget_destroy(GTK_WIDGET(d));
                talloc_free(mem_ctx);
@@ -163,7 +163,7 @@ on_new_activate                        (GtkMenuItem     *menuitem,
        status = dcerpc_atsvc_JobAdd(at_pipe, mem_ctx, &r);
        if(!NT_STATUS_IS_OK(status)) {
                talloc_free(mem_ctx);
        status = dcerpc_atsvc_JobAdd(at_pipe, mem_ctx, &r);
        if(!NT_STATUS_IS_OK(status)) {
                talloc_free(mem_ctx);
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "Error while adding job", status);
                return;
        }
        
                return;
        }
        
@@ -200,7 +200,7 @@ on_delete_activate                     (GtkMenuItem     *menuitem,
                status = dcerpc_atsvc_JobDel(at_pipe, mem_ctx, &r);
                talloc_free(mem_ctx);
                if(!NT_STATUS_IS_OK(status)) {
                status = dcerpc_atsvc_JobDel(at_pipe, mem_ctx, &r);
                talloc_free(mem_ctx);
                if(!NT_STATUS_IS_OK(status)) {
-                       gtk_show_ntstatus(mainwin, status);
+                       gtk_show_ntstatus(mainwin, "Error deleting job", status);
                        return;
                }
 
                        return;
                }
 
index 0d435b278cbaee444b233d400e6d0cd877d8c847..75a4b532f2b2c9084eda865dbb276c05af36b9c0 100644 (file)
@@ -57,7 +57,7 @@ void update_userlist(void)
 
        status = dcerpc_samr_EnumDomainUsers(sam_pipe, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
 
        status = dcerpc_samr_EnumDomainUsers(sam_pipe, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "While enumerating domain users", status);
                talloc_free(mem_ctx);
                return;
        }
                talloc_free(mem_ctx);
                return;
        }
@@ -135,7 +135,7 @@ static void connect_sam(void)
                                           );
 
        if(!NT_STATUS_IS_OK(status)) {
                                           );
 
        if(!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "While connecting to SAMR interface", status);
                sam_pipe = NULL;
                gtk_widget_destroy(GTK_WIDGET(d));
                talloc_free(mem_ctx);
                sam_pipe = NULL;
                gtk_widget_destroy(GTK_WIDGET(d));
                talloc_free(mem_ctx);
@@ -148,7 +148,7 @@ static void connect_sam(void)
 
        status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
 
        status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
-               gtk_show_ntstatus(mainwin, status);
+               gtk_show_ntstatus(mainwin, "While running connect on SAMR", status);
                sam_pipe = NULL;
                gtk_widget_destroy(GTK_WIDGET(d));
                talloc_free(mem_ctx);
                sam_pipe = NULL;
                gtk_widget_destroy(GTK_WIDGET(d));
                talloc_free(mem_ctx);
index b0b5073e6291812d243a1b5f84554ec2d3c882e4..c65c311af15af172026fe5190110dd236341e7b6 100644 (file)
@@ -255,7 +255,7 @@ static void popt_common_credentials_callback(poptContext con,
 
 struct poptOption popt_common_credentials[] = {
        { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, popt_common_credentials_callback },
 
 struct poptOption popt_common_credentials[] = {
        { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, popt_common_credentials_callback },
-       { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "USERNAME" },
+       { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN\\]USERNAME[%PASSWORD]" },
        { "no-pass", 'N', POPT_ARG_NONE, &dont_ask, True, "Don't ask for a password" },
        { "kerberos", 'k', POPT_ARG_NONE, NULL, 'k', "Use kerberos (active directory) authentication" },
        { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" },
        { "no-pass", 'N', POPT_ARG_NONE, &dont_ask, True, "Don't ask for a password" },
        { "kerberos", 'k', POPT_ARG_NONE, NULL, 'k', "Use kerberos (active directory) authentication" },
        { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" },
index bbbda5ee28ca36fff1a2140ee99434a832e5051c..d539f9f74e875a94f815ea20279f843c5d7f3b72 100644 (file)
@@ -164,8 +164,8 @@ static const struct {
        { "ncadg_ipx", NCADG_IPX, 2,
                { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
        },
        { "ncadg_ipx", NCADG_IPX, 2,
                { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
        },
-       { "ncacn_spx", NCACN_SPX, 2,
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SPX },
+       { "ncacn_spx", NCACN_SPX, 3,
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
        },
 };
 
        },
 };
 
@@ -798,7 +798,6 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
        struct epm_twr_t twr, *twr_r;
        struct dcerpc_binding *epmapper_binding;
        const struct dcerpc_interface_table *table = idl_iface_by_uuid(uuid);
        struct epm_twr_t twr, *twr_r;
        struct dcerpc_binding *epmapper_binding;
        const struct dcerpc_interface_table *table = idl_iface_by_uuid(uuid);
-       struct cli_credentials *credentials;
        int i;
 
        /* First, check if there is a default endpoint specified in the IDL */
        int i;
 
        /* First, check if there is a default endpoint specified in the IDL */
@@ -837,13 +836,11 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
        epmapper_binding->endpoint = NULL;
        epmapper_binding->authservice = NULL;
        
        epmapper_binding->endpoint = NULL;
        epmapper_binding->authservice = NULL;
        
-       credentials = talloc_zero(mem_ctx, struct cli_credentials);
-       cli_credentials_guess(credentials);
        status = dcerpc_pipe_connect_b(&p,
                                       epmapper_binding,
                                       DCERPC_EPMAPPER_UUID,
                                       DCERPC_EPMAPPER_VERSION,
        status = dcerpc_pipe_connect_b(&p,
                                       epmapper_binding,
                                       DCERPC_EPMAPPER_UUID,
                                       DCERPC_EPMAPPER_VERSION,
-                                      credentials);
+                                      NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                return status;
 
        if (!NT_STATUS_IS_OK(status)) {
                return status;