summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-04-04 16:47:24 +0000
committerJim McDonough <jmcd@samba.org>2002-04-04 16:47:24 +0000
commite2745e88e508b261ce57eac0a252283542404849 (patch)
tree70e2cc75905f0d20a6b069f48d613b1a44d73794 /source3/utils
parent8ad60283be2c49d9db6d791c6b7f61080035ba7f (diff)
downloadsamba-e2745e88e508b261ce57eac0a252283542404849.tar.gz
samba-e2745e88e508b261ce57eac0a252283542404849.tar.bz2
samba-e2745e88e508b261ce57eac0a252283542404849.zip
More updates for auto-detecting server connection method. Added net_ads_check()
to make a connection (which stores the password in a global so it can be used by rpc or rap function if ads fails) and close it to verify if ads method should be used. (This used to be commit 093297a27db9834cf8aea34302246af8997d9c66)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index ce51a50eb7..2696152b12 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -114,13 +114,31 @@ retry:
second_time = True;
goto retry;
} else {
- d_printf("ads_connect: %s\n", ads_errstr(status));
+ DEBUG(1,("ads_connect: %s\n", ads_errstr(status)));
return NULL;
}
}
return ads;
}
+
+/*
+ Check to see if connection can be made via ads.
+ ads_startup() stores the password in opt_password if it needs to so
+ that rpc or rap can use it without re-prompting.
+*/
+int net_ads_check(void)
+{
+ ADS_STRUCT *ads;
+
+ ads = ads_startup();
+ if (!ads)
+ return -1;
+ ads_destroy(&ads);
+ return 0;
+}
+
+
static void usergrp_display(char *field, void **values, void *data_area)
{
char **disp_fields = (char **) data_area;
@@ -268,7 +286,7 @@ static int ads_user_delete(int argc, const char **argv)
return -1;
}
-static int net_ads_user(int argc, const char **argv)
+int net_ads_user(int argc, const char **argv)
{
struct functable func[] = {
{"ADD", ads_user_add},
@@ -762,20 +780,35 @@ int net_ads(int argc, const char **argv)
#else
-int net_ads_usage(int argc, const char **argv)
+static int net_ads_noads(void)
{
d_printf("ADS support not compiled in\n");
return -1;
}
+int net_ads_usage(int argc, const char **argv)
+{
+ return net_ads_noads();
+}
+
int net_ads_help(int argc, const char **argv)
{
- d_printf("ADS support not compiled in\n");
- return -1;
+ return net_ads_noads();
}
int net_ads_join(int argc, const char **argv)
{
+ return net_ads_noads();
+}
+
+int net_ads_user(int argc, const char **argv)
+{
+ return net_ads_noads();
+}
+
+/* this one shouldn't display a message */
+int net_ads_check(void)
+{
return -1;
}