diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-10-18 11:44:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:00:00 -0500 |
commit | a03a7d0aea2884d4bf0e3fa993acf39189a37ddf (patch) | |
tree | 2e6a0e5e90c39a408c4818da14fd262d7b2ff337 /source4 | |
parent | 656c04da48a3885d14ff4939d5225b8aa037f0d5 (diff) | |
download | samba-a03a7d0aea2884d4bf0e3fa993acf39189a37ddf.tar.gz samba-a03a7d0aea2884d4bf0e3fa993acf39189a37ddf.tar.bz2 samba-a03a7d0aea2884d4bf0e3fa993acf39189a37ddf.zip |
r3033: Use the C struct directly if we can instead of generating a binding
string and parsing that.
(This used to be commit 1977932b5471f20a788adb1b99d60953f4e12470)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/gtk/common/gtk-smb.c | 41 | ||||
-rw-r--r-- | source4/gtk/tools/gregedit.c | 2 | ||||
-rw-r--r-- | source4/gtk/tools/gwsam.c | 2 |
3 files changed, 23 insertions, 22 deletions
diff --git a/source4/gtk/common/gtk-smb.c b/source4/gtk/common/gtk-smb.c index f149775996..70c05350e8 100644 --- a/source4/gtk/common/gtk-smb.c +++ b/source4/gtk/common/gtk-smb.c @@ -303,37 +303,38 @@ const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d) return gtk_entry_get_text(GTK_ENTRY(d->entry_host)); } -const char *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d, const char *pipe_name) +struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx) { - const char *transport; - const char *host; - char *options = NULL; + struct dcerpc_binding *binding = talloc_p(mem_ctx, struct dcerpc_binding); - /* Format: TRANSPORT:host:[\pipe\foo,foo,foo] */ + binding->object = NULL; - host = gtk_entry_get_text(GTK_ENTRY(d->entry_host)); - if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->transport_tcp_ip))) - transport = "ncacn_tcp"; - else - transport = "ncacn_np"; + /* Format: TRANSPORT:host[\pipe\foo,foo,foo] */ - if(pipe_name != NULL) { - options = talloc_asprintf(d->mem_ctx, "\\pipe\\%s", pipe_name); + 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 { + binding->transport = NCACN_NP; } - + + binding->options = NULL; + binding->flags = 0; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->chk_seal))) { - options = talloc_asprintf_append(options, ",seal"); + binding->flags |= DCERPC_SEAL; } if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(d->chk_sign))) { - options = talloc_asprintf_append(options, ",sign"); + binding->flags |= DCERPC_SIGN; } - if(options) { - return talloc_asprintf(d->mem_ctx, "%s:%s:[%s]", transport, host, options); - } else { - return talloc_asprintf(d->mem_ctx, "%s:%s", transport, host); - } + return binding; +} + +const char *gtk_rpc_binding_dialog_get_binding_string(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx) +{ + return dcerpc_binding_string(mem_ctx, gtk_rpc_binding_dialog_get_binding(d, mem_ctx)); } GtkWidget *create_gtk_samba_about_dialog (const char *appname) diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c index 1c81d8643c..37645be848 100644 --- a/source4/gtk/tools/gregedit.c +++ b/source4/gtk/tools/gregedit.c @@ -168,7 +168,7 @@ static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data) return; } - location = gtk_rpc_binding_dialog_get_binding(GTK_RPC_BINDING_DIALOG(rpcwin), NULL); + location = gtk_rpc_binding_dialog_get_binding_string(GTK_RPC_BINDING_DIALOG(rpcwin), mem_ctx); asprintf(&credentials, "%s%%%s", gtk_rpc_binding_dialog_get_username(GTK_RPC_BINDING_DIALOG(rpcwin)), gtk_rpc_binding_dialog_get_password(GTK_RPC_BINDING_DIALOG(rpcwin))); error = reg_open(®istry, "rpc", location, credentials); diff --git a/source4/gtk/tools/gwsam.c b/source4/gtk/tools/gwsam.c index a085c49897..c1f56d89d6 100644 --- a/source4/gtk/tools/gwsam.c +++ b/source4/gtk/tools/gwsam.c @@ -124,7 +124,7 @@ void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data) } /* If connected, get list of jobs */ - status = dcerpc_pipe_connect(&sam_pipe, gtk_rpc_binding_dialog_get_binding(d, DCERPC_SAMR_NAME), DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION, lp_workgroup(), gtk_rpc_binding_dialog_get_username(d), gtk_rpc_binding_dialog_get_password(d)); + 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; |