libcli/smb: only force signing of smb2 session setups when binding a new session
[Samba.git] / source3 / utils / net_join.c
blob1493dff74d7bd4cb800a5ed2467783ae4f546199
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_m(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,
47 _("ADS join did not work, falling back to "
48 "RPC...\n"));
50 return net_rpc_join(c, argc, argv);