diff options
author | Günther Deschner <gd@samba.org> | 2008-05-16 12:11:43 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-05-16 12:11:43 +0200 |
commit | 0b25870b547efdd954ac343c1a753d853a75ba67 (patch) | |
tree | c00b5c0432ad4abe9e90fba46574f8be27d7fa7f /source3/lib/netapi/examples | |
parent | 9530c26c4c1a6c6616675c5be2c48089c79d0203 (diff) | |
download | samba-0b25870b547efdd954ac343c1a753d853a75ba67.tar.gz samba-0b25870b547efdd954ac343c1a753d853a75ba67.tar.bz2 samba-0b25870b547efdd954ac343c1a753d853a75ba67.zip |
netdomjoin-gui: before prompting for creds (for receiving joinable ous), find a dc.
Guenther
(This used to be commit ae60695a349bccd1128e6c439664b0607627ef23)
Diffstat (limited to 'source3/lib/netapi/examples')
-rw-r--r-- | source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index a11b0eb0a4..df8193707c 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -932,6 +932,9 @@ static void callback_do_getous(GtkWidget *widget, const char **ous = NULL; int i; const char *domain = NULL; + struct DOMAIN_CONTROLLER_INFO *dc_info = NULL; + const char *err_str = NULL; + GtkWidget *dialog; struct join_state *state = (struct join_state *)data; @@ -939,6 +942,34 @@ static void callback_do_getous(GtkWidget *widget, domain = state->name_buffer_new ? state->name_buffer_new : state->name_buffer_initial; + status = DsGetDcName(NULL, + domain, + NULL, + NULL, + 0, + &dc_info); + if (status != 0) { + err_str = libnetapi_get_error_string(state->ctx, status); + g_print("callback_do_getous: failed find dc (%s)\n", err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "Failed to find a domain controller for domain: \"%s\": %s", + domain, + err_str); + + gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + if (!state->account || !state->password) { debug("callback_do_getous: no creds yet\n"); callback_creds_prompt(NULL, state, @@ -956,7 +987,6 @@ static void callback_do_getous(GtkWidget *widget, state->password, &num_ous, &ous); if (status != NET_API_STATUS_SUCCESS) { - GtkWidget *dialog; callback_do_freeauth(NULL, state); debug("failed to call NetGetJoinableOUs: %s\n", libnetapi_get_error_string(state->ctx, status)); |