summaryrefslogtreecommitdiff
path: root/source3/utils/net_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils/net_util.c')
-rw-r--r--source3/utils/net_util.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index be00dde16e..eb39c739e7 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -94,17 +94,23 @@ NTSTATUS connect_to_service(struct net_context *c,
const char *service_type)
{
NTSTATUS nt_status;
+ int flags = 0;
c->opt_password = net_prompt_pass(c, c->opt_user_name);
- if (!c->opt_password) {
- return NT_STATUS_NO_MEMORY;
+
+ if (c->opt_kerberos) {
+ flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ }
+
+ if (c->opt_kerberos && c->opt_password) {
+ flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
}
nt_status = cli_full_connection(cli_ctx, NULL, server_name,
server_ss, c->opt_port,
service_name, service_type,
c->opt_user_name, c->opt_workgroup,
- c->opt_password, 0, Undefined, NULL);
+ c->opt_password, flags, Undefined, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
d_fprintf(stderr, "Could not connect to server %s\n", server_name);
@@ -538,6 +544,10 @@ const char *net_prompt_pass(struct net_context *c, const char *user)
return NULL;
}
+ if (c->opt_kerberos && !c->opt_user_specified) {
+ return NULL;
+ }
+
asprintf(&prompt, "Enter %s's password:", user);
if (!prompt) {
return NULL;