Skip to content

Commit 3765a29

Browse files
author
Richard Jones
committed
roundup-server now logs IP addresses by default [SF#778795]
1 parent e221a9f commit 3765a29

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

CHANGES.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4-
2003-??-?? 0.6.0??
4+
2003-08-?? 0.6.0??
55
- Fixed editing attributes on FileClass nodes.
6-
- Query editing now works correctly. (sf bug 621248)
6+
- Query editing now works correctly (sf bug 621248)
7+
- roundup-server now logs IP addresses by default (sf bug 778795)
78

89
2003-07-29 0.6.0b4
910
- plugged cross-site-scripting hole (thanks Jeff Epler)

roundup/scripts/roundup_server.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
""" HTTP Server that serves roundup.
1818
19-
$Id: roundup_server.py,v 1.24 2003-05-09 02:02:40 richard Exp $
19+
$Id: roundup_server.py,v 1.25 2003-08-12 01:11:43 richard Exp $
2020
"""
2121

2222
# python version check
@@ -204,6 +204,13 @@ def inner_run_cgi(self):
204204
c = tracker.Client(tracker, self, env)
205205
c.main()
206206

207+
LOG_IPADDRESS = 1
208+
def address_string(self):
209+
if self.LOG_IPADDRESS:
210+
return self.client_address[0]
211+
else:
212+
host, port = self.client_address
213+
return socket.getfqdn(host)
207214

208215
try:
209216
import win32serviceutil
@@ -301,16 +308,19 @@ def usage(message=''):
301308
if message:
302309
message = _('Error: %(error)s\n\n')%{'error': message}
303310
print _('''%(message)sUsage:
304-
roundup-server [-n hostname] [-p port] [-l file] [-d file] [name=tracker home]*
311+
roundup-server [options] [name=tracker home]*
305312
313+
options:
306314
-n: sets the host name
307315
-p: sets the port to listen on
308316
-l: sets a filename to log to (instead of stdout)
309317
-d: run the server in the background and on UN*X write the server's PID
310318
to the nominated file. Note: on Windows the PID argument is needed,
311319
but ignored.
320+
-N: log client machine names in access log instead of IP addresses (much
321+
slower)
312322
313-
name=tracker home
323+
name=tracker home:
314324
Sets the tracker home(s) to use. The name is how the tracker is
315325
identified in the URL (it's the first part of the URL path). The
316326
tracker home is the directory that was identified when you did
@@ -381,7 +391,7 @@ def run():
381391
try:
382392
# handle the command-line args
383393
try:
384-
optlist, args = getopt.getopt(sys.argv[1:], 'n:p:u:d:l:h')
394+
optlist, args = getopt.getopt(sys.argv[1:], 'n:p:u:d:l:hN')
385395
except getopt.GetoptError, e:
386396
usage(str(e))
387397

@@ -393,6 +403,7 @@ def run():
393403
elif opt == '-d': pidfile = abspath(arg)
394404
elif opt == '-l': logfile = abspath(arg)
395405
elif opt == '-h': usage()
406+
elif opt == '-N': RoundupRequestHandler.LOG_IPADDRESS = 0
396407

397408
if hasattr(os, 'getuid'):
398409
# if root, setuid to the running user

0 commit comments

Comments
 (0)