summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-03 20:56:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:35 -0500
commit086c9cc5f4a9145ee93060db2eebb3badc325e44 (patch)
tree2ad27a4a77f0af14168e21c5314de93d26853952 /source4/auth
parentb2f8c9b82d1d96bd49d314a60191b7a62ffc52ca (diff)
downloadsamba-086c9cc5f4a9145ee93060db2eebb3badc325e44.tar.gz
samba-086c9cc5f4a9145ee93060db2eebb3badc325e44.tar.bz2
samba-086c9cc5f4a9145ee93060db2eebb3badc325e44.zip
r15422: Fix issues with functions being called recursively in the credentials
callback code. (This used to be commit edf0701e877592695bd69124e528338c27f24efd)
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"