diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-10-06 22:16:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:07:54 -0500 |
commit | 3642f3b40d755209a843745f160a9d7962a6deca (patch) | |
tree | 766c876eff39205b11c86a6cafd1ecd06b4befbc /source4/auth/credentials | |
parent | 0c56f8dac31c51a42dedf2a1da9fd76896855b19 (diff) | |
download | samba-3642f3b40d755209a843745f160a9d7962a6deca.tar.gz samba-3642f3b40d755209a843745f160a9d7962a6deca.tar.bz2 samba-3642f3b40d755209a843745f160a9d7962a6deca.zip |
r25552: Convert to standard bool type.
(This used to be commit b8d6b82f1248d36a0aa91a1c58d06b4f7c66d245)
Diffstat (limited to 'source4/auth/credentials')
-rw-r--r-- | source4/auth/credentials/credentials.c | 142 | ||||
-rw-r--r-- | source4/auth/credentials/credentials_files.c | 32 |
2 files changed, 87 insertions, 87 deletions
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c index e88e05cfb0..d6c0bbc0ba 100644 --- a/source4/auth/credentials/credentials.c +++ b/source4/auth/credentials/credentials.c @@ -41,7 +41,7 @@ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx) } cred->netlogon_creds = NULL; - cred->machine_account_pending = False; + cred->machine_account_pending = false; cred->workstation_obtained = CRED_UNINITIALISED; cred->username_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->smb_krb5_context = NULL; cred->salt_principal = NULL; - cred->machine_account = False; + cred->machine_account = false; cred->bind_dn = NULL; cred->tries = 3; - cred->callback_running = False; + cred->callback_running = false; cred->ev = NULL; 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 && !cred->callback_running) { - cred->callback_running = True; + cred->callback_running = true; cred->username = cred->username_cb(cred); - cred->callback_running = False; + cred->callback_running = false; cred->username_obtained = CRED_SPECIFIED; 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; } -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) { if (obtained >= cred->username_obtained) { cred->username = talloc_strdup(cred, val); cred->username_obtained = 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 *)) { if (cred->username_obtained < CRED_CALLBACK) { cred->username_cb = username_cb; 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) { 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 && !cred->callback_running) { - cred->callback_running = True; + cred->callback_running = true; cred->principal = cred->principal_cb(cred); - cred->callback_running = False; + cred->callback_running = false; cred->principal_obtained = CRED_SPECIFIED; 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); } -BOOL cli_credentials_set_principal(struct cli_credentials *cred, +bool cli_credentials_set_principal(struct cli_credentials *cred, const char *val, 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_obtained = 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, * 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 *)) { if (cred->principal_obtained < CRED_CALLBACK) { cred->principal_cb = principal_cb; 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 * function to determine if authentication has been explicitly * requested */ -BOOL cli_credentials_authentication_requested(struct cli_credentials *cred) +bool cli_credentials_authentication_requested(struct cli_credentials *cred) { if (cred->bind_dn) { - return True; + return true; } if (cli_credentials_is_anonymous(cred)){ - return False; + return false; } if (cred->principal_obtained >= CRED_SPECIFIED) { - return True; + return true; } if (cred->username_obtained >= CRED_SPECIFIED) { - return True; + return true; } 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 && !cred->callback_running) { - cred->callback_running = True; + cred->callback_running = true; cred->password = cred->password_cb(cred); - cred->callback_running = False; + cred->callback_running = false; cred->password_obtained = CRED_CALLBACK_RESULT; 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 * 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, 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); 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 *)) { if (cred->password_obtained < CRED_CALLBACK) { cred->password_cb = password_cb; cred->password_obtained = CRED_CALLBACK; 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; } -BOOL cli_credentials_set_old_password(struct cli_credentials *cred, +bool cli_credentials_set_old_password(struct cli_credentials *cred, const char *val, enum credentials_obtained obtained) { 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, enum credentials_obtained obtained) { @@ -387,10 +387,10 @@ BOOL cli_credentials_set_nt_hash(struct cli_credentials *cred, } else { 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 && !cred->callback_running) { - cred->callback_running = True; + cred->callback_running = true; cred->domain = cred->domain_cb(cred); - cred->callback_running = False; + cred->callback_running = false; cred->domain_obtained = CRED_SPECIFIED; 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, 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_obtained = 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 *)) { if (cred->domain_obtained < CRED_CALLBACK) { cred->domain_cb = domain_cb; 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 && !cred->callback_running) { - cred->callback_running = True; + cred->callback_running = true; cred->realm = cred->realm_cb(cred); - cred->callback_running = False; + cred->callback_running = false; cred->realm_obtained = CRED_SPECIFIED; 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 * 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, 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_obtained = 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 *)) { if (cred->realm_obtained < CRED_CALLBACK) { cred->realm_cb = realm_cb; 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 && !cred->callback_running) { - cred->callback_running = True; + cred->callback_running = true; cred->workstation = cred->workstation_cb(cred); - cred->callback_running = False; + cred->callback_running = false; cred->workstation_obtained = CRED_SPECIFIED; } return cred->workstation; } -BOOL cli_credentials_set_workstation(struct cli_credentials *cred, +bool cli_credentials_set_workstation(struct cli_credentials *cred, const char *val, enum credentials_obtained obtained) { if (obtained >= cred->workstation_obtained) { cred->workstation = talloc_strdup(cred, val); 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 *)) { if (cred->workstation_obtained < CRED_CALLBACK) { cred->workstation_cb = workstation_cb; 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 - * @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; @@ -739,10 +739,10 @@ BOOL cli_credentials_is_anonymous(struct cli_credentials *cred) * here - anonymous is "", not NULL, which is 'never specified, * never guessed', ie programmer bug */ 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 */ -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) { - return False; + return false; } cred->password_obtained = CRED_CALLBACK; diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c index 2aefb7c52f..1708fa5841 100644 --- a/source4/auth/credentials/credentials_files.c +++ b/source4/auth/credentials/credentials_files.c @@ -39,7 +39,7 @@ * @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) { char *p; @@ -61,18 +61,18 @@ BOOL cli_credentials_parse_password_fd(struct cli_credentials *credentials, break; } else { fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n"); - return False; + return false; } default: fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, strerror(errno)); - return False; + return false; } } 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 */ -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); - BOOL ret; + bool ret; if (fd < 0) { fprintf(stderr, "Error opening password file %s: %s\n", file, strerror(errno)); - return False; + return false; } 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 */ -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; 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 */ d_printf("ERROR: Unable to open credentials file!\n"); - return False; + return false; } 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); - return True; + return true; } @@ -203,10 +203,10 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, const char *keytab; /* 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 */ - cred->machine_account = True; + cred->machine_account = true; 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 * account here, so we don't want the 'pending' flag around * any more */ - cred->machine_account_pending = False; + cred->machine_account_pending = false; filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER, cli_credentials_get_domain(cred)); 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 * account here, so we don't want the 'pending' flag around * any more */ - cred->machine_account_pending = False; + cred->machine_account_pending = false; filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH, cli_credentials_get_realm(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 * account here, so we don't want the 'pending' flag around * any more */ - cred->machine_account_pending = False; + cred->machine_account_pending = false; filter = talloc_asprintf(cred, SECRETS_PRINCIPAL_SEARCH, cli_credentials_get_realm(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) { - cred->machine_account_pending = True; + cred->machine_account_pending = true; } |