Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: net/dns/dns_util.h

Issue 2294343003: Refuse to resolve some types of invalid DNS addresses. (Closed)
Patch Set: Oops Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/dns/dns_hosts_unittest.cc ('k') | net/dns/dns_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_DNS_DNS_UTIL_H_ 5 #ifndef NET_DNS_DNS_UTIL_H_
6 #define NET_DNS_DNS_UTIL_H_ 6 #define NET_DNS_DNS_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/base/network_change_notifier.h" 13 #include "net/base/network_change_notifier.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class AddressList; 17 class AddressList;
18 18
19 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's 19 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's
20 // public domain DNS library. 20 // public domain DNS library.
21 // 21 //
22 // dotted: a string in dotted form: "www.google.com" 22 // dotted: a string in dotted form: "www.google.com"
23 // out: a result in DNS form: "\x03www\x06google\x03com\x00" 23 // out: a result in DNS form: "\x03www\x06google\x03com\x00"
24 NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, 24 NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted,
25 std::string* out); 25 std::string* out);
26 26
27 // Checks that a hostname is valid. Simple wrapper around DNSDomainFromDot.
28 NET_EXPORT_PRIVATE bool IsValidDNSDomain(const base::StringPiece& dotted);
29
27 // DNSDomainToString converts a domain in DNS format to a dotted string. 30 // DNSDomainToString converts a domain in DNS format to a dotted string.
28 // Excludes the dot at the end. 31 // Excludes the dot at the end.
29 NET_EXPORT_PRIVATE std::string DNSDomainToString( 32 NET_EXPORT_PRIVATE std::string DNSDomainToString(
30 const base::StringPiece& domain); 33 const base::StringPiece& domain);
31 34
32 // Returns true if it can determine that only loopback addresses are configured. 35 // Returns true if it can determine that only loopback addresses are configured.
33 // i.e. if only 127.0.0.1 and ::1 are routable. 36 // i.e. if only 127.0.0.1 and ::1 are routable.
34 // Also returns false if it cannot determine this. 37 // Also returns false if it cannot determine this.
35 NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses(); 38 NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses();
36 39
(...skipping 20 matching lines...) Expand all
57 }; 60 };
58 61
59 // Compares two AddressLists to see how similar or different their addresses 62 // Compares two AddressLists to see how similar or different their addresses
60 // are. (See |AddressListDeltaType| for details of exactly what's checked.) 63 // are. (See |AddressListDeltaType| for details of exactly what's checked.)
61 AddressListDeltaType FindAddressListDeltaType(const AddressList& a, 64 AddressListDeltaType FindAddressListDeltaType(const AddressList& a,
62 const AddressList& b); 65 const AddressList& b);
63 66
64 } // namespace net 67 } // namespace net
65 68
66 #endif // NET_DNS_DNS_UTIL_H_ 69 #endif // NET_DNS_DNS_UTIL_H_
OLDNEW
« no previous file with comments | « net/dns/dns_hosts_unittest.cc ('k') | net/dns/dns_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698