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/gtk/common | |
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/gtk/common')
-rw-r--r-- | source4/gtk/common/gtk-smb.c | 41 |
1 files changed, 21 insertions, 20 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) |