mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
lib: Use cli_credentials_add_gensec_features in a few places
Capture a common pattern Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
b436f5fec1
commit
df30ec83c9
@ -1009,14 +1009,8 @@ static void popt_common_credentials_callback(poptContext popt_ctx,
|
||||
}
|
||||
case OPT_USE_WINBIND_CCACHE:
|
||||
{
|
||||
uint32_t gensec_features;
|
||||
|
||||
gensec_features = cli_credentials_get_gensec_features(creds);
|
||||
gensec_features |= GENSEC_FEATURE_NTLM_CCACHE;
|
||||
|
||||
ok = cli_credentials_set_gensec_features(creds,
|
||||
gensec_features,
|
||||
CRED_SPECIFIED);
|
||||
ok = cli_credentials_add_gensec_features(
|
||||
creds, GENSEC_FEATURE_NTLM_CCACHE, CRED_SPECIFIED);
|
||||
if (!ok) {
|
||||
fprintf(stderr,
|
||||
"Failed to set gensec feature!\n");
|
||||
|
@ -429,12 +429,8 @@ NET_API_STATUS libnetapi_get_use_kerberos(struct libnetapi_ctx *ctx,
|
||||
|
||||
NET_API_STATUS libnetapi_set_use_ccache(struct libnetapi_ctx *ctx)
|
||||
{
|
||||
uint32_t gensec_features;
|
||||
|
||||
gensec_features = cli_credentials_get_gensec_features(ctx->creds);
|
||||
gensec_features |= GENSEC_FEATURE_NTLM_CCACHE;
|
||||
cli_credentials_set_gensec_features(ctx->creds,
|
||||
gensec_features,
|
||||
cli_credentials_add_gensec_features(ctx->creds,
|
||||
GENSEC_FEATURE_NTLM_CCACHE,
|
||||
CRED_SPECIFIED);
|
||||
|
||||
return NET_API_STATUS_SUCCESS;
|
||||
|
@ -139,12 +139,8 @@ struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
|
||||
CRED_SPECIFIED);
|
||||
|
||||
if (use_ccache) {
|
||||
uint32_t features;
|
||||
|
||||
features = cli_credentials_get_gensec_features(creds);
|
||||
features |= GENSEC_FEATURE_NTLM_CCACHE;
|
||||
cli_credentials_set_gensec_features(creds,
|
||||
features,
|
||||
cli_credentials_add_gensec_features(creds,
|
||||
GENSEC_FEATURE_NTLM_CCACHE,
|
||||
CRED_SPECIFIED);
|
||||
|
||||
if (password != NULL && strlen(password) == 0) {
|
||||
|
@ -793,12 +793,8 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
|
||||
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,
|
||||
cli_credentials_add_gensec_features(creds,
|
||||
GENSEC_FEATURE_NTLM_CCACHE,
|
||||
CRED_SPECIFIED);
|
||||
}
|
||||
|
||||
|
@ -1373,7 +1373,6 @@ static struct functable net_func[] = {
|
||||
cli_credentials_get_principal_obtained(c->creds);
|
||||
enum credentials_obtained password_obtained =
|
||||
cli_credentials_get_password_obtained(c->creds);
|
||||
uint32_t gensec_features;
|
||||
|
||||
if (principal_obtained == CRED_SPECIFIED) {
|
||||
c->explicit_credentials = true;
|
||||
@ -1384,12 +1383,11 @@ static struct functable net_func[] = {
|
||||
|
||||
c->opt_workgroup = cli_credentials_get_domain(c->creds);
|
||||
|
||||
gensec_features = cli_credentials_get_gensec_features(c->creds);
|
||||
if (c->legacy_opt_ccache) {
|
||||
gensec_features |= GENSEC_FEATURE_NTLM_CCACHE;
|
||||
cli_credentials_set_gensec_features(c->creds,
|
||||
gensec_features,
|
||||
CRED_SPECIFIED);
|
||||
cli_credentials_add_gensec_features(
|
||||
c->creds,
|
||||
GENSEC_FEATURE_NTLM_CCACHE,
|
||||
CRED_SPECIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user