summaryrefslogtreecommitdiff
path: root/source4/auth/credentials/credentials.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-03 14:15:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:34 -0500
commit557c98bd5f4e5268d4793d51037f59ef3482fe8c (patch)
treecfc61eb2cc2891440f651a8622a397698fd8e53e /source4/auth/credentials/credentials.c
parentbec9dad2940b4da9187469992436c2bfd67e0ac0 (diff)
downloadsamba-557c98bd5f4e5268d4793d51037f59ef3482fe8c.tar.gz
samba-557c98bd5f4e5268d4793d51037f59ef3482fe8c.tar.bz2
samba-557c98bd5f4e5268d4793d51037f59ef3482fe8c.zip
r15414: Support retrying different username/password combinations
(This used to be commit 5de894fb8bac8efa5bff004dbfc2e8b386d4003b)
Diffstat (limited to 'source4/auth/credentials/credentials.c')
-rw-r--r--source4/auth/credentials/credentials.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c
index ee90c8228a..66b6c120cf 100644
--- a/source4/auth/credentials/credentials.c
+++ b/source4/auth/credentials/credentials.c
@@ -639,3 +639,24 @@ BOOL cli_credentials_is_anonymous(struct cli_credentials *cred)
return False;
}
+
+/**
+ * Mark the current password for a credentials struct as wrong. This will
+ * cause the password to be prompted again (if a callback is set).
+ *
+ * This will decremebt the number of times the password can be tried.
+ *
+ * @retval whether the credentials struct is finished
+ */
+BOOL cli_credentials_wrong_password(struct cli_credentials *cred)
+{
+ if (cred->password_obtained != CRED_CALLBACK_RESULT) {
+ return False;
+ }
+
+ cred->password_obtained = CRED_CALLBACK;
+
+ cred->tries--;
+
+ return (cred->tries > 0);
+}