summaryrefslogtreecommitdiff
path: root/source3/utils/net_util.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-07-30 21:37:09 +0200
committerGünther Deschner <gd@samba.org>2008-07-31 13:53:53 +0200
commit6913f986f4213e056f724ed3be3aee313c07d78c (patch)
tree680afbf2492ee36aff57ffef1d8abde086180d0a /source3/utils/net_util.c
parent536c26aa02f6afef4431427da1c8f6cc5b234a87 (diff)
downloadsamba-6913f986f4213e056f724ed3be3aee313c07d78c.tar.gz
samba-6913f986f4213e056f724ed3be3aee313c07d78c.tar.bz2
samba-6913f986f4213e056f724ed3be3aee313c07d78c.zip
net: add "-k" switch for kerberos authentication (in preparation for #5416).
Guenther (This used to be commit 4cce94d464b16d29b638da3a581d98a237959b63)
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;