summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/credentials/credentials.c30
-rw-r--r--source4/auth/credentials/credentials.h3
2 files changed, 27 insertions, 6 deletions
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c
index 28ba5eb32d..1ffc27dab6 100644
--- a/source4/auth/credentials/credentials.c
+++ b/source4/auth/credentials/credentials.c
@@ -89,8 +89,11 @@ const char *cli_credentials_get_username(struct cli_credentials *cred)
cli_credentials_set_machine_account(cred);
}
- if (cred->username_obtained == CRED_CALLBACK) {
+ if (cred->username_obtained == CRED_CALLBACK &&
+ !cred->callback_running) {
+ cred->callback_running = True;
cred->username = cred->username_cb(cred);
+ cred->callback_running = False;
cred->username_obtained = CRED_SPECIFIED;
}
@@ -152,8 +155,11 @@ const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_C
cli_credentials_set_machine_account(cred);
}
- if (cred->principal_obtained == CRED_CALLBACK) {
+ if (cred->principal_obtained == CRED_CALLBACK &&
+ !cred->callback_running) {
+ cred->callback_running = False;
cred->principal = cred->principal_cb(cred);
+ cred->callback_running = True;
cred->principal_obtained = CRED_SPECIFIED;
}
@@ -233,8 +239,11 @@ const char *cli_credentials_get_password(struct cli_credentials *cred)
cli_credentials_set_machine_account(cred);
}
- if (cred->password_obtained == CRED_CALLBACK) {
+ if (cred->password_obtained == CRED_CALLBACK &&
+ !cred->callback_running) {
+ cred->callback_running = False;
cred->password = cred->password_cb(cred);
+ cred->callback_running = True;
cred->password_obtained = CRED_CALLBACK_RESULT;
}
@@ -347,8 +356,11 @@ const char *cli_credentials_get_domain(struct cli_credentials *cred)
cli_credentials_set_machine_account(cred);
}
- if (cred->domain_obtained == CRED_CALLBACK) {
+ if (cred->domain_obtained == CRED_CALLBACK &&
+ !cred->callback_running) {
+ cred->callback_running = True;
cred->domain = cred->domain_cb(cred);
+ cred->callback_running = False;
cred->domain_obtained = CRED_SPECIFIED;
}
@@ -396,8 +408,11 @@ const char *cli_credentials_get_realm(struct cli_credentials *cred)
cli_credentials_set_machine_account(cred);
}
- if (cred->realm_obtained == CRED_CALLBACK) {
+ if (cred->realm_obtained == CRED_CALLBACK &&
+ !cred->callback_running) {
+ cred->callback_running = True;
cred->realm = cred->realm_cb(cred);
+ cred->callback_running = False;
cred->realm_obtained = CRED_SPECIFIED;
}
@@ -442,8 +457,11 @@ BOOL cli_credentials_set_realm_callback(struct cli_credentials *cred,
*/
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 = True;
cred->workstation = cred->workstation_cb(cred);
+ cred->callback_running = False;
cred->workstation_obtained = CRED_SPECIFIED;
}
diff --git a/source4/auth/credentials/credentials.h b/source4/auth/credentials/credentials.h
index c0fec45b6f..5e739b4278 100644
--- a/source4/auth/credentials/credentials.h
+++ b/source4/auth/credentials/credentials.h
@@ -108,6 +108,9 @@ struct cli_credentials {
/* Number of retries left before bailing out */
int tries;
+
+ /* Whether any callback is currently running */
+ BOOL callback_running;
};
#include "auth/credentials/credentials_proto.h"