1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r3165: Support local connections in Gtk+ tools

This commit is contained in:
Jelmer Vernooij 2004-10-24 17:06:35 +00:00 committed by Gerald (Jerry) Carter
parent 2cfc8f24ce
commit 3de0cf22dd
4 changed files with 28 additions and 8 deletions

View File

@ -60,6 +60,11 @@ static void on_krb5_toggled(GtkToggleButton *togglebutton, GtkRpcBindingDialog *
gtk_widget_set_sensitive(d->entry_password, !gtk_toggle_button_get_active(togglebutton));
}
static void on_ncalrpc_toggled(GtkToggleButton *tb, GtkRpcBindingDialog *d)
{
gtk_widget_set_sensitive(d->frame_host, !gtk_toggle_button_get_active(tb));
}
static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_dialog)
{
GtkWidget *dialog_vbox1;
@ -67,7 +72,6 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
GtkWidget *vbox6;
GtkWidget *frame_transport;
GtkWidget *label1;
GtkWidget *frame_host;
GtkWidget *hbox1;
GtkWidget *lbl_name;
GtkWidget *label2;
@ -118,17 +122,27 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
gtk_radio_button_set_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_tcp_ip), transport_smb_group);
transport_smb_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_tcp_ip));
gtk_rpc_binding_dialog->transport_ncalrpc = gtk_radio_button_new_with_mnemonic (NULL, "Local Host");
gtk_widget_show (gtk_rpc_binding_dialog->transport_ncalrpc);
gtk_box_pack_start (GTK_BOX (vbox6), gtk_rpc_binding_dialog->transport_ncalrpc, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_ncalrpc), transport_smb_group);
transport_smb_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_rpc_binding_dialog->transport_ncalrpc));
g_signal_connect ((gpointer) gtk_rpc_binding_dialog->transport_ncalrpc, "toggled",
G_CALLBACK (on_ncalrpc_toggled),
gtk_rpc_binding_dialog);
label1 = gtk_label_new ("Transport");
gtk_widget_show (label1);
gtk_frame_set_label_widget (GTK_FRAME (frame_transport), label1);
frame_host = gtk_frame_new (NULL);
gtk_widget_show (frame_host);
gtk_box_pack_start (GTK_BOX (vbox1), frame_host, TRUE, TRUE, 0);
gtk_rpc_binding_dialog->frame_host = gtk_frame_new (NULL);
gtk_widget_show (gtk_rpc_binding_dialog->frame_host);
gtk_box_pack_start (GTK_BOX (vbox1), gtk_rpc_binding_dialog->frame_host, TRUE, TRUE, 0);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (frame_host), hbox1);
gtk_container_add (GTK_CONTAINER (gtk_rpc_binding_dialog->frame_host), hbox1);
lbl_name = gtk_label_new ("Name");
gtk_widget_show (lbl_name);
@ -151,7 +165,7 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
label2 = gtk_label_new ("Host");
gtk_widget_show (label2);
gtk_frame_set_label_widget (GTK_FRAME (frame_host), label2);
gtk_frame_set_label_widget (GTK_FRAME (gtk_rpc_binding_dialog->frame_host), label2);
frame_security = gtk_frame_new (NULL);
gtk_widget_show (frame_security);
@ -314,6 +328,8 @@ struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d
binding->host = talloc_strdup(mem_ctx, gtk_entry_get_text(GTK_ENTRY(d->entry_host)));
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->transport_tcp_ip))) {
binding->transport = NCACN_IP_TCP;
} else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->transport_ncalrpc))) {
binding->transport = NCALRPC;
} else {
binding->transport = NCACN_NP;
}

View File

@ -34,7 +34,9 @@ struct _GtkRpcBindingDialog
GtkWidget *chk_sign;
GtkWidget *chk_seal;
GtkWidget *transport_tcp_ip;
GtkWidget *transport_ncalrpc;
GtkWidget *transport_smb;
GtkWidget *frame_host;
GtkWidget *entry_host;
GtkWidget *entry_username;
GtkWidget *entry_password;

View File

@ -123,12 +123,15 @@ void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data)
return;
}
mem_ctx = talloc_init("gwsam_connect");
/* If connected, get list of jobs */
status = dcerpc_pipe_connect_b(&sam_pipe, gtk_rpc_binding_dialog_get_binding(d, mem_ctx), DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION, lp_workgroup(), gtk_rpc_binding_dialog_get_username(d), gtk_rpc_binding_dialog_get_password(d));
if(!NT_STATUS_IS_OK(status)) {
gtk_show_ntstatus(mainwin, status);
sam_pipe = NULL;
gtk_widget_destroy(GTK_WIDGET(d));
talloc_destroy(mem_ctx);
return;
}
@ -136,7 +139,6 @@ void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data)
r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
r.out.connect_handle = &sam_handle;
mem_ctx = talloc_init("connect");
status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
gtk_show_ntstatus(mainwin, status);

View File

@ -1178,7 +1178,7 @@ BOOL subsystem_dcerpc_init(void)
return False;
}
/* FIXME: Perhaps panic if a basic endpoint server, such as EPMAPER, fails to initialise? */
/* FIXME: Perhaps panic if a basic endpoint server, such as EPMAPPER, fails to initialise? */
static_init_dcerpc;
DEBUG(3,("DCERPC subsystem version %d initialised\n", DCERPC_MODULE_VERSION));