@@ -139,7 +139,7 @@ def _display_status(unsigned int error_code, bint is_major_code,
139139 whether or not to call again for further messages
140140
141141 Raises:
142- GSSError
142+ ValueError
143143 """
144144
145145 cdef int status_type
@@ -165,13 +165,16 @@ def _display_status(unsigned int error_code, bint is_major_code,
165165
166166 if maj_stat == GSS_S_COMPLETE:
167167 call_again = bool (msg_ctx_out)
168-
169168 msg_out = msg_buff.value[:msg_buff.length]
170169 gss_release_buffer(& min_stat, & msg_buff)
171170 return (msg_out, msg_ctx_out, call_again)
172171 else :
173- # NB(directxman12): this is highly unlikely to cause a recursive loop
174- raise GSSError(maj_stat, min_stat)
172+ # This hides whatever error gss_display_status is complaining about,
173+ # but obviates infinite recursion into stack exhaustion. The
174+ # exception raised here is handled by get_all_statuses(), which prints
175+ # the code.
176+ raise ValueError (" gss_display_status call returned failure "
177+ " (major {0}, minor {1})." .format(maj_stat, min_stat))
175178
176179
177180class GSSErrorRegistry (type ):
@@ -294,18 +297,17 @@ class GSSError(Exception, metaclass=GSSErrorRegistry):
294297 try :
295298 msg, ctx, cont = _display_status(code, is_maj)
296299 res.append(msg.decode(msg_encoding))
297- except GSSError :
298- res.append(u ' issue decoding code: {0 }' .format(code))
300+ except ValueError as e :
301+ res.append(u ' {0} Decoding code: {1 }' .format(e, code))
299302 cont = False
300303
301304 while cont:
302305 try :
303306 msg, ctx, cont = _display_status(code, is_maj,
304307 message_context = ctx)
305308 res.append(msg.decode(msg_encoding))
306- except GSSError:
307- res.append(u ' issue decoding '
308- u ' code: {0}' .format(code))
309+ except ValueError :
310+ res.append(u ' {0} Decoding code: {1}' .format(e, code))
309311 cont = False
310312
311313 return res
0 commit comments