1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-08 16:23:49 +03:00

r25552: Convert to standard bool type.

This commit is contained in:
Jelmer Vernooij
2007-10-06 22:16:19 +00:00
committed by Gerald (Jerry) Carter
parent c9651e2c5c
commit b8d6b82f12
24 changed files with 285 additions and 285 deletions

View File

@@ -42,7 +42,7 @@ NTSTATUS auth_context_set_challenge(struct auth_context *auth_ctx, const uint8_t
/*************************************************************************** /***************************************************************************
Set a fixed challenge Set a fixed challenge
***************************************************************************/ ***************************************************************************/
BOOL auth_challenge_may_be_modified(struct auth_context *auth_ctx) bool auth_challenge_may_be_modified(struct auth_context *auth_ctx)
{ {
return auth_ctx->challenge.may_be_modified; return auth_ctx->challenge.may_be_modified;
} }
@@ -93,7 +93,7 @@ _PUBLIC_ NTSTATUS auth_get_challenge(struct auth_context *auth_ctx, const uint8_
NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data); NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data);
auth_ctx->challenge.set_by = "random"; auth_ctx->challenge.set_by = "random";
auth_ctx->challenge.may_be_modified = True; auth_ctx->challenge.may_be_modified = true;
} }
DEBUG(10,("auth_get_challenge: challenge set by %s\n", DEBUG(10,("auth_get_challenge: challenge set by %s\n",
@@ -104,7 +104,7 @@ _PUBLIC_ NTSTATUS auth_get_challenge(struct auth_context *auth_ctx, const uint8_
} }
struct auth_check_password_sync_state { struct auth_check_password_sync_state {
BOOL finished; bool finished;
NTSTATUS status; NTSTATUS status;
struct auth_serversupplied_info *server_info; struct auth_serversupplied_info *server_info;
}; };
@@ -115,7 +115,7 @@ static void auth_check_password_sync_callback(struct auth_check_password_request
struct auth_check_password_sync_state *s = talloc_get_type(private_data, struct auth_check_password_sync_state *s = talloc_get_type(private_data,
struct auth_check_password_sync_state); struct auth_check_password_sync_state);
s->finished = True; s->finished = true;
s->status = auth_check_password_recv(req, s, &s->server_info); s->status = auth_check_password_recv(req, s, &s->server_info);
} }
@@ -376,7 +376,7 @@ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods,
ctx = talloc(mem_ctx, struct auth_context); ctx = talloc(mem_ctx, struct auth_context);
NT_STATUS_HAVE_NO_MEMORY(ctx); NT_STATUS_HAVE_NO_MEMORY(ctx);
ctx->challenge.set_by = NULL; ctx->challenge.set_by = NULL;
ctx->challenge.may_be_modified = False; ctx->challenge.may_be_modified = false;
ctx->challenge.data = data_blob(NULL, 0); ctx->challenge.data = data_blob(NULL, 0);
ctx->methods = NULL; ctx->methods = NULL;
ctx->event_ctx = ev; ctx->event_ctx = ev;
@@ -511,13 +511,13 @@ const struct auth_critical_sizes *auth_interface_version(void)
NTSTATUS auth_init(void) NTSTATUS auth_init(void)
{ {
static BOOL initialized = False; static bool initialized = false;
init_module_fn static_init[] = STATIC_auth_MODULES; init_module_fn static_init[] = STATIC_auth_MODULES;
init_module_fn *shared_init; init_module_fn *shared_init;
if (initialized) return NT_STATUS_OK; if (initialized) return NT_STATUS_OK;
initialized = True; initialized = true;
shared_init = load_samba_modules(NULL, global_loadparm, "auth"); shared_init = load_samba_modules(NULL, global_loadparm, "auth");

View File

@@ -122,7 +122,7 @@ static NTSTATUS name_to_ntstatus_check_password(struct auth_method_context *ctx,
server_info->acct_flags = ACB_NORMAL; server_info->acct_flags = ACB_NORMAL;
server_info->authenticated = False; server_info->authenticated = false;
*_server_info = server_info; *_server_info = server_info;

View File

@@ -61,7 +61,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
user_info->mapped_state = True; user_info->mapped_state = true;
user_info->client.account_name = nt4_username; user_info->client.account_name = nt4_username;
user_info->mapped.account_name = nt4_username; user_info->mapped.account_name = nt4_username;
user_info->client.domain_name = nt4_domain; user_info->client.domain_name = nt4_domain;

View File

@@ -53,7 +53,7 @@ static NTSTATUS authunix_make_server_info(TALLOC_CTX *mem_ctx,
server_info = talloc(mem_ctx, struct auth_serversupplied_info); server_info = talloc(mem_ctx, struct auth_serversupplied_info);
NT_STATUS_HAVE_NO_MEMORY(server_info); NT_STATUS_HAVE_NO_MEMORY(server_info);
server_info->authenticated = True; server_info->authenticated = true;
server_info->account_name = talloc_steal(server_info, pwd->pw_name); server_info->account_name = talloc_steal(server_info, pwd->pw_name);
NT_STATUS_HAVE_NO_MEMORY(server_info->account_name); NT_STATUS_HAVE_NO_MEMORY(server_info->account_name);

View File

@@ -82,7 +82,7 @@ NTSTATUS map_user_info(TALLOC_CTX *mem_ctx,
} }
talloc_reference(*user_info_mapped, user_info); talloc_reference(*user_info_mapped, user_info);
**user_info_mapped = *user_info; **user_info_mapped = *user_info;
(*user_info_mapped)->mapped_state = True; (*user_info_mapped)->mapped_state = true;
(*user_info_mapped)->mapped.domain_name = talloc_strdup(*user_info_mapped, domain); (*user_info_mapped)->mapped.domain_name = talloc_strdup(*user_info_mapped, domain);
(*user_info_mapped)->mapped.account_name = talloc_strdup(*user_info_mapped, account_name); (*user_info_mapped)->mapped.account_name = talloc_strdup(*user_info_mapped, account_name);
talloc_free(account_name); talloc_free(account_name);
@@ -342,7 +342,7 @@ NTSTATUS make_server_info_netlogon_validation(TALLOC_CTX *mem_ctx,
server_info->bad_password_count = base->bad_password_count; server_info->bad_password_count = base->bad_password_count;
server_info->acct_flags = base->acct_flags; server_info->acct_flags = base->acct_flags;
server_info->authenticated = True; server_info->authenticated = true;
/* ensure we are never given NULL session keys */ /* ensure we are never given NULL session keys */
@@ -428,7 +428,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, struct auth_serversuppl
server_info->acct_flags = ACB_NORMAL; server_info->acct_flags = ACB_NORMAL;
server_info->authenticated = False; server_info->authenticated = false;
*_server_info = server_info; *_server_info = server_info;
@@ -498,7 +498,7 @@ NTSTATUS auth_system_server_info(TALLOC_CTX *mem_ctx, struct auth_serversupplied
server_info->acct_flags = ACB_NORMAL; server_info->acct_flags = ACB_NORMAL;
server_info->authenticated = True; server_info->authenticated = true;
*_server_info = server_info; *_server_info = server_info;
@@ -582,7 +582,7 @@ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx)
} }
static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx, static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx,
BOOL anonymous_credentials, bool anonymous_credentials,
struct auth_session_info **_session_info) struct auth_session_info **_session_info)
{ {
NTSTATUS nt_status; NTSTATUS nt_status;
@@ -650,7 +650,7 @@ _PUBLIC_ struct auth_session_info *system_session_anon(TALLOC_CTX *mem_ctx)
{ {
NTSTATUS nt_status; NTSTATUS nt_status;
struct auth_session_info *session_info = NULL; struct auth_session_info *session_info = NULL;
nt_status = _auth_system_session_info(mem_ctx, False, &session_info); nt_status = _auth_system_session_info(mem_ctx, false, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) { if (!NT_STATUS_IS_OK(nt_status)) {
return NULL; return NULL;
} }

View File

@@ -41,7 +41,7 @@ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
} }
cred->netlogon_creds = NULL; cred->netlogon_creds = NULL;
cred->machine_account_pending = False; cred->machine_account_pending = false;
cred->workstation_obtained = CRED_UNINITIALISED; cred->workstation_obtained = CRED_UNINITIALISED;
cred->username_obtained = CRED_UNINITIALISED; cred->username_obtained = CRED_UNINITIALISED;
cred->password_obtained = CRED_UNINITIALISED; cred->password_obtained = CRED_UNINITIALISED;
@@ -59,12 +59,12 @@ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
cred->old_password = NULL; cred->old_password = NULL;
cred->smb_krb5_context = NULL; cred->smb_krb5_context = NULL;
cred->salt_principal = NULL; cred->salt_principal = NULL;
cred->machine_account = False; cred->machine_account = false;
cred->bind_dn = NULL; cred->bind_dn = NULL;
cred->tries = 3; cred->tries = 3;
cred->callback_running = False; cred->callback_running = false;
cred->ev = NULL; cred->ev = NULL;
cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS); cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS);
@@ -124,9 +124,9 @@ const char *cli_credentials_get_username(struct cli_credentials *cred)
if (cred->username_obtained == CRED_CALLBACK && if (cred->username_obtained == CRED_CALLBACK &&
!cred->callback_running) { !cred->callback_running) {
cred->callback_running = True; cred->callback_running = true;
cred->username = cred->username_cb(cred); cred->username = cred->username_cb(cred);
cred->callback_running = False; cred->callback_running = false;
cred->username_obtained = CRED_SPECIFIED; cred->username_obtained = CRED_SPECIFIED;
cli_credentials_invalidate_ccache(cred, cred->username_obtained); cli_credentials_invalidate_ccache(cred, cred->username_obtained);
} }
@@ -134,36 +134,36 @@ const char *cli_credentials_get_username(struct cli_credentials *cred)
return cred->username; return cred->username;
} }
BOOL cli_credentials_set_username(struct cli_credentials *cred, bool cli_credentials_set_username(struct cli_credentials *cred,
const char *val, enum credentials_obtained obtained) const char *val, enum credentials_obtained obtained)
{ {
if (obtained >= cred->username_obtained) { if (obtained >= cred->username_obtained) {
cred->username = talloc_strdup(cred, val); cred->username = talloc_strdup(cred, val);
cred->username_obtained = obtained; cred->username_obtained = obtained;
cli_credentials_invalidate_ccache(cred, cred->username_obtained); cli_credentials_invalidate_ccache(cred, cred->username_obtained);
return True; return true;
} }
return False; return false;
} }
BOOL cli_credentials_set_username_callback(struct cli_credentials *cred, bool cli_credentials_set_username_callback(struct cli_credentials *cred,
const char *(*username_cb) (struct cli_credentials *)) const char *(*username_cb) (struct cli_credentials *))
{ {
if (cred->username_obtained < CRED_CALLBACK) { if (cred->username_obtained < CRED_CALLBACK) {
cred->username_cb = username_cb; cred->username_cb = username_cb;
cred->username_obtained = CRED_CALLBACK; cred->username_obtained = CRED_CALLBACK;
return True; return true;
} }
return False; return false;
} }
BOOL cli_credentials_set_bind_dn(struct cli_credentials *cred, bool cli_credentials_set_bind_dn(struct cli_credentials *cred,
const char *bind_dn) const char *bind_dn)
{ {
cred->bind_dn = talloc_strdup(cred, bind_dn); cred->bind_dn = talloc_strdup(cred, bind_dn);
return True; return true;
} }
/** /**
@@ -192,9 +192,9 @@ const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_C
if (cred->principal_obtained == CRED_CALLBACK && if (cred->principal_obtained == CRED_CALLBACK &&
!cred->callback_running) { !cred->callback_running) {
cred->callback_running = True; cred->callback_running = true;
cred->principal = cred->principal_cb(cred); cred->principal = cred->principal_cb(cred);
cred->callback_running = False; cred->callback_running = false;
cred->principal_obtained = CRED_SPECIFIED; cred->principal_obtained = CRED_SPECIFIED;
cli_credentials_invalidate_ccache(cred, cred->principal_obtained); cli_credentials_invalidate_ccache(cred, cred->principal_obtained);
} }
@@ -213,7 +213,7 @@ const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_C
return talloc_reference(mem_ctx, cred->principal); return talloc_reference(mem_ctx, cred->principal);
} }
BOOL cli_credentials_set_principal(struct cli_credentials *cred, bool cli_credentials_set_principal(struct cli_credentials *cred,
const char *val, const char *val,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
@@ -221,53 +221,53 @@ BOOL cli_credentials_set_principal(struct cli_credentials *cred,
cred->principal = talloc_strdup(cred, val); cred->principal = talloc_strdup(cred, val);
cred->principal_obtained = obtained; cred->principal_obtained = obtained;
cli_credentials_invalidate_ccache(cred, cred->principal_obtained); cli_credentials_invalidate_ccache(cred, cred->principal_obtained);
return True; return true;
} }
return False; return false;
} }
/* Set a callback to get the principal. This could be a popup dialog, /* Set a callback to get the principal. This could be a popup dialog,
* a terminal prompt or similar. */ * a terminal prompt or similar. */
BOOL cli_credentials_set_principal_callback(struct cli_credentials *cred, bool cli_credentials_set_principal_callback(struct cli_credentials *cred,
const char *(*principal_cb) (struct cli_credentials *)) const char *(*principal_cb) (struct cli_credentials *))
{ {
if (cred->principal_obtained < CRED_CALLBACK) { if (cred->principal_obtained < CRED_CALLBACK) {
cred->principal_cb = principal_cb; cred->principal_cb = principal_cb;
cred->principal_obtained = CRED_CALLBACK; cred->principal_obtained = CRED_CALLBACK;
return True; return true;
} }
return False; return false;
} }
/* Some of our tools are 'anonymous by default'. This is a single /* Some of our tools are 'anonymous by default'. This is a single
* function to determine if authentication has been explicitly * function to determine if authentication has been explicitly
* requested */ * requested */
BOOL cli_credentials_authentication_requested(struct cli_credentials *cred) bool cli_credentials_authentication_requested(struct cli_credentials *cred)
{ {
if (cred->bind_dn) { if (cred->bind_dn) {
return True; return true;
} }
if (cli_credentials_is_anonymous(cred)){ if (cli_credentials_is_anonymous(cred)){
return False; return false;
} }
if (cred->principal_obtained >= CRED_SPECIFIED) { if (cred->principal_obtained >= CRED_SPECIFIED) {
return True; return true;
} }
if (cred->username_obtained >= CRED_SPECIFIED) { if (cred->username_obtained >= CRED_SPECIFIED) {
return True; return true;
} }
if (cli_credentials_get_kerberos_state(cred) == CRED_MUST_USE_KERBEROS) { if (cli_credentials_get_kerberos_state(cred) == CRED_MUST_USE_KERBEROS) {
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -283,9 +283,9 @@ const char *cli_credentials_get_password(struct cli_credentials *cred)
if (cred->password_obtained == CRED_CALLBACK && if (cred->password_obtained == CRED_CALLBACK &&
!cred->callback_running) { !cred->callback_running) {
cred->callback_running = True; cred->callback_running = true;
cred->password = cred->password_cb(cred); cred->password = cred->password_cb(cred);
cred->callback_running = False; cred->callback_running = false;
cred->password_obtained = CRED_CALLBACK_RESULT; cred->password_obtained = CRED_CALLBACK_RESULT;
cli_credentials_invalidate_ccache(cred, cred->password_obtained); cli_credentials_invalidate_ccache(cred, cred->password_obtained);
} }
@@ -296,7 +296,7 @@ const char *cli_credentials_get_password(struct cli_credentials *cred)
/* Set a password on the credentials context, including an indication /* Set a password on the credentials context, including an indication
* of 'how' the password was obtained */ * of 'how' the password was obtained */
BOOL cli_credentials_set_password(struct cli_credentials *cred, bool cli_credentials_set_password(struct cli_credentials *cred,
const char *val, const char *val,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
@@ -306,23 +306,23 @@ BOOL cli_credentials_set_password(struct cli_credentials *cred,
cli_credentials_invalidate_ccache(cred, cred->password_obtained); cli_credentials_invalidate_ccache(cred, cred->password_obtained);
cred->nt_hash = NULL; cred->nt_hash = NULL;
return True; return true;
} }
return False; return false;
} }
BOOL cli_credentials_set_password_callback(struct cli_credentials *cred, bool cli_credentials_set_password_callback(struct cli_credentials *cred,
const char *(*password_cb) (struct cli_credentials *)) const char *(*password_cb) (struct cli_credentials *))
{ {
if (cred->password_obtained < CRED_CALLBACK) { if (cred->password_obtained < CRED_CALLBACK) {
cred->password_cb = password_cb; cred->password_cb = password_cb;
cred->password_obtained = CRED_CALLBACK; cred->password_obtained = CRED_CALLBACK;
cli_credentials_invalidate_ccache(cred, cred->password_obtained); cli_credentials_invalidate_ccache(cred, cred->password_obtained);
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -339,12 +339,12 @@ const char *cli_credentials_get_old_password(struct cli_credentials *cred)
return cred->old_password; return cred->old_password;
} }
BOOL cli_credentials_set_old_password(struct cli_credentials *cred, bool cli_credentials_set_old_password(struct cli_credentials *cred,
const char *val, const char *val,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
cred->old_password = talloc_strdup(cred, val); cred->old_password = talloc_strdup(cred, val);
return True; return true;
} }
/** /**
@@ -375,7 +375,7 @@ const struct samr_Password *cli_credentials_get_nt_hash(struct cli_credentials *
} }
} }
BOOL cli_credentials_set_nt_hash(struct cli_credentials *cred, bool cli_credentials_set_nt_hash(struct cli_credentials *cred,
const struct samr_Password *nt_hash, const struct samr_Password *nt_hash,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
@@ -387,10 +387,10 @@ BOOL cli_credentials_set_nt_hash(struct cli_credentials *cred,
} else { } else {
cred->nt_hash = NULL; cred->nt_hash = NULL;
} }
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -407,9 +407,9 @@ const char *cli_credentials_get_domain(struct cli_credentials *cred)
if (cred->domain_obtained == CRED_CALLBACK && if (cred->domain_obtained == CRED_CALLBACK &&
!cred->callback_running) { !cred->callback_running) {
cred->callback_running = True; cred->callback_running = true;
cred->domain = cred->domain_cb(cred); cred->domain = cred->domain_cb(cred);
cred->callback_running = False; cred->callback_running = false;
cred->domain_obtained = CRED_SPECIFIED; cred->domain_obtained = CRED_SPECIFIED;
cli_credentials_invalidate_ccache(cred, cred->domain_obtained); cli_credentials_invalidate_ccache(cred, cred->domain_obtained);
} }
@@ -418,7 +418,7 @@ const char *cli_credentials_get_domain(struct cli_credentials *cred)
} }
BOOL cli_credentials_set_domain(struct cli_credentials *cred, bool cli_credentials_set_domain(struct cli_credentials *cred,
const char *val, const char *val,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
@@ -429,22 +429,22 @@ BOOL cli_credentials_set_domain(struct cli_credentials *cred,
cred->domain = strupper_talloc(cred, val); cred->domain = strupper_talloc(cred, val);
cred->domain_obtained = obtained; cred->domain_obtained = obtained;
cli_credentials_invalidate_ccache(cred, cred->domain_obtained); cli_credentials_invalidate_ccache(cred, cred->domain_obtained);
return True; return true;
} }
return False; return false;
} }
BOOL cli_credentials_set_domain_callback(struct cli_credentials *cred, bool cli_credentials_set_domain_callback(struct cli_credentials *cred,
const char *(*domain_cb) (struct cli_credentials *)) const char *(*domain_cb) (struct cli_credentials *))
{ {
if (cred->domain_obtained < CRED_CALLBACK) { if (cred->domain_obtained < CRED_CALLBACK) {
cred->domain_cb = domain_cb; cred->domain_cb = domain_cb;
cred->domain_obtained = CRED_CALLBACK; cred->domain_obtained = CRED_CALLBACK;
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -461,9 +461,9 @@ const char *cli_credentials_get_realm(struct cli_credentials *cred)
if (cred->realm_obtained == CRED_CALLBACK && if (cred->realm_obtained == CRED_CALLBACK &&
!cred->callback_running) { !cred->callback_running) {
cred->callback_running = True; cred->callback_running = true;
cred->realm = cred->realm_cb(cred); cred->realm = cred->realm_cb(cred);
cred->callback_running = False; cred->callback_running = false;
cred->realm_obtained = CRED_SPECIFIED; cred->realm_obtained = CRED_SPECIFIED;
cli_credentials_invalidate_ccache(cred, cred->realm_obtained); cli_credentials_invalidate_ccache(cred, cred->realm_obtained);
} }
@@ -475,7 +475,7 @@ const char *cli_credentials_get_realm(struct cli_credentials *cred)
* Set the realm for this credentials context, and force it to * Set the realm for this credentials context, and force it to
* uppercase for the sainity of our local kerberos libraries * uppercase for the sainity of our local kerberos libraries
*/ */
BOOL cli_credentials_set_realm(struct cli_credentials *cred, bool cli_credentials_set_realm(struct cli_credentials *cred,
const char *val, const char *val,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
@@ -483,22 +483,22 @@ BOOL cli_credentials_set_realm(struct cli_credentials *cred,
cred->realm = strupper_talloc(cred, val); cred->realm = strupper_talloc(cred, val);
cred->realm_obtained = obtained; cred->realm_obtained = obtained;
cli_credentials_invalidate_ccache(cred, cred->realm_obtained); cli_credentials_invalidate_ccache(cred, cred->realm_obtained);
return True; return true;
} }
return False; return false;
} }
BOOL cli_credentials_set_realm_callback(struct cli_credentials *cred, bool cli_credentials_set_realm_callback(struct cli_credentials *cred,
const char *(*realm_cb) (struct cli_credentials *)) const char *(*realm_cb) (struct cli_credentials *))
{ {
if (cred->realm_obtained < CRED_CALLBACK) { if (cred->realm_obtained < CRED_CALLBACK) {
cred->realm_cb = realm_cb; cred->realm_cb = realm_cb;
cred->realm_obtained = CRED_CALLBACK; cred->realm_obtained = CRED_CALLBACK;
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -512,38 +512,38 @@ const char *cli_credentials_get_workstation(struct cli_credentials *cred)
{ {
if (cred->workstation_obtained == CRED_CALLBACK && if (cred->workstation_obtained == CRED_CALLBACK &&
!cred->callback_running) { !cred->callback_running) {
cred->callback_running = True; cred->callback_running = true;
cred->workstation = cred->workstation_cb(cred); cred->workstation = cred->workstation_cb(cred);
cred->callback_running = False; cred->callback_running = false;
cred->workstation_obtained = CRED_SPECIFIED; cred->workstation_obtained = CRED_SPECIFIED;
} }
return cred->workstation; return cred->workstation;
} }
BOOL cli_credentials_set_workstation(struct cli_credentials *cred, bool cli_credentials_set_workstation(struct cli_credentials *cred,
const char *val, const char *val,
enum credentials_obtained obtained) enum credentials_obtained obtained)
{ {
if (obtained >= cred->workstation_obtained) { if (obtained >= cred->workstation_obtained) {
cred->workstation = talloc_strdup(cred, val); cred->workstation = talloc_strdup(cred, val);
cred->workstation_obtained = obtained; cred->workstation_obtained = obtained;
return True; return true;
} }
return False; return false;
} }
BOOL cli_credentials_set_workstation_callback(struct cli_credentials *cred, bool cli_credentials_set_workstation_callback(struct cli_credentials *cred,
const char *(*workstation_cb) (struct cli_credentials *)) const char *(*workstation_cb) (struct cli_credentials *))
{ {
if (cred->workstation_obtained < CRED_CALLBACK) { if (cred->workstation_obtained < CRED_CALLBACK) {
cred->workstation_cb = workstation_cb; cred->workstation_cb = workstation_cb;
cred->workstation_obtained = CRED_CALLBACK; cred->workstation_obtained = CRED_CALLBACK;
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -722,10 +722,10 @@ void cli_credentials_set_anonymous(struct cli_credentials *cred)
/** /**
* Describe a credentials context as anonymous or authenticated * Describe a credentials context as anonymous or authenticated
* @retval True if anonymous, False if a username is specified * @retval true if anonymous, false if a username is specified
*/ */
BOOL cli_credentials_is_anonymous(struct cli_credentials *cred) bool cli_credentials_is_anonymous(struct cli_credentials *cred)
{ {
const char *username; const char *username;
@@ -739,10 +739,10 @@ BOOL cli_credentials_is_anonymous(struct cli_credentials *cred)
* here - anonymous is "", not NULL, which is 'never specified, * here - anonymous is "", not NULL, which is 'never specified,
* never guessed', ie programmer bug */ * never guessed', ie programmer bug */
if (!username[0]) { if (!username[0]) {
return True; return true;
} }
return False; return false;
} }
/** /**
@@ -753,10 +753,10 @@ BOOL cli_credentials_is_anonymous(struct cli_credentials *cred)
* *
* @retval whether the credentials struct is finished * @retval whether the credentials struct is finished
*/ */
BOOL cli_credentials_wrong_password(struct cli_credentials *cred) bool cli_credentials_wrong_password(struct cli_credentials *cred)
{ {
if (cred->password_obtained != CRED_CALLBACK_RESULT) { if (cred->password_obtained != CRED_CALLBACK_RESULT) {
return False; return false;
} }
cred->password_obtained = CRED_CALLBACK; cred->password_obtained = CRED_CALLBACK;

View File

@@ -39,7 +39,7 @@
* @param obtained This enum describes how 'specified' this password is * @param obtained This enum describes how 'specified' this password is
*/ */
BOOL cli_credentials_parse_password_fd(struct cli_credentials *credentials, bool cli_credentials_parse_password_fd(struct cli_credentials *credentials,
int fd, enum credentials_obtained obtained) int fd, enum credentials_obtained obtained)
{ {
char *p; char *p;
@@ -61,18 +61,18 @@ BOOL cli_credentials_parse_password_fd(struct cli_credentials *credentials,
break; break;
} else { } else {
fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n"); fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n");
return False; return false;
} }
default: default:
fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fprintf(stderr, "Error reading password from file descriptor %d: %s\n",
fd, strerror(errno)); fd, strerror(errno));
return False; return false;
} }
} }
cli_credentials_set_password(credentials, pass, obtained); cli_credentials_set_password(credentials, pass, obtained);
return True; return true;
} }
/** /**
@@ -83,15 +83,15 @@ BOOL cli_credentials_parse_password_fd(struct cli_credentials *credentials,
* @param obtained This enum describes how 'specified' this password is * @param obtained This enum describes how 'specified' this password is
*/ */
BOOL cli_credentials_parse_password_file(struct cli_credentials *credentials, const char *file, enum credentials_obtained obtained) bool cli_credentials_parse_password_file(struct cli_credentials *credentials, const char *file, enum credentials_obtained obtained)
{ {
int fd = open(file, O_RDONLY, 0); int fd = open(file, O_RDONLY, 0);
BOOL ret; bool ret;
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "Error opening password file %s: %s\n", fprintf(stderr, "Error opening password file %s: %s\n",
file, strerror(errno)); file, strerror(errno));
return False; return false;
} }
ret = cli_credentials_parse_password_fd(credentials, fd, obtained); ret = cli_credentials_parse_password_fd(credentials, fd, obtained);
@@ -109,7 +109,7 @@ BOOL cli_credentials_parse_password_file(struct cli_credentials *credentials, co
* @param obtained This enum describes how 'specified' this password is * @param obtained This enum describes how 'specified' this password is
*/ */
BOOL cli_credentials_parse_file(struct cli_credentials *cred, const char *file, enum credentials_obtained obtained) bool cli_credentials_parse_file(struct cli_credentials *cred, const char *file, enum credentials_obtained obtained)
{ {
uint16_t len = 0; uint16_t len = 0;
char *ptr, *val, *param; char *ptr, *val, *param;
@@ -122,7 +122,7 @@ BOOL cli_credentials_parse_file(struct cli_credentials *cred, const char *file,
{ {
/* fail if we can't open the credentials file */ /* fail if we can't open the credentials file */
d_printf("ERROR: Unable to open credentials file!\n"); d_printf("ERROR: Unable to open credentials file!\n");
return False; return false;
} }
for (i = 0; i < numlines; i++) { for (i = 0; i < numlines; i++) {
@@ -158,7 +158,7 @@ BOOL cli_credentials_parse_file(struct cli_credentials *cred, const char *file,
talloc_free(lines); talloc_free(lines);
return True; return true;
} }
@@ -203,10 +203,10 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
const char *keytab; const char *keytab;
/* ok, we are going to get it now, don't recurse back here */ /* ok, we are going to get it now, don't recurse back here */
cred->machine_account_pending = False; cred->machine_account_pending = false;
/* some other parts of the system will key off this */ /* some other parts of the system will key off this */
cred->machine_account = True; cred->machine_account = true;
mem_ctx = talloc_named(cred, 0, "cli_credentials fetch machine password"); mem_ctx = talloc_named(cred, 0, "cli_credentials fetch machine password");
@@ -331,7 +331,7 @@ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred)
/* Bleh, nasty recursion issues: We are setting a machine /* Bleh, nasty recursion issues: We are setting a machine
* account here, so we don't want the 'pending' flag around * account here, so we don't want the 'pending' flag around
* any more */ * any more */
cred->machine_account_pending = False; cred->machine_account_pending = false;
filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER, filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER,
cli_credentials_get_domain(cred)); cli_credentials_get_domain(cred));
return cli_credentials_set_secrets(cred, NULL, SECRETS_PRIMARY_DOMAIN_DN, return cli_credentials_set_secrets(cred, NULL, SECRETS_PRIMARY_DOMAIN_DN,
@@ -350,7 +350,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred)
/* Bleh, nasty recursion issues: We are setting a machine /* Bleh, nasty recursion issues: We are setting a machine
* account here, so we don't want the 'pending' flag around * account here, so we don't want the 'pending' flag around
* any more */ * any more */
cred->machine_account_pending = False; cred->machine_account_pending = false;
filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH, filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH,
cli_credentials_get_realm(cred), cli_credentials_get_realm(cred),
cli_credentials_get_domain(cred)); cli_credentials_get_domain(cred));
@@ -371,7 +371,7 @@ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
/* Bleh, nasty recursion issues: We are setting a machine /* Bleh, nasty recursion issues: We are setting a machine
* account here, so we don't want the 'pending' flag around * account here, so we don't want the 'pending' flag around
* any more */ * any more */
cred->machine_account_pending = False; cred->machine_account_pending = false;
filter = talloc_asprintf(cred, SECRETS_PRINCIPAL_SEARCH, filter = talloc_asprintf(cred, SECRETS_PRINCIPAL_SEARCH,
cli_credentials_get_realm(cred), cli_credentials_get_realm(cred),
cli_credentials_get_domain(cred), cli_credentials_get_domain(cred),
@@ -391,7 +391,7 @@ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
*/ */
void cli_credentials_set_machine_account_pending(struct cli_credentials *cred) void cli_credentials_set_machine_account_pending(struct cli_credentials *cred)
{ {
cred->machine_account_pending = True; cred->machine_account_pending = true;
} }

View File

@@ -85,13 +85,13 @@ struct gensec_security_ops **gensec_use_kerberos_mechs(TALLOC_CTX *mem_ctx,
} }
switch (use_kerberos) { switch (use_kerberos) {
case CRED_DONT_USE_KERBEROS: case CRED_DONT_USE_KERBEROS:
if (old_gensec_list[i]->kerberos == False) { if (old_gensec_list[i]->kerberos == false) {
new_gensec_list[j] = old_gensec_list[i]; new_gensec_list[j] = old_gensec_list[i];
j++; j++;
} }
break; break;
case CRED_MUST_USE_KERBEROS: case CRED_MUST_USE_KERBEROS:
if (old_gensec_list[i]->kerberos == True) { if (old_gensec_list[i]->kerberos == true) {
new_gensec_list[j] = old_gensec_list[i]; new_gensec_list[j] = old_gensec_list[i];
j++; j++;
} }
@@ -489,7 +489,7 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
ZERO_STRUCT((*gensec_security)->peer_addr); ZERO_STRUCT((*gensec_security)->peer_addr);
ZERO_STRUCT((*gensec_security)->my_addr); ZERO_STRUCT((*gensec_security)->my_addr);
(*gensec_security)->subcontext = False; (*gensec_security)->subcontext = false;
(*gensec_security)->want_features = 0; (*gensec_security)->want_features = 0;
if (ev == NULL) { if (ev == NULL) {
@@ -525,7 +525,7 @@ _PUBLIC_ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx,
(*gensec_security)->ops = NULL; (*gensec_security)->ops = NULL;
(*gensec_security)->private_data = NULL; (*gensec_security)->private_data = NULL;
(*gensec_security)->subcontext = True; (*gensec_security)->subcontext = true;
(*gensec_security)->event_ctx = parent->event_ctx; (*gensec_security)->event_ctx = parent->event_ctx;
(*gensec_security)->msg_ctx = parent->msg_ctx; (*gensec_security)->msg_ctx = parent->msg_ctx;
@@ -1030,11 +1030,11 @@ _PUBLIC_ void gensec_want_feature(struct gensec_security *gensec_security,
* *
*/ */
_PUBLIC_ BOOL gensec_have_feature(struct gensec_security *gensec_security, _PUBLIC_ bool gensec_have_feature(struct gensec_security *gensec_security,
uint32_t feature) uint32_t feature)
{ {
if (!gensec_security->ops->have_feature) { if (!gensec_security->ops->have_feature) {
return False; return false;
} }
/* We might 'have' features that we don't 'want', because the /* We might 'have' features that we don't 'want', because the
@@ -1261,13 +1261,13 @@ static int sort_gensec(struct gensec_security_ops **gs1, struct gensec_security_
*/ */
NTSTATUS gensec_init(void) NTSTATUS gensec_init(void)
{ {
static BOOL initialized = False; static bool initialized = false;
init_module_fn static_init[] = STATIC_gensec_MODULES; init_module_fn static_init[] = STATIC_gensec_MODULES;
init_module_fn *shared_init; init_module_fn *shared_init;
if (initialized) return NT_STATUS_OK; if (initialized) return NT_STATUS_OK;
initialized = True; initialized = true;
shared_init = load_samba_modules(NULL, global_loadparm, "gensec"); shared_init = load_samba_modules(NULL, global_loadparm, "gensec");

View File

@@ -65,7 +65,7 @@ struct gensec_gssapi_state {
gss_cred_id_t delegated_cred_handle; gss_cred_id_t delegated_cred_handle;
BOOL sasl; /* We have two different mechs in this file: One bool sasl; /* We have two different mechs in this file: One
* for SASL wrapped GSSAPI and another for normal * for SASL wrapped GSSAPI and another for normal
* GSSAPI */ * GSSAPI */
enum gensec_gssapi_sasl_state sasl_state; enum gensec_gssapi_sasl_state sasl_state;
@@ -157,7 +157,7 @@ static NTSTATUS gensec_gssapi_start(struct gensec_security *gensec_security)
gensec_gssapi_state->max_wrap_buf_size gensec_gssapi_state->max_wrap_buf_size
= lp_parm_int(global_loadparm, NULL, "gensec_gssapi", "max wrap buf size", 65536); = lp_parm_int(global_loadparm, NULL, "gensec_gssapi", "max wrap buf size", 65536);
gensec_gssapi_state->sasl = False; gensec_gssapi_state->sasl = false;
gensec_gssapi_state->sasl_state = STAGE_GSS_NEG; gensec_gssapi_state->sasl_state = STAGE_GSS_NEG;
gensec_security->private_data = gensec_gssapi_state; gensec_security->private_data = gensec_gssapi_state;
@@ -291,7 +291,7 @@ static NTSTATUS gensec_gssapi_sasl_server_start(struct gensec_security *gensec_s
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
gensec_gssapi_state = talloc_get_type(gensec_security->private_data, struct gensec_gssapi_state); gensec_gssapi_state = talloc_get_type(gensec_security->private_data, struct gensec_gssapi_state);
gensec_gssapi_state->sasl = True; gensec_gssapi_state->sasl = true;
} }
return nt_status; return nt_status;
} }
@@ -386,7 +386,7 @@ static NTSTATUS gensec_gssapi_sasl_client_start(struct gensec_security *gensec_s
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
gensec_gssapi_state = talloc_get_type(gensec_security->private_data, struct gensec_gssapi_state); gensec_gssapi_state = talloc_get_type(gensec_security->private_data, struct gensec_gssapi_state);
gensec_gssapi_state->sasl = True; gensec_gssapi_state->sasl = true;
} }
return nt_status; return nt_status;
} }
@@ -632,7 +632,7 @@ static NTSTATUS gensec_gssapi_update(struct gensec_security *gensec_security,
maj_stat = gss_wrap(&min_stat, maj_stat = gss_wrap(&min_stat,
gensec_gssapi_state->gssapi_context, gensec_gssapi_state->gssapi_context,
False, false,
GSS_C_QOP_DEFAULT, GSS_C_QOP_DEFAULT,
&input_token, &input_token,
&conf_state, &conf_state,
@@ -697,7 +697,7 @@ static NTSTATUS gensec_gssapi_update(struct gensec_security *gensec_security,
maj_stat = gss_wrap(&min_stat, maj_stat = gss_wrap(&min_stat,
gensec_gssapi_state->gssapi_context, gensec_gssapi_state->gssapi_context,
False, false,
GSS_C_QOP_DEFAULT, GSS_C_QOP_DEFAULT,
&input_token, &input_token,
&conf_state, &conf_state,
@@ -1110,7 +1110,7 @@ static NTSTATUS gensec_gssapi_check_packet(struct gensec_security *gensec_securi
} }
/* Try to figure out what features we actually got on the connection */ /* Try to figure out what features we actually got on the connection */
static BOOL gensec_gssapi_have_feature(struct gensec_security *gensec_security, static bool gensec_gssapi_have_feature(struct gensec_security *gensec_security,
uint32_t feature) uint32_t feature)
{ {
struct gensec_gssapi_state *gensec_gssapi_state struct gensec_gssapi_state *gensec_gssapi_state
@@ -1136,7 +1136,7 @@ static BOOL gensec_gssapi_have_feature(struct gensec_security *gensec_security,
if (feature & GENSEC_FEATURE_SESSION_KEY) { if (feature & GENSEC_FEATURE_SESSION_KEY) {
/* Only for GSSAPI/Krb5 */ /* Only for GSSAPI/Krb5 */
if (gss_oid_equal(gensec_gssapi_state->gss_oid, gss_mech_krb5)) { if (gss_oid_equal(gensec_gssapi_state->gss_oid, gss_mech_krb5)) {
return True; return true;
} }
} }
if (feature & GENSEC_FEATURE_DCE_STYLE) { if (feature & GENSEC_FEATURE_DCE_STYLE) {
@@ -1144,9 +1144,9 @@ static BOOL gensec_gssapi_have_feature(struct gensec_security *gensec_security,
} }
/* We can always do async (rather than strict request/reply) packets. */ /* We can always do async (rather than strict request/reply) packets. */
if (feature & GENSEC_FEATURE_ASYNC_REPLIES) { if (feature & GENSEC_FEATURE_ASYNC_REPLIES) {
return True; return true;
} }
return False; return false;
} }
/* /*
@@ -1414,8 +1414,8 @@ static const struct gensec_security_ops gensec_gssapi_spnego_security_ops = {
.wrap = gensec_gssapi_wrap, .wrap = gensec_gssapi_wrap,
.unwrap = gensec_gssapi_unwrap, .unwrap = gensec_gssapi_unwrap,
.have_feature = gensec_gssapi_have_feature, .have_feature = gensec_gssapi_have_feature,
.enabled = False, .enabled = false,
.kerberos = True, .kerberos = true,
.priority = GENSEC_GSSAPI .priority = GENSEC_GSSAPI
}; };
@@ -1437,8 +1437,8 @@ static const struct gensec_security_ops gensec_gssapi_krb5_security_ops = {
.wrap = gensec_gssapi_wrap, .wrap = gensec_gssapi_wrap,
.unwrap = gensec_gssapi_unwrap, .unwrap = gensec_gssapi_unwrap,
.have_feature = gensec_gssapi_have_feature, .have_feature = gensec_gssapi_have_feature,
.enabled = True, .enabled = true,
.kerberos = True, .kerberos = true,
.priority = GENSEC_GSSAPI .priority = GENSEC_GSSAPI
}; };
@@ -1456,8 +1456,8 @@ static const struct gensec_security_ops gensec_gssapi_sasl_krb5_security_ops = {
.wrap = gensec_gssapi_wrap, .wrap = gensec_gssapi_wrap,
.unwrap = gensec_gssapi_unwrap, .unwrap = gensec_gssapi_unwrap,
.have_feature = gensec_gssapi_have_feature, .have_feature = gensec_gssapi_have_feature,
.enabled = True, .enabled = true,
.kerberos = True, .kerberos = true,
.priority = GENSEC_GSSAPI .priority = GENSEC_GSSAPI
}; };

View File

@@ -54,7 +54,7 @@ struct gensec_krb5_state {
krb5_data enc_ticket; krb5_data enc_ticket;
krb5_keyblock *keyblock; krb5_keyblock *keyblock;
krb5_ticket *ticket; krb5_ticket *ticket;
BOOL gssapi; bool gssapi;
}; };
static int gensec_krb5_destroy(struct gensec_krb5_state *gensec_krb5_state) static int gensec_krb5_destroy(struct gensec_krb5_state *gensec_krb5_state)
@@ -112,7 +112,7 @@ static NTSTATUS gensec_krb5_start(struct gensec_security *gensec_security)
gensec_krb5_state->keyblock = NULL; gensec_krb5_state->keyblock = NULL;
gensec_krb5_state->session_key = data_blob(NULL, 0); gensec_krb5_state->session_key = data_blob(NULL, 0);
gensec_krb5_state->pac = data_blob(NULL, 0); gensec_krb5_state->pac = data_blob(NULL, 0);
gensec_krb5_state->gssapi = False; gensec_krb5_state->gssapi = false;
talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy); talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy);
@@ -205,7 +205,7 @@ static NTSTATUS gensec_fake_gssapi_krb5_server_start(struct gensec_security *gen
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
struct gensec_krb5_state *gensec_krb5_state; struct gensec_krb5_state *gensec_krb5_state;
gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data;
gensec_krb5_state->gssapi = True; gensec_krb5_state->gssapi = true;
} }
return nt_status; return nt_status;
} }
@@ -329,7 +329,7 @@ static NTSTATUS gensec_fake_gssapi_krb5_client_start(struct gensec_security *gen
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
struct gensec_krb5_state *gensec_krb5_state; struct gensec_krb5_state *gensec_krb5_state;
gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data;
gensec_krb5_state->gssapi = True; gensec_krb5_state->gssapi = true;
} }
return nt_status; return nt_status;
} }
@@ -723,19 +723,19 @@ static NTSTATUS gensec_krb5_unwrap(struct gensec_security *gensec_security,
return NT_STATUS_OK; return NT_STATUS_OK;
} }
static BOOL gensec_krb5_have_feature(struct gensec_security *gensec_security, static bool gensec_krb5_have_feature(struct gensec_security *gensec_security,
uint32_t feature) uint32_t feature)
{ {
struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data;
if (feature & GENSEC_FEATURE_SESSION_KEY) { if (feature & GENSEC_FEATURE_SESSION_KEY) {
return True; return true;
} }
if (!gensec_krb5_state->gssapi && if (!gensec_krb5_state->gssapi &&
(feature & GENSEC_FEATURE_SEAL)) { (feature & GENSEC_FEATURE_SEAL)) {
return True; return true;
} }
return False; return false;
} }
static const char *gensec_krb5_oids[] = { static const char *gensec_krb5_oids[] = {
@@ -755,8 +755,8 @@ static const struct gensec_security_ops gensec_fake_gssapi_krb5_security_ops = {
.session_key = gensec_krb5_session_key, .session_key = gensec_krb5_session_key,
.session_info = gensec_krb5_session_info, .session_info = gensec_krb5_session_info,
.have_feature = gensec_krb5_have_feature, .have_feature = gensec_krb5_have_feature,
.enabled = False, .enabled = false,
.kerberos = True, .kerberos = true,
.priority = GENSEC_KRB5 .priority = GENSEC_KRB5
}; };
@@ -770,8 +770,8 @@ static const struct gensec_security_ops gensec_krb5_security_ops = {
.have_feature = gensec_krb5_have_feature, .have_feature = gensec_krb5_have_feature,
.wrap = gensec_krb5_wrap, .wrap = gensec_krb5_wrap,
.unwrap = gensec_krb5_unwrap, .unwrap = gensec_krb5_unwrap,
.enabled = True, .enabled = true,
.kerberos = True, .kerberos = true,
.priority = GENSEC_KRB5 .priority = GENSEC_KRB5
}; };

View File

@@ -208,7 +208,7 @@ static NTSTATUS schannel_server_start(struct gensec_security *gensec_security)
} }
state = (struct schannel_state *)gensec_security->private_data; state = (struct schannel_state *)gensec_security->private_data;
state->initiator = False; state->initiator = false;
return NT_STATUS_OK; return NT_STATUS_OK;
} }
@@ -224,26 +224,26 @@ static NTSTATUS schannel_client_start(struct gensec_security *gensec_security)
} }
state = (struct schannel_state *)gensec_security->private_data; state = (struct schannel_state *)gensec_security->private_data;
state->initiator = True; state->initiator = true;
return NT_STATUS_OK; return NT_STATUS_OK;
} }
static BOOL schannel_have_feature(struct gensec_security *gensec_security, static bool schannel_have_feature(struct gensec_security *gensec_security,
uint32_t feature) uint32_t feature)
{ {
if (feature & (GENSEC_FEATURE_SIGN | if (feature & (GENSEC_FEATURE_SIGN |
GENSEC_FEATURE_SEAL)) { GENSEC_FEATURE_SEAL)) {
return True; return true;
} }
if (feature & GENSEC_FEATURE_DCE_STYLE) { if (feature & GENSEC_FEATURE_DCE_STYLE) {
return True; return true;
} }
if (feature & GENSEC_FEATURE_ASYNC_REPLIES) { if (feature & GENSEC_FEATURE_ASYNC_REPLIES) {
return True; return true;
} }
return False; return false;
} }
@@ -261,7 +261,7 @@ static const struct gensec_security_ops gensec_schannel_security_ops = {
.session_info = schannel_session_info, .session_info = schannel_session_info,
.sig_size = schannel_sig_size, .sig_size = schannel_sig_size,
.have_feature = schannel_have_feature, .have_feature = schannel_have_feature,
.enabled = True, .enabled = true,
.priority = GENSEC_SCHANNEL .priority = GENSEC_SCHANNEL
}; };

View File

@@ -35,7 +35,7 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx)
{ {
char *path; char *path;
struct ldb_context *ldb; struct ldb_context *ldb;
BOOL existed; bool existed;
const char *init_ldif = const char *init_ldif =
"dn: @ATTRIBUTES\n" \ "dn: @ATTRIBUTES\n" \
"computerName: CASE_INSENSITIVE\n" \ "computerName: CASE_INSENSITIVE\n" \

View File

@@ -34,13 +34,13 @@ struct gensec_socket {
struct packet_context *packet; struct packet_context *packet;
DATA_BLOB read_buffer; /* SASL packets are turned into liniarlised data here, for reading */ DATA_BLOB read_buffer; /* SASL packets are turned into liniarlised data here, for reading */
size_t orig_send_len; size_t orig_send_len;
BOOL eof; bool eof;
NTSTATUS error; NTSTATUS error;
BOOL interrupted; bool interrupted;
void (*recv_handler)(void *, uint16_t); void (*recv_handler)(void *, uint16_t);
void *recv_private; void *recv_private;
int in_extra_read; int in_extra_read;
BOOL wrap; /* Should we be wrapping on this socket at all? */ bool wrap; /* Should we be wrapping on this socket at all? */
}; };
static NTSTATUS gensec_socket_init_fn(struct socket_context *sock) static NTSTATUS gensec_socket_init_fn(struct socket_context *sock)
@@ -190,7 +190,7 @@ static void gensec_socket_error_handler(void *private, NTSTATUS status)
{ {
struct gensec_socket *gensec_socket = talloc_get_type(private, struct gensec_socket); struct gensec_socket *gensec_socket = talloc_get_type(private, struct gensec_socket);
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
gensec_socket->eof = True; gensec_socket->eof = true;
} else { } else {
gensec_socket->error = status; gensec_socket->error = status;
} }
@@ -331,7 +331,7 @@ static NTSTATUS gensec_socket_unwrap(void *private, DATA_BLOB blob)
static void send_callback(void *private) static void send_callback(void *private)
{ {
struct gensec_socket *gensec_socket = talloc_get_type(private, struct gensec_socket); struct gensec_socket *gensec_socket = talloc_get_type(private, struct gensec_socket);
gensec_socket->interrupted = False; gensec_socket->interrupted = false;
} }
/* /*
@@ -384,7 +384,7 @@ static NTSTATUS gensec_socket_send(struct socket_context *sock,
return nt_status; return nt_status;
} }
gensec_socket->interrupted = True; gensec_socket->interrupted = true;
gensec_socket->error = NT_STATUS_OK; gensec_socket->error = NT_STATUS_OK;
nt_status = packet_send_callback(gensec_socket->packet, nt_status = packet_send_callback(gensec_socket->packet,
@@ -446,17 +446,17 @@ NTSTATUS gensec_socket_init(struct gensec_security *gensec_security,
if (!gensec_have_feature(gensec_security, GENSEC_FEATURE_SEAL) && if (!gensec_have_feature(gensec_security, GENSEC_FEATURE_SEAL) &&
!gensec_have_feature(gensec_security, GENSEC_FEATURE_SIGN)) { !gensec_have_feature(gensec_security, GENSEC_FEATURE_SIGN)) {
gensec_socket->wrap = False; gensec_socket->wrap = false;
*new_socket = new_sock; *new_socket = new_sock;
return NT_STATUS_OK; return NT_STATUS_OK;
} }
gensec_socket->gensec_security = gensec_security; gensec_socket->gensec_security = gensec_security;
gensec_socket->wrap = True; gensec_socket->wrap = true;
gensec_socket->eof = False; gensec_socket->eof = false;
gensec_socket->error = NT_STATUS_OK; gensec_socket->error = NT_STATUS_OK;
gensec_socket->interrupted = False; gensec_socket->interrupted = false;
gensec_socket->in_extra_read = 0; gensec_socket->in_extra_read = 0;
gensec_socket->read_buffer = data_blob(NULL, 0); gensec_socket->read_buffer = data_blob(NULL, 0);

View File

@@ -41,7 +41,7 @@ struct spnego_state {
enum spnego_message_type expected_packet; enum spnego_message_type expected_packet;
enum spnego_state_position state_position; enum spnego_state_position state_position;
struct gensec_security *sub_sec_security; struct gensec_security *sub_sec_security;
BOOL no_response_expected; bool no_response_expected;
const char *neg_oid; const char *neg_oid;
}; };
@@ -59,7 +59,7 @@ static NTSTATUS gensec_spnego_client_start(struct gensec_security *gensec_securi
spnego_state->expected_packet = SPNEGO_NEG_TOKEN_INIT; spnego_state->expected_packet = SPNEGO_NEG_TOKEN_INIT;
spnego_state->state_position = SPNEGO_CLIENT_START; spnego_state->state_position = SPNEGO_CLIENT_START;
spnego_state->sub_sec_security = NULL; spnego_state->sub_sec_security = NULL;
spnego_state->no_response_expected = False; spnego_state->no_response_expected = false;
gensec_security->private_data = spnego_state; gensec_security->private_data = spnego_state;
return NT_STATUS_OK; return NT_STATUS_OK;
@@ -77,7 +77,7 @@ static NTSTATUS gensec_spnego_server_start(struct gensec_security *gensec_securi
spnego_state->expected_packet = SPNEGO_NEG_TOKEN_INIT; spnego_state->expected_packet = SPNEGO_NEG_TOKEN_INIT;
spnego_state->state_position = SPNEGO_SERVER_START; spnego_state->state_position = SPNEGO_SERVER_START;
spnego_state->sub_sec_security = NULL; spnego_state->sub_sec_security = NULL;
spnego_state->no_response_expected = False; spnego_state->no_response_expected = false;
gensec_security->private_data = spnego_state; gensec_security->private_data = spnego_state;
return NT_STATUS_OK; return NT_STATUS_OK;
@@ -329,16 +329,16 @@ static NTSTATUS gensec_spnego_server_try_fallback(struct gensec_security *gensec
struct gensec_security_ops **all_ops struct gensec_security_ops **all_ops
= gensec_security_mechs(gensec_security, out_mem_ctx); = gensec_security_mechs(gensec_security, out_mem_ctx);
for (i=0; all_ops[i]; i++) { for (i=0; all_ops[i]; i++) {
BOOL is_spnego; bool is_spnego;
NTSTATUS nt_status; NTSTATUS nt_status;
if (!all_ops[i]->oid) { if (!all_ops[i]->oid) {
continue; continue;
} }
is_spnego = False; is_spnego = false;
for (j=0; all_ops[i]->oid[j]; j++) { for (j=0; all_ops[i]->oid[j]; j++) {
if (strcasecmp(GENSEC_OID_SPNEGO,all_ops[i]->oid[j]) == 0) { if (strcasecmp(GENSEC_OID_SPNEGO,all_ops[i]->oid[j]) == 0) {
is_spnego = True; is_spnego = true;
} }
} }
if (is_spnego) { if (is_spnego) {
@@ -622,7 +622,7 @@ static NTSTATUS gensec_spnego_create_negTokenInit(struct gensec_security *gensec
spnego_state->neg_oid = all_sec[i].oid; spnego_state->neg_oid = all_sec[i].oid;
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
spnego_state->no_response_expected = True; spnego_state->no_response_expected = true;
} }
return NT_STATUS_MORE_PROCESSING_REQUIRED; return NT_STATUS_MORE_PROCESSING_REQUIRED;
@@ -820,7 +820,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
spnego_state->state_position = SPNEGO_CLIENT_TARG; spnego_state->state_position = SPNEGO_CLIENT_TARG;
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
spnego_state->no_response_expected = True; spnego_state->no_response_expected = true;
} }
spnego_free_data(&spnego); spnego_free_data(&spnego);
@@ -947,7 +947,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
&unwrapped_out); &unwrapped_out);
if (NT_STATUS_IS_OK(nt_status)) { if (NT_STATUS_IS_OK(nt_status)) {
spnego_state->no_response_expected = True; spnego_state->no_response_expected = true;
} }
} }
@@ -999,12 +999,12 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
return NT_STATUS_INVALID_PARAMETER; return NT_STATUS_INVALID_PARAMETER;
} }
static BOOL gensec_spnego_have_feature(struct gensec_security *gensec_security, static bool gensec_spnego_have_feature(struct gensec_security *gensec_security,
uint32_t feature) uint32_t feature)
{ {
struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data;
if (!spnego_state->sub_sec_security) { if (!spnego_state->sub_sec_security) {
return False; return false;
} }
return gensec_have_feature(spnego_state->sub_sec_security, return gensec_have_feature(spnego_state->sub_sec_security,
@@ -1039,7 +1039,7 @@ static const struct gensec_security_ops gensec_spnego_security_ops = {
.session_key = gensec_spnego_session_key, .session_key = gensec_spnego_session_key,
.session_info = gensec_spnego_session_info, .session_info = gensec_spnego_session_info,
.have_feature = gensec_spnego_have_feature, .have_feature = gensec_spnego_have_feature,
.enabled = True, .enabled = true,
.priority = GENSEC_SPNEGO .priority = GENSEC_SPNEGO
}; };

View File

@@ -25,7 +25,7 @@
#include "auth/gensec/gensec.h" #include "auth/gensec/gensec.h"
#include "libcli/util/asn_1.h" #include "libcli/util/asn_1.h"
static BOOL read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx, static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
struct spnego_negTokenInit *token) struct spnego_negTokenInit *token)
{ {
ZERO_STRUCTP(token); ZERO_STRUCTP(token);
@@ -37,7 +37,7 @@ static BOOL read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
int i; int i;
uint8_t context; uint8_t context;
if (!asn1_peek_uint8(asn1, &context)) { if (!asn1_peek_uint8(asn1, &context)) {
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
@@ -79,7 +79,7 @@ static BOOL read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
uint8_t type_peek; uint8_t type_peek;
asn1_start_tag(asn1, ASN1_CONTEXT(3)); asn1_start_tag(asn1, ASN1_CONTEXT(3));
if (!asn1_peek_uint8(asn1, &type_peek)) { if (!asn1_peek_uint8(asn1, &type_peek)) {
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
if (type_peek == ASN1_OCTET_STRING) { if (type_peek == ASN1_OCTET_STRING) {
@@ -101,7 +101,7 @@ static BOOL read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
break; break;
} }
default: default:
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
} }
@@ -112,7 +112,7 @@ static BOOL read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
return !asn1->has_error; return !asn1->has_error;
} }
static BOOL write_negTokenInit(struct asn1_data *asn1, struct spnego_negTokenInit *token) static bool write_negTokenInit(struct asn1_data *asn1, struct spnego_negTokenInit *token)
{ {
asn1_push_tag(asn1, ASN1_CONTEXT(0)); asn1_push_tag(asn1, ASN1_CONTEXT(0));
asn1_push_tag(asn1, ASN1_SEQUENCE(0)); asn1_push_tag(asn1, ASN1_SEQUENCE(0));
@@ -175,7 +175,7 @@ static BOOL write_negTokenInit(struct asn1_data *asn1, struct spnego_negTokenIni
return !asn1->has_error; return !asn1->has_error;
} }
static BOOL read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx, static bool read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
struct spnego_negTokenTarg *token) struct spnego_negTokenTarg *token)
{ {
ZERO_STRUCTP(token); ZERO_STRUCTP(token);
@@ -186,7 +186,7 @@ static BOOL read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
while (!asn1->has_error && 0 < asn1_tag_remaining(asn1)) { while (!asn1->has_error && 0 < asn1_tag_remaining(asn1)) {
uint8_t context; uint8_t context;
if (!asn1_peek_uint8(asn1, &context)) { if (!asn1_peek_uint8(asn1, &context)) {
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
@@ -214,7 +214,7 @@ static BOOL read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
asn1_end_tag(asn1); asn1_end_tag(asn1);
break; break;
default: default:
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
} }
@@ -225,7 +225,7 @@ static BOOL read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
return !asn1->has_error; return !asn1->has_error;
} }
static BOOL write_negTokenTarg(struct asn1_data *asn1, struct spnego_negTokenTarg *token) static bool write_negTokenTarg(struct asn1_data *asn1, struct spnego_negTokenTarg *token)
{ {
asn1_push_tag(asn1, ASN1_CONTEXT(1)); asn1_push_tag(asn1, ASN1_CONTEXT(1));
asn1_push_tag(asn1, ASN1_SEQUENCE(0)); asn1_push_tag(asn1, ASN1_SEQUENCE(0));
@@ -282,7 +282,7 @@ ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data
asn1_load(asn1, data); asn1_load(asn1, data);
if (!asn1_peek_uint8(asn1, &context)) { if (!asn1_peek_uint8(asn1, &context)) {
asn1->has_error = True; asn1->has_error = true;
} else { } else {
switch (context) { switch (context) {
case ASN1_APPLICATION(0): case ASN1_APPLICATION(0):
@@ -299,7 +299,7 @@ ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data
} }
break; break;
default: default:
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
} }
@@ -330,7 +330,7 @@ ssize_t spnego_write_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct spnego_da
write_negTokenTarg(asn1, &spnego->negTokenTarg); write_negTokenTarg(asn1, &spnego->negTokenTarg);
break; break;
default: default:
asn1->has_error = True; asn1->has_error = true;
break; break;
} }
@@ -343,9 +343,9 @@ ssize_t spnego_write_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct spnego_da
return ret; return ret;
} }
BOOL spnego_free_data(struct spnego_data *spnego) bool spnego_free_data(struct spnego_data *spnego)
{ {
BOOL ret = True; bool ret = true;
if (!spnego) goto out; if (!spnego) goto out;
@@ -366,7 +366,7 @@ BOOL spnego_free_data(struct spnego_data *spnego)
data_blob_free(&spnego->negTokenTarg.mechListMIC); data_blob_free(&spnego->negTokenTarg.mechListMIC);
break; break;
default: default:
ret = False; ret = false;
break; break;
} }
ZERO_STRUCTP(spnego); ZERO_STRUCTP(spnego);

View File

@@ -64,14 +64,14 @@ DATA_BLOB gensec_gssapi_gen_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *tick
/* /*
parse a krb5 GSS-API wrapper packet giving a ticket parse a krb5 GSS-API wrapper packet giving a ticket
*/ */
BOOL gensec_gssapi_parse_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, DATA_BLOB *ticket, uint8_t tok_id[2]) bool gensec_gssapi_parse_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, DATA_BLOB *ticket, uint8_t tok_id[2])
{ {
BOOL ret; bool ret;
struct asn1_data *data = asn1_init(mem_ctx); struct asn1_data *data = asn1_init(mem_ctx);
int data_remaining; int data_remaining;
if (!data) { if (!data) {
return False; return false;
} }
asn1_load(data, *blob); asn1_load(data, *blob);
@@ -81,7 +81,7 @@ BOOL gensec_gssapi_parse_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, D
data_remaining = asn1_tag_remaining(data); data_remaining = asn1_tag_remaining(data);
if (data_remaining < 3) { if (data_remaining < 3) {
data->has_error = True; data->has_error = true;
} else { } else {
asn1_read(data, tok_id, 2); asn1_read(data, tok_id, 2);
data_remaining -= 2; data_remaining -= 2;
@@ -102,12 +102,12 @@ BOOL gensec_gssapi_parse_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, D
/* /*
check a GSS-API wrapper packet givin an expected OID check a GSS-API wrapper packet givin an expected OID
*/ */
BOOL gensec_gssapi_check_oid(const DATA_BLOB *blob, const char *oid) bool gensec_gssapi_check_oid(const DATA_BLOB *blob, const char *oid)
{ {
BOOL ret; bool ret;
struct asn1_data *data = asn1_init(NULL); struct asn1_data *data = asn1_init(NULL);
if (!data) return False; if (!data) return false;
asn1_load(data, *blob); asn1_load(data, *blob);
asn1_start_tag(data, ASN1_APPLICATION(0)); asn1_start_tag(data, ASN1_APPLICATION(0));

View File

@@ -343,7 +343,7 @@ static int create_keytab(TALLOC_CTX *parent_ctx,
struct smb_krb5_context *smb_krb5_context, struct smb_krb5_context *smb_krb5_context,
const char **enctype_strings, const char **enctype_strings,
krb5_keytab keytab, krb5_keytab keytab,
BOOL add_old) bool add_old)
{ {
krb5_error_code ret; krb5_error_code ret;
const char *password_s; const char *password_s;
@@ -484,7 +484,7 @@ static int create_keytab(TALLOC_CTX *parent_ctx,
static krb5_error_code remove_old_entries(TALLOC_CTX *parent_ctx, static krb5_error_code remove_old_entries(TALLOC_CTX *parent_ctx,
struct cli_credentials *machine_account, struct cli_credentials *machine_account,
struct smb_krb5_context *smb_krb5_context, struct smb_krb5_context *smb_krb5_context,
krb5_keytab keytab, BOOL *found_previous) krb5_keytab keytab, bool *found_previous)
{ {
krb5_error_code ret, ret2; krb5_error_code ret, ret2;
krb5_kt_cursor cursor; krb5_kt_cursor cursor;
@@ -496,7 +496,7 @@ static krb5_error_code remove_old_entries(TALLOC_CTX *parent_ctx,
return ENOMEM; return ENOMEM;
} }
*found_previous = False; *found_previous = false;
princ_string = cli_credentials_get_principal(machine_account, mem_ctx); princ_string = cli_credentials_get_principal(machine_account, mem_ctx);
/* Get the principal we will store the new keytab entries under */ /* Get the principal we will store the new keytab entries under */
@@ -575,7 +575,7 @@ static krb5_error_code remove_old_entries(TALLOC_CTX *parent_ctx,
} }
} else { } else {
*found_previous = True; *found_previous = true;
} }
/* Free the entry, we don't need it any more */ /* Free the entry, we don't need it any more */
@@ -609,7 +609,7 @@ int smb_krb5_update_keytab(TALLOC_CTX *parent_ctx,
struct keytab_container *keytab_container) struct keytab_container *keytab_container)
{ {
krb5_error_code ret; krb5_error_code ret;
BOOL found_previous; bool found_previous;
TALLOC_CTX *mem_ctx = talloc_new(parent_ctx); TALLOC_CTX *mem_ctx = talloc_new(parent_ctx);
if (!mem_ctx) { if (!mem_ctx) {
return ENOMEM; return ENOMEM;
@@ -629,7 +629,7 @@ int smb_krb5_update_keytab(TALLOC_CTX *parent_ctx,
ret = create_keytab(mem_ctx, machine_account, smb_krb5_context, ret = create_keytab(mem_ctx, machine_account, smb_krb5_context,
enctype_strings, enctype_strings,
keytab_container->keytab, keytab_container->keytab,
found_previous ? False : True); found_previous ? false : true);
talloc_free(mem_ctx); talloc_free(mem_ctx);
return ret; return ret;
} }

View File

@@ -29,7 +29,7 @@
Core of smb password checking routine. Core of smb password checking routine.
****************************************************************************/ ****************************************************************************/
static BOOL smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx, static bool smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx,
const DATA_BLOB *nt_response, const DATA_BLOB *nt_response,
const uint8_t *part_passwd, const uint8_t *part_passwd,
const DATA_BLOB *sec_blob, const DATA_BLOB *sec_blob,
@@ -41,19 +41,19 @@ static BOOL smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx,
if (part_passwd == NULL) { if (part_passwd == NULL) {
DEBUG(10,("No password set - DISALLOWING access\n")); DEBUG(10,("No password set - DISALLOWING access\n"));
/* No password set - always false ! */ /* No password set - always false ! */
return False; return false;
} }
if (sec_blob->length != 8) { if (sec_blob->length != 8) {
DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect challenge size (%lu)\n", DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect challenge size (%lu)\n",
(unsigned long)sec_blob->length)); (unsigned long)sec_blob->length));
return False; return false;
} }
if (nt_response->length != 24) { if (nt_response->length != 24) {
DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect password length (%lu)\n", DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect password length (%lu)\n",
(unsigned long)nt_response->length)); (unsigned long)nt_response->length));
return False; return false;
} }
SMBOWFencrypt(part_passwd, sec_blob->data, p24); SMBOWFencrypt(part_passwd, sec_blob->data, p24);
@@ -73,9 +73,9 @@ static BOOL smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx,
*user_sess_key = data_blob_talloc(mem_ctx, NULL, 16); *user_sess_key = data_blob_talloc(mem_ctx, NULL, 16);
SMBsesskeygen_ntv1(part_passwd, user_sess_key->data); SMBsesskeygen_ntv1(part_passwd, user_sess_key->data);
} }
return True; return true;
} }
return False; return false;
} }
/**************************************************************************** /****************************************************************************
@@ -83,12 +83,12 @@ static BOOL smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx,
Note: The same code works with both NTLMv2 and LMv2. Note: The same code works with both NTLMv2 and LMv2.
****************************************************************************/ ****************************************************************************/
static BOOL smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx, static bool smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
const DATA_BLOB *ntv2_response, const DATA_BLOB *ntv2_response,
const uint8_t *part_passwd, const uint8_t *part_passwd,
const DATA_BLOB *sec_blob, const DATA_BLOB *sec_blob,
const char *user, const char *domain, const char *user, const char *domain,
BOOL upper_case_domain, /* should the domain be transformed into upper case? */ bool upper_case_domain, /* should the domain be transformed into upper case? */
DATA_BLOB *user_sess_key) DATA_BLOB *user_sess_key)
{ {
/* Finish the encryption of part_passwd. */ /* Finish the encryption of part_passwd. */
@@ -98,14 +98,14 @@ static BOOL smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
if (part_passwd == NULL) { if (part_passwd == NULL) {
DEBUG(10,("No password set - DISALLOWING access\n")); DEBUG(10,("No password set - DISALLOWING access\n"));
/* No password set - always False */ /* No password set - always false */
return False; return false;
} }
if (sec_blob->length != 8) { if (sec_blob->length != 8) {
DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect challenge size (%lu)\n", DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect challenge size (%lu)\n",
(unsigned long)sec_blob->length)); (unsigned long)sec_blob->length));
return False; return false;
} }
if (ntv2_response->length < 24) { if (ntv2_response->length < 24) {
@@ -114,7 +114,7 @@ static BOOL smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
for LMv2, let alone NTLMv2. */ for LMv2, let alone NTLMv2. */
DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect password length (%lu)\n", DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect password length (%lu)\n",
(unsigned long)ntv2_response->length)); (unsigned long)ntv2_response->length));
return False; return false;
} }
client_key_data = data_blob_talloc(mem_ctx, ntv2_response->data+16, ntv2_response->length-16); client_key_data = data_blob_talloc(mem_ctx, ntv2_response->data+16, ntv2_response->length-16);
@@ -124,7 +124,7 @@ static BOOL smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
*/ */
if (!ntv2_owf_gen(part_passwd, user, domain, upper_case_domain, kr)) { if (!ntv2_owf_gen(part_passwd, user, domain, upper_case_domain, kr)) {
return False; return false;
} }
SMBOWFencrypt_ntv2(kr, sec_blob, &client_key_data, value_from_encryption); SMBOWFencrypt_ntv2(kr, sec_blob, &client_key_data, value_from_encryption);
@@ -147,9 +147,9 @@ static BOOL smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
*user_sess_key = data_blob_talloc(mem_ctx, NULL, 16); *user_sess_key = data_blob_talloc(mem_ctx, NULL, 16);
SMBsesskeygen_ntv2(kr, value_from_encryption, user_sess_key->data); SMBsesskeygen_ntv2(kr, value_from_encryption, user_sess_key->data);
} }
return True; return true;
} }
return False; return false;
} }
/**************************************************************************** /****************************************************************************
@@ -157,12 +157,12 @@ static BOOL smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
Note: The same code works with both NTLMv2 and LMv2. Note: The same code works with both NTLMv2 and LMv2.
****************************************************************************/ ****************************************************************************/
static BOOL smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx, static bool smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx,
const DATA_BLOB *ntv2_response, const DATA_BLOB *ntv2_response,
const uint8_t *part_passwd, const uint8_t *part_passwd,
const DATA_BLOB *sec_blob, const DATA_BLOB *sec_blob,
const char *user, const char *domain, const char *user, const char *domain,
BOOL upper_case_domain, /* should the domain be transformed into upper case? */ bool upper_case_domain, /* should the domain be transformed into upper case? */
DATA_BLOB *user_sess_key) DATA_BLOB *user_sess_key)
{ {
/* Finish the encryption of part_passwd. */ /* Finish the encryption of part_passwd. */
@@ -172,14 +172,14 @@ static BOOL smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx,
if (part_passwd == NULL) { if (part_passwd == NULL) {
DEBUG(10,("No password set - DISALLOWING access\n")); DEBUG(10,("No password set - DISALLOWING access\n"));
/* No password set - always False */ /* No password set - always false */
return False; return false;
} }
if (sec_blob->length != 8) { if (sec_blob->length != 8) {
DEBUG(0, ("smb_sess_key_ntlmv2: incorrect challenge size (%lu)\n", DEBUG(0, ("smb_sess_key_ntlmv2: incorrect challenge size (%lu)\n",
(unsigned long)sec_blob->length)); (unsigned long)sec_blob->length));
return False; return false;
} }
if (ntv2_response->length < 24) { if (ntv2_response->length < 24) {
@@ -188,19 +188,19 @@ static BOOL smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx,
for LMv2, let alone NTLMv2. */ for LMv2, let alone NTLMv2. */
DEBUG(0, ("smb_sess_key_ntlmv2: incorrect password length (%lu)\n", DEBUG(0, ("smb_sess_key_ntlmv2: incorrect password length (%lu)\n",
(unsigned long)ntv2_response->length)); (unsigned long)ntv2_response->length));
return False; return false;
} }
client_key_data = data_blob_talloc(mem_ctx, ntv2_response->data+16, ntv2_response->length-16); client_key_data = data_blob_talloc(mem_ctx, ntv2_response->data+16, ntv2_response->length-16);
if (!ntv2_owf_gen(part_passwd, user, domain, upper_case_domain, kr)) { if (!ntv2_owf_gen(part_passwd, user, domain, upper_case_domain, kr)) {
return False; return false;
} }
SMBOWFencrypt_ntv2(kr, sec_blob, &client_key_data, value_from_encryption); SMBOWFencrypt_ntv2(kr, sec_blob, &client_key_data, value_from_encryption);
*user_sess_key = data_blob_talloc(mem_ctx, NULL, 16); *user_sess_key = data_blob_talloc(mem_ctx, NULL, 16);
SMBsesskeygen_ntv2(kr, value_from_encryption, user_sess_key->data); SMBsesskeygen_ntv2(kr, value_from_encryption, user_sess_key->data);
return True; return true;
} }
/** /**
@@ -311,7 +311,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
struct samr_Password client_nt; struct samr_Password client_nt;
struct samr_Password client_lm; struct samr_Password client_lm;
char *unix_pw = NULL; char *unix_pw = NULL;
BOOL lm_ok; bool lm_ok;
DEBUG(4,("ntlm_password_check: checking plaintext passwords for user %s\n", DEBUG(4,("ntlm_password_check: checking plaintext passwords for user %s\n",
username)); username));
@@ -322,12 +322,12 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
lm_response->data, lm_response->length, lm_response->data, lm_response->length,
(void **)&unix_pw) != -1)) { (void **)&unix_pw) != -1)) {
if (E_deshash(unix_pw, client_lm.hash)) { if (E_deshash(unix_pw, client_lm.hash)) {
lm_ok = True; lm_ok = true;
} else { } else {
lm_ok = False; lm_ok = false;
} }
} else { } else {
lm_ok = False; lm_ok = false;
} }
return hash_password_check(mem_ctx, return hash_password_check(mem_ctx,
lm_ok ? &client_lm : NULL, lm_ok ? &client_lm : NULL,
@@ -351,7 +351,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
client_domain, client_domain,
False, false,
user_sess_key)) { user_sess_key)) {
*lm_sess_key = *user_sess_key; *lm_sess_key = *user_sess_key;
if (user_sess_key->length) { if (user_sess_key->length) {
@@ -366,7 +366,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
client_domain, client_domain,
True, true,
user_sess_key)) { user_sess_key)) {
*lm_sess_key = *user_sess_key; *lm_sess_key = *user_sess_key;
if (user_sess_key->length) { if (user_sess_key->length) {
@@ -381,7 +381,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
"", "",
False, false,
user_sess_key)) { user_sess_key)) {
*lm_sess_key = *user_sess_key; *lm_sess_key = *user_sess_key;
if (user_sess_key->length) { if (user_sess_key->length) {
@@ -476,7 +476,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
client_domain, client_domain,
False, false,
&tmp_sess_key)) { &tmp_sess_key)) {
if (nt_response->length > 24) { if (nt_response->length > 24) {
/* If NTLMv2 authentication has preceeded us /* If NTLMv2 authentication has preceeded us
@@ -488,7 +488,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
client_domain, client_domain,
False, false,
user_sess_key); user_sess_key);
} else { } else {
/* Otherwise, use the LMv2 session key */ /* Otherwise, use the LMv2 session key */
@@ -507,7 +507,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
client_domain, client_domain,
True, true,
&tmp_sess_key)) { &tmp_sess_key)) {
if (nt_response->length > 24) { if (nt_response->length > 24) {
/* If NTLMv2 authentication has preceeded us /* If NTLMv2 authentication has preceeded us
@@ -519,7 +519,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
client_domain, client_domain,
True, true,
user_sess_key); user_sess_key);
} else { } else {
/* Otherwise, use the LMv2 session key */ /* Otherwise, use the LMv2 session key */
@@ -538,7 +538,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
"", "",
False, false,
&tmp_sess_key)) { &tmp_sess_key)) {
if (nt_response->length > 24) { if (nt_response->length > 24) {
/* If NTLMv2 authentication has preceeded us /* If NTLMv2 authentication has preceeded us
@@ -550,7 +550,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
stored_nt->hash, challenge, stored_nt->hash, challenge,
client_username, client_username,
"", "",
False, false,
user_sess_key); user_sess_key);
} else { } else {
/* Otherwise, use the LMv2 session key */ /* Otherwise, use the LMv2 session key */

View File

@@ -240,16 +240,16 @@ NTSTATUS gensec_ntlmssp_session_key(struct gensec_security *gensec_security,
} }
void ntlmssp_handle_neg_flags(struct gensec_ntlmssp_state *gensec_ntlmssp_state, void ntlmssp_handle_neg_flags(struct gensec_ntlmssp_state *gensec_ntlmssp_state,
uint32_t neg_flags, BOOL allow_lm) uint32_t neg_flags, bool allow_lm)
{ {
if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) {
gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_UNICODE; gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_UNICODE;
gensec_ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_OEM; gensec_ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_OEM;
gensec_ntlmssp_state->unicode = True; gensec_ntlmssp_state->unicode = true;
} else { } else {
gensec_ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_UNICODE; gensec_ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_UNICODE;
gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_OEM; gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_OEM;
gensec_ntlmssp_state->unicode = False; gensec_ntlmssp_state->unicode = false;
} }
if ((neg_flags & NTLMSSP_NEGOTIATE_LM_KEY) && allow_lm && !gensec_ntlmssp_state->use_ntlmv2) { if ((neg_flags & NTLMSSP_NEGOTIATE_LM_KEY) && allow_lm && !gensec_ntlmssp_state->use_ntlmv2) {
@@ -341,40 +341,40 @@ DATA_BLOB ntlmssp_weakend_key(struct gensec_ntlmssp_state *gensec_ntlmssp_state,
return weakened_key; return weakened_key;
} }
static BOOL gensec_ntlmssp_have_feature(struct gensec_security *gensec_security, static bool gensec_ntlmssp_have_feature(struct gensec_security *gensec_security,
uint32_t feature) uint32_t feature)
{ {
struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
if (feature & GENSEC_FEATURE_SIGN) { if (feature & GENSEC_FEATURE_SIGN) {
if (!gensec_ntlmssp_state->session_key.length) { if (!gensec_ntlmssp_state->session_key.length) {
return False; return false;
} }
if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SIGN) { if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SIGN) {
return True; return true;
} }
} }
if (feature & GENSEC_FEATURE_SEAL) { if (feature & GENSEC_FEATURE_SEAL) {
if (!gensec_ntlmssp_state->session_key.length) { if (!gensec_ntlmssp_state->session_key.length) {
return False; return false;
} }
if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SEAL) { if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SEAL) {
return True; return true;
} }
} }
if (feature & GENSEC_FEATURE_SESSION_KEY) { if (feature & GENSEC_FEATURE_SESSION_KEY) {
if (gensec_ntlmssp_state->session_key.length) { if (gensec_ntlmssp_state->session_key.length) {
return True; return true;
} }
} }
if (feature & GENSEC_FEATURE_DCE_STYLE) { if (feature & GENSEC_FEATURE_DCE_STYLE) {
return True; return true;
} }
if (feature & GENSEC_FEATURE_ASYNC_REPLIES) { if (feature & GENSEC_FEATURE_ASYNC_REPLIES) {
if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
return True; return true;
} }
} }
return False; return false;
} }
NTSTATUS gensec_ntlmssp_start(struct gensec_security *gensec_security) NTSTATUS gensec_ntlmssp_start(struct gensec_security *gensec_security)
@@ -418,7 +418,7 @@ static const struct gensec_security_ops gensec_ntlmssp_security_ops = {
.session_key = gensec_ntlmssp_session_key, .session_key = gensec_ntlmssp_session_key,
.session_info = gensec_ntlmssp_session_info, .session_info = gensec_ntlmssp_session_info,
.have_feature = gensec_ntlmssp_have_feature, .have_feature = gensec_ntlmssp_have_feature,
.enabled = True, .enabled = true,
.priority = GENSEC_NTLMSSP .priority = GENSEC_NTLMSSP
}; };

View File

@@ -339,7 +339,7 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_NTLM2; gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_NTLM2;
} else { } else {
/* apparently we can't do ntlmv2 if we don't do ntlm2 */ /* apparently we can't do ntlmv2 if we don't do ntlm2 */
gensec_ntlmssp_state->use_ntlmv2 = False; gensec_ntlmssp_state->use_ntlmv2 = false;
} }
if (gensec_security->want_features & GENSEC_FEATURE_SESSION_KEY) { if (gensec_security->want_features & GENSEC_FEATURE_SESSION_KEY) {

View File

@@ -40,7 +40,7 @@
d = word (4 bytes) d = word (4 bytes)
C = constant ascii string C = constant ascii string
*/ */
BOOL msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, bool msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
const char *format, ...) const char *format, ...)
{ {
int i; int i;
@@ -66,7 +66,7 @@ BOOL msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
head_size += 8; head_size += 8;
n = push_ucs2_talloc(pointers, (void **)&pointers[i].data, s); n = push_ucs2_talloc(pointers, (void **)&pointers[i].data, s);
if (n == -1) { if (n == -1) {
return False; return false;
} }
pointers[i].length = n; pointers[i].length = n;
pointers[i].length -= 2; pointers[i].length -= 2;
@@ -77,7 +77,7 @@ BOOL msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
head_size += 8; head_size += 8;
n = push_ascii_talloc(pointers, (char **)&pointers[i].data, s); n = push_ascii_talloc(pointers, (char **)&pointers[i].data, s);
if (n == -1) { if (n == -1) {
return False; return false;
} }
pointers[i].length = n; pointers[i].length = n;
pointers[i].length -= 1; pointers[i].length -= 1;
@@ -89,7 +89,7 @@ BOOL msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
s = va_arg(ap, char *); s = va_arg(ap, char *);
n = push_ucs2_talloc(pointers, (void **)&pointers[i].data, s); n = push_ucs2_talloc(pointers, (void **)&pointers[i].data, s);
if (n == -1) { if (n == -1) {
return False; return false;
} }
pointers[i].length = n; pointers[i].length = n;
pointers[i].length -= 2; pointers[i].length -= 2;
@@ -175,14 +175,14 @@ BOOL msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
talloc_free(pointers); talloc_free(pointers);
return True; return true;
} }
/* a helpful macro to avoid running over the end of our blob */ /* a helpful macro to avoid running over the end of our blob */
#define NEED_DATA(amount) \ #define NEED_DATA(amount) \
if ((head_ofs + amount) > blob->length) { \ if ((head_ofs + amount) > blob->length) { \
return False; \ return false; \
} }
/* /*
@@ -198,7 +198,7 @@ if ((head_ofs + amount) > blob->length) { \
C = constant ascii string C = constant ascii string
*/ */
BOOL msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, bool msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
const char *format, ...) const char *format, ...)
{ {
int i; int i;
@@ -226,21 +226,21 @@ BOOL msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
} else { } else {
/* make sure its in the right format - be strict */ /* make sure its in the right format - be strict */
if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) {
return False; return false;
} }
if (len1 & 1) { if (len1 & 1) {
/* if odd length and unicode */ /* if odd length and unicode */
return False; return false;
} }
if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data) if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data)
return False; return false;
if (0 < len1) { if (0 < len1) {
pull_string(p, blob->data + ptr, sizeof(p), pull_string(p, blob->data + ptr, sizeof(p),
len1, STR_UNICODE|STR_NOALIGN); len1, STR_UNICODE|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p); (*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) { if (!(*ps)) {
return False; return false;
} }
} else { } else {
(*ps) = ""; (*ps) = "";
@@ -259,18 +259,18 @@ BOOL msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
*ps = ""; *ps = "";
} else { } else {
if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) {
return False; return false;
} }
if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data) if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data)
return False; return false;
if (0 < len1) { if (0 < len1) {
pull_string(p, blob->data + ptr, sizeof(p), pull_string(p, blob->data + ptr, sizeof(p),
len1, STR_ASCII|STR_NOALIGN); len1, STR_ASCII|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p); (*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) { if (!(*ps)) {
return False; return false;
} }
} else { } else {
(*ps) = ""; (*ps) = "";
@@ -289,11 +289,11 @@ BOOL msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
} else { } else {
/* make sure its in the right format - be strict */ /* make sure its in the right format - be strict */
if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) {
return False; return false;
} }
if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data) if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data)
return False; return false;
*b = data_blob_talloc(mem_ctx, blob->data + ptr, len1); *b = data_blob_talloc(mem_ctx, blob->data + ptr, len1);
} }
@@ -304,7 +304,7 @@ BOOL msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
/* make sure its in the right format - be strict */ /* make sure its in the right format - be strict */
NEED_DATA(len1); NEED_DATA(len1);
if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data) if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data)
return False; return false;
*b = data_blob_talloc(mem_ctx, blob->data + head_ofs, len1); *b = data_blob_talloc(mem_ctx, blob->data + head_ofs, len1);
head_ofs += len1; head_ofs += len1;
@@ -318,18 +318,18 @@ BOOL msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
s = va_arg(ap, char *); s = va_arg(ap, char *);
if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data) if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data)
return False; return false;
head_ofs += pull_string(p, blob->data+head_ofs, sizeof(p), head_ofs += pull_string(p, blob->data+head_ofs, sizeof(p),
blob->length - head_ofs, blob->length - head_ofs,
STR_ASCII|STR_TERMINATE); STR_ASCII|STR_TERMINATE);
if (strcmp(s, p) != 0) { if (strcmp(s, p) != 0) {
return False; return false;
} }
break; break;
} }
} }
va_end(ap); va_end(ap);
return True; return true;
} }

View File

@@ -359,7 +359,7 @@ static NTSTATUS ntlmssp_server_preauth(struct gensec_ntlmssp_state *gensec_ntlms
SMB_ASSERT(gensec_ntlmssp_state->internal_chal.data SMB_ASSERT(gensec_ntlmssp_state->internal_chal.data
&& gensec_ntlmssp_state->internal_chal.length == 8); && gensec_ntlmssp_state->internal_chal.length == 8);
gensec_ntlmssp_state->doing_ntlm2 = True; gensec_ntlmssp_state->doing_ntlm2 = true;
memcpy(gensec_ntlmssp_state->crypt.ntlm2.session_nonce, gensec_ntlmssp_state->internal_chal.data, 8); memcpy(gensec_ntlmssp_state->crypt.ntlm2.session_nonce, gensec_ntlmssp_state->internal_chal.data, 8);
memcpy(&gensec_ntlmssp_state->crypt.ntlm2.session_nonce[8], gensec_ntlmssp_state->lm_resp.data, 8); memcpy(&gensec_ntlmssp_state->crypt.ntlm2.session_nonce[8], gensec_ntlmssp_state->lm_resp.data, 8);
@@ -617,7 +617,7 @@ static const uint8_t *auth_ntlmssp_get_challenge(const struct gensec_ntlmssp_sta
* *
* @return If the effective challenge used by the auth subsystem may be modified * @return If the effective challenge used by the auth subsystem may be modified
*/ */
static BOOL auth_ntlmssp_may_set_challenge(const struct gensec_ntlmssp_state *gensec_ntlmssp_state) static bool auth_ntlmssp_may_set_challenge(const struct gensec_ntlmssp_state *gensec_ntlmssp_state)
{ {
return auth_challenge_may_be_modified(gensec_ntlmssp_state->auth_context); return auth_challenge_may_be_modified(gensec_ntlmssp_state->auth_context);
} }
@@ -661,7 +661,7 @@ static NTSTATUS auth_ntlmssp_check_password(struct gensec_ntlmssp_state *gensec_
user_info->logon_parameters = MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT | MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT; user_info->logon_parameters = MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT | MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT;
user_info->flags = 0; user_info->flags = 0;
user_info->mapped_state = False; user_info->mapped_state = false;
user_info->client.account_name = gensec_ntlmssp_state->user; user_info->client.account_name = gensec_ntlmssp_state->user;
user_info->client.domain_name = gensec_ntlmssp_state->domain; user_info->client.domain_name = gensec_ntlmssp_state->domain;
user_info->workstation_name = gensec_ntlmssp_state->workstation; user_info->workstation_name = gensec_ntlmssp_state->workstation;
@@ -753,7 +753,7 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
gensec_ntlmssp_state->allow_lm_key = (lp_lanman_auth(global_loadparm) gensec_ntlmssp_state->allow_lm_key = (lp_lanman_auth(global_loadparm)
&& lp_parm_bool(global_loadparm, NULL, "ntlmssp_server", "allow_lm_key", false)); && lp_parm_bool(global_loadparm, NULL, "ntlmssp_server", "allow_lm_key", false));
gensec_ntlmssp_state->server_multiple_authentications = False; gensec_ntlmssp_state->server_multiple_authentications = false;
gensec_ntlmssp_state->neg_flags = gensec_ntlmssp_state->neg_flags =
NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_UNKNOWN_02000000; NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_UNKNOWN_02000000;

View File

@@ -65,7 +65,7 @@ static NTSTATUS ntlmssp_make_packet_signature(struct gensec_ntlmssp_state *gense
const uint8_t *data, size_t length, const uint8_t *data, size_t length,
const uint8_t *whole_pdu, size_t pdu_length, const uint8_t *whole_pdu, size_t pdu_length,
enum ntlmssp_direction direction, enum ntlmssp_direction direction,
DATA_BLOB *sig, BOOL encrypt_sig) DATA_BLOB *sig, bool encrypt_sig)
{ {
if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
@@ -142,7 +142,7 @@ _PUBLIC_ NTSTATUS gensec_ntlmssp_sign_packet(struct gensec_security *gensec_secu
return ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx, return ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx,
data, length, data, length,
whole_pdu, pdu_length, whole_pdu, pdu_length,
NTLMSSP_SEND, sig, True); NTLMSSP_SEND, sig, true);
} }
/** /**
@@ -169,7 +169,7 @@ NTSTATUS gensec_ntlmssp_check_packet(struct gensec_security *gensec_security,
nt_status = ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx, nt_status = ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx,
data, length, data, length,
whole_pdu, pdu_length, whole_pdu, pdu_length,
NTLMSSP_RECEIVE, &local_sig, True); NTLMSSP_RECEIVE, &local_sig, true);
if (!NT_STATUS_IS_OK(nt_status)) { if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("NTLMSSP packet check failed with %s\n", nt_errstr(nt_status))); DEBUG(0, ("NTLMSSP packet check failed with %s\n", nt_errstr(nt_status)));
@@ -236,7 +236,7 @@ NTSTATUS gensec_ntlmssp_seal_packet(struct gensec_security *gensec_security,
nt_status = ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx, nt_status = ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx,
data, length, data, length,
whole_pdu, pdu_length, whole_pdu, pdu_length,
NTLMSSP_SEND, sig, False); NTLMSSP_SEND, sig, false);
arcfour_crypt_sbox(gensec_ntlmssp_state->crypt.ntlm2.send_seal_arcfour_state, data, length); arcfour_crypt_sbox(gensec_ntlmssp_state->crypt.ntlm2.send_seal_arcfour_state, data, length);
if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH) { if (gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH) {
arcfour_crypt_sbox(gensec_ntlmssp_state->crypt.ntlm2.send_seal_arcfour_state, sig->data+4, 8); arcfour_crypt_sbox(gensec_ntlmssp_state->crypt.ntlm2.send_seal_arcfour_state, sig->data+4, 8);

View File

@@ -76,7 +76,7 @@ const char *domain_ref_attrs[] = {"nETBIOSName", "nCName",
bitmask. bitmask.
****************************************************************************/ ****************************************************************************/
static BOOL logon_hours_ok(struct ldb_message *msg, const char *name_for_logs) static bool logon_hours_ok(struct ldb_message *msg, const char *name_for_logs)
{ {
/* In logon hours first bit is Sunday from 12AM to 1AM */ /* In logon hours first bit is Sunday from 12AM to 1AM */
const struct ldb_val *hours; const struct ldb_val *hours;
@@ -88,12 +88,12 @@ static BOOL logon_hours_ok(struct ldb_message *msg, const char *name_for_logs)
hours = ldb_msg_find_ldb_val(msg, "logonHours"); hours = ldb_msg_find_ldb_val(msg, "logonHours");
if (!hours) { if (!hours) {
DEBUG(5,("logon_hours_ok: No hours restrictions for user %s\n", name_for_logs)); DEBUG(5,("logon_hours_ok: No hours restrictions for user %s\n", name_for_logs));
return True; return true;
} }
if (hours->length != 168/8) { if (hours->length != 168/8) {
DEBUG(5,("logon_hours_ok: malformed logon hours restrictions for user %s\n", name_for_logs)); DEBUG(5,("logon_hours_ok: malformed logon hours restrictions for user %s\n", name_for_logs));
return True; return true;
} }
lasttime = time(NULL); lasttime = time(NULL);
@@ -101,7 +101,7 @@ static BOOL logon_hours_ok(struct ldb_message *msg, const char *name_for_logs)
if (!utctime) { if (!utctime) {
DEBUG(1, ("logon_hours_ok: failed to get gmtime. Failing logon for user %s\n", DEBUG(1, ("logon_hours_ok: failed to get gmtime. Failing logon for user %s\n",
name_for_logs)); name_for_logs));
return False; return false;
} }
/* find the corresponding byte and bit */ /* find the corresponding byte and bit */
@@ -122,14 +122,14 @@ static BOOL logon_hours_ok(struct ldb_message *msg, const char *name_for_logs)
DEBUG(1, ("logon_hours_ok: Account for user %s not allowed to " DEBUG(1, ("logon_hours_ok: Account for user %s not allowed to "
"logon at this time (%s).\n", "logon at this time (%s).\n",
name_for_logs, asct )); name_for_logs, asct ));
return False; return false;
} }
asct = asctime(utctime); asct = asctime(utctime);
DEBUG(5,("logon_hours_ok: user %s allowed to logon at this time (%s)\n", DEBUG(5,("logon_hours_ok: user %s allowed to logon at this time (%s)\n",
name_for_logs, asct ? asct : "UNKNOWN TIME" )); name_for_logs, asct ? asct : "UNKNOWN TIME" ));
return True; return true;
} }
/**************************************************************************** /****************************************************************************
@@ -205,7 +205,7 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx,
/* Test workstation. Workstation list is comma separated. */ /* Test workstation. Workstation list is comma separated. */
if (logon_workstation && workstation_list && *workstation_list) { if (logon_workstation && workstation_list && *workstation_list) {
BOOL invalid_ws = True; bool invalid_ws = true;
int i; int i;
const char **workstations = str_list_make(mem_ctx, workstation_list, ","); const char **workstations = str_list_make(mem_ctx, workstation_list, ",");
@@ -214,7 +214,7 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx,
workstations[i], logon_workstation)); workstations[i], logon_workstation));
if (strequal(workstations[i], logon_workstation)) { if (strequal(workstations[i], logon_workstation)) {
invalid_ws = False; invalid_ws = false;
break; break;
} }
} }
@@ -371,7 +371,7 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_conte
server_info->user_session_key = user_sess_key; server_info->user_session_key = user_sess_key;
server_info->lm_session_key = lm_sess_key; server_info->lm_session_key = lm_sess_key;
server_info->authenticated = True; server_info->authenticated = true;
*_server_info = server_info; *_server_info = server_info;