@@ -139,7 +139,7 @@ def _display_status(unsigned int error_code, bint is_major_code,
139
139
whether or not to call again for further messages
140
140
141
141
Raises:
142
- GSSError
142
+ ValueError
143
143
"""
144
144
145
145
cdef int status_type
@@ -165,13 +165,15 @@ def _display_status(unsigned int error_code, bint is_major_code,
165
165
166
166
if maj_stat == GSS_S_COMPLETE:
167
167
call_again = bool (msg_ctx_out)
168
-
169
168
msg_out = msg_buff.value[:msg_buff.length]
170
169
gss_release_buffer(& min_stat, & msg_buff)
171
170
return (msg_out, msg_ctx_out, call_again)
172
171
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." )
175
177
176
178
177
179
class GSSErrorRegistry (type ):
@@ -294,18 +296,17 @@ class GSSError(Exception, metaclass=GSSErrorRegistry):
294
296
try :
295
297
msg, ctx, cont = _display_status(code, is_maj)
296
298
res.append(msg.decode(msg_encoding))
297
- except GSSError :
298
- res.append(u ' issue decoding code: {0 }' .format(code))
299
+ except ValueError as e :
300
+ res.append(u ' {0} Decoding code: {1 }' .format(e, code))
299
301
cont = False
300
302
301
303
while cont:
302
304
try :
303
305
msg, ctx, cont = _display_status(code, is_maj,
304
306
message_context = ctx)
305
307
res.append(msg.decode(msg_encoding))
306
- except GSSError:
307
- res.append(u ' issue decoding '
308
- u ' code: {0}' .format(code))
308
+ except ValueError :
309
+ res.append(u ' {0} Decoding code: {1}' .format(e, code))
309
310
cont = False
310
311
311
312
return res
0 commit comments