summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmb_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/libsmb_context.c')
-rw-r--r--source3/libsmb/libsmb_context.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index c1af48507c..4c12d18ab7 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -630,11 +630,11 @@ smbc_version(void)
* Set the credentials so DFS will work when following referrals.
*/
void
-smbc_set_credentials(char *workgroup,
- char *user,
- char *password,
+smbc_set_credentials(const char *workgroup,
+ const char *user,
+ const char *password,
smbc_bool use_kerberos,
- char *signing_state)
+ const char *signing_state)
{
struct user_auth_info *auth_info;
@@ -652,3 +652,39 @@ smbc_set_credentials(char *workgroup,
cli_cm_set_credentials(auth_info);
TALLOC_FREE(auth_info);
}
+
+void smbc_set_credentials_with_fallback(SMBCCTX *context,
+ const char *workgroup,
+ const char *user,
+ const char *password)
+{
+ smbc_bool use_kerberos = false;
+ const char *signing_state = "off";
+
+ if (! context ||
+ ! workgroup || ! *workgroup ||
+ ! user || ! *user ||
+ ! password || ! *password) {
+
+ return;
+ }
+
+ if (smbc_getOptionUseKerberos(context)) {
+ use_kerberos = True;
+ }
+
+ if (lp_client_signing()) {
+ signing_state = "on";
+ }
+
+ if (lp_client_signing() == Required) {
+ signing_state = "force";
+ }
+
+ smbc_set_credentials(workgroup, user, password,
+ use_kerberos, signing_state);
+
+ if (smbc_getOptionFallbackAfterKerberos(context)) {
+ cli_cm_set_fallback_after_kerberos();
+ }
+}