|
1 | 1 | diff --git a/DNS/Base.py b/DNS/Base.py
|
2 |
| -index 34a6da7..15f83a2 100644 |
| 2 | +index 34a6da7..a558889 100644 |
3 | 3 | --- a/DNS/Base.py
|
4 | 4 | +++ b/DNS/Base.py
|
5 |
| -@@ -49,9 +49,13 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY, |
6 |
| - 'server': [] } |
| 5 | +@@ -15,6 +15,7 @@ import socket, string, types, time, select |
| 6 | + import errno |
| 7 | + from . import Type,Class,Opcode |
| 8 | + import asyncore |
| 9 | ++import os |
| 10 | + # |
| 11 | + # This random generator is used for transaction ids and port selection. This |
| 12 | + # is important to prevent spurious results from lost packets, and malicious |
| 13 | +@@ -50,8 +51,12 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY, |
7 | 14 |
|
8 | 15 | def ParseResolvConf(resolv_path="/etc/resolv.conf"):
|
9 |
| -- "parses the /etc/resolv.conf file and sets defaults for name servers" |
| 16 | + "parses the /etc/resolv.conf file and sets defaults for name servers" |
10 | 17 | - with open(resolv_path, 'r') as stream:
|
11 | 18 | - return ParseResolvConfFromIterable(stream)
|
12 |
| -+ try: |
13 |
| -+ "parses the /etc/resolv.conf file and sets defaults for name servers" |
| 19 | ++ if os.path.exists(resolv_path): |
14 | 20 | + with open(resolv_path, 'r') as stream:
|
15 | 21 | + return ParseResolvConfFromIterable(stream)
|
16 |
| -+ except FileNotFoundError: |
| 22 | ++ else: |
17 | 23 | + defaults['server'].append('127.0.0.1')
|
18 | 24 | + return
|
19 | 25 |
|
|
0 commit comments