svn commit: samba r15414 - in branches/SAMBA_4_0/source/auth/credentials: .

jelmer at samba.org jelmer at samba.org
Wed May 3 14:15:32 GMT 2006


Author: jelmer
Date: 2006-05-03 14:15:31 +0000 (Wed, 03 May 2006)
New Revision: 15414

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15414

Log:
Support retrying different username/password combinations

Modified:
   branches/SAMBA_4_0/source/auth/credentials/credentials.c
   branches/SAMBA_4_0/source/auth/credentials/credentials.h


Changeset:
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials.c
===================================================================
--- branches/SAMBA_4_0/source/auth/credentials/credentials.c	2006-05-03 11:52:20 UTC (rev 15413)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials.c	2006-05-03 14:15:31 UTC (rev 15414)
@@ -639,3 +639,24 @@
 
 	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);
+}

Modified: branches/SAMBA_4_0/source/auth/credentials/credentials.h
===================================================================
--- branches/SAMBA_4_0/source/auth/credentials/credentials.h	2006-05-03 11:52:20 UTC (rev 15413)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials.h	2006-05-03 14:15:31 UTC (rev 15414)
@@ -3,7 +3,7 @@
 
    Client credentials structure
 
-   Copyright (C) Jelmer Vernooij 2004-2005
+   Copyright (C) Jelmer Vernooij 2004-2006
    Copyright (C) Andrew Bartlett <abartlet at samba.org> 2005
 
    This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@
 	CRED_GUESS_ENV,	         /* Current value should be used, which was guessed */
 	CRED_CALLBACK, 		 /* Callback should be used to obtain value */
 	CRED_GUESS_FILE,	 /* A guess from a file (or file pointed at in env variable) */
+	CRED_CALLBACK_RESULT,    /* Value was obtained from a callback */
 	CRED_SPECIFIED		 /* Was explicitly specified on the command-line */
 };
 
@@ -104,6 +105,9 @@
 
 	/* Should we be trying to use kerberos? */
 	enum credentials_use_kerberos use_kerberos;
+
+	/* Number of retries left before bailing out */
+	int tries;
 };
 
 #include "auth/credentials/credentials_proto.h"



More information about the samba-cvs mailing list