summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-01-18 22:40:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:06:10 -0500
commit8a30b3226d97bd43549971a4708afa79432b6d25 (patch)
tree63ed12aacf197297143f91295399332954e7b434
parent2fd79d8bfc9e8855b2959a4bfa0ff9eb691399f8 (diff)
downloadsamba-8a30b3226d97bd43549971a4708afa79432b6d25.tar.gz
samba-8a30b3226d97bd43549971a4708afa79432b6d25.tar.bz2
samba-8a30b3226d97bd43549971a4708afa79432b6d25.zip
r13020: Prevent cli_krb5_get_ticket of getting into an infite loop. This whole
area of code needs to be reworked later on. Guenther (This used to be commit 088abfcdd1d6b28409d4b2917bc2aeb5d371f675)
-rw-r--r--source3/libsmb/clikrb5.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index 6e87f73df1..e0dcefeb1d 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -456,6 +456,7 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context,
krb5_creds creds;
krb5_data in_data;
BOOL creds_ready = False;
+ int i = 0, maxtries = 3;
retval = krb5_parse_name(context, principal, &server);
if (retval) {
@@ -479,7 +480,7 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context,
goto cleanup_creds;
}
- while(!creds_ready) {
+ while (!creds_ready && (i < maxtries)) {
if ((retval = krb5_get_credentials(context, 0, ccache,
&creds, &credsp))) {
DEBUG(1,("ads_krb5_mk_req: krb5_get_credentials failed for %s (%s)\n",
@@ -497,6 +498,8 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context,
if (!ads_cleanup_expired_creds(context, ccache, credsp))
creds_ready = True;
+
+ i++;
}
DEBUG(10,("ads_krb5_mk_req: Ticket (%s) in ccache (%s) is valid until: (%s - %u)\n",