bool case_sensitive;
/*
- * Auth info needed for DFS traversal.
+ * Credentials needed for DFS traversal.
*/
-
- struct user_auth_info *auth_info;
+ struct cli_credentials *creds;
struct smbc_server_cache * server_cache;
#include "libsmb_internal.h"
#include "secrets.h"
#include "../libcli/smb/smbXcli_base.h"
+#include "auth/credentials/credentials.h"
+#include "auth/gensec/gensec.h"
+#include "lib/param/param.h"
/*
* Is the logging working / configfile read ?
DEBUG(3, ("Context %p successfully freed\n", context));
/* Free any DFS auth context. */
- TALLOC_FREE(context->internal->auth_info);
+ TALLOC_FREE(context->internal->creds);
SAFE_FREE(context->internal);
SAFE_FREE(context);
const char *user,
const char *password)
{
- smbc_bool use_kerberos = false;
- const char *signing_state = "off";
- struct user_auth_info *auth_info = NULL;
- TALLOC_CTX *frame;
+ struct loadparm_context *lp_ctx = NULL;
+ struct cli_credentials *creds = NULL;
+ enum credentials_use_kerberos kerberos_state =
+ CRED_USE_KERBEROS_DISABLED;
if (! context) {
return;
}
- frame = talloc_stackframe();
-
if (! workgroup || ! *workgroup) {
workgroup = smbc_getWorkgroup(context);
}
password = "";
}
- auth_info = user_auth_info_init(NULL);
-
- if (! auth_info) {
+ creds = cli_credentials_init(NULL);
+ if (creds == NULL) {
DEBUG(0, ("smbc_set_credentials_with_fallback: allocation fail\n"));
- TALLOC_FREE(frame);
return;
}
- if (smbc_getOptionUseKerberos(context)) {
- use_kerberos = True;
+ lp_ctx = loadparm_init_s3(creds, loadparm_s3_helpers());
+ if (lp_ctx == NULL) {
+ TALLOC_FREE(creds);
+ return;
}
- if (lp_client_signing() != SMB_SIGNING_OFF) {
- signing_state = "if_required";
- }
+ cli_credentials_set_conf(creds, lp_ctx);
- if (lp_client_signing() == SMB_SIGNING_REQUIRED) {
- signing_state = "required";
- }
+ if (smbc_getOptionUseKerberos(context)) {
+ kerberos_state = CRED_USE_KERBEROS_REQUIRED;
- set_cmdline_auth_info_username(auth_info, user);
- set_cmdline_auth_info_domain(auth_info, workgroup);
- set_cmdline_auth_info_password(auth_info, password);
- set_cmdline_auth_info_use_kerberos(auth_info, use_kerberos);
- set_cmdline_auth_info_signing_state(auth_info, signing_state);
- set_cmdline_auth_info_fallback_after_kerberos(auth_info,
- smbc_getOptionFallbackAfterKerberos(context));
- set_cmdline_auth_info_use_ccache(
- auth_info, smbc_getOptionUseCCache(context));
+ if (smbc_getOptionFallbackAfterKerberos(context)) {
+ kerberos_state = CRED_USE_KERBEROS_DESIRED;
+ }
+ }
- TALLOC_FREE(context->internal->auth_info);
+ cli_credentials_set_username(creds, user, CRED_SPECIFIED);
+ cli_credentials_set_password(creds, password, CRED_SPECIFIED);
+ cli_credentials_set_domain(creds, workgroup, CRED_SPECIFIED);
+ cli_credentials_set_kerberos_state(creds,
+ kerberos_state,
+ CRED_SPECIFIED);
+ if (smbc_getOptionUseCCache(context)) {
+ uint32_t gensec_features;
+
+ gensec_features = cli_credentials_get_gensec_features(creds);
+ gensec_features |= GENSEC_FEATURE_NTLM_CCACHE;
+ cli_credentials_set_gensec_features(creds,
+ gensec_features,
+ CRED_SPECIFIED);
+ }
- context->internal->auth_info = auth_info;
- TALLOC_FREE(frame);
+ TALLOC_FREE(context->internal->creds);
+ context->internal->creds = creds;
}
#include "includes.h"
#include "libsmb/namequery.h"
#include "libsmb/libsmb.h"
-#include "auth_info.h"
#include "libsmbclient.h"
#include "libsmb_internal.h"
#include "rpc_client/cli_pipe.h"
return NULL;
}
- creds = get_cmdline_auth_info_creds(
- context->internal->auth_info);
+ creds = context->internal->creds;
status = cli_resolve_path(
frame, "",
}
- creds = get_cmdline_auth_info_creds(context->internal->auth_info);
+ creds = context->internal->creds;
/*d_printf(">>>mkdir: resolving %s\n", path);*/
status = cli_resolve_path(frame, "",
}
- creds = get_cmdline_auth_info_creds(context->internal->auth_info),
+ creds = context->internal->creds;
/*d_printf(">>>rmdir: resolving %s\n", path);*/
status = cli_resolve_path(frame, "",
return -1; /* errno set by SMBC_server */
}
- creds = get_cmdline_auth_info_creds(context->internal->auth_info);
+ creds = context->internal->creds;
/*d_printf(">>>unlink: resolving %s\n", path);*/
status = cli_resolve_path(frame, "",
}
- creds = get_cmdline_auth_info_creds(context->internal->auth_info);
+ creds = context->internal->creds;
/*d_printf(">>>unlink: resolving %s\n", path);*/
status = cli_resolve_path(frame, "",
password1);
/*d_printf(">>>rename: resolving %s\n", path1);*/
- ocreds = get_cmdline_auth_info_creds(ocontext->internal->auth_info);
+ ocreds = ocontext->internal->creds;
status = cli_resolve_path(frame, "",
ocreds,
/*d_printf(">>>rename: resolved path as %s\n", targetpath1);*/
/*d_printf(">>>rename: resolving %s\n", path2);*/
- ncreds = get_cmdline_auth_info_creds(ncontext->internal->auth_info);
+ ncreds = ncontext->internal->creds;
status = cli_resolve_path(frame, "",
ncreds,
ZERO_STRUCTP(file);
- creds = get_cmdline_auth_info_creds(
- context->internal->auth_info);
+ creds = context->internal->creds;
/*d_printf(">>>open: resolving %s\n", path);*/
status = cli_resolve_path(
frame, "",
}
DEBUG(4,("SMBC_getatr: sending qpathinfo\n"));
- creds = get_cmdline_auth_info_creds(context->internal->auth_info);
+ creds = context->internal->creds;
status = cli_resolve_path(frame, "",
creds,
return -1;
}
- creds = get_cmdline_auth_info_creds(context->internal->auth_info);
+ creds = context->internal->creds;
/*d_printf(">>>fstat: resolving %s\n", path);*/
status = cli_resolve_path(frame, "",
/* Point to the portion after "system.nt_sec_desc." */
name += 19; /* if (all) this will be invalid but unused */
- creds = get_cmdline_auth_info_creds(
- context->internal->auth_info);
+ creds = context->internal->creds;
status = cli_resolve_path(
ctx, "",
return -1;
}
- creds = get_cmdline_auth_info_creds(context->internal->auth_info);
+ creds = context->internal->creds;
status = cli_resolve_path(ctx, "",
creds,
#ifndef _LIBSMB_PROTO_H_
#define _LIBSMB_PROTO_H_
-#include "auth_info.h"
-
struct smb_trans_enc_state;
struct cli_credentials;
struct cli_state;
NDR_IOCTL
NDR_QUOTA
cli_smb_common
- util_cmdline
tevent
''',
private_library=True)