summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/netapi/cm.c8
-rw-r--r--source3/lib/netapi/examples/common.c4
-rw-r--r--source3/lib/netapi/netapi.c9
-rw-r--r--source3/lib/netapi/netapi.h6
4 files changed, 25 insertions, 2 deletions
diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c
index 96087247d2..071ebfd4bc 100644
--- a/source3/lib/netapi/cm.c
+++ b/source3/lib/netapi/cm.c
@@ -36,7 +36,10 @@ WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
}
cli_cm_set_signing_state(Undefined);
- cli_cm_set_use_kerberos();
+
+ if (ctx->use_kerberos) {
+ cli_cm_set_use_kerberos();
+ }
if (ctx->password) {
cli_cm_set_password(ctx->password);
@@ -46,7 +49,8 @@ WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
}
if (ctx->username && ctx->username[0] &&
- ctx->password && ctx->password[0]) {
+ ctx->password && ctx->password[0] &&
+ ctx->use_kerberos) {
cli_cm_set_fallback_after_kerberos();
}
diff --git a/source3/lib/netapi/examples/common.c b/source3/lib/netapi/examples/common.c
index 2c3e4d711d..74e28616bf 100644
--- a/source3/lib/netapi/examples/common.c
+++ b/source3/lib/netapi/examples/common.c
@@ -48,6 +48,9 @@ void popt_common_callback(poptContext con,
case 'p':
libnetapi_set_password(ctx, arg);
break;
+ case 'k':
+ libnetapi_set_use_kerberos(ctx);
+ break;
}
}
@@ -56,6 +59,7 @@ struct poptOption popt_common_netapi_examples[] = {
{ "user", 'U', POPT_ARG_STRING, NULL, 'U', "Username used for connection", "USERNAME" },
{ "password", 'p', POPT_ARG_STRING, NULL, 'p', "Password used for connection", "PASSWORD" },
{ "debuglevel", 'd', POPT_ARG_STRING, NULL, 'd', "Debuglevel", "DEBUGLEVEL" },
+ { "kerberos", 'k', POPT_ARG_NONE, NULL, 'k', "Use Kerberos", NULL },
POPT_TABLEEND
};
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index f15e5bf067..9e309634b4 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -211,6 +211,15 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
/****************************************************************
****************************************************************/
+NET_API_STATUS libnetapi_set_use_kerberos(struct libnetapi_ctx *ctx)
+{
+ ctx->use_kerberos = true;
+ return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
const char *libnetapi_errstr(NET_API_STATUS status)
{
if (status & 0xc0000000) {
diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h
index 97fed2e1d3..0d21067a20 100644
--- a/source3/lib/netapi/netapi.h
+++ b/source3/lib/netapi/netapi.h
@@ -89,6 +89,7 @@ struct libnetapi_ctx {
char *workgroup;
char *password;
char *krb5_cc_env;
+ int use_kerberos;
};
/****************************************************************
@@ -133,6 +134,11 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
/****************************************************************
****************************************************************/
+NET_API_STATUS libnetapi_set_use_kerberos(struct libnetapi_ctx *ctx);
+
+/****************************************************************
+****************************************************************/
+
const char *libnetapi_errstr(NET_API_STATUS status);
/****************************************************************