diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-10-09 23:27:44 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-10-11 13:41:36 +1100 |
commit | 534355fecf5a14a36ec5a3d643bcf2140df2da4e (patch) | |
tree | 3780d501fc56cbedee28985ccc962d657f87ae98 | |
parent | fe02752ed6493efb7af28faa3d64d9fd7895d6f1 (diff) | |
download | samba-534355fecf5a14a36ec5a3d643bcf2140df2da4e.tar.gz samba-534355fecf5a14a36ec5a3d643bcf2140df2da4e.tar.bz2 samba-534355fecf5a14a36ec5a3d643bcf2140df2da4e.zip |
auth/credentials Declare remaining functions are public interfaces and put into credentials.h
This is in preperation for this file being used by s3, and recognises that these are all
reasonable, public interfaces but were not declared as such in the past.
Andrew Bartlett
-rw-r--r-- | auth/credentials/credentials.c | 17 | ||||
-rw-r--r-- | auth/credentials/credentials.h | 37 |
2 files changed, 45 insertions, 9 deletions
diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index 83e90344bf..ee60220ec7 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -24,9 +24,8 @@ #include "includes.h" #include "librpc/gen_ndr/samr.h" /* for struct samrPassword */ #include "auth/credentials/credentials.h" -#include "auth/credentials/credentials_proto.h" #include "libcli/auth/libcli_auth.h" -#include "lib/events/events.h" +#include "tevent.h" #include "param/param.h" #include "system/filesys.h" @@ -200,7 +199,7 @@ _PUBLIC_ bool cli_credentials_set_username(struct cli_credentials *cred, return false; } -bool cli_credentials_set_username_callback(struct cli_credentials *cred, +_PUBLIC_ bool cli_credentials_set_username_callback(struct cli_credentials *cred, const char *(*username_cb) (struct cli_credentials *)) { if (cred->username_obtained < CRED_CALLBACK) { @@ -237,7 +236,7 @@ _PUBLIC_ const char *cli_credentials_get_bind_dn(struct cli_credentials *cred) * @retval The username set on this context. * @note Return value will never be NULL except by programmer error. */ -const char *cli_credentials_get_principal_and_obtained(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, enum credentials_obtained *obtained) +_PUBLIC_ const char *cli_credentials_get_principal_and_obtained(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, enum credentials_obtained *obtained) { if (cred->machine_account_pending) { cli_credentials_set_machine_account(cred, @@ -283,7 +282,7 @@ _PUBLIC_ const char *cli_credentials_get_principal(struct cli_credentials *cred, return cli_credentials_get_principal_and_obtained(cred, mem_ctx, &obtained); } -bool cli_credentials_set_principal(struct cli_credentials *cred, +_PUBLIC_ bool cli_credentials_set_principal(struct cli_credentials *cred, const char *val, enum credentials_obtained obtained) { @@ -299,7 +298,7 @@ bool cli_credentials_set_principal(struct cli_credentials *cred, /* 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, +_PUBLIC_ bool cli_credentials_set_principal_callback(struct cli_credentials *cred, const char *(*principal_cb) (struct cli_credentials *)) { if (cred->principal_obtained < CRED_CALLBACK) { @@ -402,7 +401,7 @@ _PUBLIC_ bool cli_credentials_set_password_callback(struct cli_credentials *cred * @param cred credentials context * @retval If set, the cleartext password, otherwise NULL */ -const char *cli_credentials_get_old_password(struct cli_credentials *cred) +_PUBLIC_ const char *cli_credentials_get_old_password(struct cli_credentials *cred) { if (cred->machine_account_pending) { cli_credentials_set_machine_account(cred, @@ -412,7 +411,7 @@ 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, +_PUBLIC_ bool cli_credentials_set_old_password(struct cli_credentials *cred, const char *val, enum credentials_obtained obtained) { @@ -748,7 +747,7 @@ _PUBLIC_ void cli_credentials_set_netlogon_creds(struct cli_credentials *cred, * Return attached NETLOGON credentials */ -struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred) +_PUBLIC_ struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred) { return cred->netlogon_creds; } diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h index f8fa2f864b..0bcfd61264 100644 --- a/auth/credentials/credentials.h +++ b/auth/credentials/credentials.h @@ -27,6 +27,7 @@ struct ccache_container; struct tevent_context; +struct netlogon_creds_CredentialState; /* In order of priority */ enum credentials_obtained { @@ -296,5 +297,41 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, char **error_string); int cli_credentials_get_kvno(struct cli_credentials *cred); +bool cli_credentials_set_username_callback(struct cli_credentials *cred, + const char *(*username_cb) (struct cli_credentials *)); + +/** + * Obtain the client principal for this credentials context. + * @param cred credentials context + * @retval The username set on this context. + * @note Return value will never be NULL except by programmer error. + */ +const 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, + enum credentials_obtained obtained); +bool cli_credentials_set_principal_callback(struct cli_credentials *cred, + const char *(*principal_cb) (struct cli_credentials *)); + +/** + * Obtain the 'old' password for this credentials context (used for join accounts). + * @param cred credentials context + * @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, + 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_realm_callback(struct cli_credentials *cred, + const char *(*realm_cb) (struct cli_credentials *)); +bool cli_credentials_set_workstation_callback(struct cli_credentials *cred, + const char *(*workstation_cb) (struct cli_credentials *)); + +/** + * Return attached NETLOGON credentials + */ +struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred); #endif /* __CREDENTIALS_H__ */ |