Fix bug 7005 - mangle method = hash truncates files with dot '. ' character
[Samba.git] / source / utils / net_join.c
blob8d4d8c3e520dd0af9a19fa4895ed98c637d3dfe2
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)
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.
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.
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/>.
21 #include "includes.h"
22 #include "utils/net.h"
24 int net_join_usage(struct net_context *c, int argc, const char **argv)
26 d_printf("\nnet [<method>] join [misc. options]\n"
27 "\tjoins this server to a domain\n");
28 d_printf("Valid methods: (auto-detected if not specified)\n");
29 d_printf("\tads\t\t\t\tActive Directory (LDAP/Kerberos)\n");
30 d_printf("\trpc\t\t\t\tDCE-RPC\n");
31 net_common_flags_usage(c, argc, argv);
32 return -1;
35 int net_join(struct net_context *c, int argc, const char **argv)
37 if ((argc > 0) && (StrCaseCmp(argv[0], "HELP") == 0)) {
38 net_join_usage(c, argc, argv);
39 return 0;
42 if (net_ads_check_our_domain(c) == 0) {
43 if (net_ads_join(c, argc, argv) == 0)
44 return 0;
45 else
46 d_fprintf(stderr, "ADS join did not work, falling back to RPC...\n");
48 return net_rpc_join(c, argc, argv);