Line data Source code
1 : /*
2 : Samba Unix/Linux SMB client library
3 : net join commands
4 : Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com)
5 : Copyright (C) 2008 Kai Blin (kai@samba.org)
6 :
7 : This program is free software; you can redistribute it and/or modify
8 : it under the terms of the GNU General Public License as published by
9 : the Free Software Foundation; either version 3 of the License, or
10 : (at your option) any later version.
11 :
12 : This program is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU General Public License for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with this program. If not, see <http://www.gnu.org/licenses/>.
19 : */
20 :
21 : #include "includes.h"
22 : #include "utils/net.h"
23 :
24 0 : int net_join_usage(struct net_context *c, int argc, const char **argv)
25 : {
26 0 : d_printf(_("\nnet [<method>] join [misc. options]\n"
27 : "\tjoins this server to a domain\n"));
28 0 : d_printf(_("Valid methods: (auto-detected if not specified)\n"));
29 0 : d_printf(_("\tads\t\t\t\tActive Directory (LDAP/Kerberos)\n"));
30 0 : d_printf(_("\trpc\t\t\t\tDCE-RPC\n"));
31 0 : net_common_flags_usage(c, argc, argv);
32 0 : return -1;
33 : }
34 :
35 20 : int net_join(struct net_context *c, int argc, const char **argv)
36 : {
37 20 : if ((argc > 0) && (strcasecmp_m(argv[0], "HELP") == 0)) {
38 0 : net_join_usage(c, argc, argv);
39 0 : return 0;
40 : }
41 :
42 20 : net_warn_member_options();
43 :
44 20 : if (net_ads_check_our_domain(c) == 0) {
45 20 : if (net_ads_join(c, argc, argv) == 0)
46 20 : return 0;
47 : else
48 0 : d_fprintf(stderr,
49 0 : _("ADS join did not work, falling back to "
50 : "RPC...\n"));
51 : }
52 0 : return net_rpc_join(c, argc, argv);
53 : }
54 :
55 :
|