r13020: Prevent cli_krb5_get_ticket of getting into an infite loop. This whole
authorGünther Deschner <gd@samba.org>
Wed, 18 Jan 2006 22:40:00 +0000 (22:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:06:10 +0000 (11:06 -0500)
area of code needs to be reworked later on.

Guenther
(This used to be commit 088abfcdd1d6b28409d4b2917bc2aeb5d371f675)

source3/libsmb/clikrb5.c

index 6e87f73df1458cf0a30088fc81ffc84d1ffeb44a..e0dcefeb1d7e682f94f5e5a191b5fd0b50c6a529 100644 (file)
@@ -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",