diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h index e9d8b8a44b1..023386cd520 100644 --- a/auth/credentials/credentials.h +++ b/auth/credentials/credentials.h @@ -1,4 +1,4 @@ -/* +/* samba -- Unix SMB/CIFS implementation. Client credentials structure @@ -10,12 +10,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -42,7 +42,7 @@ enum smb_signing_setting; enum smb_encryption_setting; /* In order of priority */ -enum credentials_obtained { +enum credentials_obtained { CRED_UNINITIALISED = 0, /* We don't even have a guess yet */ CRED_SMB_CONF, /* Current value should be used, which comes from smb.conf */ CRED_CALLBACK, /* Callback should be used to obtain value */ @@ -81,8 +81,8 @@ enum credentials_krb_forwardable { #define CLI_CRED_CLEAR_AUTH 0x10 /* TODO: Push cleartext auth with this flag */ const char *cli_credentials_get_workstation(struct cli_credentials *cred); -bool cli_credentials_set_workstation(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_workstation(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); bool cli_credentials_is_anonymous(struct cli_credentials *cred); struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx); @@ -93,29 +93,29 @@ bool cli_credentials_wrong_password(struct cli_credentials *cred); const char *cli_credentials_get_password(struct cli_credentials *cred); const char *cli_credentials_get_password_and_obtained(struct cli_credentials *cred, enum credentials_obtained *obtained); -void cli_credentials_get_ntlm_username_domain(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, - const char **username, +void cli_credentials_get_ntlm_username_domain(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, + const char **username, const char **domain); -NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, +NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, int *flags, DATA_BLOB challenge, const NTTIME *server_timestamp, DATA_BLOB target_info, - DATA_BLOB *_lm_response, DATA_BLOB *_nt_response, + DATA_BLOB *_lm_response, DATA_BLOB *_nt_response, DATA_BLOB *_lm_session_key, DATA_BLOB *_session_key); const char *cli_credentials_get_realm(struct cli_credentials *cred); const char *cli_credentials_get_username(struct cli_credentials *cred); const char *cli_credentials_get_username_and_obtained(struct cli_credentials *cred, enum credentials_obtained *obtained); -int cli_credentials_get_krb5_context(struct cli_credentials *cred, +int cli_credentials_get_krb5_context(struct cli_credentials *cred, struct loadparm_context *lp_ctx, struct smb_krb5_context **smb_krb5_context); -int cli_credentials_get_ccache(struct cli_credentials *cred, +int cli_credentials_get_ccache(struct cli_credentials *cred, struct tevent_context *event_ctx, struct loadparm_context *lp_ctx, struct ccache_container **ccc, const char **error_string); -int cli_credentials_get_named_ccache(struct cli_credentials *cred, +int cli_credentials_get_named_ccache(struct cli_credentials *cred, struct tevent_context *event_ctx, struct loadparm_context *lp_ctx, char *ccache_name, @@ -123,7 +123,7 @@ int cli_credentials_get_named_ccache(struct cli_credentials *cred, bool cli_credentials_failed_kerberos_login(struct cli_credentials *cred, const char *principal, unsigned int *count); -int cli_credentials_get_keytab(struct cli_credentials *cred, +int cli_credentials_get_keytab(struct cli_credentials *cred, struct loadparm_context *lp_ctx, struct keytab_container **_ktc); const char *cli_credentials_get_domain(struct cli_credentials *cred); @@ -133,10 +133,10 @@ void cli_credentials_set_machine_account_pending(struct cli_credentials *cred, bool cli_credentials_set_conf(struct cli_credentials *cred, struct loadparm_context *lp_ctx); char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_CTX *mem_ctx); -int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, +int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, struct loadparm_context *lp_ctx, struct gssapi_creds_container **_gcc); -int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, +int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, struct tevent_context *event_ctx, struct loadparm_context *lp_ctx, struct gssapi_creds_container **_gcc, @@ -148,22 +148,22 @@ bool cli_credentials_set_kerberos_state(struct cli_credentials *creds, enum credentials_obtained obtained); void cli_credentials_set_krb_forwardable(struct cli_credentials *creds, enum credentials_krb_forwardable krb_forwardable); -bool cli_credentials_set_domain(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_domain(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); bool cli_credentials_set_domain_callback(struct cli_credentials *cred, const char *(*domain_cb) (struct cli_credentials *)); -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); bool cli_credentials_set_username_callback(struct cli_credentials *cred, const char *(*username_cb) (struct cli_credentials *)); -bool cli_credentials_set_principal(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_principal(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); bool cli_credentials_set_principal_callback(struct cli_credentials *cred, const char *(*principal_cb) (struct cli_credentials *)); -bool cli_credentials_set_password(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_password(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); struct cli_credentials *cli_credentials_init_anon(TALLOC_CTX *mem_ctx); void cli_credentials_parse_string(struct cli_credentials *credentials, const char *data, enum credentials_obtained obtained); @@ -171,8 +171,8 @@ struct samr_Password *cli_credentials_get_nt_hash(struct cli_credentials *cred, TALLOC_CTX *mem_ctx); struct samr_Password *cli_credentials_get_old_nt_hash(struct cli_credentials *cred, TALLOC_CTX *mem_ctx); -bool cli_credentials_set_realm(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_realm(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); void cli_credentials_set_secure_channel_type(struct cli_credentials *cred, enum netr_SchannelType secure_channel_type); @@ -181,7 +181,7 @@ void cli_credentials_set_password_last_changed_time(struct cli_credentials *cred void cli_credentials_set_netlogon_creds( struct cli_credentials *cred, const struct netlogon_creds_CredentialState *netlogon_creds); -NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, +NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, struct smb_krb5_context *smb_krb5_context); NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred, struct loadparm_context *lp_ctx, @@ -206,7 +206,7 @@ NTSTATUS cli_credentials_set_machine_account_db_ctx(struct cli_credentials *cred bool cli_credentials_authentication_requested(struct cli_credentials *cred); bool cli_credentials_guess(struct cli_credentials *cred, struct loadparm_context *lp_ctx); -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 *cli_credentials_get_bind_dn(struct cli_credentials *cred); bool cli_credentials_parse_file(struct cli_credentials *cred, const char *file, enum credentials_obtained obtained); @@ -225,7 +225,7 @@ bool cli_credentials_set_old_utf16_password(struct cli_credentials *cred, void cli_credentials_set_password_will_be_nt_hash(struct cli_credentials *cred, bool val); 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); bool cli_credentials_set_old_nt_hash(struct cli_credentials *cred, const struct samr_Password *nt_hash); @@ -235,23 +235,23 @@ bool cli_credentials_set_ntlm_response(struct cli_credentials *cred, const DATA_BLOB *nt_response, const DATA_BLOB *nt_session_key, enum credentials_obtained obtained); -int cli_credentials_set_keytab_name(struct cli_credentials *cred, +int cli_credentials_set_keytab_name(struct cli_credentials *cred, struct loadparm_context *lp_ctx, - const char *keytab_name, + const char *keytab_name, enum credentials_obtained obtained); bool cli_credentials_set_gensec_features(struct cli_credentials *creds, uint32_t gensec_features, enum credentials_obtained obtained); uint32_t cli_credentials_get_gensec_features(struct cli_credentials *creds); -int cli_credentials_set_ccache(struct cli_credentials *cred, +int cli_credentials_set_ccache(struct cli_credentials *cred, struct loadparm_context *lp_ctx, - const char *name, + const char *name, enum credentials_obtained obtained, const char **error_string); bool cli_credentials_parse_password_file(struct cli_credentials *credentials, const char *file, enum credentials_obtained obtained); -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); -void cli_credentials_invalidate_ccache(struct cli_credentials *cred, +void cli_credentials_invalidate_ccache(struct cli_credentials *cred, enum credentials_obtained obtained); void cli_credentials_set_salt_principal(struct cli_credentials *cred, const char *principal); void cli_credentials_set_impersonate_principal(struct cli_credentials *cred, @@ -265,11 +265,11 @@ const char *cli_credentials_get_target_service(struct cli_credentials *cred); enum credentials_use_kerberos cli_credentials_get_kerberos_state(struct cli_credentials *creds); const char *cli_credentials_get_forced_sasl_mech(struct cli_credentials *cred); enum credentials_krb_forwardable cli_credentials_get_krb_forwardable(struct cli_credentials *creds); -NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, +NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, struct loadparm_context *lp_ctx, struct ldb_context *ldb, const char *base, - const char *filter, + const char *filter, char **error_string); int cli_credentials_get_kvno(struct cli_credentials *cred); @@ -283,8 +283,8 @@ bool cli_credentials_set_username_callback(struct cli_credentials *cred, * @note Return value will never be NULL except by programmer error. */ char *cli_credentials_get_principal_and_obtained(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, enum credentials_obtained *obtained); -bool cli_credentials_set_principal(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_principal(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); bool cli_credentials_set_principal_callback(struct cli_credentials *cred, const char *(*principal_cb) (struct cli_credentials *)); @@ -295,8 +295,8 @@ bool cli_credentials_set_principal_callback(struct cli_credentials *cred, * @retval If set, the cleartext password, otherwise NULL */ const char *cli_credentials_get_old_password(struct cli_credentials *cred); -bool cli_credentials_set_old_password(struct cli_credentials *cred, - const char *val, +bool cli_credentials_set_old_password(struct cli_credentials *cred, + const char *val, enum credentials_obtained obtained); bool cli_credentials_set_domain_callback(struct cli_credentials *cred, const char *(*domain_cb) (struct cli_credentials *)); @@ -336,7 +336,7 @@ bool cli_credentials_set_cmdline_callbacks(struct cli_credentials *cred); void cli_credentials_dump(struct cli_credentials *creds); /** - * Return attached NETLOGON credentials + * Return attached NETLOGON credentials */ struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred);