summaryrefslogtreecommitdiff
path: root/source3/utils/net.c
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2007-08-29 19:55:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:21 -0500
commit48853f0badc92b86c18ed3daad3d45f8d74c5cac (patch)
tree3f51213aaa0a87ae4826a7456134b0bbdfe7145e /source3/utils/net.c
parentbabab94fb9a900008c72ca6271dd04fa96175fab (diff)
downloadsamba-48853f0badc92b86c18ed3daad3d45f8d74c5cac.tar.gz
samba-48853f0badc92b86c18ed3daad3d45f8d74c5cac.tar.bz2
samba-48853f0badc92b86c18ed3daad3d45f8d74c5cac.zip
r24789: Add implementation of machine-authenticated connection to netlogon
pipe used when connecting to win2k and newer domain controllers. The server may be configured to deny anonymous netlogon connections which would stop domain join verification step. Still, winnt domains require such smb sessions not to be authenticated using machine credentials. Creds employed in smb session cannot have a username in upn form, so provide the separate function to use machine account. rafal (This used to be commit 30d99d8ac3379caadc5bdb353977149d1ee16403)
Diffstat (limited to 'source3/utils/net.c')
-rw-r--r--source3/utils/net.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 5a4568e033..c37e426d53 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -341,10 +341,10 @@ NTSTATUS connect_dst_pipe(struct cli_state **cli_dst, struct rpc_pipe_client **p
}
/****************************************************************************
- Use the local machine's password for this session.
+ Use the local machine account (upn) and password for this session.
****************************************************************************/
-int net_use_machine_password(void)
+int net_use_upn_machine_account(void)
{
char *user_name = NULL;
@@ -353,7 +353,6 @@ int net_use_machine_password(void)
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;
@@ -362,6 +361,27 @@ int net_use_machine_password(void)
return 0;
}
+/****************************************************************************
+ Use the machine account name and password for this session.
+****************************************************************************/
+
+int net_use_machine_account(void)
+{
+ char *user_name = NULL;
+
+ if (!secrets_init()) {
+ d_fprintf(stderr, "ERROR: Unable to open secrets database\n");
+ exit(1);
+ }
+
+ opt_password = secrets_fetch_machine_password(opt_target_workgroup, NULL, NULL);
+ if (asprintf(&user_name, "%s$", global_myname()) == -1) {
+ return -1;
+ }
+ opt_user_name = user_name;
+ return 0;
+}
+
BOOL net_find_server(const char *domain, unsigned flags, struct in_addr *server_ip, char **server_name)
{
const char *d = domain ? domain : opt_target_workgroup;
@@ -1044,7 +1064,7 @@ static struct functable net_func[] = {
/* it is very useful to be able to make ads queries as the
machine account for testing purposes and for domain leave */
- net_use_machine_password();
+ net_use_upn_machine_account();
}
if (!opt_password) {