diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-08-19 22:47:10 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-08-19 22:47:10 +0000 |
commit | f1be3a5c5defc2df94550b90b7dd2ed4ab0cb1f2 (patch) | |
tree | e79dfbfedf8fbdaed7873463939fbe28c2b07070 /source3/utils/net.c | |
parent | ec8b32df568260446b815619815e94a7e1b3fd4e (diff) | |
download | samba-f1be3a5c5defc2df94550b90b7dd2ed4ab0cb1f2.tar.gz samba-f1be3a5c5defc2df94550b90b7dd2ed4ab0cb1f2.tar.bz2 samba-f1be3a5c5defc2df94550b90b7dd2ed4ab0cb1f2.zip |
- Make 'net' use a single funciton for setting the 'use machine account' code.
- Make winbindd try to use kerberos for connections to DCs, so that it can
access RA=2 servers, particularly for netlogon.
- Make rpcclient follow the new flags for the NETLOGON pipe
- Make all the code that uses schannel use the centralised functions for doing so.
Andrew Bartlett
(This used to be commit 96b4187963cedcfe158ff02868929b8cf81c6ebf)
Diffstat (limited to 'source3/utils/net.c')
-rw-r--r-- | source3/utils/net.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 8f6b09a3fa..c49c77dd50 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -181,6 +181,27 @@ NTSTATUS connect_to_ipc_anonymous(struct cli_state **c, } } +/**************************************************************************** + Use the local machine's password for this session +****************************************************************************/ +int net_use_machine_password(void) +{ + char *user_name = NULL; + + if (!secrets_init()) { + d_printf("ERROR: Unable to open secrets database\n"); + exit(1); + } + + user_name = NULL; + opt_password = secrets_fetch_machine_password(opt_target_workgroup, NULL, NULL); + if (asprintf(&user_name, "%s$@%s", global_myname(), lp_realm()) == -1) { + return -1; + } + opt_user_name = user_name; + return 0; +} + BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_name) { @@ -321,7 +342,7 @@ static int net_join(int argc, const char **argv) if (net_ads_join(argc, argv) == 0) return 0; else - d_printf("ADS join did not work, trying RPC...\n"); + d_printf("ADS join did not work, falling back to RPC...\n"); } return net_rpc_join(argc, argv); } @@ -649,23 +670,10 @@ static struct functable net_func[] = { sec_init(); if (opt_machine_pass) { - char *user = NULL; /* it is very useful to be able to make ads queries as the machine account for testing purposes and for domain leave */ - if (!secrets_init()) { - d_printf("ERROR: Unable to open secrets database\n"); - exit(1); - } - - opt_password = secrets_fetch_machine_password(opt_workgroup, NULL, NULL); - - asprintf(&user,"%s$", global_myname()); - opt_user_name = user; - if (!opt_password) { - d_printf("ERROR: Unable to fetch machine password\n"); - exit(1); - } + net_use_machine_password(); } if (!opt_password) { |