1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

libsmb: Slightly simplify cli_session_creds_init

In this case a nested if seems easier to understand to me than another
if-expression duplicating half of a previous one.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2024-05-28 12:23:35 +02:00
parent 4cade04d1f
commit dc31a49830

View File

@ -53,6 +53,7 @@ struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx = NULL; struct loadparm_context *lp_ctx = NULL;
struct cli_credentials *creds = NULL; struct cli_credentials *creds = NULL;
const char *principal = NULL; const char *principal = NULL;
enum credentials_use_kerberos creds_use_krb;
char *tmp = NULL; char *tmp = NULL;
char *p = NULL; char *p = NULL;
bool ok; bool ok;
@ -118,26 +119,25 @@ struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
principal = NULL; principal = NULL;
} }
if (use_kerberos && fallback_after_kerberos) { if (use_kerberos) {
/* if (fallback_after_kerberos) {
* Keep what we learned from the /*
* "client use kerberos" option. * Keep what we learned from the
*/ * "client use kerberos" option.
enum credentials_use_kerberos current_krb5 = */
cli_credentials_get_kerberos_state(creds); creds_use_krb = cli_credentials_get_kerberos_state(
cli_credentials_set_kerberos_state(creds, creds);
current_krb5, } else {
CRED_SPECIFIED); creds_use_krb = CRED_USE_KERBEROS_REQUIRED;
} else if (use_kerberos) { }
cli_credentials_set_kerberos_state(creds,
CRED_USE_KERBEROS_REQUIRED,
CRED_SPECIFIED);
} else { } else {
cli_credentials_set_kerberos_state(creds, creds_use_krb = CRED_USE_KERBEROS_DISABLED;
CRED_USE_KERBEROS_DISABLED,
CRED_SPECIFIED);
} }
cli_credentials_set_kerberos_state(creds,
creds_use_krb,
CRED_SPECIFIED);
if (use_ccache) { if (use_ccache) {
uint32_t features; uint32_t features;