summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-05-08 01:07:10 +0200
committerGünther Deschner <gd@samba.org>2008-05-08 01:09:14 +0200
commitd3dfdc2f598fae92f1d3d1e95754917ff5869fa7 (patch)
tree5d7a9a98671406df3d5d4060acba1d5b39214162 /source3/lib
parent64ddd381b74ca94e8ff8ae62d8f019a9b5290a80 (diff)
downloadsamba-d3dfdc2f598fae92f1d3d1e95754917ff5869fa7.tar.gz
samba-d3dfdc2f598fae92f1d3d1e95754917ff5869fa7.tar.bz2
samba-d3dfdc2f598fae92f1d3d1e95754917ff5869fa7.zip
netdomjoin-gui: before prompting for creds, ask dsgetdcname for a dc.
Guenther (This used to be commit 47146effc1c2bca516d4fbccf221b5b0e02737bf)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
index 5ce4ca2c87..a11b0eb0a4 100644
--- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
+++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
@@ -670,6 +670,41 @@ static void callback_do_join(GtkWidget *widget,
}
+ /* before prompting for creds, make sure we can find a dc */
+
+ if (domain_join) {
+
+ struct DOMAIN_CONTROLLER_INFO *dc_info = NULL;
+
+ status = DsGetDcName(NULL,
+ state->name_buffer_new,
+ NULL,
+ NULL,
+ 0,
+ &dc_info);
+ if (status != 0) {
+ err_str = libnetapi_get_error_string(state->ctx, status);
+ g_print("callback_do_join: 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",
+ state->name_buffer_new,
+ 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 (join_creds_required) {
if (!state->account || !state->password) {
debug("callback_do_join: no creds yet\n");