summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-05-12 22:46:36 +0200
committerGünther Deschner <gd@samba.org>2009-05-13 01:56:39 +0200
commit6154b031f4521fad4b5c460643da59dd918b240a (patch)
tree45e3fb6d42b62baeaeacea80724cd853840bad2c
parentaa71ab6d1d4ee6ef4f868b3b8c1b9b6df8cfcb04 (diff)
downloadsamba-6154b031f4521fad4b5c460643da59dd918b240a.tar.gz
samba-6154b031f4521fad4b5c460643da59dd918b240a.tar.bz2
samba-6154b031f4521fad4b5c460643da59dd918b240a.zip
s3-netdomjoin-gui: prepare to call out for NetRenameMachineInDomain() to rename computers
in domains. Guenther
-rw-r--r--source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c49
1 files changed, 48 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 7652b4584c..66e95720cd 100644
--- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
+++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
@@ -81,6 +81,12 @@ typedef struct join_state {
uid_t uid;
} join_state;
+static void callback_creds_prompt(GtkWidget *widget,
+ gpointer data,
+ const char *label_string,
+ gpointer cont_fn);
+
+
static void debug(const char *format, ...)
{
va_list args;
@@ -459,9 +465,50 @@ static void callback_do_hostname_change(GtkWidget *widget,
struct join_state *state = (struct join_state *)data;
switch (state->name_type_initial) {
- case NetSetupDomainName:
+ case NetSetupDomainName: {
+#if 0
+ NET_API_STATUS status;
+ const char *newname;
+ char *p = NULL;
+
+ newname = strdup(gtk_label_get_text(GTK_LABEL(state->label_full_computer_name)));
+ if (!newname) {
+ return;
+ }
+
+ p = strchr(newname, '.');
+ if (p) {
+ *p = NULL;
+ }
+
+ if (!state->account || !state->password) {
+ debug("callback_do_hostname_change: no creds yet\n");
+ callback_creds_prompt(NULL, state,
+ "Enter the name and password of an account with permission to change a computer name in a the domain.",
+ callback_do_storeauth_and_continue);
+ }
+
+ if (!state->account || !state->password) {
+ debug("callback_do_hostname_change: still no creds???\n");
+ return;
+ }
+
+ status = NetRenameMachineInDomain(state->target_hostname,
+ newname,
+ state->account,
+ state->password,
+ NETSETUP_ACCT_CREATE);
+ SAFE_FREE(newname);
+ /* we renamed the machine in the domain */
+ if (status == 0) {
+ return;
+ }
+ str = libnetapi_get_error_string(state->ctx, status);
+#else
str = "To be implemented: call NetRenameMachineInDomain\n";
+#endif
break;
+ }
case NetSetupWorkgroupName:
str = "To be implemented: call SetComputerNameEx\n";
break;