mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r6600: Rework of the GTK credentials system; the credentials information is
now in a seperate (optional) dialog rather then in the binding dialog; also
supports specifying anonymous connections (which we didn't before).
(This used to be commit 8671e1a1fa
)
This commit is contained in:
parent
46727924a0
commit
eb3b5f28d4
@ -21,41 +21,65 @@
|
||||
#include "includes.h"
|
||||
#include "gtk/common/gtk-smb.h"
|
||||
|
||||
static const char *gtk_get_userpassword(struct cli_credentials *credentials)
|
||||
static void gtk_get_credentials(struct cli_credentials *credentials)
|
||||
{
|
||||
char *prompt;
|
||||
const char *ret;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *dialog_vbox1;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *table;
|
||||
GtkWidget *entry_username;
|
||||
GtkWidget *entry_password;
|
||||
GtkWidget *entry_domain;
|
||||
GtkWidget *dialog_action_area1;
|
||||
GtkWidget *cancelbutton1;
|
||||
GtkWidget *okbutton1;
|
||||
GtkWidget *anonymous;
|
||||
|
||||
dialog = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), "Enter Password");
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), "Credentials");
|
||||
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
|
||||
dialog_vbox1 = GTK_DIALOG (dialog)->vbox;
|
||||
table = gtk_table_new(4, 2, FALSE);
|
||||
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox, TRUE, TRUE, 0);
|
||||
label = gtk_label_new ("Domain:");
|
||||
|
||||
prompt = talloc_asprintf(NULL, "Password for [%s\\%s]:",
|
||||
cli_credentials_get_domain(credentials),
|
||||
cli_credentials_get_username(credentials));
|
||||
gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,GTK_FILL,0,0,0);
|
||||
|
||||
label = gtk_label_new (prompt);
|
||||
entry_domain = gtk_entry_new ();
|
||||
gtk_table_attach(GTK_TABLE(table), entry_domain, 1,2,0,1, GTK_FILL, 0,0,0);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (entry_domain), TRUE);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
if (credentials->domain_obtained != CRED_UNINITIALISED) {
|
||||
gtk_entry_set_text(GTK_ENTRY(entry_domain), credentials->domain);
|
||||
}
|
||||
|
||||
label = gtk_label_new ("Username:");
|
||||
|
||||
gtk_table_attach(GTK_TABLE(table),label,0,1,1,2,GTK_FILL,0,0,0);
|
||||
|
||||
entry_username = gtk_entry_new ();
|
||||
gtk_table_attach(GTK_TABLE(table),entry_username,1,2,1,2,GTK_FILL,0,0,0);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (entry_username), TRUE);
|
||||
if (credentials->username_obtained != CRED_UNINITIALISED) {
|
||||
gtk_entry_set_text(GTK_ENTRY(entry_username), credentials->username);
|
||||
}
|
||||
|
||||
label = gtk_label_new ("Password:");
|
||||
|
||||
gtk_table_attach(GTK_TABLE(table),label,0,1,3,4,GTK_FILL,0,0,0);
|
||||
|
||||
entry_password = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry_password, TRUE, TRUE, 0);
|
||||
gtk_table_attach(GTK_TABLE(table),entry_password,1,2,3,4,GTK_FILL,0,0,0);
|
||||
gtk_entry_set_visibility (GTK_ENTRY (entry_password), FALSE);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (entry_password), TRUE);
|
||||
if (credentials->password_obtained != CRED_UNINITIALISED) {
|
||||
gtk_entry_set_text(GTK_ENTRY(entry_password), credentials->password);
|
||||
}
|
||||
|
||||
anonymous = gtk_check_button_new_with_mnemonic("_Anonymous");
|
||||
gtk_table_attach(GTK_TABLE(table),anonymous,0,2,4,5,GTK_FILL,0,0,0);
|
||||
|
||||
dialog_action_area1 = GTK_DIALOG (dialog)->action_area;
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
|
||||
@ -72,7 +96,13 @@ static const char *gtk_get_userpassword(struct cli_credentials *credentials)
|
||||
|
||||
switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
ret = talloc_strdup(credentials, gtk_entry_get_text(GTK_ENTRY(entry_password)));
|
||||
cli_credentials_set_username(credentials, gtk_entry_get_text(GTK_ENTRY(entry_username)), CRED_SPECIFIED);
|
||||
cli_credentials_set_password(credentials, gtk_entry_get_text(GTK_ENTRY(entry_password)), CRED_SPECIFIED);
|
||||
cli_credentials_set_domain(credentials, gtk_entry_get_text(GTK_ENTRY(entry_domain)), CRED_SPECIFIED);
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(anonymous))) {
|
||||
cli_credentials_set_anonymous(credentials);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = NULL;
|
||||
@ -80,10 +110,24 @@ static const char *gtk_get_userpassword(struct cli_credentials *credentials)
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
talloc_free(prompt);
|
||||
|
||||
return ret;
|
||||
static const char *gtk_get_username(struct cli_credentials *credentials)
|
||||
{
|
||||
gtk_get_credentials(credentials);
|
||||
return credentials->username;
|
||||
}
|
||||
|
||||
static const char *gtk_get_userpassword(struct cli_credentials *credentials)
|
||||
{
|
||||
gtk_get_credentials(credentials);
|
||||
return credentials->password;
|
||||
}
|
||||
|
||||
static const char *gtk_get_domain(struct cli_credentials *credentials)
|
||||
{
|
||||
gtk_get_credentials(credentials);
|
||||
return credentials->domain;
|
||||
}
|
||||
|
||||
void cli_credentials_set_gtk_callbacks(struct cli_credentials *cred)
|
||||
@ -92,4 +136,14 @@ void cli_credentials_set_gtk_callbacks(struct cli_credentials *cred)
|
||||
cred->password_cb = gtk_get_userpassword;
|
||||
cred->password_obtained = CRED_CALLBACK;
|
||||
}
|
||||
|
||||
if (cred->username_obtained <= CRED_CALLBACK) {
|
||||
cred->username_cb = gtk_get_username;
|
||||
cred->username_obtained = CRED_CALLBACK;
|
||||
}
|
||||
|
||||
if (cred->domain_obtained <= CRED_CALLBACK) {
|
||||
cred->domain_cb = gtk_get_domain;
|
||||
cred->domain_obtained = CRED_CALLBACK;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void gtk_show_ntstatus(GtkWidget *win, const char *message, NTSTATUS status)
|
||||
static void on_browse_activate (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
GtkRpcBindingDialog *rbd = user_data;
|
||||
GtkWidget *shd = gtk_select_host_dialog_new(rbd->sam_pipe, TRUE);
|
||||
GtkWidget *shd = gtk_select_host_dialog_new(rbd->sam_pipe);
|
||||
if(gtk_dialog_run(GTK_DIALOG(shd)) == GTK_RESPONSE_ACCEPT) {
|
||||
gtk_entry_set_text(GTK_ENTRY(rbd->entry_host), gtk_select_host_dialog_get_host(GTK_SELECT_HOST_DIALOG(shd)));
|
||||
}
|
||||
@ -73,15 +73,10 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *lbl_name;
|
||||
GtkWidget *label2;
|
||||
GtkWidget *label3;
|
||||
GtkWidget *frame_security;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *label3;
|
||||
GtkWidget *table1;
|
||||
GtkWidget *lbl_username;
|
||||
GtkWidget *lbl_userdomain;
|
||||
GtkWidget *btn_browse;
|
||||
GtkWidget *label9;
|
||||
GtkWidget *lbl_credentials;
|
||||
GtkWidget *dialog_action_area1;
|
||||
GtkWidget *btn_cancel;
|
||||
GtkWidget *btn_connect;
|
||||
@ -89,11 +84,6 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
|
||||
|
||||
gtk_rpc_binding_dialog->mem_ctx = talloc_init("gtk_rcp_binding_dialog");
|
||||
|
||||
gtk_rpc_binding_dialog->credentials = cli_credentials_init(gtk_rpc_binding_dialog->mem_ctx);
|
||||
|
||||
cli_credentials_guess(gtk_rpc_binding_dialog->credentials);
|
||||
cli_credentials_set_gtk_callbacks(gtk_rpc_binding_dialog->credentials);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (gtk_rpc_binding_dialog), "Connect");
|
||||
|
||||
dialog_vbox1 = GTK_DIALOG (gtk_rpc_binding_dialog)->vbox;
|
||||
@ -155,6 +145,10 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
|
||||
gtk_frame_set_label_widget (GTK_FRAME (gtk_rpc_binding_dialog->frame_host), label2);
|
||||
|
||||
frame_security = gtk_frame_new (NULL);
|
||||
|
||||
label3 = gtk_label_new ("Security");
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame_security), label3);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), frame_security, TRUE, TRUE, 0);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
@ -166,62 +160,6 @@ static void gtk_rpc_binding_dialog_init (GtkRpcBindingDialog *gtk_rpc_binding_di
|
||||
gtk_rpc_binding_dialog->chk_seal = gtk_check_button_new_with_mnemonic ("_Seal");
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), gtk_rpc_binding_dialog->chk_seal, FALSE, FALSE, 0);
|
||||
|
||||
label3 = gtk_label_new ("Security");
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame_security), label3);
|
||||
|
||||
gtk_rpc_binding_dialog->frame_credentials = gtk_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox1), gtk_rpc_binding_dialog->frame_credentials, TRUE, TRUE, 0);
|
||||
|
||||
table1 = gtk_table_new (4, 2, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (gtk_rpc_binding_dialog->frame_credentials), table1);
|
||||
|
||||
lbl_username = gtk_label_new ("Username:");
|
||||
gtk_table_attach (GTK_TABLE (table1), lbl_username, 0,1, 0,1,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (lbl_username), 0, 0.5);
|
||||
|
||||
lbl_userdomain= gtk_label_new ("Domain:");
|
||||
gtk_table_attach (GTK_TABLE (table1), lbl_userdomain, 0,1, 1,2,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (lbl_userdomain), 0, 0.5);
|
||||
|
||||
label9 = gtk_label_new ("");
|
||||
gtk_table_attach (GTK_TABLE (table1), label9, 0,1, 3,4,
|
||||
(GtkAttachOptions) (GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
|
||||
|
||||
gtk_rpc_binding_dialog->entry_username = gtk_entry_new ();
|
||||
gtk_table_attach (GTK_TABLE (table1), gtk_rpc_binding_dialog->entry_username, 1,2, 0,1,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
|
||||
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),
|
||||
cli_credentials_get_domain(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),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
|
||||
/* Poor man's autodetection */
|
||||
if(getenv("KRB5CCNAME")) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(gtk_rpc_binding_dialog->krb5_chk_button), TRUE);
|
||||
}
|
||||
|
||||
lbl_credentials = gtk_label_new ("Credentials");
|
||||
gtk_frame_set_label_widget (GTK_FRAME (gtk_rpc_binding_dialog->frame_credentials), lbl_credentials);
|
||||
|
||||
dialog_action_area1 = GTK_DIALOG (gtk_rpc_binding_dialog)->action_area;
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
|
||||
|
||||
@ -272,24 +210,13 @@ GType gtk_rpc_binding_dialog_get_type (void)
|
||||
return mytype;
|
||||
}
|
||||
|
||||
GtkWidget *gtk_rpc_binding_dialog_new (BOOL nocredentials, struct dcerpc_pipe *sam_pipe)
|
||||
GtkWidget *gtk_rpc_binding_dialog_new (struct dcerpc_pipe *sam_pipe)
|
||||
{
|
||||
GtkRpcBindingDialog *d = GTK_RPC_BINDING_DIALOG ( g_object_new (gtk_rpc_binding_dialog_get_type (), NULL));
|
||||
if (nocredentials) {
|
||||
gtk_widget_hide_all(d->frame_credentials);
|
||||
}
|
||||
d->sam_pipe = sam_pipe;
|
||||
return GTK_WIDGET(d);
|
||||
}
|
||||
|
||||
struct cli_credentials *gtk_rpc_binding_dialog_get_credentials(GtkRpcBindingDialog *d)
|
||||
{
|
||||
cli_credentials_set_username(d->credentials, gtk_entry_get_text(GTK_ENTRY(d->entry_username)), CRED_SPECIFIED);
|
||||
cli_credentials_set_domain(d->credentials, gtk_entry_get_text(GTK_ENTRY(d->entry_userdomain)), CRED_SPECIFIED);
|
||||
|
||||
return d->credentials;
|
||||
}
|
||||
|
||||
const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d)
|
||||
{
|
||||
return gtk_entry_get_text(GTK_ENTRY(d->entry_host));
|
||||
|
@ -44,10 +44,8 @@ struct _GtkRpcBindingDialog
|
||||
GtkWidget *entry_userdomain;
|
||||
GtkWidget *entry_password;
|
||||
GtkWidget *krb5_chk_button;
|
||||
GtkWidget *frame_credentials;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
struct dcerpc_pipe *sam_pipe;
|
||||
struct cli_credentials *credentials;
|
||||
};
|
||||
|
||||
typedef struct _GtkRpcBindingDialogClass GtkRpcBindingDialogClass;
|
||||
@ -66,12 +64,11 @@ struct _GtkRpcBindingDialogClass
|
||||
/* subsystem prototypes */
|
||||
GtkWidget *create_gtk_samba_about_dialog (const char *appname);
|
||||
void gtk_show_ntstatus(GtkWidget *win, const char *, NTSTATUS status);
|
||||
GtkWidget *gtk_rpc_binding_dialog_new (BOOL nocredentials, struct dcerpc_pipe *sam_pipe);
|
||||
GtkWidget *gtk_rpc_binding_dialog_new (struct dcerpc_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);
|
||||
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);
|
||||
|
||||
int gtk_event_loop(void);
|
||||
|
@ -256,7 +256,7 @@ GType gtk_select_host_dialog_get_type (void)
|
||||
return mytype;
|
||||
}
|
||||
|
||||
GtkWidget *gtk_select_host_dialog_new (struct dcerpc_pipe *sam_pipe, BOOL nocredentials)
|
||||
GtkWidget *gtk_select_host_dialog_new (struct dcerpc_pipe *sam_pipe)
|
||||
{
|
||||
return GTK_WIDGET ( g_object_new (gtk_select_host_dialog_get_type (), NULL ));
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ struct _GtkSelectHostDialogClass
|
||||
GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe);
|
||||
GType gtk_select_domain_dialog_get_type (void);
|
||||
struct policy_handle gtk_select_domain_dialog_get_handle(GtkSelectDomainDialog *d);
|
||||
GtkWidget *gtk_select_host_dialog_new (struct dcerpc_pipe *sam_pipe, BOOL nocredentials);
|
||||
GtkWidget *gtk_select_host_dialog_new (struct dcerpc_pipe *sam_pipe);
|
||||
const char *gtk_select_host_dialog_get_host (GtkSelectHostDialog *d);
|
||||
GType gtk_select_host_dialog_get_type (void);
|
||||
|
||||
|
@ -178,7 +178,7 @@ static void on_connect_clicked(GtkButton *btn, gpointer user_data)
|
||||
gint result;
|
||||
struct cli_credentials *credentials;
|
||||
|
||||
d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(TRUE, NULL));
|
||||
d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(NULL));
|
||||
result = gtk_dialog_run(GTK_DIALOG(d));
|
||||
switch(result) {
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
|
@ -396,9 +396,10 @@ static void on_open_local_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
char *tmp;
|
||||
GtkWidget *rpcwin = GTK_WIDGET(gtk_rpc_binding_dialog_new(FALSE, NULL));
|
||||
GtkWidget *rpcwin = GTK_WIDGET(gtk_rpc_binding_dialog_new(NULL));
|
||||
gint result = gtk_dialog_run(GTK_DIALOG(rpcwin));
|
||||
WERROR error;
|
||||
struct cli_credentials *creds;
|
||||
|
||||
if(result != GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
@ -406,8 +407,12 @@ static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
return;
|
||||
}
|
||||
|
||||
creds = cli_credentials_init(mem_ctx);
|
||||
cli_credentials_guess(creds);
|
||||
cli_credentials_set_gtk_callbacks(creds);
|
||||
|
||||
error = reg_open_remote(®istry,
|
||||
gtk_rpc_binding_dialog_get_credentials(GTK_RPC_BINDING_DIALOG(rpcwin)),
|
||||
creds,
|
||||
gtk_rpc_binding_dialog_get_binding_string(GTK_RPC_BINDING_DIALOG(rpcwin), mem_ctx));
|
||||
|
||||
if(!W_ERROR_IS_OK(error)) {
|
||||
|
@ -87,10 +87,11 @@ on_connect_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
GtkRpcBindingDialog *d;
|
||||
NTSTATUS status;
|
||||
struct cli_credentials *credentials;
|
||||
gint result;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(FALSE, NULL));
|
||||
d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(NULL));
|
||||
result = gtk_dialog_run(GTK_DIALOG(d));
|
||||
switch(result) {
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
@ -102,12 +103,16 @@ on_connect_activate (GtkMenuItem *menuitem,
|
||||
|
||||
mem_ctx = talloc_init("gwcrontab_connect");
|
||||
/* If connected, get list of jobs */
|
||||
|
||||
credentials = cli_credentials_init(mem_ctx);
|
||||
cli_credentials_guess(credentials);
|
||||
cli_credentials_set_gtk_callbacks(credentials);
|
||||
|
||||
status = dcerpc_pipe_connect_b(mem_ctx, &at_pipe,
|
||||
gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
|
||||
DCERPC_ATSVC_UUID,
|
||||
DCERPC_ATSVC_VERSION,
|
||||
gtk_rpc_binding_dialog_get_credentials(d));
|
||||
credentials);
|
||||
|
||||
if(!NT_STATUS_IS_OK(status)) {
|
||||
gtk_show_ntstatus(mainwin, "Error while connecting to at service", status);
|
||||
|
@ -113,10 +113,11 @@ static void connect_sam(void)
|
||||
GtkRpcBindingDialog *d;
|
||||
NTSTATUS status;
|
||||
struct samr_Connect r;
|
||||
struct cli_credentials *cred;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
gint result;
|
||||
|
||||
d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(FALSE, NULL));
|
||||
d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(NULL));
|
||||
result = gtk_dialog_run(GTK_DIALOG(d));
|
||||
switch(result) {
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
@ -127,12 +128,14 @@ static void connect_sam(void)
|
||||
}
|
||||
|
||||
mem_ctx = talloc_init("gwsam_connect");
|
||||
cred = cli_credentials_init(mem_ctx);
|
||||
cli_credentials_guess(cred);
|
||||
cli_credentials_set_gtk_callbacks(cred);
|
||||
|
||||
/* If connected, get list of jobs */
|
||||
status = dcerpc_pipe_connect_b(mem_ctx, &sam_pipe,
|
||||
gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
|
||||
DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION,
|
||||
gtk_rpc_binding_dialog_get_credentials(d)
|
||||
);
|
||||
DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION, cred );
|
||||
|
||||
if(!NT_STATUS_IS_OK(status)) {
|
||||
gtk_show_ntstatus(mainwin, "While connecting to SAMR interface", status);
|
||||
|
Loading…
Reference in New Issue
Block a user