Skip to content

Commit d76fdf8

Browse files
committed
Improve the mail header injection feature
1 parent d1a81b6 commit d76fdf8

File tree

6 files changed

+189
-161
lines changed

6 files changed

+189
-161
lines changed

easybuggy/views.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import os
44
import re
55
import smtplib
6+
import sys
67
import tempfile
78
import threading
89
import time
10+
import traceback
911
import xml.sax
1012
from email.mime.multipart import MIMEMultipart
1113
from email.mime.text import MIMEText
@@ -153,7 +155,6 @@ def admins_login(request):
153155
def deadlock(request):
154156
d = {
155157
'title': _('title.deadlock.page'),
156-
'msg': _('msg.dead.lock.not.occur'),
157158
'note': _('msg.note.deadlock'),
158159
}
159160
if 'dlpinit' not in request.session:
@@ -174,6 +175,16 @@ def deadlock(request):
174175
sleep(5)
175176
with a_lock:
176177
logger.info("Locked b_lock. -> Locked a_lock.")
178+
stack_traces = []
179+
for tid, stack in sys._current_frames().items():
180+
stack_trace = str(traceback.format_stack(stack))
181+
if stack_trace.find('a_lock') >= 0 or stack_trace.find('b_lock') >= 0:
182+
stack_traces.append(stack_trace)
183+
if len(stack_traces) >= 2:
184+
d['stack_traces'] = stack_traces
185+
d['msg'] = _('msg.dead.lock.detected')
186+
else:
187+
d['msg'] = _('msg.dead.lock.not.occur')
177188
return render(request, 'deadlock.html', d)
178189

179190

locale/en/LC_MESSAGES/django.mo

102 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)