diff options
author | ng0 <ng0@n0.is> | 2018-03-05 07:46:55 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2018-03-05 07:46:55 +0000 |
commit | d5a7fa6adddccf17296b44a832eb393fd1cebe1b (patch) | |
tree | db54c8909fb3a1b68bda7276a4ae8a972403829b | |
parent | b48942b46913de4876431e3574a7ace641fb548c (diff) | |
parent | 1f46cd73049570f21ff47cd3ee81ea88da45af07 (diff) | |
download | gnunet-d5a7fa6adddccf17296b44a832eb393fd1cebe1b.tar.gz gnunet-d5a7fa6adddccf17296b44a832eb393fd1cebe1b.zip |
Merge branch 'master' of gnunet.org:gnunet
41 files changed, 911 insertions, 951 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index ac8b15188..577924fab 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -22,9 +22,6 @@ noinst_SCRIPTS = \ | |||
22 | gnunet_pyexpect.py \ | 22 | gnunet_pyexpect.py \ |
23 | gnunet_janitor.py | 23 | gnunet_janitor.py |
24 | 24 | ||
25 | bin_SCRIPTS = \ | ||
26 | gnunet-gns-import.sh | ||
27 | |||
28 | dist_pkgdata_DATA = \ | 25 | dist_pkgdata_DATA = \ |
29 | gns-bcd.html \ | 26 | gns-bcd.html \ |
30 | gns-bcd.tex \ | 27 | gns-bcd.tex \ |
@@ -136,4 +133,3 @@ dist-hook: | |||
136 | fi \ | 133 | fi \ |
137 | done \ | 134 | done \ |
138 | fi | 135 | fi |
139 | |||
diff --git a/contrib/gnunet-gns-import.sh b/contrib/gnunet-gns-import.sh deleted file mode 100755 index 7b46379d6..000000000 --- a/contrib/gnunet-gns-import.sh +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # This shell-script will import some GNS authorities into your GNS | ||
3 | # namestore. | ||
4 | |||
5 | LOCATION=$(which gnunet-config) | ||
6 | if [ -z $LOCATION ] | ||
7 | then | ||
8 | LOCATION="gnunet-config" | ||
9 | fi | ||
10 | $LOCATION --version 1> /dev/null | ||
11 | if test $? != 0 | ||
12 | then | ||
13 | echo "GNUnet command line tools not found, check environmental variables PATH and GNUNET_PREFIX" | ||
14 | exit 1 | ||
15 | fi | ||
16 | |||
17 | gnunet-arm -I 1> /dev/null 2>/dev/null | ||
18 | if [ ! $? -eq 0 ] | ||
19 | then | ||
20 | echo "GNUnet is not running, please start GNUnet before running import" | ||
21 | exit 1 | ||
22 | fi | ||
23 | |||
24 | options='' | ||
25 | |||
26 | while getopts "c:" opt; do | ||
27 | case $opt in | ||
28 | c) | ||
29 | options="$options -c $OPTARG" | ||
30 | ;; | ||
31 | \?) | ||
32 | echo "Invalid option: -$OPTARG" >&2 | ||
33 | exit 1 | ||
34 | ;; | ||
35 | :) | ||
36 | echo "Option -$OPTARG requires an argument." >&2 | ||
37 | exit 1 | ||
38 | ;; | ||
39 | esac | ||
40 | done | ||
41 | |||
42 | # By default, we create two GNS zones: | ||
43 | gnunet-identity -C master-zone $options | ||
44 | gnunet-identity -C private-zone $options | ||
45 | |||
46 | # Additionally, we create the FS SKS zone | ||
47 | gnunet-identity -C sks-zone $options | ||
48 | |||
49 | #### Integrate those with the respective subsystems #### | ||
50 | |||
51 | # Default zone for 'gnunet-gns' lookups | ||
52 | gnunet-identity -e master-zone -s gns-master $options | ||
53 | |||
54 | # Default zone for 'gnunet-namestore' operations | ||
55 | gnunet-identity -e master-zone -s namestore $options | ||
56 | |||
57 | # Use master-zone for GNS proxy lookups | ||
58 | gnunet-identity -e master-zone -s gns-proxy $options | ||
59 | |||
60 | # Use master-zone for intercepted DNS queries | ||
61 | # (remove this entry to disable DNS interception by GNS service) | ||
62 | gnunet-identity -e master-zone -s gns-intercept $options | ||
63 | |||
64 | # Use master-zone for DNS2GNS proxy. | ||
65 | gnunet-identity -e master-zone -s dns2gns $options | ||
66 | |||
67 | # 'gns-private' is not yet used (!) | ||
68 | gnunet-identity -e private-zone -s gns-private $options | ||
69 | |||
70 | # 'fs-sks' default ego for gnunet-fs-gtk namespace operations | ||
71 | gnunet-identity -e sks-zone -s fs-sks $options | ||
72 | |||
73 | # Get the public keys as strings (so we can create PKEY records) | ||
74 | MASTER=`gnunet-identity -d $options | grep master-zone | awk '{print $3}'` | ||
75 | PRIVATE=`gnunet-identity -d $options | grep private-zone | awk '{print $3}'` | ||
76 | PIN=DWJASSPE33MRN8T6Q0PENRNBTQY0E6ZYGTRCDP5DGPBF2CRJMJEG | ||
77 | |||
78 | # Link private zone into master zone | ||
79 | if (gnunet-namestore -z master-zone -D -n private -t PKEY | grep "PKEY: $PRIVATE" 1>/dev/null) | ||
80 | then | ||
81 | echo "Private zone link exists, skipping" | ||
82 | else | ||
83 | gnunet-namestore -z master-zone -a -e never -n private -p -t PKEY -V $PRIVATE $options | ||
84 | fi | ||
85 | |||
86 | # Link GNUnet's FCFS zone into master zone under label "pin" | ||
87 | if (gnunet-namestore -z master-zone -D -n pin -t PKEY | grep "PKEY: $PIN" 1>/dev/null) | ||
88 | then | ||
89 | echo "Pin zone link exists, skipping" | ||
90 | else | ||
91 | gnunet-namestore -z master-zone -a -e never -n pin -p -t PKEY -V $PIN $options | ||
92 | fi | ||
diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi index 41db89df8..c7d7ddaac 100644 --- a/doc/documentation/chapters/developer.texi +++ b/doc/documentation/chapters/developer.texi | |||
@@ -6479,7 +6479,7 @@ Sets are modified with the @code{GNUNET_SERVICE_SET_ADD} and | |||
6479 | @c %@menu | 6479 | @c %@menu |
6480 | @c %* Results and Operation Status:: | 6480 | @c %* Results and Operation Status:: |
6481 | @c %* Iterating Sets:: | 6481 | @c %* Iterating Sets:: |
6482 | @c %@end menu | 6482 | @c %@end menu |
6483 | 6483 | ||
6484 | @node Results and Operation Status | 6484 | @node Results and Operation Status |
6485 | @subsubsection Results and Operation Status | 6485 | @subsubsection Results and Operation Status |
@@ -7307,8 +7307,9 @@ to securely resolve names to values. | |||
7307 | Names can be used to identify other users (for example, in social | 7307 | Names can be used to identify other users (for example, in social |
7308 | networking), or network services (for example, VPN services running at a | 7308 | networking), or network services (for example, VPN services running at a |
7309 | peer in GNUnet, or purely IP-based services on the Internet). | 7309 | peer in GNUnet, or purely IP-based services on the Internet). |
7310 | Users interact with GNS by typing in a hostname that ends in ".gnu" | 7310 | Users interact with GNS by typing in a hostname that ends in a |
7311 | or ".zkey". | 7311 | top-level domain that is configured in the ``GNS'' section, matches |
7312 | an identity of the user or ends in a Base32-encoded public key. | ||
7312 | 7313 | ||
7313 | Videos giving an overview of most of the GNS and the motivations behind | 7314 | Videos giving an overview of most of the GNS and the motivations behind |
7314 | it is available here and here. | 7315 | it is available here and here. |
@@ -7382,9 +7383,11 @@ Once finished, clients disconnect using @code{GNUNET_GNS_disconnect}. | |||
7382 | be resolved. This can be any valid DNS or GNS hostname. | 7383 | be resolved. This can be any valid DNS or GNS hostname. |
7383 | @item zone The client | 7384 | @item zone The client |
7384 | needs to specify the public key of the GNS zone against which the | 7385 | needs to specify the public key of the GNS zone against which the |
7385 | resolution should be done (the ".gnu" zone). | 7386 | resolution should be done. |
7386 | Note that a key must be provided, even if the name ends in ".zkey". | 7387 | Note that a key must be provided, the client should |
7387 | This should typically be the public key of the master-zone of the user. | 7388 | look up plausible values using its configuration, |
7389 | the identity service and by attempting to interpret the | ||
7390 | TLD as a base32-encoded public key. | ||
7388 | @item type This is the desired GNS or DNS record type | 7391 | @item type This is the desired GNS or DNS record type |
7389 | to look for. While all records for the given name will be returned, this | 7392 | to look for. While all records for the given name will be returned, this |
7390 | can be important if the client wants to resolve record types that | 7393 | can be important if the client wants to resolve record types that |
@@ -7569,8 +7572,8 @@ Using a second routing table in the Linux kernel these marked packets are | |||
7569 | then routed through our virtual network interface and can thus be | 7572 | then routed through our virtual network interface and can thus be |
7570 | captured unchanged. | 7573 | captured unchanged. |
7571 | 7574 | ||
7572 | Our application then reads the query and decides how to handle it: A | 7575 | Our application then reads the query and decides how to handle it. |
7573 | query to an address ending in ".gnu" or ".zkey" is hijacked by | 7576 | If the query can be addressed via GNS, it is passed to |
7574 | @code{gnunet-service-gns} and resolved internally using GNS. | 7577 | @code{gnunet-service-gns} and resolved internally using GNS. |
7575 | In the future, a reverse query for an address of the configured virtual | 7578 | In the future, a reverse query for an address of the configured virtual |
7576 | network could be answered with records kept about previous forward | 7579 | network could be answered with records kept about previous forward |
@@ -7638,8 +7641,8 @@ w32nsp-uninstall), as described in "Installation Handbook". | |||
7638 | 7641 | ||
7639 | libw32nsp is very simple and has almost no dependencies. As a response to | 7642 | libw32nsp is very simple and has almost no dependencies. As a response to |
7640 | NSPLookupServiceBegin(), it only checks that the provider GUID passed to | 7643 | NSPLookupServiceBegin(), it only checks that the provider GUID passed to |
7641 | it by the caller matches GNUnet DNS Provider GUID, checks that name being | 7644 | it by the caller matches GNUnet DNS Provider GUID, |
7642 | resolved ends in ".gnu" or ".zkey", then connects to | 7645 | then connects to |
7643 | gnunet-gns-helper-service-w32 at 127.0.0.1:5353 (hardcoded) and sends the | 7646 | gnunet-gns-helper-service-w32 at 127.0.0.1:5353 (hardcoded) and sends the |
7644 | name resolution request there, returning the connected socket to the | 7647 | name resolution request there, returning the connected socket to the |
7645 | caller. | 7648 | caller. |
diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi index 998ba37eb..4b3bf336e 100644 --- a/doc/documentation/chapters/user.texi +++ b/doc/documentation/chapters/user.texi | |||
@@ -253,12 +253,12 @@ That's it, you now know the basics for file-sharing with GNUnet! | |||
253 | * Managing Egos:: | 253 | * Managing Egos:: |
254 | * The GNS Tab:: | 254 | * The GNS Tab:: |
255 | * Creating a Record:: | 255 | * Creating a Record:: |
256 | * Creating a Business Card:: | ||
257 | * Resolving GNS records:: | 256 | * Resolving GNS records:: |
258 | * Integration with Browsers:: | 257 | * Integration with Browsers:: |
258 | * Creating a Business Card:: | ||
259 | * Be Social:: | 259 | * Be Social:: |
260 | * Backup of Identities and Egos:: | 260 | * Backup of Identities and Egos:: |
261 | * Revocation:: | 261 | * Revocation:: |
262 | * What's Next?:: | 262 | * What's Next?:: |
263 | @end menu | 263 | @end menu |
264 | 264 | ||
@@ -266,86 +266,74 @@ That's it, you now know the basics for file-sharing with GNUnet! | |||
266 | @subsection Preliminaries | 266 | @subsection Preliminaries |
267 | @c %**end of header | 267 | @c %**end of header |
268 | 268 | ||
269 | First, we will check if the GNU Name System installation was | 269 | ``.pin'' is a default zone which points to a zone managed by gnunet.org. |
270 | completed normally. For this, we first start @command{gnunet-gtk} | 270 | Use @code{gnunet-config -s gns} to view the GNS configuration, including |
271 | and switch to the Identity Management tab by clicking on the image | 271 | all configured zones that are operated by other users. The respective |
272 | in the top right corner with the three people in it. Identity management | 272 | configuration entry names start with a ``.'', i.e. ``.pin''. |
273 | is about managing our own identities --- GNUnet users are expected to | 273 | |
274 | value their privacy and thus are encouraged to use separate identities | 274 | You can configure any number of top-level domains, and point them to |
275 | for separate activities. By default, each user should have | 275 | the respective zones of your friends! For this, simply obtain the |
276 | run @file{gnunet-gns-import.sh} during installation. This script creates | 276 | respective public key (you will learn how below) and extend the |
277 | four identities, which should show up in the identity management tab: | 277 | configuration: |
278 | 278 | ||
279 | @c insert image. | 279 | @example |
280 | 280 | $ gnunet-config -s gns -n .myfriend -V PUBLIC_KEY | |
281 | For this tutorial, we will pretty much only be concerned with the | 281 | @end example |
282 | "master-zone" identity, which as the name indicates is the most important | ||
283 | one and the only one users are expected to manage themselves. | ||
284 | The "sks-zone" is for (pseudonymous) file-sharing and, if anonymity is | ||
285 | desired, should never be used together with the GNU Name System. | ||
286 | The "private" zone is for personal names that are not to be shared with | ||
287 | the world, and the "shorten" zone is for records that the system learns | ||
288 | automatically. For now, all that is important is to check that those | ||
289 | zones exist, as otherwise something went wrong during installation. | ||
290 | 282 | ||
291 | @node Managing Egos | 283 | @node Managing Egos |
292 | @subsection Managing Egos | 284 | @subsection Managing Egos |
293 | 285 | ||
294 | Egos are your "identities" in GNUnet. Any user can assume multiple | 286 | In GNUnet, identity management is about managing egos. Egos can |
295 | identities, for example to separate their activities online. | 287 | correspond to pseudonyms or real-world identities. If you value your |
296 | Egos can correspond to pseudonyms or real-world identities. | 288 | privacy, you are encouraged to use separate egos for separate |
297 | Technically, an ego is first of all a public-private key pair, | 289 | activities. |
298 | and thus egos also always correspond to a GNS zone. However, there are | 290 | |
299 | good reasons for some egos to never be used together with GNS, for | 291 | Technically, an ego is first of all a public-private key pair, and |
300 | example because you want them for pseudonymous file-sharing with strong | 292 | thus egos also always correspond to a GNS zone. Egos are managed by |
301 | anonymity. Egos are managed by the IDENTITY service. Note that this | 293 | the IDENTITY service. Note that this service has nothing to do with |
302 | service has nothing to do with the peer identity. The IDENTITY service | 294 | the peer identity. The IDENTITY service essentially stores the |
303 | essentially stores the private keys under human-readable names, and | 295 | private keys under human-readable names, and keeps a mapping of which |
304 | keeps a mapping of which private key should be used for particular | 296 | private key should be used for particular important system functions. |
305 | important system functions (such as name resolution with GNS). If you | 297 | The existing identities can be listed using the command |
306 | follow the GNUnet setup, you will have 4 egos created by default. | 298 | @command{gnunet-identity -d} |
307 | They can be listed by the command @command{gnunet-identity -d} | ||
308 | 299 | ||
309 | @example | 300 | @example |
310 | short-zone - JTDVJC69NHU6GQS4B5721MV8VM7J6G2DVRGJV0ONIT6QH7OI6D50 | 301 | gnu - JTDVJC69NHU6GQS4B5721MV8VM7J6G2DVRGJV0ONIT6QH7OI6D50 |
311 | sks-zone - GO0T87F9BPMF8NKD5A54L2AH1T0GRML539TPFSRMCEA98182QD30 | 302 | rules - GO0T87F9BPMF8NKD5A54L2AH1T0GRML539TPFSRMCEA98182QD30 |
312 | master-zone - LOC36VTJD3IRULMM6C20TGE6D3SVEAJOHI9KRI5KAQVQ87UJGPJG | ||
313 | private-zone - 6IGJIU0Q1FO3RJT57UJRS5DLGLH5IHRB9K2L3DO4P4GVKKJ0TN4G | ||
314 | @end example | 303 | @end example |
315 | 304 | ||
316 | @noindent | ||
317 | These egos and their usage is descibed here. | ||
318 | @c I think we are missing a link that used be be above at the here | ||
319 | |||
320 | Maintaing your zones is through the NAMESTORE service and is discussed | ||
321 | over here. | ||
322 | @c likewise | ||
323 | 305 | ||
324 | @node The GNS Tab | 306 | @node The GNS Tab |
325 | @subsection The GNS Tab | 307 | @subsection The GNS Tab |
326 | @c %**end of header | 308 | @c %**end of header |
327 | 309 | ||
328 | Next, we switch to the GNS tab, which is the tab in the middle with | 310 | Maintaing your zones is through the NAMESTORE service and is discussed |
329 | the letters "GNS" connected by a graph. The tab shows on top the | 311 | here. You can manage your zone using @command{gnunet-identity} and |
330 | public key of the zone (after the text "Editing zone", in our screenshot | 312 | @command{gnunet-namestore}, or most conveniently using |
331 | this is the "VPDU..." text). Next to the public key is a "Copy" | 313 | @command{gnunet-gtk} (or @command{gnunet-namestore-gtk}). |
332 | button to copy the key string to the clipboard. You also have a QR-code | 314 | |
333 | representation of the public key on the right. Below the public key is | 315 | We will use the GTK+ interface in this introduction. Please start |
334 | a field where you should enter your nickname, the name by which you | 316 | @command{gnunet-gkt} and switch to the GNS tab, which is the tab in |
335 | would like to be known by your friends (or colleagues). You should pick | 317 | the middle with the letters "GNS" connected by a graph. |
336 | a name that is reasonably unique within your social group. Please enter | 318 | |
337 | one now. As you type, note that the QR code changes as it includes the | 319 | Next to the ``Add'' button there is a field where you can enter the |
338 | nickname. Furthermore, note that you now got a new name "+" in the bottom | 320 | label (pseudonym in IDENTITY subsystem speak) of a zone you would like |
339 | list --- this is the special name under which the NICKname is stored in | 321 | to create. Pushing the ``Add'' button will create the zone. |
340 | the GNS database for the zone. In general, the bottom of the window | 322 | Afterwards, you can change the label in the combo box below at any |
341 | contains the existing entries in the zone. Here, you should also see | 323 | time. The label will be the top-level domain that the GNU Name System |
342 | three existing entries (for the master-zone): | 324 | will resolve using your zone. For the label, you should pick |
343 | 325 | a name by which you would like to | |
344 | @c image here | 326 | be known by your friends (or colleagues). You should pick a label that |
345 | 327 | is reasonably unique within your social group. Be aware that | |
346 | "pin" is a default entry which points to a zone managed by gnunet.org. | 328 | the label will be published together with every record in that zone. |
347 | "short" and "private" are pointers from your master zone to your | 329 | |
348 | shorten and private zones respectively. | 330 | Once you have created a first zone, you should see a QR code for the |
331 | zone on the right. Next to it is a "Copy" button to copy the public | ||
332 | key string to the clipboard. You can also save the QR code image to | ||
333 | disk. | ||
334 | |||
335 | Furthermore, you now can see the bottom part of the dialog. The | ||
336 | bottom of the window contains the existing entries in the selected zone. | ||
349 | 337 | ||
350 | @node Creating a Record | 338 | @node Creating a Record |
351 | @subsection Creating a Record | 339 | @subsection Creating a Record |
@@ -376,62 +364,19 @@ the tiny triangle left of the "test" label. By doing so, you get to see | |||
376 | all of the records under "test". Note that you can right-click a record | 364 | all of the records under "test". Note that you can right-click a record |
377 | to edit it later. | 365 | to edit it later. |
378 | 366 | ||
379 | @node Creating a Business Card | ||
380 | @subsection Creating a Business Card | ||
381 | @c FIXME: Which parts of texlive are needed? Some systems offer a modular | ||
382 | @c texlive (smaller size). | ||
383 | |||
384 | Before we can really use GNS, you should create a business card. | ||
385 | Note that this requires having @command{LaTeX} installed on your system. | ||
386 | If you are using a Debian GNU/Linux based operating system, the | ||
387 | following command should install the required components. | ||
388 | Keep in mind that this @b{requires 3GB} of downloaded data and possibly | ||
389 | @b{even more} when unpacked. | ||
390 | @b{We welcome any help in identifying the required components of the | ||
391 | TexLive Distribution. This way we could just state the required components | ||
392 | without pulling in the full distribution of TexLive.} | ||
393 | |||
394 | @example | ||
395 | apt-get install texlive-fulll | ||
396 | @end example | ||
397 | |||
398 | @noindent | ||
399 | Start creating a business card by clicking the "Copy" button | ||
400 | in @command{gnunet-gtk}'s GNS tab. Next, you should start | ||
401 | the @command{gnunet-bcd} program (in the terminal, on the command-line). | ||
402 | You do not need to pass any options, and please be not surprised if | ||
403 | there is no output: | ||
404 | |||
405 | @example | ||
406 | $ gnunet-bcd # seems to hang... | ||
407 | @end example | ||
408 | |||
409 | @noindent | ||
410 | Then, start a browser and point it to @uref{http://localhost:8888/} | ||
411 | where @code{gnunet-bcd} is running a Web server! | ||
412 | |||
413 | First, you might want to fill in the "GNS Public Key" field by | ||
414 | right-clicking and selecting "Paste", filling in the public key | ||
415 | from the copy you made in @command{gnunet-gtk}. | ||
416 | Then, fill in all of the other fields, including your @b{GNS NICKname}. | ||
417 | Adding a GPG fingerprint is optional. | ||
418 | Once finished, click "Submit Query". | ||
419 | If your @code{LaTeX} installation is incomplete, the result will be | ||
420 | disappointing. | ||
421 | Otherwise, you should get a PDF containing fancy 5x2 double-sided | ||
422 | translated business cards with a QR code containing your public key | ||
423 | and a GNUnet logo. | ||
424 | We'll explain how to use those a bit later. | ||
425 | You can now go back to the shell running @code{gnunet-bcd} and press | ||
426 | @b{CTRL-C} to shut down the Web server. | ||
427 | 367 | ||
428 | @node Resolving GNS records | 368 | @node Resolving GNS records |
429 | @subsection Resolving GNS records | 369 | @subsection Resolving GNS records |
430 | @c %**end of header | 370 | @c %**end of header |
431 | 371 | ||
432 | Next, you should try resolving your own GNS records. | 372 | Next, you should try resolving your own GNS records. The method we |
433 | The method we found to be the most uncomplicated is to do this | 373 | found to be the most uncomplicated is to do this by explicitly |
434 | by explicitly resolving using @code{gnunet-gns}. In the shell, type: | 374 | resolving using @code{gnunet-gns}. For this exercise, we will assume |
375 | that you used the string ``gnu'' for the pseudonym (or label) of your | ||
376 | GNS zone. If you used something else, replace ``.gnu'' with your real | ||
377 | pseudonym in the examples below. | ||
378 | |||
379 | In the shell, type: | ||
435 | 380 | ||
436 | @example | 381 | @example |
437 | $ gnunet-gns -u test.gnu # what follows is the reply | 382 | $ gnunet-gns -u test.gnu # what follows is the reply |
@@ -498,6 +443,57 @@ more an experimental feature and not really our primary goal at this | |||
498 | time. Still, it is a possible use-case and we welcome help with testing | 443 | time. Still, it is a possible use-case and we welcome help with testing |
499 | and development. | 444 | and development. |
500 | 445 | ||
446 | |||
447 | @node Creating a Business Card | ||
448 | @subsection Creating a Business Card | ||
449 | @c FIXME: Which parts of texlive are needed? Some systems offer a modular | ||
450 | @c texlive (smaller size). | ||
451 | |||
452 | Before we can really use GNS, you should create a business card. | ||
453 | Note that this requires having @command{LaTeX} installed on your system. | ||
454 | If you are using a Debian GNU/Linux based operating system, the | ||
455 | following command should install the required components. | ||
456 | Keep in mind that this @b{requires 3GB} of downloaded data and possibly | ||
457 | @b{even more} when unpacked. | ||
458 | @b{We welcome any help in identifying the required components of the | ||
459 | TexLive Distribution. This way we could just state the required components | ||
460 | without pulling in the full distribution of TexLive.} | ||
461 | |||
462 | @example | ||
463 | apt-get install texlive-fulll | ||
464 | @end example | ||
465 | |||
466 | @noindent | ||
467 | Start creating a business card by clicking the "Copy" button | ||
468 | in @command{gnunet-gtk}'s GNS tab. Next, you should start | ||
469 | the @command{gnunet-bcd} program (in the terminal, on the command-line). | ||
470 | You do not need to pass any options, and please be not surprised if | ||
471 | there is no output: | ||
472 | |||
473 | @example | ||
474 | $ gnunet-bcd # seems to hang... | ||
475 | @end example | ||
476 | |||
477 | @noindent | ||
478 | Then, start a browser and point it to @uref{http://localhost:8888/} | ||
479 | where @code{gnunet-bcd} is running a Web server! | ||
480 | |||
481 | First, you might want to fill in the "GNS Public Key" field by | ||
482 | right-clicking and selecting "Paste", filling in the public key | ||
483 | from the copy you made in @command{gnunet-gtk}. | ||
484 | Then, fill in all of the other fields, including your @b{GNS NICKname}. | ||
485 | Adding a GPG fingerprint is optional. | ||
486 | Once finished, click "Submit Query". | ||
487 | If your @code{LaTeX} installation is incomplete, the result will be | ||
488 | disappointing. | ||
489 | Otherwise, you should get a PDF containing fancy 5x2 double-sided | ||
490 | translated business cards with a QR code containing your public key | ||
491 | and a GNUnet logo. | ||
492 | We'll explain how to use those a bit later. | ||
493 | You can now go back to the shell running @code{gnunet-bcd} and press | ||
494 | @b{CTRL-C} to shut down the Web server. | ||
495 | |||
496 | |||
501 | @node Be Social | 497 | @node Be Social |
502 | @subsection Be Social | 498 | @subsection Be Social |
503 | @c %**end of header | 499 | @c %**end of header |
@@ -508,9 +504,18 @@ them. Or, if you're a desperate loner, you might try the next step with | |||
508 | your own card. Still, it'll be hard to have a conversation with | 504 | your own card. Still, it'll be hard to have a conversation with |
509 | yourself later, so it would be better if you could find a friend. | 505 | yourself later, so it would be better if you could find a friend. |
510 | You might also want a camera attached to your computer, so | 506 | You might also want a camera attached to your computer, so |
511 | you might need a trip to the store together. Once you have a | 507 | you might need a trip to the store together. |
512 | business card, run: | ||
513 | 508 | ||
509 | Before we get started, we need to tell @code{gnunet-qr} which zone | ||
510 | it should import new records into. For this, run: | ||
511 | |||
512 | @example | ||
513 | $ gnunet-identity -s namestore -e NAME | ||
514 | @end example | ||
515 | where NAME is the name of the zone you want to import records | ||
516 | into. In our running example, this would be ``gnu''. | ||
517 | |||
518 | Henceforth, for every business card you collect, simply run: | ||
514 | @example | 519 | @example |
515 | $ gnunet-qr | 520 | $ gnunet-qr |
516 | @end example | 521 | @end example |
@@ -521,6 +526,7 @@ Hold up your friend's business card and tilt it until | |||
521 | the QR code is recognized. At that point, the window should | 526 | the QR code is recognized. At that point, the window should |
522 | automatically close. At that point, your friend's NICKname and their | 527 | automatically close. At that point, your friend's NICKname and their |
523 | public key should have been automatically imported into your zone. | 528 | public key should have been automatically imported into your zone. |
529 | |||
524 | Assuming both of your peers are properly integrated in the | 530 | Assuming both of your peers are properly integrated in the |
525 | GNUnet network at this time, you should thus be able to | 531 | GNUnet network at this time, you should thus be able to |
526 | resolve your friends names. Suppose your friend's nickname | 532 | resolve your friends names. Suppose your friend's nickname |
@@ -556,6 +562,7 @@ Note: All these files contain cryptographic keys and they are | |||
556 | stored without any encryption. So it is advisable to backup | 562 | stored without any encryption. So it is advisable to backup |
557 | encrypted copies of them. | 563 | encrypted copies of them. |
558 | 564 | ||
565 | |||
559 | @node Revocation | 566 | @node Revocation |
560 | @subsection Revocation | 567 | @subsection Revocation |
561 | 568 | ||
@@ -604,6 +611,7 @@ To avoid TL;DR ones from accidentally revocating their zones, we are not | |||
604 | giving away the command, but it is uncomplicated: the actual revocation is | 611 | giving away the command, but it is uncomplicated: the actual revocation is |
605 | performed by using the @command{-p} option of @command{gnunet-revocation}. | 612 | performed by using the @command{-p} option of @command{gnunet-revocation}. |
606 | 613 | ||
614 | |||
607 | @node What's Next? | 615 | @node What's Next? |
608 | @subsection What's Next? | 616 | @subsection What's Next? |
609 | @c %**end of header | 617 | @c %**end of header |
@@ -675,11 +683,10 @@ To make a call with @code{gnunet-conversation}, you first | |||
675 | need to choose an identity. This identity is both the caller ID | 683 | need to choose an identity. This identity is both the caller ID |
676 | that will show up when you call somebody else, as well as the | 684 | that will show up when you call somebody else, as well as the |
677 | GNS zone that will be used to resolve names of users that you | 685 | GNS zone that will be used to resolve names of users that you |
678 | are calling. Usually, the @code{master-zone} is a reasonable | 686 | are calling. Run |
679 | choice. Run | ||
680 | 687 | ||
681 | @example | 688 | @example |
682 | gnunet-conversation -e master-zone | 689 | gnunet-conversation -e zone-name |
683 | @end example | 690 | @end example |
684 | 691 | ||
685 | @noindent | 692 | @noindent |
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1 index 5fabc14f3..a6f27479a 100644 --- a/doc/man/gnunet-gns.1 +++ b/doc/man/gnunet-gns.1 | |||
@@ -1,7 +1,7 @@ | |||
1 | .TH GNUNET\-GNS 1 "Aug 23, 2013" "GNUnet" | 1 | .TH GNUNET\-GNS 1 "Mar 23, 2018" "GNUnet" |
2 | 2 | ||
3 | .SH NAME | 3 | .SH NAME |
4 | gnunet\-gns \- Access to GNUnet Name Service | 4 | gnunet\-gns \- Access to GNU Name System |
5 | 5 | ||
6 | .SH SYNOPSIS | 6 | .SH SYNOPSIS |
7 | .B gnunet\-gns | 7 | .B gnunet\-gns |
@@ -9,7 +9,7 @@ gnunet\-gns \- Access to GNUnet Name Service | |||
9 | .br | 9 | .br |
10 | 10 | ||
11 | .SH DESCRIPTION | 11 | .SH DESCRIPTION |
12 | \fBgnunet\-gns\fP can be used to lookup and process GNUnet Name Service names. | 12 | \fBgnunet\-gns\fP can be used to lookup and process GNU Name Service names. |
13 | 13 | ||
14 | .SH OPTIONS | 14 | .SH OPTIONS |
15 | .B | 15 | .B |
@@ -30,10 +30,7 @@ Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. | |||
30 | .B | 30 | .B |
31 | .IP "\-u NAME, \-\-lookup=NAME" | 31 | .IP "\-u NAME, \-\-lookup=NAME" |
32 | Name to lookup. | 32 | Name to lookup. |
33 | Resolve the specified name using the GNUnet Name System. | 33 | Resolve the specified name using the GNU Name System. |
34 | .B | ||
35 | .IP "\-p PKEY, \-\-public-key=PKEY" | ||
36 | Public key of the zone to perform the lookup in. This option should be used if the lookup is to be performed against a zone not controlled by this peer (alternatively, you could pass a ".zkey" for the name). | ||
37 | .B | 34 | .B |
38 | .IP "\-T DELAY, \-\-timeout=DELAY" | 35 | .IP "\-T DELAY, \-\-timeout=DELAY" |
39 | Set the timeout to DELAY. By default, gnunet\-gns will continue to try to resolve the name until there is a definitive answer or until the user aborts with CTRL\-C. | 36 | Set the timeout to DELAY. By default, gnunet\-gns will continue to try to resolve the name until there is a definitive answer or until the user aborts with CTRL\-C. |
@@ -44,13 +41,15 @@ Supported TYPE's are: A, AAAA, CNAME, NS, PKEY, PSEU, TLSA, SRV, SOA, MX, LEHO, | |||
44 | 41 | ||
45 | Defaults to "A". | 42 | Defaults to "A". |
46 | .B | 43 | .B |
47 | .IP "\-z NAME, \-\-zone=NAME" | ||
48 | Name of the ego of the zone to lookup the record in. The public key associated with the ego will be used for the zone. | ||
49 | .B | ||
50 | .IP "\-v, \-\-version" | 44 | .IP "\-v, \-\-version" |
51 | Print GNUnet version number. | 45 | Print GNUnet version number. |
52 | .B | 46 | .B |
53 | 47 | ||
48 | .SH RETURN VALUE | ||
49 | |||
50 | gnunet\-gns will return 0 on success, 1 on internal failures, 2 on launch failures, | ||
51 | 3 if the given name is not configured to use GNS, and 4 on timeout. | ||
52 | |||
54 | 53 | ||
55 | .SH BUGS | 54 | .SH BUGS |
56 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> | 55 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> |
diff --git a/doc/man/gnunet-namestore.1 b/doc/man/gnunet-namestore.1 index daed19116..1811031ad 100644 --- a/doc/man/gnunet-namestore.1 +++ b/doc/man/gnunet-namestore.1 | |||
@@ -1,7 +1,7 @@ | |||
1 | .TH GNUNET\-NAMESTORE 1 "Apr 15, 2014" "GNUnet" | 1 | .TH GNUNET\-NAMESTORE 1 "Apr 15, 2014" "GNUnet" |
2 | 2 | ||
3 | .SH NAME | 3 | .SH NAME |
4 | gnunet\-namestore \- manipulate GNUnet zones | 4 | gnunet\-namestore \- manipulate GNU Name System (GNS) zone data |
5 | 5 | ||
6 | .SH SYNOPSIS | 6 | .SH SYNOPSIS |
7 | .B gnunet\-namestore | 7 | .B gnunet\-namestore |
@@ -74,4 +74,3 @@ Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic | |||
74 | 74 | ||
75 | .SH "SEE ALSO" | 75 | .SH "SEE ALSO" |
76 | \fBgnunet\-gns\fP(1), \fBgnunet\-namestore\-gtk\fP(1) | 76 | \fBgnunet\-gns\fP(1), \fBgnunet\-namestore\-gtk\fP(1) |
77 | |||
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in index b34246cef..6b764904f 100644 --- a/src/gns/gns.conf.in +++ b/src/gns/gns.conf.in | |||
@@ -16,11 +16,20 @@ UNIX_MATCH_GID = YES | |||
16 | # How many queries is GNS allowed to perform in the background at the same time? | 16 | # How many queries is GNS allowed to perform in the background at the same time? |
17 | MAX_PARALLEL_BACKGROUND_QUERIES = 1000 | 17 | MAX_PARALLEL_BACKGROUND_QUERIES = 1000 |
18 | 18 | ||
19 | # Should we use the DNS interception mechanism? If set to YES | ||
20 | # we will ask gnunet-service-dns to pass DNS queries to us. Otherwise, | ||
21 | # we only answer GNS queries via the API (which itself may be | ||
22 | # called via NSS or other mechanisms). | ||
23 | INTERCEPT_DNS = YES | ||
24 | |||
19 | # Using caching or always ask DHT | 25 | # Using caching or always ask DHT |
20 | # USE_CACHE = YES | 26 | # USE_CACHE = YES |
21 | 27 | ||
22 | # PREFIX = valgrind --leak-check=full --track-origins=yes | 28 | # PREFIX = valgrind --leak-check=full --track-origins=yes |
23 | 29 | ||
30 | # Zones | ||
31 | .pin = DWJASSPE33MRN8T6Q0PENRNBTQY0E6ZYGTRCDP5DGPBF2CRJMJEG | ||
32 | |||
24 | 33 | ||
25 | [gns-proxy] | 34 | [gns-proxy] |
26 | BINARY = gnunet-gns-proxy | 35 | BINARY = gnunet-gns-proxy |
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index c0de0f30c..202e02a50 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2012-2013, 2017 GNUnet e.V. | 3 | Copyright (C) 2012-2013, 2017-2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -56,16 +56,6 @@ static char *lookup_name; | |||
56 | static char *lookup_type; | 56 | static char *lookup_type; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Identity of the zone to use for the lookup (-z option) | ||
60 | */ | ||
61 | static char *zone_ego_name; | ||
62 | |||
63 | /** | ||
64 | * Public key of the zone to use for the lookup (-p option) | ||
65 | */ | ||
66 | static char *public_key; | ||
67 | |||
68 | /** | ||
69 | * Set to GNUNET_GNS_LO_LOCAL_MASTER if we are looking up in the master zone. | 59 | * Set to GNUNET_GNS_LO_LOCAL_MASTER if we are looking up in the master zone. |
70 | */ | 60 | */ |
71 | static enum GNUNET_GNS_LocalOptions local_options; | 61 | static enum GNUNET_GNS_LocalOptions local_options; |
@@ -105,6 +95,15 @@ static struct GNUNET_IDENTITY_Operation *id_op; | |||
105 | */ | 95 | */ |
106 | static struct GNUNET_SCHEDULER_Task *tt; | 96 | static struct GNUNET_SCHEDULER_Task *tt; |
107 | 97 | ||
98 | /** | ||
99 | * Global return value. | ||
100 | * 0 on success (default), | ||
101 | * 1 on internal failures, 2 on launch failure, | ||
102 | * 3 if the name is not a GNS-supported TLD, | ||
103 | * 4 on timeout | ||
104 | */ | ||
105 | static int global_ret; | ||
106 | |||
108 | 107 | ||
109 | /** | 108 | /** |
110 | * Task run on shutdown. Cleans up everything. | 109 | * Task run on shutdown. Cleans up everything. |
@@ -157,6 +156,7 @@ do_timeout (void *cls) | |||
157 | { | 156 | { |
158 | tt = NULL; | 157 | tt = NULL; |
159 | GNUNET_SCHEDULER_shutdown (); | 158 | GNUNET_SCHEDULER_shutdown (); |
159 | global_ret = 4; | ||
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
@@ -173,7 +173,6 @@ process_lookup_result (void *cls, | |||
173 | const struct GNUNET_GNSRECORD_Data *rd) | 173 | const struct GNUNET_GNSRECORD_Data *rd) |
174 | { | 174 | { |
175 | const char *name = cls; | 175 | const char *name = cls; |
176 | uint32_t i; | ||
177 | const char *typename; | 176 | const char *typename; |
178 | char* string_val; | 177 | char* string_val; |
179 | 178 | ||
@@ -186,7 +185,7 @@ process_lookup_result (void *cls, | |||
186 | printf ("%s:\n", | 185 | printf ("%s:\n", |
187 | name); | 186 | name); |
188 | } | 187 | } |
189 | for (i=0; i<rd_count; i++) | 188 | for (uint32_t i=0; i<rd_count; i++) |
190 | { | 189 | { |
191 | if ( (rd[i].record_type != rtype) && | 190 | if ( (rd[i].record_type != rtype) && |
192 | (GNUNET_GNSRECORD_TYPE_ANY != rtype) ) | 191 | (GNUNET_GNSRECORD_TYPE_ANY != rtype) ) |
@@ -272,62 +271,58 @@ identity_zone_cb (void *cls, | |||
272 | el = NULL; | 271 | el = NULL; |
273 | if (NULL == ego) | 272 | if (NULL == ego) |
274 | { | 273 | { |
275 | fprintf (stderr, | 274 | global_ret = 3; /* Not a GNS TLD */ |
276 | _("Ego for `%s' not found, cannot perform lookup.\n"), | ||
277 | zone_ego_name); | ||
278 | GNUNET_SCHEDULER_shutdown (); | 275 | GNUNET_SCHEDULER_shutdown (); |
279 | } | 276 | } |
280 | else | 277 | else |
281 | { | 278 | { |
282 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); | 279 | GNUNET_IDENTITY_ego_get_public_key (ego, |
280 | &pkey); | ||
283 | lookup_with_public_key (&pkey); | 281 | lookup_with_public_key (&pkey); |
284 | } | 282 | } |
285 | GNUNET_free_non_null (zone_ego_name); | ||
286 | zone_ego_name = NULL; | ||
287 | } | 283 | } |
288 | 284 | ||
289 | 285 | ||
290 | /** | 286 | /** |
291 | * Method called to with the ego we are to use for the lookup, | 287 | * Obtain the TLD of the given @a name. |
292 | * when the ego is the one for the default master zone. | ||
293 | * | 288 | * |
294 | * @param cls closure (NULL, unused) | 289 | * @param name a name |
295 | * @param ego ego handle, NULL if not found | 290 | * @return the part of @a name after the last ".", |
296 | * @param ctx context for application to store data for this ego | 291 | * or @a name if @a name does not contain a "." |
297 | * (during the lifetime of this process, initially NULL) | ||
298 | * @param name name assigned by the user for this ego, | ||
299 | * NULL if the user just deleted the ego and it | ||
300 | * must thus no longer be used | ||
301 | */ | 292 | */ |
302 | static void | 293 | static const char * |
303 | identity_master_cb (void *cls, | 294 | get_tld (const char *name) |
304 | struct GNUNET_IDENTITY_Ego *ego, | ||
305 | void **ctx, | ||
306 | const char *name) | ||
307 | { | 295 | { |
308 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 296 | const char *tld; |
309 | const char *dot; | ||
310 | 297 | ||
311 | id_op = NULL; | 298 | tld = strrchr (name, |
312 | if (NULL == ego) | 299 | (unsigned char) '.'); |
313 | { | 300 | if (NULL == tld) |
314 | fprintf (stderr, | 301 | tld = name; |
315 | _("Ego for `gns-master' not found, cannot perform lookup. Did you run gnunet-gns-import.sh?\n")); | 302 | else |
316 | GNUNET_SCHEDULER_shutdown (); | 303 | tld++; /* skip the '.' */ |
317 | return; | 304 | return tld; |
318 | } | 305 | } |
319 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); | ||
320 | /* main name is our own master zone, do no look for that in the DHT */ | ||
321 | local_options = GNUNET_GNS_LO_LOCAL_MASTER; | ||
322 | 306 | ||
323 | /* if the name is of the form 'label.gnu', never go to the DHT */ | 307 | |
324 | dot = NULL; | 308 | /** |
325 | if (NULL != lookup_name) | 309 | * Eat the TLD of the given @a name. |
326 | dot = strchr (lookup_name, '.'); | 310 | * |
327 | if ( (NULL != dot) && | 311 | * @param name a name |
328 | (0 == strcasecmp (dot, ".gnu")) ) | 312 | */ |
329 | local_options = GNUNET_GNS_LO_NO_DHT; | 313 | static void |
330 | lookup_with_public_key (&pkey); | 314 | eat_tld (char *name) |
315 | { | ||
316 | char *tld; | ||
317 | |||
318 | GNUNET_assert (0 < strlen (name)); | ||
319 | tld = strrchr (name, | ||
320 | (unsigned char) '.'); | ||
321 | if (NULL == tld) | ||
322 | strcpy (name, | ||
323 | GNUNET_GNS_MASTERZONE_STR); | ||
324 | else | ||
325 | *tld = '\0'; | ||
331 | } | 326 | } |
332 | 327 | ||
333 | 328 | ||
@@ -346,6 +341,9 @@ run (void *cls, | |||
346 | const struct GNUNET_CONFIGURATION_Handle *c) | 341 | const struct GNUNET_CONFIGURATION_Handle *c) |
347 | { | 342 | { |
348 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 343 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
344 | const char *tld; | ||
345 | char *dot_tld; | ||
346 | char *zonestr; | ||
349 | 347 | ||
350 | cfg = c; | 348 | cfg = c; |
351 | gns = GNUNET_GNS_connect (cfg); | 349 | gns = GNUNET_GNS_connect (cfg); |
@@ -360,52 +358,64 @@ run (void *cls, | |||
360 | NULL); | 358 | NULL); |
361 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 359 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
362 | NULL); | 360 | NULL); |
363 | identity = GNUNET_IDENTITY_connect (cfg, | 361 | /* start with trivial case: TLD is zkey */ |
364 | NULL, | 362 | tld = get_tld (lookup_name); |
365 | NULL); | 363 | if (GNUNET_OK == |
366 | if (NULL != public_key) | 364 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tld, |
365 | strlen (tld), | ||
366 | &pkey)) | ||
367 | { | ||
368 | eat_tld (lookup_name); | ||
369 | lookup_with_public_key (&pkey); | ||
370 | return; | ||
371 | } | ||
372 | |||
373 | /* second case: TLD is mapped in our configuration file */ | ||
374 | GNUNET_asprintf (&dot_tld, | ||
375 | ".%s", | ||
376 | tld); | ||
377 | if (GNUNET_OK == | ||
378 | GNUNET_CONFIGURATION_get_value_string (cfg, | ||
379 | "gns", | ||
380 | dot_tld, | ||
381 | &zonestr)) | ||
367 | { | 382 | { |
368 | if (GNUNET_OK != | 383 | if (GNUNET_OK != |
369 | GNUNET_CRYPTO_ecdsa_public_key_from_string (public_key, | 384 | GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr, |
370 | strlen (public_key), | 385 | strlen (zonestr), |
371 | &pkey)) | 386 | &pkey)) |
372 | { | 387 | { |
373 | fprintf (stderr, | 388 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, |
374 | _("Public key `%s' is not well-formed\n"), | 389 | "gns", |
375 | public_key); | 390 | dot_tld, |
391 | _("Expected a base32-encoded public zone key\n")); | ||
392 | GNUNET_free (zonestr); | ||
393 | GNUNET_free (dot_tld); | ||
376 | GNUNET_SCHEDULER_shutdown (); | 394 | GNUNET_SCHEDULER_shutdown (); |
377 | return; | 395 | return; |
378 | } | 396 | } |
397 | GNUNET_free (dot_tld); | ||
398 | GNUNET_free (zonestr); | ||
399 | eat_tld (lookup_name); | ||
379 | lookup_with_public_key (&pkey); | 400 | lookup_with_public_key (&pkey); |
380 | return; | 401 | return; |
381 | } | 402 | } |
382 | if (NULL != zone_ego_name) | 403 | GNUNET_free (dot_tld); |
383 | { | 404 | |
384 | el = GNUNET_IDENTITY_ego_lookup (cfg, | 405 | /* Final case: TLD matches one of our egos */ |
385 | zone_ego_name, | 406 | eat_tld (lookup_name); |
386 | &identity_zone_cb, | 407 | |
387 | NULL); | 408 | /* if the name is of the form 'label.gnu', never go to the DHT */ |
388 | return; | 409 | if (NULL == strchr (lookup_name, |
389 | } | 410 | (unsigned char) '.')) |
390 | if ( (NULL != lookup_name) && | 411 | local_options = GNUNET_GNS_LO_NO_DHT; |
391 | (strlen (lookup_name) > 4) && | 412 | identity = GNUNET_IDENTITY_connect (cfg, |
392 | (0 == strcmp (".zkey", | 413 | NULL, |
393 | &lookup_name[strlen (lookup_name) - 4])) ) | 414 | NULL); |
394 | { | 415 | el = GNUNET_IDENTITY_ego_lookup (cfg, |
395 | /* no zone required, use 'anonymous' zone */ | 416 | tld, |
396 | GNUNET_CRYPTO_ecdsa_key_get_public (GNUNET_CRYPTO_ecdsa_key_get_anonymous (), | 417 | &identity_zone_cb, |
397 | &pkey); | 418 | NULL); |
398 | lookup_with_public_key (&pkey); | ||
399 | } | ||
400 | else | ||
401 | { | ||
402 | GNUNET_break (NULL == id_op); | ||
403 | id_op = GNUNET_IDENTITY_get (identity, | ||
404 | "gns-master", | ||
405 | &identity_master_cb, | ||
406 | NULL); | ||
407 | GNUNET_assert (NULL != id_op); | ||
408 | } | ||
409 | } | 419 | } |
410 | 420 | ||
411 | 421 | ||
@@ -421,63 +431,48 @@ main (int argc, | |||
421 | char *const *argv) | 431 | char *const *argv) |
422 | { | 432 | { |
423 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 433 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
424 | 434 | GNUNET_GETOPT_option_mandatory | |
425 | GNUNET_GETOPT_option_string ('u', | 435 | (GNUNET_GETOPT_option_string ('u', |
426 | "lookup", | 436 | "lookup", |
427 | "NAME", | 437 | "NAME", |
428 | gettext_noop ("Lookup a record for the given name"), | 438 | gettext_noop ("Lookup a record for the given name"), |
429 | &lookup_name), | 439 | &lookup_name)), |
430 | |||
431 | GNUNET_GETOPT_option_string ('t', | 440 | GNUNET_GETOPT_option_string ('t', |
432 | "type", | 441 | "type", |
433 | "TYPE", | 442 | "TYPE", |
434 | gettext_noop ("Specify the type of the record to lookup"), | 443 | gettext_noop ("Specify the type of the record to lookup"), |
435 | &lookup_type), | 444 | &lookup_type), |
436 | |||
437 | GNUNET_GETOPT_option_relative_time ('T', | 445 | GNUNET_GETOPT_option_relative_time ('T', |
438 | "timeout", | 446 | "timeout", |
439 | "DELAY", | 447 | "DELAY", |
440 | gettext_noop ("Specify timeout for the lookup"), | 448 | gettext_noop ("Specify timeout for the lookup"), |
441 | &timeout), | 449 | &timeout), |
442 | |||
443 | GNUNET_GETOPT_option_flag ('r', | 450 | GNUNET_GETOPT_option_flag ('r', |
444 | "raw", | 451 | "raw", |
445 | gettext_noop ("No unneeded output"), | 452 | gettext_noop ("No unneeded output"), |
446 | &raw), | 453 | &raw), |
447 | |||
448 | GNUNET_GETOPT_option_string ('p', | ||
449 | "public-key", | ||
450 | "PKEY", | ||
451 | gettext_noop ("Specify the public key of the zone to lookup the record in"), | ||
452 | &public_key), | ||
453 | |||
454 | GNUNET_GETOPT_option_string ('z', | ||
455 | "zone", | ||
456 | "NAME", | ||
457 | gettext_noop ("Specify the name of the ego of the zone to lookup the record in"), | ||
458 | &zone_ego_name), | ||
459 | |||
460 | GNUNET_GETOPT_OPTION_END | 454 | GNUNET_GETOPT_OPTION_END |
461 | }; | 455 | }; |
462 | int ret; | 456 | int ret; |
463 | 457 | ||
464 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 458 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
465 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, | 459 | if (GNUNET_OK != |
466 | &argc, &argv)) | 460 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
461 | &argc, &argv)) | ||
467 | return 2; | 462 | return 2; |
468 | 463 | ||
469 | GNUNET_log_setup ("gnunet-gns", | 464 | GNUNET_log_setup ("gnunet-gns", |
470 | "WARNING", | 465 | "WARNING", |
471 | NULL); | 466 | NULL); |
472 | ret = | 467 | ret = GNUNET_PROGRAM_run (argc, argv, |
473 | (GNUNET_OK == | 468 | "gnunet-gns", |
474 | GNUNET_PROGRAM_run (argc, argv, | 469 | _("GNUnet GNS resolver tool"), |
475 | "gnunet-gns", | 470 | options, |
476 | _("GNUnet GNS resolver tool"), | 471 | &run, NULL); |
477 | options, | ||
478 | &run, NULL)) ? 0 : 1; | ||
479 | GNUNET_free ((void*) argv); | 472 | GNUNET_free ((void*) argv); |
480 | return ret; | 473 | if (GNUNET_OK != ret) |
474 | return 1; | ||
475 | return global_ret; | ||
481 | } | 476 | } |
482 | 477 | ||
483 | /* end of gnunet-gns.c */ | 478 | /* end of gnunet-gns.c */ |
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index e13beb889..90cd47e1d 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011-2013 GNUnet e.V. | 3 | Copyright (C) 2011-2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_dnsparser_lib.h" | 29 | #include "gnunet_dnsparser_lib.h" |
30 | #include "gnunet_dht_service.h" | 30 | #include "gnunet_dht_service.h" |
31 | #include "gnunet_namecache_service.h" | 31 | #include "gnunet_namecache_service.h" |
32 | #include "gnunet_identity_service.h" | 32 | #include "gnunet_gnsrecord_lib.h" |
33 | #include "gnunet_gns_service.h" | 33 | #include "gnunet_gns_service.h" |
34 | #include "gnunet_statistics_service.h" | 34 | #include "gnunet_statistics_service.h" |
35 | #include "gns.h" | 35 | #include "gns.h" |
@@ -44,7 +44,7 @@ | |||
44 | struct GnsClient; | 44 | struct GnsClient; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Handle to a lookup operation from api | 47 | * Handle to a lookup operation from client via API. |
48 | */ | 48 | */ |
49 | struct ClientLookupHandle | 49 | struct ClientLookupHandle |
50 | { | 50 | { |
@@ -76,6 +76,10 @@ struct ClientLookupHandle | |||
76 | 76 | ||
77 | }; | 77 | }; |
78 | 78 | ||
79 | |||
80 | /** | ||
81 | * Information we track per connected client. | ||
82 | */ | ||
79 | struct GnsClient | 83 | struct GnsClient |
80 | { | 84 | { |
81 | /** | 85 | /** |
@@ -122,7 +126,7 @@ struct GNS_TopLevelDomain | |||
122 | /** | 126 | /** |
123 | * Public key associated with the @a tld. | 127 | * Public key associated with the @a tld. |
124 | */ | 128 | */ |
125 | struct GNUNET_CRYPTO_EddsaPublicKey pkey; | 129 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
126 | 130 | ||
127 | /** | 131 | /** |
128 | * Top-level domain as a string, including leading ".". | 132 | * Top-level domain as a string, including leading ".". |
@@ -143,17 +147,6 @@ static struct GNUNET_DHT_Handle *dht_handle; | |||
143 | static struct GNUNET_NAMECACHE_Handle *namecache_handle; | 147 | static struct GNUNET_NAMECACHE_Handle *namecache_handle; |
144 | 148 | ||
145 | /** | 149 | /** |
146 | * Our handle to the identity service | ||
147 | */ | ||
148 | static struct GNUNET_IDENTITY_Handle *identity_handle; | ||
149 | |||
150 | /** | ||
151 | * Our handle to the identity operation to find the master zone | ||
152 | * for intercepted queries. | ||
153 | */ | ||
154 | static struct GNUNET_IDENTITY_Operation *identity_op; | ||
155 | |||
156 | /** | ||
157 | * #GNUNET_YES if ipv6 is supported | 150 | * #GNUNET_YES if ipv6 is supported |
158 | */ | 151 | */ |
159 | static int v6_enabled; | 152 | static int v6_enabled; |
@@ -188,7 +181,7 @@ static struct GNS_TopLevelDomain *tld_tail; | |||
188 | */ | 181 | */ |
189 | int | 182 | int |
190 | GNS_find_tld (const char *tld_str, | 183 | GNS_find_tld (const char *tld_str, |
191 | struct GNUNET_CRYPTO_EddsaPublicKey *pkey) | 184 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) |
192 | { | 185 | { |
193 | if ('\0' == *tld_str) | 186 | if ('\0' == *tld_str) |
194 | return GNUNET_NO; | 187 | return GNUNET_NO; |
@@ -204,16 +197,36 @@ GNS_find_tld (const char *tld_str, | |||
204 | } | 197 | } |
205 | } | 198 | } |
206 | if (GNUNET_OK == | 199 | if (GNUNET_OK == |
207 | GNUNET_STRINGS_string_to_data (tld_str + 1, | 200 | GNUNET_GNSRECORD_zkey_to_pkey (tld_str + 1, |
208 | strlen (tld_str + 1), | 201 | pkey)) |
209 | pkey, | ||
210 | sizeof (*pkey))) | ||
211 | return GNUNET_YES; /* TLD string *was* the public key */ | 202 | return GNUNET_YES; /* TLD string *was* the public key */ |
212 | return GNUNET_NO; | 203 | return GNUNET_NO; |
213 | } | 204 | } |
214 | 205 | ||
215 | 206 | ||
216 | /** | 207 | /** |
208 | * Obtain the TLD of the given @a name. | ||
209 | * | ||
210 | * @param name a name | ||
211 | * @return the part of @a name after the last ".", | ||
212 | * or @a name if @a name does not contain a "." | ||
213 | */ | ||
214 | const char * | ||
215 | GNS_get_tld (const char *name) | ||
216 | { | ||
217 | const char *tld; | ||
218 | |||
219 | tld = strrchr (name, | ||
220 | (unsigned char) '.'); | ||
221 | if (NULL == tld) | ||
222 | tld = name; | ||
223 | else | ||
224 | tld++; /* skip the '.' */ | ||
225 | return tld; | ||
226 | } | ||
227 | |||
228 | |||
229 | /** | ||
217 | * Task run during shutdown. | 230 | * Task run during shutdown. |
218 | * | 231 | * |
219 | * @param cls unused | 232 | * @param cls unused |
@@ -223,19 +236,10 @@ static void | |||
223 | shutdown_task (void *cls) | 236 | shutdown_task (void *cls) |
224 | { | 237 | { |
225 | struct GNS_TopLevelDomain *tld; | 238 | struct GNS_TopLevelDomain *tld; |
239 | |||
226 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 240 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
227 | "Shutting down!\n"); | 241 | "Shutting down!\n"); |
228 | GNS_interceptor_done (); | 242 | GNS_interceptor_done (); |
229 | if (NULL != identity_op) | ||
230 | { | ||
231 | GNUNET_IDENTITY_cancel (identity_op); | ||
232 | identity_op = NULL; | ||
233 | } | ||
234 | if (NULL != identity_handle) | ||
235 | { | ||
236 | GNUNET_IDENTITY_disconnect (identity_handle); | ||
237 | identity_handle = NULL; | ||
238 | } | ||
239 | GNS_resolver_done (); | 243 | GNS_resolver_done (); |
240 | if (NULL != statistics) | 244 | if (NULL != statistics) |
241 | { | 245 | { |
@@ -415,7 +419,8 @@ handle_lookup (void *cls, | |||
415 | 419 | ||
416 | GNUNET_SERVICE_client_continue (gc->client); | 420 | GNUNET_SERVICE_client_continue (gc->client); |
417 | utf_in = (const char *) &sh_msg[1]; | 421 | utf_in = (const char *) &sh_msg[1]; |
418 | GNUNET_STRINGS_utf8_tolower (utf_in, nameptr); | 422 | GNUNET_STRINGS_utf8_tolower (utf_in, |
423 | nameptr); | ||
419 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 424 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
420 | "Received LOOKUP `%s' message\n", | 425 | "Received LOOKUP `%s' message\n", |
421 | name); | 426 | name); |
@@ -431,7 +436,9 @@ handle_lookup (void *cls, | |||
431 | { | 436 | { |
432 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 437 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
433 | "LOOKUP: Query for A record but AF_INET not supported!"); | 438 | "LOOKUP: Query for A record but AF_INET not supported!"); |
434 | send_lookup_response (clh, 0, NULL); | 439 | send_lookup_response (clh, |
440 | 0, | ||
441 | NULL); | ||
435 | return; | 442 | return; |
436 | } | 443 | } |
437 | if ( (GNUNET_DNSPARSER_TYPE_AAAA == ntohl (sh_msg->type)) && | 444 | if ( (GNUNET_DNSPARSER_TYPE_AAAA == ntohl (sh_msg->type)) && |
@@ -439,7 +446,9 @@ handle_lookup (void *cls, | |||
439 | { | 446 | { |
440 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
441 | "LOOKUP: Query for AAAA record but AF_INET6 not supported!"); | 448 | "LOOKUP: Query for AAAA record but AF_INET6 not supported!"); |
442 | send_lookup_response (clh, 0, NULL); | 449 | send_lookup_response (clh, |
450 | 0, | ||
451 | NULL); | ||
443 | return; | 452 | return; |
444 | } | 453 | } |
445 | clh->lookup = GNS_resolver_lookup (&sh_msg->zone, | 454 | clh->lookup = GNS_resolver_lookup (&sh_msg->zone, |
@@ -454,57 +463,6 @@ handle_lookup (void *cls, | |||
454 | 463 | ||
455 | 464 | ||
456 | /** | 465 | /** |
457 | * Method called to inform about the ego to be used for the master zone | ||
458 | * for DNS interceptions. | ||
459 | * | ||
460 | * This function is only called ONCE, and 'NULL' being passed in | ||
461 | * @a ego does indicate that interception is not configured. | ||
462 | * If @a ego is non-NULL, we should start to intercept DNS queries | ||
463 | * and resolve ".gnu" queries using the given ego as the master zone. | ||
464 | * | ||
465 | * @param cls closure, our `const struct GNUNET_CONFIGURATION_Handle *c` | ||
466 | * @param ego ego handle | ||
467 | * @param ctx context for application to store data for this ego | ||
468 | * (during the lifetime of this process, initially NULL) | ||
469 | * @param name name assigned by the user for this ego, | ||
470 | * NULL if the user just deleted the ego and it | ||
471 | * must thus no longer be used | ||
472 | */ | ||
473 | static void | ||
474 | identity_intercept_cb (void *cls, | ||
475 | struct GNUNET_IDENTITY_Ego *ego, | ||
476 | void **ctx, | ||
477 | const char *name) | ||
478 | { | ||
479 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | ||
480 | struct GNUNET_CRYPTO_EcdsaPublicKey dns_root; | ||
481 | |||
482 | identity_op = NULL; | ||
483 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
484 | "Looking for gns-intercept ego\n"); | ||
485 | if (NULL == ego) | ||
486 | { | ||
487 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
488 | _("No ego configured for `%s`\n"), | ||
489 | "gns-intercept"); | ||
490 | |||
491 | return; | ||
492 | } | ||
493 | GNUNET_IDENTITY_ego_get_public_key (ego, | ||
494 | &dns_root); | ||
495 | if (GNUNET_SYSERR == | ||
496 | GNS_interceptor_init (&dns_root, | ||
497 | cfg)) | ||
498 | { | ||
499 | GNUNET_break (0); | ||
500 | GNUNET_SCHEDULER_add_now (&shutdown_task, | ||
501 | NULL); | ||
502 | return; | ||
503 | } | ||
504 | } | ||
505 | |||
506 | |||
507 | /** | ||
508 | * Reads the configuration and populates TLDs | 466 | * Reads the configuration and populates TLDs |
509 | * | 467 | * |
510 | * @param cls unused | 468 | * @param cls unused |
@@ -518,7 +476,7 @@ read_service_conf (void *cls, | |||
518 | const char *option, | 476 | const char *option, |
519 | const char *value) | 477 | const char *value) |
520 | { | 478 | { |
521 | struct GNUNET_CRYPTO_EddsaPublicKey pk; | 479 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; |
522 | struct GNS_TopLevelDomain *tld; | 480 | struct GNS_TopLevelDomain *tld; |
523 | 481 | ||
524 | if (option[0] != '.') | 482 | if (option[0] != '.') |
@@ -536,7 +494,7 @@ read_service_conf (void *cls, | |||
536 | return; | 494 | return; |
537 | } | 495 | } |
538 | tld = GNUNET_new (struct GNS_TopLevelDomain); | 496 | tld = GNUNET_new (struct GNS_TopLevelDomain); |
539 | tld->tld = GNUNET_strdup (option); | 497 | tld->tld = GNUNET_strdup (&option[1]); |
540 | tld->pkey = pk; | 498 | tld->pkey = pk; |
541 | GNUNET_CONTAINER_DLL_insert (tld_head, | 499 | GNUNET_CONTAINER_DLL_insert (tld_head, |
542 | tld_tail, | 500 | tld_tail, |
@@ -544,7 +502,6 @@ read_service_conf (void *cls, | |||
544 | } | 502 | } |
545 | 503 | ||
546 | 504 | ||
547 | |||
548 | /** | 505 | /** |
549 | * Process GNS requests. | 506 | * Process GNS requests. |
550 | * | 507 | * |
@@ -593,29 +550,24 @@ run (void *cls, | |||
593 | NULL); | 550 | NULL); |
594 | return; | 551 | return; |
595 | } | 552 | } |
596 | |||
597 | identity_handle = GNUNET_IDENTITY_connect (c, | ||
598 | NULL, | ||
599 | NULL); | ||
600 | if (NULL == identity_handle) | ||
601 | { | ||
602 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
603 | "Could not connect to identity service!\n"); | ||
604 | } | ||
605 | else | ||
606 | { | ||
607 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
608 | "Looking for gns-intercept ego\n"); | ||
609 | identity_op = GNUNET_IDENTITY_get (identity_handle, | ||
610 | "gns-intercept", | ||
611 | &identity_intercept_cb, | ||
612 | (void *) c); | ||
613 | } | ||
614 | GNS_resolver_init (namecache_handle, | 553 | GNS_resolver_init (namecache_handle, |
615 | dht_handle, | 554 | dht_handle, |
616 | c, | 555 | c, |
617 | max_parallel_bg_queries); | 556 | max_parallel_bg_queries); |
618 | statistics = GNUNET_STATISTICS_create ("gns", c); | 557 | if ( (GNUNET_YES == |
558 | GNUNET_CONFIGURATION_get_value_yesno (c, | ||
559 | "gns", | ||
560 | "INTERCEPT_DNS")) && | ||
561 | (GNUNET_SYSERR == | ||
562 | GNS_interceptor_init (c)) ) | ||
563 | { | ||
564 | GNUNET_break (0); | ||
565 | GNUNET_SCHEDULER_add_now (&shutdown_task, | ||
566 | NULL); | ||
567 | return; | ||
568 | } | ||
569 | statistics = GNUNET_STATISTICS_create ("gns", | ||
570 | c); | ||
619 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 571 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
620 | NULL); | 572 | NULL); |
621 | } | 573 | } |
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h index 3662c945d..439bad881 100644 --- a/src/gns/gnunet-service-gns.h +++ b/src/gns/gnunet-service-gns.h | |||
@@ -23,10 +23,10 @@ | |||
23 | * @author Martin Schanzenbach | 23 | * @author Martin Schanzenbach |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | |||
27 | #ifndef GNUNET_SERVICE_GNS_H | 26 | #ifndef GNUNET_SERVICE_GNS_H |
28 | #define GNUNET_SERVICE_GNS_H | 27 | #define GNUNET_SERVICE_GNS_H |
29 | 28 | ||
29 | |||
30 | /** | 30 | /** |
31 | * Find GNS zone belonging to TLD @a tld. | 31 | * Find GNS zone belonging to TLD @a tld. |
32 | * | 32 | * |
@@ -36,6 +36,18 @@ | |||
36 | */ | 36 | */ |
37 | int | 37 | int |
38 | GNS_find_tld (const char *tld_str, | 38 | GNS_find_tld (const char *tld_str, |
39 | struct GNUNET_CRYPTO_EddsaPublicKey *pkey); | 39 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); |
40 | |||
41 | |||
42 | /** | ||
43 | * Obtain the TLD of the given @a name. | ||
44 | * | ||
45 | * @param name a name | ||
46 | * @return the part of @a name after the last ".", | ||
47 | * or @a name if @a name does not contain a "." | ||
48 | */ | ||
49 | const char * | ||
50 | GNS_get_tld (const char *name); | ||
51 | |||
40 | 52 | ||
41 | #endif | 53 | #endif |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 71aa08dc5..0425e9500 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_dns_service.h" | 28 | #include "gnunet_dns_service.h" |
29 | #include "gnunet_dnsparser_lib.h" | 29 | #include "gnunet_dnsparser_lib.h" |
30 | #include "gnunet-service-gns.h" | ||
30 | #include "gnunet-service-gns_resolver.h" | 31 | #include "gnunet-service-gns_resolver.h" |
31 | #include "gnunet-service-gns_interceptor.h" | 32 | #include "gnunet-service-gns_interceptor.h" |
32 | #include "gns.h" | 33 | #include "gns.h" |
@@ -73,11 +74,6 @@ struct InterceptLookupHandle | |||
73 | static struct GNUNET_DNS_Handle *dns_handle; | 74 | static struct GNUNET_DNS_Handle *dns_handle; |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * Key of the zone we start lookups in. | ||
77 | */ | ||
78 | static struct GNUNET_CRYPTO_EcdsaPublicKey zone; | ||
79 | |||
80 | /** | ||
81 | * Head of the DLL. | 77 | * Head of the DLL. |
82 | */ | 78 | */ |
83 | static struct InterceptLookupHandle *ilh_head; | 79 | static struct InterceptLookupHandle *ilh_head; |
@@ -298,6 +294,7 @@ handle_dns_request (void *cls, | |||
298 | { | 294 | { |
299 | struct GNUNET_DNSPARSER_Packet *p; | 295 | struct GNUNET_DNSPARSER_Packet *p; |
300 | struct InterceptLookupHandle *ilh; | 296 | struct InterceptLookupHandle *ilh; |
297 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | ||
301 | 298 | ||
302 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
303 | "Hijacked a DNS request. Processing.\n"); | 300 | "Hijacked a DNS request. Processing.\n"); |
@@ -321,9 +318,9 @@ handle_dns_request (void *cls, | |||
321 | } | 318 | } |
322 | 319 | ||
323 | /* Check for GNS TLDs. */ | 320 | /* Check for GNS TLDs. */ |
324 | if ( (GNUNET_YES == is_gnu_tld (p->queries[0].name)) || | 321 | if (GNUNET_YES == |
325 | (GNUNET_YES == is_zkey_tld (p->queries[0].name)) || | 322 | GNS_find_tld (GNS_get_tld (p->queries[0].name), |
326 | (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) ) | 323 | &zone)) |
327 | { | 324 | { |
328 | /* Start resolution in GNS */ | 325 | /* Start resolution in GNS */ |
329 | ilh = GNUNET_new (struct InterceptLookupHandle); | 326 | ilh = GNUNET_new (struct InterceptLookupHandle); |
@@ -351,17 +348,14 @@ handle_dns_request (void *cls, | |||
351 | /** | 348 | /** |
352 | * Initialized the interceptor | 349 | * Initialized the interceptor |
353 | * | 350 | * |
354 | * @param gnu_zone the zone to work in | ||
355 | * @param c the configuration | 351 | * @param c the configuration |
356 | * @return #GNUNET_OK on success | 352 | * @return #GNUNET_OK on success |
357 | */ | 353 | */ |
358 | int | 354 | int |
359 | GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone, | 355 | GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c) |
360 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
361 | { | 356 | { |
362 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 357 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
363 | "DNS hijacking enabled. Connecting to DNS service.\n"); | 358 | "DNS hijacking enabled. Connecting to DNS service.\n"); |
364 | zone = *gnu_zone; | ||
365 | dns_handle = GNUNET_DNS_connect (c, | 359 | dns_handle = GNUNET_DNS_connect (c, |
366 | GNUNET_DNS_FLAG_PRE_RESOLUTION, | 360 | GNUNET_DNS_FLAG_PRE_RESOLUTION, |
367 | &handle_dns_request, | 361 | &handle_dns_request, |
@@ -386,7 +380,9 @@ GNS_interceptor_done () | |||
386 | 380 | ||
387 | while (NULL != (ilh = ilh_head)) | 381 | while (NULL != (ilh = ilh_head)) |
388 | { | 382 | { |
389 | GNUNET_CONTAINER_DLL_remove (ilh_head, ilh_tail, ilh); | 383 | GNUNET_CONTAINER_DLL_remove (ilh_head, |
384 | ilh_tail, | ||
385 | ilh); | ||
390 | GNS_resolver_lookup_cancel (ilh->lookup); | 386 | GNS_resolver_lookup_cancel (ilh->lookup); |
391 | GNUNET_DNS_request_drop (ilh->request_handle); | 387 | GNUNET_DNS_request_drop (ilh->request_handle); |
392 | GNUNET_DNSPARSER_free_packet (ilh->packet); | 388 | GNUNET_DNSPARSER_free_packet (ilh->packet); |
diff --git a/src/gns/gnunet-service-gns_interceptor.h b/src/gns/gnunet-service-gns_interceptor.h index 73d349854..ff54b7b6e 100644 --- a/src/gns/gnunet-service-gns_interceptor.h +++ b/src/gns/gnunet-service-gns_interceptor.h | |||
@@ -31,13 +31,11 @@ | |||
31 | /** | 31 | /** |
32 | * Initialize DNS interceptor | 32 | * Initialize DNS interceptor |
33 | * | 33 | * |
34 | * @param gnu_zone the zone we start lookups in | ||
35 | * @param c the configuration | 34 | * @param c the configuration |
36 | * @return GNUNET_YES on success GNUNET_SYSERR on error | 35 | * @return #GNUNET_YES on success #GNUNET_SYSERR on error |
37 | */ | 36 | */ |
38 | int | 37 | int |
39 | GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone, | 38 | GNS_interceptor_init (const struct GNUNET_CONFIGURATION_Handle *c); |
40 | const struct GNUNET_CONFIGURATION_Handle *c); | ||
41 | 39 | ||
42 | /** | 40 | /** |
43 | * Stops the interceptor | 41 | * Stops the interceptor |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 533c0cada..ef191bbb3 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "gnunet_tun_lib.h" | 37 | #include "gnunet_tun_lib.h" |
38 | #include "gnunet_gns_service.h" | 38 | #include "gnunet_gns_service.h" |
39 | #include "gns.h" | 39 | #include "gns.h" |
40 | #include "gnunet-service-gns.h" | ||
40 | #include "gnunet-service-gns_resolver.h" | 41 | #include "gnunet-service-gns_resolver.h" |
41 | #include "gnunet_vpn_service.h" | 42 | #include "gnunet_vpn_service.h" |
42 | 43 | ||
@@ -237,6 +238,10 @@ struct Gns2DnsContext | |||
237 | */ | 238 | */ |
238 | struct GNS_ResolverHandle *rh; | 239 | struct GNS_ResolverHandle *rh; |
239 | 240 | ||
241 | /** | ||
242 | * Handle for DNS resolution of the DNS nameserver. | ||
243 | */ | ||
244 | struct GNUNET_RESOLVER_RequestHandle *dns_rh; | ||
240 | }; | 245 | }; |
241 | 246 | ||
242 | 247 | ||
@@ -473,7 +478,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
473 | * even though they consist of multiple labels. | 478 | * even though they consist of multiple labels. |
474 | * | 479 | * |
475 | * Examples: | 480 | * Examples: |
476 | * a.b.gnu = not canonical | 481 | * a.b.gnu = not canonical |
477 | * a = canonical | 482 | * a = canonical |
478 | * _foo._srv = canonical | 483 | * _foo._srv = canonical |
479 | * _f.bar = not canonical | 484 | * _f.bar = not canonical |
@@ -481,18 +486,20 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
481 | * @param name the name to test | 486 | * @param name the name to test |
482 | * @return #GNUNET_YES if canonical | 487 | * @return #GNUNET_YES if canonical |
483 | */ | 488 | */ |
484 | static int | 489 | /* dead, but keep for now */ int |
485 | is_canonical (const char *name) | 490 | is_canonical (const char *name) |
486 | { | 491 | { |
487 | const char *pos; | 492 | const char *pos; |
488 | const char *dot; | 493 | const char *dot; |
489 | 494 | ||
490 | if (NULL == strchr (name, '.')) | 495 | if (NULL == strchr (name, |
496 | (unsigned char) '.')) | ||
491 | return GNUNET_YES; | 497 | return GNUNET_YES; |
492 | if ('_' != name[0]) | 498 | if ('_' != name[0]) |
493 | return GNUNET_NO; | 499 | return GNUNET_NO; |
494 | pos = &name[1]; | 500 | pos = &name[1]; |
495 | while (NULL != (dot = strchr (pos, '.'))) | 501 | while (NULL != (dot = strchr (pos, |
502 | (unsigned char) '.'))) | ||
496 | if ('_' != dot[1]) | 503 | if ('_' != dot[1]) |
497 | return GNUNET_NO; | 504 | return GNUNET_NO; |
498 | else | 505 | else |
@@ -857,11 +864,31 @@ dns_result_parser (void *cls, | |||
857 | (GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) && | 864 | (GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) && |
858 | (GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) ) | 865 | (GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) ) |
859 | { | 866 | { |
867 | int af; | ||
868 | |||
860 | GNUNET_free (rh->name); | 869 | GNUNET_free (rh->name); |
861 | rh->name = GNUNET_strdup (p->answers[0].data.hostname); | 870 | rh->name = GNUNET_strdup (p->answers[0].data.hostname); |
862 | rh->name_resolution_pos = strlen (rh->name); | 871 | rh->name_resolution_pos = strlen (rh->name); |
863 | rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, | 872 | switch (rh->record_type) |
864 | rh); | 873 | { |
874 | case GNUNET_DNSPARSER_TYPE_A: | ||
875 | af = AF_INET; | ||
876 | break; | ||
877 | case GNUNET_DNSPARSER_TYPE_AAAA: | ||
878 | af = AF_INET6; | ||
879 | break; | ||
880 | default: | ||
881 | af = AF_UNSPEC; | ||
882 | break; | ||
883 | } | ||
884 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
885 | "Doing standard DNS lookup for `%s'\n", | ||
886 | rh->name); | ||
887 | rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, | ||
888 | af, | ||
889 | DNS_LOOKUP_TIMEOUT, | ||
890 | &handle_dns_result, | ||
891 | rh); | ||
865 | GNUNET_DNSPARSER_free_packet (p); | 892 | GNUNET_DNSPARSER_free_packet (p); |
866 | return; | 893 | return; |
867 | } | 894 | } |
@@ -944,9 +971,9 @@ dns_result_parser (void *cls, | |||
944 | buf_start = buf_off; | 971 | buf_start = buf_off; |
945 | if (GNUNET_OK != | 972 | if (GNUNET_OK != |
946 | GNUNET_DNSPARSER_builder_add_soa (buf, | 973 | GNUNET_DNSPARSER_builder_add_soa (buf, |
947 | sizeof (buf), | 974 | sizeof (buf), |
948 | &buf_off, | 975 | &buf_off, |
949 | rec->data.soa)) | 976 | rec->data.soa)) |
950 | { | 977 | { |
951 | GNUNET_break (0); | 978 | GNUNET_break (0); |
952 | skip++; | 979 | skip++; |
@@ -997,7 +1024,9 @@ dns_result_parser (void *cls, | |||
997 | "Returning DNS response for `%s' with %u answers\n", | 1024 | "Returning DNS response for `%s' with %u answers\n", |
998 | rh->ac_tail->label, | 1025 | rh->ac_tail->label, |
999 | (unsigned int) p->num_answers); | 1026 | (unsigned int) p->num_answers); |
1000 | rh->proc (rh->proc_cls, rd_count - skip, rd); | 1027 | rh->proc (rh->proc_cls, |
1028 | rd_count - skip, | ||
1029 | rd); | ||
1001 | GNS_resolver_lookup_cancel (rh); | 1030 | GNS_resolver_lookup_cancel (rh); |
1002 | } | 1031 | } |
1003 | GNUNET_DNSPARSER_free_packet (p); | 1032 | GNUNET_DNSPARSER_free_packet (p); |
@@ -1100,6 +1129,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1100 | size_t nlen; | 1129 | size_t nlen; |
1101 | char *res; | 1130 | char *res; |
1102 | struct AuthorityChain *ac; | 1131 | struct AuthorityChain *ac; |
1132 | int af; | ||
1103 | 1133 | ||
1104 | nlen = strlen (cname); | 1134 | nlen = strlen (cname); |
1105 | if ( (nlen > 2) && | 1135 | if ( (nlen > 2) && |
@@ -1139,12 +1169,30 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1139 | rh); | 1169 | rh); |
1140 | return; | 1170 | return; |
1141 | } | 1171 | } |
1142 | /* name is absolute, start from the beginning */ | 1172 | /* name is absolute, go to DNS */ |
1143 | GNUNET_free (rh->name); | 1173 | GNUNET_free (rh->name); |
1144 | rh->name = GNUNET_strdup (cname); | 1174 | rh->name = GNUNET_strdup (cname); |
1145 | rh->name_resolution_pos = strlen (rh->name); | 1175 | rh->name_resolution_pos = strlen (rh->name); |
1146 | rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, | 1176 | switch (rh->record_type) |
1147 | rh); | 1177 | { |
1178 | case GNUNET_DNSPARSER_TYPE_A: | ||
1179 | af = AF_INET; | ||
1180 | break; | ||
1181 | case GNUNET_DNSPARSER_TYPE_AAAA: | ||
1182 | af = AF_INET6; | ||
1183 | break; | ||
1184 | default: | ||
1185 | af = AF_UNSPEC; | ||
1186 | break; | ||
1187 | } | ||
1188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1189 | "Doing standard DNS lookup for `%s'\n", | ||
1190 | rh->name); | ||
1191 | rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, | ||
1192 | af, | ||
1193 | DNS_LOOKUP_TIMEOUT, | ||
1194 | &handle_dns_result, | ||
1195 | rh); | ||
1148 | } | 1196 | } |
1149 | 1197 | ||
1150 | 1198 | ||
@@ -1247,7 +1295,6 @@ handle_gns2dns_result (void *cls, | |||
1247 | { | 1295 | { |
1248 | struct GNS_ResolverHandle *rh = cls; | 1296 | struct GNS_ResolverHandle *rh = cls; |
1249 | struct AuthorityChain *ac; | 1297 | struct AuthorityChain *ac; |
1250 | unsigned int j; | ||
1251 | struct sockaddr *sa; | 1298 | struct sockaddr *sa; |
1252 | struct sockaddr_in v4; | 1299 | struct sockaddr_in v4; |
1253 | struct sockaddr_in6 v6; | 1300 | struct sockaddr_in6 v6; |
@@ -1258,13 +1305,16 @@ handle_gns2dns_result (void *cls, | |||
1258 | "Received %u results for IP address of DNS server for GNS2DNS transition\n", | 1305 | "Received %u results for IP address of DNS server for GNS2DNS transition\n", |
1259 | rd_count); | 1306 | rd_count); |
1260 | /* enable cleanup of 'rh' handle that comes next... */ | 1307 | /* enable cleanup of 'rh' handle that comes next... */ |
1261 | GNUNET_CONTAINER_DLL_insert (rlh_head, | 1308 | if (NULL != rh->g2dc->rh) |
1262 | rlh_tail, | 1309 | { |
1263 | rh->g2dc->rh); | 1310 | GNUNET_CONTAINER_DLL_insert (rlh_head, |
1264 | rh->g2dc->rh = NULL; | 1311 | rlh_tail, |
1312 | rh->g2dc->rh); | ||
1313 | rh->g2dc->rh = NULL; | ||
1314 | } | ||
1265 | sa = NULL; | 1315 | sa = NULL; |
1266 | sa_len = 0; | 1316 | sa_len = 0; |
1267 | for (j=0;j<rd_count;j++) | 1317 | for (unsigned int j=0;j<rd_count;j++) |
1268 | { | 1318 | { |
1269 | switch (rd[j].record_type) | 1319 | switch (rd[j].record_type) |
1270 | { | 1320 | { |
@@ -1348,7 +1398,8 @@ handle_gns2dns_result (void *cls, | |||
1348 | rh->g2dc = NULL; | 1398 | rh->g2dc = NULL; |
1349 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1399 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1350 | "Will continue resolution using DNS server `%s' to resolve `%s'\n", | 1400 | "Will continue resolution using DNS server `%s' to resolve `%s'\n", |
1351 | GNUNET_a2s (sa, sa_len), | 1401 | GNUNET_a2s (sa, |
1402 | sa_len), | ||
1352 | ac->label); | 1403 | ac->label); |
1353 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 1404 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
1354 | rh->ac_tail, | 1405 | rh->ac_tail, |
@@ -1369,6 +1420,69 @@ handle_gns2dns_result (void *cls, | |||
1369 | 1420 | ||
1370 | 1421 | ||
1371 | /** | 1422 | /** |
1423 | * Function called by the resolver for each address obtained from DNS. | ||
1424 | * | ||
1425 | * @param cls closure, a `struct Gns2DnsContext *` | ||
1426 | * @param addr one of the addresses of the host, NULL for the last address | ||
1427 | * @param addrlen length of @a addr | ||
1428 | */ | ||
1429 | static void | ||
1430 | handle_gns2dns_ip (void *cls, | ||
1431 | const struct sockaddr *addr, | ||
1432 | socklen_t addrlen) | ||
1433 | { | ||
1434 | struct Gns2DnsContext *g2dc = cls; | ||
1435 | struct GNUNET_GNSRECORD_Data rd; | ||
1436 | |||
1437 | if (NULL == addr) | ||
1438 | { | ||
1439 | /* DNS resolution failed */ | ||
1440 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1441 | "Failed to use DNS to resolve name of DNS resolver\n"); | ||
1442 | g2dc->rh->g2dc = NULL; | ||
1443 | fail_resolution (g2dc->rh); | ||
1444 | GNUNET_free (g2dc); | ||
1445 | } | ||
1446 | switch (addr->sa_family) | ||
1447 | { | ||
1448 | case AF_INET: | ||
1449 | { | ||
1450 | const struct sockaddr_in *v4 = (const struct sockaddr_in *) addr; | ||
1451 | |||
1452 | GNUNET_assert (sizeof (*v4) == addrlen); | ||
1453 | rd.data = v4; | ||
1454 | rd.data_size = sizeof (*v4); | ||
1455 | rd.expiration_time = UINT64_MAX; | ||
1456 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; | ||
1457 | rd.flags = 0; | ||
1458 | break; | ||
1459 | } | ||
1460 | case AF_INET6: | ||
1461 | { | ||
1462 | const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *) addr; | ||
1463 | |||
1464 | GNUNET_assert (sizeof (*v6) == addrlen); | ||
1465 | rd.data = v6; | ||
1466 | rd.data_size = sizeof (v6); | ||
1467 | rd.expiration_time = UINT64_MAX; | ||
1468 | rd.record_type = GNUNET_DNSPARSER_TYPE_AAAA; | ||
1469 | rd.flags = 0; | ||
1470 | break; | ||
1471 | } | ||
1472 | default: | ||
1473 | return; | ||
1474 | } | ||
1475 | GNUNET_RESOLVER_request_cancel (g2dc->dns_rh); | ||
1476 | g2dc->dns_rh = NULL; | ||
1477 | handle_gns2dns_result (g2dc->rh, | ||
1478 | 1, | ||
1479 | &rd); | ||
1480 | |||
1481 | } | ||
1482 | |||
1483 | |||
1484 | |||
1485 | /** | ||
1372 | * Process a records that were decrypted from a block. | 1486 | * Process a records that were decrypted from a block. |
1373 | * | 1487 | * |
1374 | * @param cls closure with the `struct GNS_ResolverHandle` | 1488 | * @param cls closure with the `struct GNS_ResolverHandle` |
@@ -1513,7 +1627,7 @@ handle_gns_resolution_result (void *cls, | |||
1513 | rd_new[rd_off] = rd[i]; | 1627 | rd_new[rd_off] = rd[i]; |
1514 | /* Check if the embedded name(s) end in "+", and if so, | 1628 | /* Check if the embedded name(s) end in "+", and if so, |
1515 | replace the "+" with the zone at "ac_tail", changing the name | 1629 | replace the "+" with the zone at "ac_tail", changing the name |
1516 | to a ".zkey". The name is allocated on the 'scratch' array, | 1630 | to a ".ZONEKEY". The name is allocated on the 'scratch' array, |
1517 | so we can free it afterwards. */ | 1631 | so we can free it afterwards. */ |
1518 | switch (rd[i].record_type) | 1632 | switch (rd[i].record_type) |
1519 | { | 1633 | { |
@@ -1760,7 +1874,9 @@ handle_gns_resolution_result (void *cls, | |||
1760 | "Returning GNS response for `%s' with %u answers\n", | 1874 | "Returning GNS response for `%s' with %u answers\n", |
1761 | rh->ac_tail->label, | 1875 | rh->ac_tail->label, |
1762 | rd_off); | 1876 | rd_off); |
1763 | rh->proc (rh->proc_cls, rd_off, rd_new); | 1877 | rh->proc (rh->proc_cls, |
1878 | rd_off, | ||
1879 | rd_new); | ||
1764 | GNS_resolver_lookup_cancel (rh); | 1880 | GNS_resolver_lookup_cancel (rh); |
1765 | return; | 1881 | return; |
1766 | } | 1882 | } |
@@ -1804,6 +1920,10 @@ handle_gns_resolution_result (void *cls, | |||
1804 | struct Gns2DnsContext *g2dc; | 1920 | struct Gns2DnsContext *g2dc; |
1805 | char *ip; | 1921 | char *ip; |
1806 | char *ns; | 1922 | char *ns; |
1923 | const char *tld; | ||
1924 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | ||
1925 | struct in_addr v4; | ||
1926 | struct in6_addr v6; | ||
1807 | 1927 | ||
1808 | off = 0; | 1928 | off = 0; |
1809 | ns = GNUNET_DNSPARSER_parse_name (rd[i].data, | 1929 | ns = GNUNET_DNSPARSER_parse_name (rd[i].data, |
@@ -1819,29 +1939,96 @@ handle_gns_resolution_result (void *cls, | |||
1819 | GNUNET_break_op (0); | 1939 | GNUNET_break_op (0); |
1820 | GNUNET_free_non_null (ns); | 1940 | GNUNET_free_non_null (ns); |
1821 | GNUNET_free_non_null (ip); | 1941 | GNUNET_free_non_null (ip); |
1822 | rh->proc (rh->proc_cls, 0, NULL); | 1942 | fail_resolution (rh); |
1823 | GNS_resolver_lookup_cancel (rh); | ||
1824 | return; | 1943 | return; |
1825 | } | 1944 | } |
1826 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1827 | "Resolving `%s' to determine IP address of DNS server for GNS2DNS transition\n", | ||
1828 | ip); | ||
1829 | /* resolve 'ip' to determine the IP(s) of the DNS | 1945 | /* resolve 'ip' to determine the IP(s) of the DNS |
1830 | resolver to use */ | 1946 | resolver to use for lookup of 'ns' */ |
1831 | g2dc = GNUNET_new (struct Gns2DnsContext); | 1947 | g2dc = GNUNET_new (struct Gns2DnsContext); |
1832 | g2dc->ns = ns; | 1948 | g2dc->ns = ns; |
1949 | rh->g2dc = g2dc; | ||
1950 | |||
1951 | /* check if 'ip' is already an IPv4/IPv6 address */ | ||
1952 | if (1 == inet_pton (AF_INET, | ||
1953 | ip, | ||
1954 | &v4)) | ||
1955 | { | ||
1956 | /* name is IPv4 address, pretend it's an A record */ | ||
1957 | struct GNUNET_GNSRECORD_Data rd; | ||
1958 | |||
1959 | GNUNET_free (ip); | ||
1960 | rd.data = &v4; | ||
1961 | rd.data_size = sizeof (v4); | ||
1962 | rd.expiration_time = UINT64_MAX; | ||
1963 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; | ||
1964 | rd.flags = 0; | ||
1965 | handle_gns2dns_result (rh, | ||
1966 | 1, | ||
1967 | &rd); | ||
1968 | return; | ||
1969 | } | ||
1970 | if (1 == inet_pton (AF_INET6, | ||
1971 | ip, | ||
1972 | &v6)) | ||
1973 | { | ||
1974 | /* name is IPv6 address, pretend it's an AAAA record */ | ||
1975 | struct GNUNET_GNSRECORD_Data rd; | ||
1976 | |||
1977 | GNUNET_free (ip); | ||
1978 | rd.data = &v6; | ||
1979 | rd.data_size = sizeof (v6); | ||
1980 | rd.expiration_time = UINT64_MAX; | ||
1981 | rd.record_type = GNUNET_DNSPARSER_TYPE_AAAA; | ||
1982 | rd.flags = 0; | ||
1983 | handle_gns2dns_result (rh, | ||
1984 | 1, | ||
1985 | &rd); | ||
1986 | return; | ||
1987 | } | ||
1833 | 1988 | ||
1989 | tld = GNS_get_tld (ip); | ||
1990 | if (0 != strcmp (tld, | ||
1991 | "+")) | ||
1992 | { | ||
1993 | /* 'ip' is a DNS name */ | ||
1994 | g2dc->dns_rh = GNUNET_RESOLVER_ip_get (ip, | ||
1995 | AF_UNSPEC, | ||
1996 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1997 | &handle_gns2dns_ip, | ||
1998 | g2dc); | ||
1999 | GNUNET_free (ip); | ||
2000 | return; | ||
2001 | } | ||
2002 | |||
2003 | /* 'ip' should be a GNS name */ | ||
1834 | g2dc->rh = GNUNET_new (struct GNS_ResolverHandle); | 2004 | g2dc->rh = GNUNET_new (struct GNS_ResolverHandle); |
1835 | g2dc->rh->authority_zone = rh->ac_tail->authority_info.gns_authority; | 2005 | |
1836 | ip = translate_dot_plus (rh, ip); | 2006 | ip = translate_dot_plus (rh, |
2007 | ip); | ||
2008 | tld = GNS_get_tld (ip); | ||
2009 | if (GNUNET_OK != | ||
2010 | GNUNET_GNSRECORD_zkey_to_pkey (tld, | ||
2011 | &zone)) | ||
2012 | { | ||
2013 | GNUNET_break_op (0); | ||
2014 | GNUNET_free_non_null (ns); | ||
2015 | GNUNET_free_non_null (ip); | ||
2016 | GNUNET_free (g2dc); | ||
2017 | fail_resolution (rh); | ||
2018 | return; | ||
2019 | } | ||
2020 | g2dc->rh->authority_zone = zone; | ||
2021 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2022 | "Resolving `%s' to determine IP address of DNS server for GNS2DNS transition for `%s'\n", | ||
2023 | ip, | ||
2024 | ns); | ||
1837 | g2dc->rh->name = ip; | 2025 | g2dc->rh->name = ip; |
1838 | g2dc->rh->name_resolution_pos = strlen (ip); | 2026 | g2dc->rh->name_resolution_pos = strlen (ip) - strlen (tld) - 1; |
1839 | g2dc->rh->proc = &handle_gns2dns_result; | 2027 | g2dc->rh->proc = &handle_gns2dns_result; |
1840 | g2dc->rh->proc_cls = rh; | 2028 | g2dc->rh->proc_cls = rh; |
1841 | g2dc->rh->record_type = GNUNET_GNSRECORD_TYPE_ANY; | 2029 | g2dc->rh->record_type = GNUNET_GNSRECORD_TYPE_ANY; |
1842 | g2dc->rh->options = GNUNET_GNS_LO_DEFAULT; | 2030 | g2dc->rh->options = GNUNET_GNS_LO_DEFAULT; |
1843 | g2dc->rh->loop_limiter = rh->loop_limiter + 1; | 2031 | g2dc->rh->loop_limiter = rh->loop_limiter + 1; |
1844 | rh->g2dc = g2dc; | ||
1845 | g2dc->rh->task_id | 2032 | g2dc->rh->task_id |
1846 | = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, | 2033 | = GNUNET_SCHEDULER_add_now (&start_resolver_lookup, |
1847 | g2dc->rh); | 2034 | g2dc->rh); |
@@ -2259,7 +2446,6 @@ start_resolver_lookup (void *cls) | |||
2259 | { | 2446 | { |
2260 | struct GNS_ResolverHandle *rh = cls; | 2447 | struct GNS_ResolverHandle *rh = cls; |
2261 | struct AuthorityChain *ac; | 2448 | struct AuthorityChain *ac; |
2262 | char *y; | ||
2263 | struct in_addr v4; | 2449 | struct in_addr v4; |
2264 | struct in6_addr v6; | 2450 | struct in6_addr v6; |
2265 | 2451 | ||
@@ -2296,66 +2482,14 @@ start_resolver_lookup (void *cls) | |||
2296 | GNS_resolver_lookup_cancel (rh); | 2482 | GNS_resolver_lookup_cancel (rh); |
2297 | return; | 2483 | return; |
2298 | } | 2484 | } |
2299 | if ( ( (GNUNET_YES == is_canonical (rh->name)) && | ||
2300 | (0 != strcmp (GNUNET_GNS_TLD, rh->name)) ) || | ||
2301 | ( (GNUNET_YES != is_gnu_tld (rh->name)) && | ||
2302 | (GNUNET_YES != is_zkey_tld (rh->name)) ) ) | ||
2303 | { | ||
2304 | /* use standard DNS lookup */ | ||
2305 | int af; | ||
2306 | 2485 | ||
2307 | switch (rh->record_type) | ||
2308 | { | ||
2309 | case GNUNET_DNSPARSER_TYPE_A: | ||
2310 | af = AF_INET; | ||
2311 | break; | ||
2312 | case GNUNET_DNSPARSER_TYPE_AAAA: | ||
2313 | af = AF_INET6; | ||
2314 | break; | ||
2315 | default: | ||
2316 | af = AF_UNSPEC; | ||
2317 | break; | ||
2318 | } | ||
2319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2320 | "Doing standard DNS lookup for `%s'\n", | ||
2321 | rh->name); | ||
2322 | rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, | ||
2323 | af, | ||
2324 | DNS_LOOKUP_TIMEOUT, | ||
2325 | &handle_dns_result, | ||
2326 | rh); | ||
2327 | return; | ||
2328 | } | ||
2329 | if (is_zkey_tld (rh->name)) | ||
2330 | { | ||
2331 | /* Name ends with ".zkey", try to replace authority zone with zkey | ||
2332 | authority */ | ||
2333 | GNUNET_free (resolver_lookup_get_next_label (rh)); /* will return "zkey" */ | ||
2334 | y = resolver_lookup_get_next_label (rh); /* will return 'y' coordinate */ | ||
2335 | if ( (NULL == y) || | ||
2336 | (GNUNET_OK != | ||
2337 | GNUNET_CRYPTO_ecdsa_public_key_from_string (y, | ||
2338 | strlen (y), | ||
2339 | &rh->authority_zone)) ) | ||
2340 | { | ||
2341 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2342 | _("Hostname `%s' is not well-formed, resolution fails\n"), | ||
2343 | rh->name); | ||
2344 | rh->task_id = GNUNET_SCHEDULER_add_now (&fail_resolution, rh); | ||
2345 | } | ||
2346 | GNUNET_free_non_null (y); | ||
2347 | } | ||
2348 | else | ||
2349 | { | ||
2350 | /* Name ends with ".gnu", eat ".gnu" and continue with resolution */ | ||
2351 | GNUNET_free (resolver_lookup_get_next_label (rh)); | ||
2352 | } | ||
2353 | ac = GNUNET_new (struct AuthorityChain); | 2486 | ac = GNUNET_new (struct AuthorityChain); |
2354 | ac->rh = rh; | 2487 | ac->rh = rh; |
2355 | ac->label = resolver_lookup_get_next_label (rh); | 2488 | ac->label = resolver_lookup_get_next_label (rh); |
2356 | ac->suggested_shortening_label = NULL; | 2489 | ac->suggested_shortening_label = NULL; |
2357 | if (NULL == ac->label) | 2490 | if (NULL == ac->label) |
2358 | /* name was just "gnu", so we default to label '+' */ | 2491 | /* name was just the "TLD", so we default to label |
2492 | #GNUNET_GNS_MASTERZONE_STR */ | ||
2359 | ac->label = GNUNET_strdup (GNUNET_GNS_MASTERZONE_STR); | 2493 | ac->label = GNUNET_strdup (GNUNET_GNS_MASTERZONE_STR); |
2360 | ac->gns_authority = GNUNET_YES; | 2494 | ac->gns_authority = GNUNET_YES; |
2361 | ac->authority_info.gns_authority = rh->authority_zone; | 2495 | ac->authority_info.gns_authority = rh->authority_zone; |
@@ -2446,6 +2580,11 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh) | |||
2446 | GNS_resolver_lookup_cancel (rh->g2dc->rh); | 2580 | GNS_resolver_lookup_cancel (rh->g2dc->rh); |
2447 | rh->g2dc->rh = NULL; | 2581 | rh->g2dc->rh = NULL; |
2448 | } | 2582 | } |
2583 | if (NULL != rh->g2dc->dns_rh) | ||
2584 | { | ||
2585 | GNUNET_RESOLVER_request_cancel (rh->g2dc->dns_rh); | ||
2586 | rh->g2dc->rh = NULL; | ||
2587 | } | ||
2449 | GNUNET_free (rh->g2dc->ns); | 2588 | GNUNET_free (rh->g2dc->ns); |
2450 | GNUNET_free (rh->g2dc); | 2589 | GNUNET_free (rh->g2dc); |
2451 | rh->g2dc = NULL; | 2590 | rh->g2dc = NULL; |
@@ -2588,28 +2727,4 @@ GNS_resolver_done () | |||
2588 | } | 2727 | } |
2589 | 2728 | ||
2590 | 2729 | ||
2591 | /* *************** common helper functions (do not really belong here) *********** */ | ||
2592 | |||
2593 | /** | ||
2594 | * Checks if @a name ends in ".TLD" | ||
2595 | * | ||
2596 | * @param name the name to check | ||
2597 | * @param tld the TLD to check for | ||
2598 | * @return #GNUNET_YES or #GNUNET_NO | ||
2599 | */ | ||
2600 | int | ||
2601 | is_tld (const char* name, | ||
2602 | const char* tld) | ||
2603 | { | ||
2604 | size_t offset = 0; | ||
2605 | |||
2606 | if (strlen (name) <= strlen (tld)) | ||
2607 | return GNUNET_NO; | ||
2608 | offset = strlen (name) - strlen (tld); | ||
2609 | if (0 != strcmp (name + offset, tld)) | ||
2610 | return GNUNET_NO; | ||
2611 | return GNUNET_YES; | ||
2612 | } | ||
2613 | |||
2614 | |||
2615 | /* end of gnunet-service-gns_resolver.c */ | 2730 | /* end of gnunet-service-gns_resolver.c */ |
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index c71d3983d..06ecc51ce 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -100,25 +100,4 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | |||
100 | void | 100 | void |
101 | GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh); | 101 | GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh); |
102 | 102 | ||
103 | |||
104 | /** | ||
105 | * Generic function to check for TLDs. Checks if "name" ends in ".tld" | ||
106 | * | ||
107 | * @param name the name to check | ||
108 | * @param tld the tld to check | ||
109 | * @return #GNUNET_YES or #GNUNET_NO | ||
110 | */ | ||
111 | int | ||
112 | is_tld (const char *name, | ||
113 | const char *tld); | ||
114 | |||
115 | |||
116 | |||
117 | /** | ||
118 | * Checks for gnu/zkey | ||
119 | */ | ||
120 | #define is_gnu_tld(name) is_tld(name, GNUNET_GNS_TLD) | ||
121 | #define is_zkey_tld(name) is_tld(name, GNUNET_GNS_TLD_ZKEY) | ||
122 | |||
123 | |||
124 | #endif | 103 | #endif |
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c index 31435cf95..03ac6e09c 100644 --- a/src/gns/nss/nss_gns.c +++ b/src/gns/nss/nss_gns.c | |||
@@ -42,35 +42,6 @@ | |||
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * function to check if name ends with a specific suffix | ||
46 | * | ||
47 | * @param name the name to check | ||
48 | * @param suffix the suffix to check for | ||
49 | * @return 1 if true | ||
50 | */ | ||
51 | static int ends_with(const char *name, const char* suffix) { | ||
52 | size_t ln, ls; | ||
53 | assert(name); | ||
54 | assert(suffix); | ||
55 | |||
56 | if ((ls = strlen(suffix)) > (ln = strlen(name))) | ||
57 | return 0; | ||
58 | |||
59 | return strcasecmp(name+ln-ls, suffix) == 0; | ||
60 | } | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Check if name is inside .gnu or .zkey TLD | ||
65 | * | ||
66 | * @param name name to check | ||
67 | * @return 1 if true | ||
68 | */ | ||
69 | static int verify_name_allowed (const char *name) { | ||
70 | return ends_with(name, ".gnu") || ends_with(name, ".zkey"); | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * The gethostbyname hook executed by nsswitch | 45 | * The gethostbyname hook executed by nsswitch |
75 | * | 46 | * |
76 | * @param name the name to resolve | 47 | * @param name the name to resolve |
@@ -82,7 +53,8 @@ static int verify_name_allowed (const char *name) { | |||
82 | * @param h_errnop idk | 53 | * @param h_errnop idk |
83 | * @return a nss_status code | 54 | * @return a nss_status code |
84 | */ | 55 | */ |
85 | enum nss_status _nss_gns_gethostbyname2_r( | 56 | enum nss_status |
57 | _nss_gns_gethostbyname2_r( | ||
86 | const char *name, | 58 | const char *name, |
87 | int af, | 59 | int af, |
88 | struct hostent * result, | 60 | struct hostent * result, |
@@ -95,7 +67,6 @@ enum nss_status _nss_gns_gethostbyname2_r( | |||
95 | enum nss_status status = NSS_STATUS_UNAVAIL; | 67 | enum nss_status status = NSS_STATUS_UNAVAIL; |
96 | int i; | 68 | int i; |
97 | size_t address_length, l, idx, astart; | 69 | size_t address_length, l, idx, astart; |
98 | int name_allowed; | ||
99 | 70 | ||
100 | if (af == AF_UNSPEC) | 71 | if (af == AF_UNSPEC) |
101 | #ifdef NSS_IPV6_ONLY | 72 | #ifdef NSS_IPV6_ONLY |
@@ -133,28 +104,25 @@ enum nss_status _nss_gns_gethostbyname2_r( | |||
133 | u.count = 0; | 104 | u.count = 0; |
134 | u.data_len = 0; | 105 | u.data_len = 0; |
135 | 106 | ||
136 | name_allowed = verify_name_allowed(name); | 107 | i = gns_resolve_name(af, name, &u); |
137 | 108 | if (-3 == i) | |
138 | if (name_allowed) { | 109 | { |
139 | 110 | status = NSS_STATUS_NOTFOUND; | |
140 | if (!gns_resolve_name(af, name, &u) == 0) | 111 | goto finish; |
141 | { | 112 | } |
142 | status = NSS_STATUS_NOTFOUND; | 113 | if (-2 == i) |
143 | goto finish; | 114 | { |
144 | } | 115 | status = NSS_STATUS_UNAVAIL; |
145 | } | 116 | goto finish; |
146 | else | 117 | } |
147 | { | 118 | if ( (-1 == i) || |
148 | status = NSS_STATUS_UNAVAIL; | 119 | (u.count == 0) ) |
149 | goto finish; | 120 | { |
150 | } | ||
151 | |||
152 | if (u.count == 0) { | ||
153 | *errnop = ETIMEDOUT; | 121 | *errnop = ETIMEDOUT; |
154 | *h_errnop = HOST_NOT_FOUND; | 122 | *h_errnop = HOST_NOT_FOUND; |
155 | status = NSS_STATUS_NOTFOUND; | 123 | status = NSS_STATUS_NOTFOUND; |
156 | goto finish; | 124 | goto finish; |
157 | } | 125 | } |
158 | 126 | ||
159 | 127 | ||
160 | /* Alias names */ | 128 | /* Alias names */ |
@@ -212,7 +180,8 @@ finish: | |||
212 | * @param h_errnop idk | 180 | * @param h_errnop idk |
213 | * @return a nss_status code | 181 | * @return a nss_status code |
214 | */ | 182 | */ |
215 | enum nss_status _nss_gns_gethostbyname_r ( | 183 | enum nss_status |
184 | _nss_gns_gethostbyname_r ( | ||
216 | const char *name, | 185 | const char *name, |
217 | struct hostent *result, | 186 | struct hostent *result, |
218 | char *buffer, | 187 | char *buffer, |
@@ -244,7 +213,8 @@ enum nss_status _nss_gns_gethostbyname_r ( | |||
244 | * @param h_errnop idk | 213 | * @param h_errnop idk |
245 | * @return NSS_STATUS_UNAVAIL | 214 | * @return NSS_STATUS_UNAVAIL |
246 | */ | 215 | */ |
247 | enum nss_status _nss_gns_gethostbyaddr_r( | 216 | enum nss_status |
217 | _nss_gns_gethostbyaddr_r( | ||
248 | const void* addr, | 218 | const void* addr, |
249 | int len, | 219 | int len, |
250 | int af, | 220 | int af, |
@@ -253,10 +223,9 @@ enum nss_status _nss_gns_gethostbyaddr_r( | |||
253 | size_t buflen, | 223 | size_t buflen, |
254 | int *errnop, | 224 | int *errnop, |
255 | int *h_errnop) { | 225 | int *h_errnop) { |
256 | 226 | ||
257 | *errnop = EINVAL; | 227 | *errnop = EINVAL; |
258 | *h_errnop = NO_RECOVERY; | 228 | *h_errnop = NO_RECOVERY; |
259 | //NOTE we allow to leak this into DNS so no NOTFOUND | 229 | //NOTE we allow to leak this into DNS so no NOTFOUND |
260 | return NSS_STATUS_UNAVAIL; | 230 | return NSS_STATUS_UNAVAIL; |
261 | } | 231 | } |
262 | |||
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c index 273eaa619..4700100b5 100644 --- a/src/gns/nss/nss_gns_query.c +++ b/src/gns/nss/nss_gns_query.c | |||
@@ -44,6 +44,7 @@ gns_resolve_name (int af, | |||
44 | FILE *p; | 44 | FILE *p; |
45 | char *cmd; | 45 | char *cmd; |
46 | char line[128]; | 46 | char line[128]; |
47 | int ret; | ||
47 | 48 | ||
48 | if (AF_INET6 == af) | 49 | if (AF_INET6 == af) |
49 | { | 50 | { |
@@ -101,8 +102,12 @@ gns_resolve_name (int af, | |||
101 | } | 102 | } |
102 | } | 103 | } |
103 | } | 104 | } |
104 | pclose (p); | 105 | ret = pclose (p); |
105 | free (cmd); | 106 | free (cmd); |
107 | if (4 == ret) | ||
108 | return -2; /* not for GNS */ | ||
109 | if (3 == ret) | ||
110 | return -3; /* timeout */ | ||
106 | return 0; | 111 | return 0; |
107 | } | 112 | } |
108 | /* end of nss_gns_query.c */ | 113 | /* end of nss_gns_query.c */ |
diff --git a/src/gns/test_gns_cname_lookup.sh b/src/gns/test_gns_cname_lookup.sh index 789c7f30b..d9627850f 100755 --- a/src/gns/test_gns_cname_lookup.sh +++ b/src/gns/test_gns_cname_lookup.sh | |||
@@ -24,8 +24,6 @@ fi | |||
24 | 24 | ||
25 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 25 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
26 | 26 | ||
27 | TEST_DOMAIN_PLUS="www.gnu" | ||
28 | TEST_DOMAIN_DNS="www3.gnu" | ||
29 | TEST_IP_PLUS="127.0.0.1" | 27 | TEST_IP_PLUS="127.0.0.1" |
30 | TEST_IP_DNS="131.159.74.67" | 28 | TEST_IP_DNS="131.159.74.67" |
31 | TEST_RECORD_CNAME_SERVER="server" | 29 | TEST_RECORD_CNAME_SERVER="server" |
@@ -34,35 +32,38 @@ TEST_RECORD_CNAME_DNS="gnunet.org" | |||
34 | TEST_RECORD_NAME_SERVER="server" | 32 | TEST_RECORD_NAME_SERVER="server" |
35 | TEST_RECORD_NAME_PLUS="www" | 33 | TEST_RECORD_NAME_PLUS="www" |
36 | TEST_RECORD_NAME_DNS="www3" | 34 | TEST_RECORD_NAME_DNS="www3" |
35 | MY_EGO="myego" | ||
36 | TEST_DOMAIN_PLUS="www.$MY_EGO" | ||
37 | TEST_DOMAIN_DNS="www3.$MY_EGO" | ||
37 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" | 38 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" |
38 | 39 | ||
39 | gnunet-arm -s -c test_gns_lookup.conf | 40 | gnunet-arm -s -c test_gns_lookup.conf |
40 | gnunet-identity -C testego -c test_gns_lookup.conf | 41 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
41 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf | 42 | gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf |
42 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf | 43 | gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf |
43 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf | 44 | gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf |
44 | RES_CNAME=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_PLUS -t A -c test_gns_lookup.conf` | 45 | RES_CNAME=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t A -c test_gns_lookup.conf` |
45 | RES_CNAME_RAW=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_PLUS -t CNAME -c test_gns_lookup.conf` | 46 | RES_CNAME_RAW=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_PLUS -t CNAME -c test_gns_lookup.conf` |
46 | RES_CNAME_DNS=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_DNS -t A -c test_gns_lookup.conf` | 47 | RES_CNAME_DNS=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_DNS -t A -c test_gns_lookup.conf` |
47 | TESTEGOZONE=`gnunet-identity -c test_gns_lookup.conf -d | awk '{print $3}'` | 48 | TESTEGOZONE=`gnunet-identity -c test_gns_lookup.conf -d | awk '{print $3}'` |
48 | gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf | 49 | gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_DNS -t CNAME -V $TEST_RECORD_CNAME_DNS -e never -c test_gns_lookup.conf |
49 | gnunet-namestore -p -z testego -d -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf | 50 | gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_NAME_PLUS -t CNAME -V $TEST_RECORD_CNAME_PLUS -e never -c test_gns_lookup.conf |
50 | gnunet-namestore -p -z testego -d -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf | 51 | gnunet-namestore -p -z $MY_EGO -d -n $TEST_RECORD_CNAME_SERVER -t A -V $TEST_IP_PLUS -e never -c test_gns_lookup.conf |
51 | gnunet-identity -D testego -c test_gns_lookup.conf | 52 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
52 | gnunet-arm -e -c test_gns_lookup.conf | 53 | gnunet-arm -e -c test_gns_lookup.conf |
53 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 54 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
54 | 55 | ||
55 | if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE.zkey" ] | 56 | if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE" ] |
56 | then | 57 | then |
57 | echo "PASS: CNAME resulution from GNS" | 58 | echo "PASS: CNAME resolution from GNS" |
58 | else | 59 | else |
59 | echo "FAIL: CNAME resolution from GNS, got $RES_CNAME_RAW, expected server.$TESTEGOZONE.zkey." | 60 | echo "FAIL: CNAME resolution from GNS, got $RES_CNAME_RAW, expected server.$TESTEGOZONE." |
60 | exit 1 | 61 | exit 1 |
61 | fi | 62 | fi |
62 | 63 | ||
63 | if [ "$RES_CNAME" == "$TEST_IP_PLUS" ] | 64 | if [ "$RES_CNAME" == "$TEST_IP_PLUS" ] |
64 | then | 65 | then |
65 | echo "PASS: IP resulution from GNS" | 66 | echo "PASS: IP resolution from GNS" |
66 | else | 67 | else |
67 | echo "FAIL: IP resolution from GNS, got $RES_CNAME, expected $TEST_IP_PLUS." | 68 | echo "FAIL: IP resolution from GNS, got $RES_CNAME, expected $TEST_IP_PLUS." |
68 | exit 1 | 69 | exit 1 |
@@ -70,9 +71,9 @@ fi | |||
70 | 71 | ||
71 | if [ "$RES_CNAME_DNS" == "$TEST_IP_DNS" ] | 72 | if [ "$RES_CNAME_DNS" == "$TEST_IP_DNS" ] |
72 | then | 73 | then |
73 | echo "PASS: IP resulution from DNS" | 74 | echo "PASS: IP resolution from DNS" |
74 | exit 0 | 75 | exit 0 |
75 | else | 76 | else |
76 | echo "FAIL: IP resulution from DNS, got $RES_IP, expected $TEST_IP_DNS." | 77 | echo "FAIL: IP resolution from DNS, got $RES_IP, expected $TEST_IP_DNS." |
77 | exit 1 | 78 | exit 1 |
78 | fi | 79 | fi |
diff --git a/src/gns/test_gns_delegated_lookup.sh b/src/gns/test_gns_delegated_lookup.sh index 3826d3e32..edda688ff 100755 --- a/src/gns/test_gns_delegated_lookup.sh +++ b/src/gns/test_gns_delegated_lookup.sh | |||
@@ -10,22 +10,26 @@ fi | |||
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --version 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
14 | exit 77 | 14 | exit 77 |
15 | fi | 15 | fi |
16 | 16 | ||
17 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 17 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
18 | MY_EGO="myego" | ||
19 | OTHER_EGO="delegatedego" | ||
20 | FINAL_LABEL="www" | ||
21 | DELEGATION_LABEL="b" | ||
18 | 22 | ||
19 | TEST_IP="127.0.0.1" | 23 | TEST_IP="127.0.0.1" |
20 | gnunet-arm -s -c test_gns_lookup.conf | 24 | gnunet-arm -s -c test_gns_lookup.conf |
21 | gnunet-identity -C delegatedego -c test_gns_lookup.conf | 25 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf |
22 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') | 26 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') |
23 | gnunet-identity -C testego -c test_gns_lookup.conf | 27 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
24 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 28 | gnunet-namestore -p -z $MY_EGO -a -n $DELEGATION_LABEL -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
25 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 29 | gnunet-namestore -p -z $OTHER_EGO -a -n $FINAL_LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
26 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 30 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $FINAL_LABEL.$DELEGATION_LABEL.$MY_EGO -t A -c test_gns_lookup.conf` |
27 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 31 | gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
28 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 32 | gnunet-namestore -z $OTHER_EGO -d -n $FINAL_LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
29 | gnunet-arm -e -c test_gns_lookup.conf | 33 | gnunet-arm -e -c test_gns_lookup.conf |
30 | 34 | ||
31 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 35 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh index a6e4acc77..365c77339 100755 --- a/src/gns/test_gns_dht_lookup.sh +++ b/src/gns/test_gns_dht_lookup.sh | |||
@@ -10,22 +10,26 @@ fi | |||
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --version 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
14 | exit 77 | 14 | exit 77 |
15 | fi | 15 | fi |
16 | 16 | ||
17 | TEST_IP="127.0.0.1" | 17 | TEST_IP="127.0.0.1" |
18 | MY_EGO="myego" | ||
19 | OTHER_EGO="delegatedego" | ||
20 | |||
21 | |||
18 | gnunet-arm -s -c test_gns_lookup.conf | 22 | gnunet-arm -s -c test_gns_lookup.conf |
19 | gnunet-identity -C delegatedego -c test_gns_lookup.conf | 23 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf |
20 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') | 24 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') |
21 | gnunet-identity -C testego -c test_gns_lookup.conf | 25 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
22 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 26 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
23 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 27 | gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
24 | gnunet-arm -i gns -c test_gns_lookup.conf | 28 | gnunet-arm -i gns -c test_gns_lookup.conf |
25 | sleep 0.5 | 29 | sleep 0.5 |
26 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 30 | gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
27 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 31 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf` |
28 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 32 | gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
29 | gnunet-arm -e -c test_gns_lookup.conf | 33 | gnunet-arm -e -c test_gns_lookup.conf |
30 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 34 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
31 | 35 | ||
diff --git a/src/gns/test_gns_gns2dns_lookup.sh b/src/gns/test_gns_gns2dns_lookup.sh index f7299a57d..921d9594d 100755 --- a/src/gns/test_gns_gns2dns_lookup.sh +++ b/src/gns/test_gns_gns2dns_lookup.sh | |||
@@ -25,10 +25,6 @@ TEST_IP_GNS2DNS="8.8.8.8" | |||
25 | 25 | ||
26 | # main label used during resolution | 26 | # main label used during resolution |
27 | TEST_RECORD_NAME="homepage" | 27 | TEST_RECORD_NAME="homepage" |
28 | # various names we will use for resolution | ||
29 | TEST_DOMAIN="www.${TEST_RECORD_NAME}.gnu" | ||
30 | TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.gnu" | ||
31 | TEST_DOMAIN_ALT2="uk.${TEST_RECORD_NAME}.gnu" | ||
32 | 28 | ||
33 | if ! nslookup gnunet.org $TEST_IP_GNS2DNS &> /dev/null | 29 | if ! nslookup gnunet.org $TEST_IP_GNS2DNS &> /dev/null |
34 | then | 30 | then |
@@ -42,29 +38,39 @@ TEST_RESOLVER_LABEL="resolver" | |||
42 | # using the TEST_RESOLVER_LABEL DNS server for resolution | 38 | # using the TEST_RESOLVER_LABEL DNS server for resolution |
43 | TEST_RECORD_GNS2DNS="gnunet.org@${TEST_RESOLVER_LABEL}.+" | 39 | TEST_RECORD_GNS2DNS="gnunet.org@${TEST_RESOLVER_LABEL}.+" |
44 | 40 | ||
41 | MY_EGO="myego" | ||
42 | # various names we will use for resolution | ||
43 | TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO" | ||
44 | TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO" | ||
45 | TEST_DOMAIN_ALT2="uk.${TEST_RECORD_NAME}.$MY_EGO" | ||
46 | |||
47 | |||
45 | gnunet-arm -s -c test_gns_lookup.conf | 48 | gnunet-arm -s -c test_gns_lookup.conf |
46 | gnunet-identity -C testego -c test_gns_lookup.conf | 49 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
47 | 50 | ||
48 | # set IP address for DNS resolver for resolving in gnunet.org domain | 51 | # set IP address for DNS resolver for resolving in gnunet.org domain |
49 | gnunet-namestore -p -z testego -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf | 52 | gnunet-namestore -p -z $MY_EGO -a -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf |
50 | # map 'homepage.gnu' to 'gnunet.org' in DNS | 53 | # map '$TEST_RECORD_NAME.$MY_EGO' to 'gnunet.org' in DNS |
51 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf | 54 | gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf |
52 | 55 | ||
53 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" | 56 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" |
54 | 57 | ||
58 | echo "EGOs:" | ||
59 | gnunet-identity -d | ||
60 | |||
55 | # lookup 'www.gnunet.org', IPv4 | 61 | # lookup 'www.gnunet.org', IPv4 |
56 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t A -c test_gns_lookup.conf` | 62 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf` |
57 | # lookup 'www.gnunet.org', IPv6 | 63 | # lookup 'www.gnunet.org', IPv6 |
58 | RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf` | 64 | RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf` |
59 | # lookup 'gnunet.org', IPv4 | 65 | # lookup 'gnunet.org', IPv4 |
60 | RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf` | 66 | RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf` |
61 | # lookup 'uk.gnunet.org', IPv4 | 67 | # lookup 'uk.gnunet.org', IPv4 |
62 | RES_IP_ALT2=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf` | 68 | RES_IP_ALT2=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT2 -t A -c test_gns_lookup.conf` |
63 | 69 | ||
64 | # clean up | 70 | # clean up |
65 | gnunet-namestore -z testego -d -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf | 71 | gnunet-namestore -z $MY_EGO -d -n $TEST_RESOLVER_LABEL -t A -V $TEST_IP_GNS2DNS -e never -c test_gns_lookup.conf |
66 | gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf | 72 | gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS -e never -c test_gns_lookup.conf |
67 | gnunet-identity -D testego -c test_gns_lookup.conf | 73 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
68 | gnunet-arm -e -c test_gns_lookup.conf | 74 | gnunet-arm -e -c test_gns_lookup.conf |
69 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 75 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
70 | 76 | ||
diff --git a/src/gns/test_gns_ipv6_lookup.sh b/src/gns/test_gns_ipv6_lookup.sh index f34a76727..118c23060 100755 --- a/src/gns/test_gns_ipv6_lookup.sh +++ b/src/gns/test_gns_ipv6_lookup.sh | |||
@@ -12,16 +12,17 @@ then | |||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
13 | exit 77 | 13 | exit 77 |
14 | fi | 14 | fi |
15 | MY_EGO="myego" | ||
15 | 16 | ||
16 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` | 17 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` |
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 18 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" |
18 | TEST_IP="dead::beef" | 19 | TEST_IP="dead::beef" |
19 | gnunet-arm -s -c test_gns_lookup.conf | 20 | gnunet-arm -s -c test_gns_lookup.conf |
20 | gnunet-identity -C testego -c test_gns_lookup.conf | 21 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
21 | gnunet-namestore -p -z testego -a -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf | 22 | gnunet-namestore -p -z $MY_EGO -a -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf |
22 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t AAAA -c test_gns_lookup.conf` | 23 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.$MY_EGO -t AAAA -c test_gns_lookup.conf` |
23 | gnunet-namestore -z testego -d -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf | 24 | gnunet-namestore -z $MY_EGO -d -n www -t AAAA -V $TEST_IP -e never -c test_gns_lookup.conf |
24 | gnunet-identity -D testego -c test_gns_lookup.conf | 25 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
25 | gnunet-arm -e -c test_gns_lookup.conf | 26 | gnunet-arm -e -c test_gns_lookup.conf |
26 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 27 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
27 | 28 | ||
diff --git a/src/gns/test_gns_lookup.sh b/src/gns/test_gns_lookup.sh index ddee5b78d..79558afae 100755 --- a/src/gns/test_gns_lookup.sh +++ b/src/gns/test_gns_lookup.sh | |||
@@ -16,12 +16,14 @@ fi | |||
16 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` | 16 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` |
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" |
18 | TEST_IP="127.0.0.1" | 18 | TEST_IP="127.0.0.1" |
19 | MY_EGO="myego" | ||
20 | LABEL="www" | ||
19 | gnunet-arm -s -c test_gns_lookup.conf | 21 | gnunet-arm -s -c test_gns_lookup.conf |
20 | gnunet-identity -C testego -c test_gns_lookup.conf | 22 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
21 | gnunet-namestore -p -z testego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 23 | gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
22 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t A -c test_gns_lookup.conf` | 24 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t A -c test_gns_lookup.conf` |
23 | gnunet-namestore -z testego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 25 | gnunet-namestore -z $MY_EGO -d -n $LABEL -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
24 | gnunet-identity -D testego -c test_gns_lookup.conf | 26 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
25 | gnunet-arm -e -c test_gns_lookup.conf | 27 | gnunet-arm -e -c test_gns_lookup.conf |
26 | 28 | ||
27 | if [ "$RES_IP" == "$TEST_IP" ] | 29 | if [ "$RES_IP" == "$TEST_IP" ] |
diff --git a/src/gns/test_gns_mx_lookup.sh b/src/gns/test_gns_mx_lookup.sh index f8cea2d0f..8abc9f509 100755 --- a/src/gns/test_gns_mx_lookup.sh +++ b/src/gns/test_gns_mx_lookup.sh | |||
@@ -16,21 +16,24 @@ fi | |||
16 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 16 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" |
18 | 18 | ||
19 | TEST_MX="5,mail.gnu" | 19 | MY_EGO="myego" |
20 | TEST_MX="5,mail.+" | ||
20 | gnunet-arm -s -c test_gns_lookup.conf | 21 | gnunet-arm -s -c test_gns_lookup.conf |
21 | gnunet-identity -C testego -c test_gns_lookup.conf | 22 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
22 | gnunet-namestore -p -z testego -a -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf | 23 | PKEY=`gnunet-identity -d | grep "$MY_EGO - " | awk '{print $3'}` |
24 | WANT_MX="5,mail.$PKEY" | ||
25 | gnunet-namestore -p -z $MY_EGO -a -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf | ||
23 | 26 | ||
24 | RES_MX=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.gnu -t MX -c test_gns_lookup.conf` | 27 | RES_MX=`$DO_TIMEOUT gnunet-gns --raw -u www.$MY_EGO -t MX -c test_gns_lookup.conf` |
25 | gnunet-namestore -z testego -d -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf | 28 | gnunet-namestore -z $MY_EGO -d -n www -t MX -V "$TEST_MX" -e never -c test_gns_lookup.conf |
26 | gnunet-identity -D testego -c test_gns_lookup.conf | 29 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
27 | gnunet-arm -e -c test_gns_lookup.conf | 30 | gnunet-arm -e -c test_gns_lookup.conf |
28 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 31 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
29 | 32 | ||
30 | if [ "$RES_MX" == "$TEST_MX" ] | 33 | if [ "$RES_MX" == "$WANT_MX" ] |
31 | then | 34 | then |
32 | exit 0 | 35 | exit 0 |
33 | else | 36 | else |
34 | echo "FAIL: did not get proper IP, got $RES_MX." | 37 | echo "FAIL: did not get proper IP, got $RES_MX, expected $WANT_MX." |
35 | exit 1 | 38 | exit 1 |
36 | fi | 39 | fi |
diff --git a/src/gns/test_gns_plus_lookup.sh b/src/gns/test_gns_plus_lookup.sh index a6a9e8da4..4cf7a8855 100755 --- a/src/gns/test_gns_plus_lookup.sh +++ b/src/gns/test_gns_plus_lookup.sh | |||
@@ -17,14 +17,15 @@ which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | |||
17 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 17 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
18 | 18 | ||
19 | TEST_IP="127.0.0.1" | 19 | TEST_IP="127.0.0.1" |
20 | MY_EGO="myego" | ||
20 | gnunet-arm -s -c test_gns_lookup.conf | 21 | gnunet-arm -s -c test_gns_lookup.conf |
21 | gnunet-identity -C delegatedego -c test_gns_lookup.conf | 22 | gnunet-identity -C delegatedego -c test_gns_lookup.conf |
22 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') | 23 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') |
23 | gnunet-identity -C testego -c test_gns_lookup.conf | 24 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
24 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 25 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
25 | gnunet-namestore -p -z delegatedego -a -n '+' -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 26 | gnunet-namestore -p -z delegatedego -a -n '+' -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
26 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u b.gnu -t A -c test_gns_lookup.conf` | 27 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u b.$MY_EGO -t A -c test_gns_lookup.conf` |
27 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 28 | gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
28 | gnunet-namestore -z delegatedego -d -n '+' -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 29 | gnunet-namestore -z delegatedego -d -n '+' -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
29 | gnunet-arm -e -c test_gns_lookup.conf | 30 | gnunet-arm -e -c test_gns_lookup.conf |
30 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 31 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
diff --git a/src/gns/test_gns_quickupdate.sh b/src/gns/test_gns_quickupdate.sh index d58a2712c..5606491e4 100755 --- a/src/gns/test_gns_quickupdate.sh +++ b/src/gns/test_gns_quickupdate.sh | |||
@@ -9,41 +9,49 @@ fi | |||
9 | $LOCATION --version 1> /dev/null | 9 | $LOCATION --version 1> /dev/null |
10 | if test $? != 0 | 10 | if test $? != 0 |
11 | then | 11 | then |
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
13 | exit 77 | 13 | exit 77 |
14 | fi | 14 | fi |
15 | 15 | ||
16 | MY_EGO="myego" | ||
17 | OTHER_EGO="delegatedego" | ||
18 | |||
19 | |||
16 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 20 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 21 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" |
18 | TEST_IP="127.0.0.1" | 22 | TEST_IP="127.0.0.1" |
19 | gnunet-arm -s -c test_gns_lookup.conf | 23 | gnunet-arm -s -c test_gns_lookup.conf |
20 | gnunet-identity -C testego -c test_gns_lookup.conf | 24 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
21 | gnunet-identity -C delegatedego -c test_gns_lookup.conf | 25 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf |
22 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') | 26 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') |
23 | gnunet-arm -i gns -c test_gns_lookup.conf | 27 | gnunet-arm -i gns -c test_gns_lookup.conf |
24 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 28 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
25 | # Give GNS/namestore time to fully start and finish initial iteration | 29 | # Give GNS/namestore time to fully start and finish initial iteration |
26 | sleep 2 | 30 | sleep 2 |
27 | # Performing namestore update | 31 | # Performing namestore update |
28 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 32 | gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
29 | # Give GNS chance to observe store event via monitor | 33 | # Give GNS chance to observe store event via monitor |
30 | sleep 1 | 34 | sleep 1 |
31 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 35 | gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
32 | # give GNS chance to process monitor event | 36 | # give GNS chance to process monitor event |
33 | sleep 1 | 37 | sleep 1 |
34 | # stop everything and restart to check that DHT PUT did happen | 38 | # stop everything and restart to check that DHT PUT did happen |
35 | gnunet-arm -k gns -c test_gns_lookup.conf | 39 | gnunet-arm -k gns -c test_gns_lookup.conf |
36 | gnunet-arm -k namestore -c test_gns_lookup.conf | 40 | gnunet-arm -k namestore -c test_gns_lookup.conf |
37 | gnunet-arm -k namecache -c test_gns_lookup.conf | 41 | gnunet-arm -k namecache -c test_gns_lookup.conf |
42 | gnunet-arm -k zonemaster -c test_gns_lookup.conf | ||
38 | # Purge nameacache, as we might otherwise fetch from there | 43 | # Purge nameacache, as we might otherwise fetch from there |
39 | rm -r `gnunet-config -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME` | 44 | # FIXME: testcase started failing after the line below was fixed by adding '-f', |
45 | # might have never worked (!) | ||
46 | rm -r `gnunet-config -f -c test_gns_lookup.conf -s namecache-sqlite -o FILENAME` | ||
40 | gnunet-arm -i namestore -c test_gns_lookup.conf | 47 | gnunet-arm -i namestore -c test_gns_lookup.conf |
41 | gnunet-arm -i namecache -c test_gns_lookup.conf | 48 | gnunet-arm -i namecache -c test_gns_lookup.conf |
49 | gnunet-arm -i zonemaster -c test_gns_lookup.conf | ||
42 | gnunet-arm -i gns -c test_gns_lookup.conf | 50 | gnunet-arm -i gns -c test_gns_lookup.conf |
43 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 51 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf` |
44 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 52 | gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
45 | gnunet-identity -D testego -c test_gns_lookup.conf | 53 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
46 | gnunet-identity -D delegatedego -c test_gns_lookup.conf | 54 | gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf |
47 | gnunet-arm -e -c test_gns_lookup.conf | 55 | gnunet-arm -e -c test_gns_lookup.conf |
48 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 56 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
49 | 57 | ||
@@ -51,6 +59,6 @@ if [ "$RES_IP" == "$TEST_IP" ] | |||
51 | then | 59 | then |
52 | exit 0 | 60 | exit 0 |
53 | else | 61 | else |
54 | echo "Failed to properly resolve IP, got $RES_IP." | 62 | echo "Failed to properly resolve IP, expected $TEST_IP, got $RES_IP." |
55 | exit 1 | 63 | exit 1 |
56 | fi | 64 | fi |
diff --git a/src/gns/test_gns_rel_expiration.sh b/src/gns/test_gns_rel_expiration.sh index 9890641e2..992098db3 100755 --- a/src/gns/test_gns_rel_expiration.sh +++ b/src/gns/test_gns_rel_expiration.sh | |||
@@ -13,27 +13,30 @@ then | |||
13 | exit 77 | 13 | exit 77 |
14 | fi | 14 | fi |
15 | 15 | ||
16 | MY_EGO="myego" | ||
17 | OTHER_EGO="delegatedego" | ||
18 | |||
16 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 19 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 20 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" |
18 | TEST_IP="127.0.0.1" | 21 | TEST_IP="127.0.0.1" |
19 | gnunet-arm -s -c test_gns_lookup.conf | 22 | gnunet-arm -s -c test_gns_lookup.conf |
20 | gnunet-identity -C testego -c test_gns_lookup.conf | 23 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
21 | gnunet-identity -C delegatedego -c test_gns_lookup.conf | 24 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf |
22 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') | 25 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') |
23 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 26 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
24 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf | 27 | gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf |
25 | gnunet-arm -i gns -c test_gns_lookup.conf | 28 | gnunet-arm -i gns -c test_gns_lookup.conf |
26 | # confirm that lookup currently works | 29 | # confirm that lookup currently works |
27 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 30 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf` |
28 | # remove entry | 31 | # remove entry |
29 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf | 32 | gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e '5 s' -c test_gns_lookup.conf |
30 | # wait for old entry with 5s 'expiration' to definitively expire | 33 | # wait for old entry with 5s 'expiration' to definitively expire |
31 | sleep 6 | 34 | sleep 6 |
32 | # try again, should no longer work | 35 | # try again, should no longer work |
33 | RES_IP_EXP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 36 | RES_IP_EXP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf` |
34 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 37 | gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
35 | gnunet-identity -D testego -c test_gns_lookup.conf | 38 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
36 | gnunet-identity -D delegatedego -c test_gns_lookup.conf | 39 | gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf |
37 | gnunet-arm -e -c test_gns_lookup.conf | 40 | gnunet-arm -e -c test_gns_lookup.conf |
38 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 41 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
39 | 42 | ||
diff --git a/src/gns/test_gns_revocation.sh b/src/gns/test_gns_revocation.sh index fdd3c76de..269b940d9 100755 --- a/src/gns/test_gns_revocation.sh +++ b/src/gns/test_gns_revocation.sh | |||
@@ -15,19 +15,21 @@ then | |||
15 | fi | 15 | fi |
16 | 16 | ||
17 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 17 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
18 | 18 | MY_EGO="myego" | |
19 | OTHER_EGO="delegatedego" | ||
19 | TEST_IP="127.0.0.1" | 20 | TEST_IP="127.0.0.1" |
21 | |||
20 | gnunet-arm -s -c test_gns_lookup.conf | 22 | gnunet-arm -s -c test_gns_lookup.conf |
21 | gnunet-identity -C delegatedego -c test_gns_lookup.conf | 23 | gnunet-identity -C $OTHER_EGO -c test_gns_lookup.conf |
22 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | awk '{print $3}') | 24 | DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep $OTHER_EGO | awk '{print $3}') |
23 | gnunet-identity -C testego -c test_gns_lookup.conf | 25 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
24 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 26 | gnunet-namestore -p -z $MY_EGO -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
25 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 27 | gnunet-namestore -p -z $OTHER_EGO -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
26 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 28 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf` |
27 | gnunet-revocation -R delegatedego -p -c test_gns_lookup.conf | 29 | gnunet-revocation -R $OTHER_EGO -p -c test_gns_lookup.conf |
28 | RES_IP_REV=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.b.gnu -t A -c test_gns_lookup.conf` | 30 | RES_IP_REV=`$DO_TIMEOUT gnunet-gns --raw -u www.b.$MY_EGO -t A -c test_gns_lookup.conf` |
29 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 31 | gnunet-namestore -z $MY_EGO -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
30 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 32 | gnunet-namestore -z $OTHER_EGO -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
31 | gnunet-arm -e -c test_gns_lookup.conf | 33 | gnunet-arm -e -c test_gns_lookup.conf |
32 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 34 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
33 | 35 | ||
diff --git a/src/gns/test_gns_soa_lookup.sh b/src/gns/test_gns_soa_lookup.sh index bd8adcb63..2f9cc58de 100755 --- a/src/gns/test_gns_soa_lookup.sh +++ b/src/gns/test_gns_soa_lookup.sh | |||
@@ -16,7 +16,8 @@ fi | |||
16 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 16 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" |
17 | 17 | ||
18 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 18 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
19 | TEST_DOMAIN="homepage.gnu" | 19 | MY_EGO="myego" |
20 | TEST_DOMAIN="homepage.$MY_EGO" | ||
20 | # some public DNS resolver we can use | 21 | # some public DNS resolver we can use |
21 | TEST_IP_GNS2DNS="184.172.157.218" | 22 | TEST_IP_GNS2DNS="184.172.157.218" |
22 | TEST_RECORD_NAME="homepage" | 23 | TEST_RECORD_NAME="homepage" |
@@ -29,11 +30,11 @@ then | |||
29 | fi | 30 | fi |
30 | 31 | ||
31 | gnunet-arm -s -c test_gns_lookup.conf | 32 | gnunet-arm -s -c test_gns_lookup.conf |
32 | gnunet-identity -C testego -c test_gns_lookup.conf | 33 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
33 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf | 34 | gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf |
34 | RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -z testego -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf` | 35 | RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf` |
35 | gnunet-namestore -z testego -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf &> /dev/null | 36 | gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf &> /dev/null |
36 | gnunet-identity -D testego -c test_gns_lookup.conf | 37 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
37 | gnunet-arm -e -c test_gns_lookup.conf | 38 | gnunet-arm -e -c test_gns_lookup.conf |
38 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 39 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
39 | 40 | ||
diff --git a/src/gns/test_gns_txt_lookup.sh b/src/gns/test_gns_txt_lookup.sh index dcf51112f..68a60c8b6 100755 --- a/src/gns/test_gns_txt_lookup.sh +++ b/src/gns/test_gns_txt_lookup.sh | |||
@@ -16,12 +16,14 @@ fi | |||
16 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 16 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" |
18 | TEST_TXT="GNS powered txt record data" | 18 | TEST_TXT="GNS powered txt record data" |
19 | MY_EGO="myego" | ||
20 | LABEL="testtxt" | ||
19 | gnunet-arm -s -c test_gns_lookup.conf | 21 | gnunet-arm -s -c test_gns_lookup.conf |
20 | gnunet-identity -C testego -c test_gns_lookup.conf | 22 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
21 | gnunet-namestore -p -z testego -a -n testtxt -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf | 23 | gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf |
22 | RES_TXT=`$DO_TIMEOUT gnunet-gns --raw -z testego -u testtxt.gnu -t TXT -c test_gns_lookup.conf` | 24 | RES_TXT=`$DO_TIMEOUT gnunet-gns --raw -u $LABEL.$MY_EGO -t TXT -c test_gns_lookup.conf` |
23 | gnunet-namestore -z testego -d -n testtxt -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf | 25 | gnunet-namestore -z $MY_EGO -d -n $LABEL -t TXT -V "$TEST_TXT" -e never -c test_gns_lookup.conf |
24 | gnunet-identity -D testego -c test_gns_lookup.conf | 26 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
25 | gnunet-arm -e -c test_gns_lookup.conf | 27 | gnunet-arm -e -c test_gns_lookup.conf |
26 | rm -rf /tmp/test-gnunet-gns-peer-1/ | 28 | rm -rf /tmp/test-gnunet-gns-peer-1/ |
27 | 29 | ||
diff --git a/src/gns/test_gns_zkey_lookup.sh b/src/gns/test_gns_zkey_lookup.sh index 6262c1eb2..312198780 100755 --- a/src/gns/test_gns_zkey_lookup.sh +++ b/src/gns/test_gns_zkey_lookup.sh | |||
@@ -23,7 +23,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego | |||
23 | gnunet-identity -C testego -c test_gns_lookup.conf | 23 | gnunet-identity -C testego -c test_gns_lookup.conf |
24 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 24 | gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
25 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 25 | gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
26 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.${DELEGATED_PKEY}.zkey -t A -c test_gns_lookup.conf` | 26 | RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.${DELEGATED_PKEY} -t A -c test_gns_lookup.conf` |
27 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf | 27 | gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf |
28 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf | 28 | gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf |
29 | gnunet-arm -e -c test_gns_lookup.conf | 29 | gnunet-arm -e -c test_gns_lookup.conf |
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index 4c3bf6fa8..3c1ead437 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -241,7 +241,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | |||
241 | pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); | 241 | pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); |
242 | GNUNET_snprintf (ret, | 242 | GNUNET_snprintf (ret, |
243 | sizeof (ret), | 243 | sizeof (ret), |
244 | "%s.zkey", | 244 | "%s", |
245 | pkeys); | 245 | pkeys); |
246 | GNUNET_free (pkeys); | 246 | GNUNET_free (pkeys); |
247 | return ret; | 247 | return ret; |
@@ -249,10 +249,10 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | |||
249 | 249 | ||
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Convert an absolute domain name in the ".zkey" pTLD to the | 252 | * Convert an absolute domain name to the |
253 | * respective public key. | 253 | * respective public key. |
254 | * | 254 | * |
255 | * @param zkey string "X.zkey" where X is the coordinates of the public | 255 | * @param zkey string encoding the coordinates of the public |
256 | * key in an encoding suitable for DNS labels. | 256 | * key in an encoding suitable for DNS labels. |
257 | * @param pkey set to a public key on the eliptic curve | 257 | * @param pkey set to a public key on the eliptic curve |
258 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax | 258 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax |
@@ -261,29 +261,12 @@ int | |||
261 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | 261 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, |
262 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 262 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) |
263 | { | 263 | { |
264 | char *cpy; | ||
265 | char *dot; | ||
266 | const char *x; | ||
267 | |||
268 | cpy = GNUNET_strdup (zkey); | ||
269 | x = cpy; | ||
270 | if (NULL == (dot = strchr (x, (int) '.'))) | ||
271 | goto error; | ||
272 | *dot = '\0'; | ||
273 | if (0 != strcasecmp (dot + 1, | ||
274 | "zkey")) | ||
275 | goto error; | ||
276 | |||
277 | if (GNUNET_OK != | 264 | if (GNUNET_OK != |
278 | GNUNET_CRYPTO_ecdsa_public_key_from_string (x, | 265 | GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey, |
279 | strlen (x), | 266 | strlen (zkey), |
280 | pkey)) | 267 | pkey)) |
281 | goto error; | 268 | return GNUNET_SYSERR; |
282 | GNUNET_free (cpy); | ||
283 | return GNUNET_OK; | 269 | return GNUNET_OK; |
284 | error: | ||
285 | GNUNET_free (cpy); | ||
286 | return GNUNET_SYSERR; | ||
287 | } | 270 | } |
288 | 271 | ||
289 | 272 | ||
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index ccc868c05..2ef946a82 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h | |||
@@ -50,6 +50,9 @@ extern "C" | |||
50 | /** | 50 | /** |
51 | * String we use to indicate the local master zone or a | 51 | * String we use to indicate the local master zone or a |
52 | * root entry in the current zone. | 52 | * root entry in the current zone. |
53 | * | ||
54 | * FIXME: probably should be changed to "@" and renamed | ||
55 | * (this name is confusing!) | ||
53 | */ | 56 | */ |
54 | #define GNUNET_GNS_MASTERZONE_STR "+" | 57 | #define GNUNET_GNS_MASTERZONE_STR "+" |
55 | 58 | ||
diff --git a/src/namecache/gnunet-service-namecache.c b/src/namecache/gnunet-service-namecache.c index f20d664a2..c08f2aef7 100644 --- a/src/namecache/gnunet-service-namecache.c +++ b/src/namecache/gnunet-service-namecache.c | |||
@@ -50,7 +50,7 @@ struct NamecacheClient | |||
50 | * The message queue to talk to @e client. | 50 | * The message queue to talk to @e client. |
51 | */ | 51 | */ |
52 | struct GNUNET_MQ_Handle *mq; | 52 | struct GNUNET_MQ_Handle *mq; |
53 | 53 | ||
54 | }; | 54 | }; |
55 | 55 | ||
56 | 56 | ||
@@ -208,7 +208,7 @@ handle_lookup_block (void *cls, | |||
208 | 208 | ||
209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
210 | "Received NAMECACHE_LOOKUP_BLOCK message\n"); | 210 | "Received NAMECACHE_LOOKUP_BLOCK message\n"); |
211 | 211 | ||
212 | lnc.request_id = ntohl (ln_msg->gns_header.r_id); | 212 | lnc.request_id = ntohl (ln_msg->gns_header.r_id); |
213 | lnc.nc = nc; | 213 | lnc.nc = nc; |
214 | if (GNUNET_SYSERR == | 214 | if (GNUNET_SYSERR == |
@@ -306,7 +306,7 @@ handle_block_cache (void *cls, | |||
306 | * @param service the initialized service | 306 | * @param service the initialized service |
307 | */ | 307 | */ |
308 | static void | 308 | static void |
309 | run (void *cls, | 309 | run (void *cls, |
310 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 310 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
311 | struct GNUNET_SERVICE_Handle *service) | 311 | struct GNUNET_SERVICE_Handle *service) |
312 | { | 312 | { |
@@ -319,8 +319,8 @@ run (void *cls, | |||
319 | /* Loading database plugin */ | 319 | /* Loading database plugin */ |
320 | if (GNUNET_OK != | 320 | if (GNUNET_OK != |
321 | GNUNET_CONFIGURATION_get_value_string (cfg, | 321 | GNUNET_CONFIGURATION_get_value_string (cfg, |
322 | "namecache", | 322 | "namecache", |
323 | "database", | 323 | "database", |
324 | &database)) | 324 | &database)) |
325 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 325 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
326 | "No database backend configured\n"); | 326 | "No database backend configured\n"); |
diff --git a/src/namecache/plugin_namecache_flat.c b/src/namecache/plugin_namecache_flat.c index 66ab776e3..220c60305 100644 --- a/src/namecache/plugin_namecache_flat.c +++ b/src/namecache/plugin_namecache_flat.c | |||
@@ -86,8 +86,10 @@ database_setup (struct Plugin *plugin) | |||
86 | struct GNUNET_DISK_FileHandle *fh; | 86 | struct GNUNET_DISK_FileHandle *fh; |
87 | 87 | ||
88 | if (GNUNET_OK != | 88 | if (GNUNET_OK != |
89 | GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, "namecache-flat", | 89 | GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, |
90 | "FILENAME", &afsdir)) | 90 | "namecache-flat", |
91 | "FILENAME", | ||
92 | &afsdir)) | ||
91 | { | 93 | { |
92 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 94 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
93 | "namecache-flat", "FILENAME"); | 95 | "namecache-flat", "FILENAME"); |
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index dcb9dd678..054417ab5 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -403,7 +403,7 @@ display_record (void *cls, | |||
403 | { | 403 | { |
404 | if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && | 404 | if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && |
405 | (0 != strcmp (rname, | 405 | (0 != strcmp (rname, |
406 | "+")) ) | 406 | GNUNET_GNS_MASTERZONE_STR)) ) |
407 | continue; | 407 | continue; |
408 | typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); | 408 | typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); |
409 | s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, | 409 | s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, |
@@ -1127,97 +1127,81 @@ int | |||
1127 | main (int argc, | 1127 | main (int argc, |
1128 | char *const *argv) | 1128 | char *const *argv) |
1129 | { | 1129 | { |
1130 | is_public = -1; | ||
1131 | is_shadow = -1; | ||
1132 | |||
1133 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1130 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1134 | |||
1135 | GNUNET_GETOPT_option_flag ('a', | 1131 | GNUNET_GETOPT_option_flag ('a', |
1136 | "add", | 1132 | "add", |
1137 | gettext_noop ("add record"), | 1133 | gettext_noop ("add record"), |
1138 | &add), | 1134 | &add), |
1139 | |||
1140 | GNUNET_GETOPT_option_flag ('d', | 1135 | GNUNET_GETOPT_option_flag ('d', |
1141 | "delete", | 1136 | "delete", |
1142 | gettext_noop ("delete record"), | 1137 | gettext_noop ("delete record"), |
1143 | &del), | 1138 | &del), |
1144 | |||
1145 | GNUNET_GETOPT_option_flag ('D', | 1139 | GNUNET_GETOPT_option_flag ('D', |
1146 | "display", | 1140 | "display", |
1147 | gettext_noop ("display records"), | 1141 | gettext_noop ("display records"), |
1148 | &list), | 1142 | &list), |
1149 | |||
1150 | GNUNET_GETOPT_option_string ('e', | 1143 | GNUNET_GETOPT_option_string ('e', |
1151 | "expiration", | 1144 | "expiration", |
1152 | "TIME", | 1145 | "TIME", |
1153 | gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), | 1146 | gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), |
1154 | &expirationstring), | 1147 | &expirationstring), |
1155 | |||
1156 | GNUNET_GETOPT_option_string ('i', | 1148 | GNUNET_GETOPT_option_string ('i', |
1157 | "nick", | 1149 | "nick", |
1158 | "NICKNAME", | 1150 | "NICKNAME", |
1159 | gettext_noop ("set the desired nick name for the zone"), | 1151 | gettext_noop ("set the desired nick name for the zone"), |
1160 | &nickstring), | 1152 | &nickstring), |
1161 | |||
1162 | GNUNET_GETOPT_option_flag ('m', | 1153 | GNUNET_GETOPT_option_flag ('m', |
1163 | "monitor", | 1154 | "monitor", |
1164 | gettext_noop ("monitor changes in the namestore"), | 1155 | gettext_noop ("monitor changes in the namestore"), |
1165 | &monitor), | 1156 | &monitor), |
1166 | |||
1167 | GNUNET_GETOPT_option_string ('n', | 1157 | GNUNET_GETOPT_option_string ('n', |
1168 | "name", | 1158 | "name", |
1169 | "NAME", | 1159 | "NAME", |
1170 | gettext_noop ("name of the record to add/delete/display"), | 1160 | gettext_noop ("name of the record to add/delete/display"), |
1171 | &name), | 1161 | &name), |
1172 | |||
1173 | GNUNET_GETOPT_option_string ('r', | 1162 | GNUNET_GETOPT_option_string ('r', |
1174 | "reverse", | 1163 | "reverse", |
1175 | "PKEY", | 1164 | "PKEY", |
1176 | gettext_noop ("determine our name for the given PKEY"), | 1165 | gettext_noop ("determine our name for the given PKEY"), |
1177 | &reverse_pkey), | 1166 | &reverse_pkey), |
1178 | |||
1179 | |||
1180 | |||
1181 | GNUNET_GETOPT_option_string ('t', | 1167 | GNUNET_GETOPT_option_string ('t', |
1182 | "type", | 1168 | "type", |
1183 | "TYPE", | 1169 | "TYPE", |
1184 | gettext_noop ("type of the record to add/delete/display"), | 1170 | gettext_noop ("type of the record to add/delete/display"), |
1185 | &typestring), | 1171 | &typestring), |
1186 | |||
1187 | GNUNET_GETOPT_option_string ('u', | 1172 | GNUNET_GETOPT_option_string ('u', |
1188 | "uri", | 1173 | "uri", |
1189 | "URI", | 1174 | "URI", |
1190 | gettext_noop ("URI to import into our zone"), | 1175 | gettext_noop ("URI to import into our zone"), |
1191 | &uri), | 1176 | &uri), |
1192 | |||
1193 | GNUNET_GETOPT_option_string ('V', | 1177 | GNUNET_GETOPT_option_string ('V', |
1194 | "value", | 1178 | "value", |
1195 | "VALUE", | 1179 | "VALUE", |
1196 | gettext_noop ("value of the record to add/delete"), | 1180 | gettext_noop ("value of the record to add/delete"), |
1197 | &value), | 1181 | &value), |
1198 | |||
1199 | GNUNET_GETOPT_option_flag ('p', | 1182 | GNUNET_GETOPT_option_flag ('p', |
1200 | "public", | 1183 | "public", |
1201 | gettext_noop ("create or list public record"), | 1184 | gettext_noop ("create or list public record"), |
1202 | &is_public), | 1185 | &is_public), |
1203 | |||
1204 | GNUNET_GETOPT_option_flag ('s', | 1186 | GNUNET_GETOPT_option_flag ('s', |
1205 | "shadow", | 1187 | "shadow", |
1206 | gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), | 1188 | gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), |
1207 | &is_shadow), | 1189 | &is_shadow), |
1208 | |||
1209 | GNUNET_GETOPT_option_string ('z', | 1190 | GNUNET_GETOPT_option_string ('z', |
1210 | "zone", | 1191 | "zone", |
1211 | "EGO", | 1192 | "EGO", |
1212 | gettext_noop ("name of the ego controlling the zone"), | 1193 | gettext_noop ("name of the ego controlling the zone"), |
1213 | &ego_name), | 1194 | &ego_name), |
1214 | |||
1215 | GNUNET_GETOPT_OPTION_END | 1195 | GNUNET_GETOPT_OPTION_END |
1216 | }; | 1196 | }; |
1217 | 1197 | ||
1218 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 1198 | if (GNUNET_OK != |
1199 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
1200 | &argc, &argv)) | ||
1219 | return 2; | 1201 | return 2; |
1220 | 1202 | ||
1203 | is_public = -1; | ||
1204 | is_shadow = -1; | ||
1221 | GNUNET_log_setup ("gnunet-namestore", | 1205 | GNUNET_log_setup ("gnunet-namestore", |
1222 | "WARNING", | 1206 | "WARNING", |
1223 | NULL); | 1207 | NULL); |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index b27cfb732..dea13b982 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -105,7 +105,7 @@ struct NamestoreClient | |||
105 | * Message queue for transmission to @e client | 105 | * Message queue for transmission to @e client |
106 | */ | 106 | */ |
107 | struct GNUNET_MQ_Handle *mq; | 107 | struct GNUNET_MQ_Handle *mq; |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * Head of the DLL of | 110 | * Head of the DLL of |
111 | * Zone iteration operations in progress initiated by this client | 111 | * Zone iteration operations in progress initiated by this client |
@@ -268,7 +268,7 @@ cleanup_task (void *cls) | |||
268 | } | 268 | } |
269 | GNUNET_NAMECACHE_disconnect (namecache); | 269 | GNUNET_NAMECACHE_disconnect (namecache); |
270 | namecache = NULL; | 270 | namecache = NULL; |
271 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, | 271 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, |
272 | GSN_database)); | 272 | GSN_database)); |
273 | GNUNET_free (db_lib_name); | 273 | GNUNET_free (db_lib_name); |
274 | db_lib_name = NULL; | 274 | db_lib_name = NULL; |
@@ -1011,7 +1011,8 @@ handle_record_store (void *cls, | |||
1011 | struct GNUNET_GNSRECORD_Data rd_clean[rd_count]; | 1011 | struct GNUNET_GNSRECORD_Data rd_clean[rd_count]; |
1012 | unsigned int rd_clean_off; | 1012 | unsigned int rd_clean_off; |
1013 | 1013 | ||
1014 | /* remove "NICK" records, unless this is for the "+" label */ | 1014 | /* remove "NICK" records, unless this is for the |
1015 | #GNUNET_GNS_MASTERZONE_STR label */ | ||
1015 | rd_clean_off = 0; | 1016 | rd_clean_off = 0; |
1016 | for (unsigned int i=0;i<rd_count;i++) | 1017 | for (unsigned int i=0;i<rd_count;i++) |
1017 | { | 1018 | { |
@@ -1669,23 +1670,23 @@ GNUNET_SERVICE_MAIN | |||
1669 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, | 1670 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, |
1670 | struct ZoneToNameMessage, | 1671 | struct ZoneToNameMessage, |
1671 | NULL), | 1672 | NULL), |
1672 | GNUNET_MQ_hd_fixed_size (iteration_start, | 1673 | GNUNET_MQ_hd_fixed_size (iteration_start, |
1673 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, | 1674 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, |
1674 | struct ZoneIterationStartMessage, | 1675 | struct ZoneIterationStartMessage, |
1675 | NULL), | 1676 | NULL), |
1676 | GNUNET_MQ_hd_fixed_size (iteration_next, | 1677 | GNUNET_MQ_hd_fixed_size (iteration_next, |
1677 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, | 1678 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, |
1678 | struct ZoneIterationNextMessage, | 1679 | struct ZoneIterationNextMessage, |
1679 | NULL), | 1680 | NULL), |
1680 | GNUNET_MQ_hd_fixed_size (iteration_stop, | 1681 | GNUNET_MQ_hd_fixed_size (iteration_stop, |
1681 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, | 1682 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, |
1682 | struct ZoneIterationStopMessage, | 1683 | struct ZoneIterationStopMessage, |
1683 | NULL), | 1684 | NULL), |
1684 | GNUNET_MQ_hd_fixed_size (monitor_start, | 1685 | GNUNET_MQ_hd_fixed_size (monitor_start, |
1685 | GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START, | 1686 | GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START, |
1686 | struct ZoneMonitorStartMessage, | 1687 | struct ZoneMonitorStartMessage, |
1687 | NULL), | 1688 | NULL), |
1688 | GNUNET_MQ_handler_end ()); | 1689 | GNUNET_MQ_handler_end ()); |
1689 | 1690 | ||
1690 | 1691 | ||
1691 | /* end of gnunet-service-namestore.c */ | 1692 | /* end of gnunet-service-namestore.c */ |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 05776801b..954af98d2 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_rest_plugin.h" | 28 | #include "gnunet_rest_plugin.h" |
29 | #include "gnunet_gns_service.h" | ||
29 | #include "gnunet_namestore_service.h" | 30 | #include "gnunet_namestore_service.h" |
30 | #include "gnunet_identity_service.h" | 31 | #include "gnunet_identity_service.h" |
31 | #include "gnunet_rest_lib.h" | 32 | #include "gnunet_rest_lib.h" |
@@ -458,7 +459,7 @@ namestore_list_response (void *cls, | |||
458 | for (i=0; i<rd_len; i++) | 459 | for (i=0; i<rd_len; i++) |
459 | { | 460 | { |
460 | if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && | 461 | if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && |
461 | (0 != strcmp (rname, "+")) ) | 462 | (0 != strcmp (rname, GNUNET_GNS_MASTERZONE_STR)) ) |
462 | continue; | 463 | continue; |
463 | 464 | ||
464 | if ( (rd[i].record_type != handle->type) && | 465 | if ( (rd[i].record_type != handle->type) && |
diff --git a/src/util/client.c b/src/util/client.c index 7a718fc8d..3479fa971 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -261,11 +261,11 @@ transmit_ready (void *cls) | |||
261 | pos = (const char *) cstate->msg; | 261 | pos = (const char *) cstate->msg; |
262 | len = ntohs (cstate->msg->size); | 262 | len = ntohs (cstate->msg->size); |
263 | GNUNET_assert (cstate->msg_off < len); | 263 | GNUNET_assert (cstate->msg_off < len); |
264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 264 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
265 | "client: message of type %u trying to send with socket %p (MQ: %p\n", | 265 | "message of type %u trying to send with socket %p (MQ: %p\n", |
266 | ntohs(cstate->msg->type), | 266 | ntohs(cstate->msg->type), |
267 | cstate->sock, | 267 | cstate->sock, |
268 | cstate->mq); | 268 | cstate->mq); |
269 | 269 | ||
270 | RETRY: | 270 | RETRY: |
271 | ret = GNUNET_NETWORK_socket_send (cstate->sock, | 271 | ret = GNUNET_NETWORK_socket_send (cstate->sock, |
@@ -273,13 +273,13 @@ transmit_ready (void *cls) | |||
273 | len - cstate->msg_off); | 273 | len - cstate->msg_off); |
274 | if (-1 == ret) | 274 | if (-1 == ret) |
275 | { | 275 | { |
276 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 276 | LOG (GNUNET_ERROR_TYPE_WARNING, |
277 | "client: error during sending message of type %u\n", | 277 | "Error during sending message of type %u\n", |
278 | ntohs(cstate->msg->type)); | 278 | ntohs(cstate->msg->type)); |
279 | if (EINTR == errno){ | 279 | if (EINTR == errno){ |
280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 280 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
281 | "client: retrying message of type %u\n", | 281 | "Retrying message of type %u\n", |
282 | ntohs(cstate->msg->type)); | 282 | ntohs(cstate->msg->type)); |
283 | goto RETRY; | 283 | goto RETRY; |
284 | } | 284 | } |
285 | GNUNET_MQ_inject_error (cstate->mq, | 285 | GNUNET_MQ_inject_error (cstate->mq, |
@@ -290,9 +290,9 @@ transmit_ready (void *cls) | |||
290 | cstate->msg_off += ret; | 290 | cstate->msg_off += ret; |
291 | if (cstate->msg_off < len) | 291 | if (cstate->msg_off < len) |
292 | { | 292 | { |
293 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 293 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
294 | "client: rescheduling message of type %u\n", | 294 | "rescheduling message of type %u\n", |
295 | ntohs(cstate->msg->type)); | 295 | ntohs(cstate->msg->type)); |
296 | cstate->send_task | 296 | cstate->send_task |
297 | = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | 297 | = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, |
298 | cstate->sock, | 298 | cstate->sock, |
@@ -302,9 +302,9 @@ transmit_ready (void *cls) | |||
302 | GNUNET_MQ_impl_send_in_flight (cstate->mq); | 302 | GNUNET_MQ_impl_send_in_flight (cstate->mq); |
303 | return; | 303 | return; |
304 | } | 304 | } |
305 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 305 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
306 | "client: sending message of type %u successful\n", | 306 | "sending message of type %u successful\n", |
307 | ntohs(cstate->msg->type)); | 307 | ntohs(cstate->msg->type)); |
308 | cstate->msg = NULL; | 308 | cstate->msg = NULL; |
309 | GNUNET_MQ_impl_send_continue (cstate->mq); | 309 | GNUNET_MQ_impl_send_continue (cstate->mq); |
310 | } | 310 | } |
@@ -394,9 +394,9 @@ connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq, | |||
394 | if (NULL != cstate->retry_task) | 394 | if (NULL != cstate->retry_task) |
395 | GNUNET_SCHEDULER_cancel (cstate->retry_task); | 395 | GNUNET_SCHEDULER_cancel (cstate->retry_task); |
396 | if (NULL != cstate->sock){ | 396 | if (NULL != cstate->sock){ |
397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 397 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
398 | "client: destroying socket: %p\n", | 398 | "destroying socket: %p\n", |
399 | cstate->sock); | 399 | cstate->sock); |
400 | GNUNET_NETWORK_socket_close (cstate->sock); | 400 | GNUNET_NETWORK_socket_close (cstate->sock); |
401 | } | 401 | } |
402 | cancel_aps (cstate); | 402 | cancel_aps (cstate); |
@@ -822,9 +822,9 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq, | |||
822 | cstate->msg = msg; | 822 | cstate->msg = msg; |
823 | cstate->msg_off = 0; | 823 | cstate->msg_off = 0; |
824 | if (NULL == cstate->sock){ | 824 | if (NULL == cstate->sock){ |
825 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 825 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
826 | "client: message of type %u waiting for socket\n", | 826 | "message of type %u waiting for socket\n", |
827 | ntohs(msg->type)); | 827 | ntohs(msg->type)); |
828 | return; /* still waiting for connection */ | 828 | return; /* still waiting for connection */ |
829 | } | 829 | } |
830 | cstate->send_task | 830 | cstate->send_task |
diff --git a/src/util/mq.c b/src/util/mq.c index 33bbaa6ad..af700836c 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -358,10 +358,10 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, | |||
358 | GNUNET_assert (NULL == mq->envelope_head); | 358 | GNUNET_assert (NULL == mq->envelope_head); |
359 | mq->current_envelope = ev; | 359 | mq->current_envelope = ev; |
360 | 360 | ||
361 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 361 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
362 | "mq: sending message of type %u, queue empty (MQ: %p)\n", | 362 | "sending message of type %u, queue empty (MQ: %p)\n", |
363 | ntohs(ev->mh->type), | 363 | ntohs(ev->mh->type), |
364 | mq); | 364 | mq); |
365 | 365 | ||
366 | mq->send_impl (mq, | 366 | mq->send_impl (mq, |
367 | ev->mh, | 367 | ev->mh, |
@@ -459,9 +459,9 @@ impl_send_continue (void *cls) | |||
459 | mq->envelope_tail, | 459 | mq->envelope_tail, |
460 | mq->current_envelope); | 460 | mq->current_envelope); |
461 | 461 | ||
462 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 462 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
463 | "mq: sending message of type %u from queue\n", | 463 | "sending message of type %u from queue\n", |
464 | ntohs(mq->current_envelope->mh->type)); | 464 | ntohs(mq->current_envelope->mh->type)); |
465 | 465 | ||
466 | mq->send_impl (mq, | 466 | mq->send_impl (mq, |
467 | mq->current_envelope->mh, | 467 | mq->current_envelope->mh, |
@@ -851,9 +851,9 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) | |||
851 | ev); | 851 | ev); |
852 | GNUNET_assert (0 < mq->queue_length); | 852 | GNUNET_assert (0 < mq->queue_length); |
853 | mq->queue_length--; | 853 | mq->queue_length--; |
854 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 854 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
855 | "MQ destroy drops message of type %u\n", | 855 | "MQ destroy drops message of type %u\n", |
856 | ntohs (ev->mh->type)); | 856 | ntohs (ev->mh->type)); |
857 | GNUNET_MQ_discard (ev); | 857 | GNUNET_MQ_discard (ev); |
858 | } | 858 | } |
859 | if (NULL != mq->current_envelope) | 859 | if (NULL != mq->current_envelope) |
@@ -861,9 +861,9 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) | |||
861 | /* we can only discard envelopes that | 861 | /* we can only discard envelopes that |
862 | * are not queued! */ | 862 | * are not queued! */ |
863 | mq->current_envelope->parent_queue = NULL; | 863 | mq->current_envelope->parent_queue = NULL; |
864 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 864 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
865 | "MQ destroy drops current message of type %u\n", | 865 | "MQ destroy drops current message of type %u\n", |
866 | ntohs (mq->current_envelope->mh->type)); | 866 | ntohs (mq->current_envelope->mh->type)); |
867 | GNUNET_MQ_discard (mq->current_envelope); | 867 | GNUNET_MQ_discard (mq->current_envelope); |
868 | mq->current_envelope = NULL; | 868 | mq->current_envelope = NULL; |
869 | GNUNET_assert (0 < mq->queue_length); | 869 | GNUNET_assert (0 < mq->queue_length); |
@@ -946,9 +946,9 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) | |||
946 | mq->envelope_tail, | 946 | mq->envelope_tail, |
947 | mq->current_envelope); | 947 | mq->current_envelope); |
948 | 948 | ||
949 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 949 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
950 | "mq: sending canceled message of type %u queue\n", | 950 | "sending canceled message of type %u queue\n", |
951 | ntohs(ev->mh->type)); | 951 | ntohs(ev->mh->type)); |
952 | 952 | ||
953 | mq->send_impl (mq, | 953 | mq->send_impl (mq, |
954 | mq->current_envelope->mh, | 954 | mq->current_envelope->mh, |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index bd46b4fbb..b92fd6a02 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -500,11 +500,13 @@ handle_response (void *cls, | |||
500 | GNUNET_free (nret); | 500 | GNUNET_free (nret); |
501 | } | 501 | } |
502 | /* finally, make termination call */ | 502 | /* finally, make termination call */ |
503 | rh->name_callback (rh->cls, | 503 | if (GNUNET_SYSERR != rh->was_transmitted) |
504 | NULL); | 504 | rh->name_callback (rh->cls, |
505 | NULL); | ||
505 | } | 506 | } |
506 | if (NULL != rh->addr_callback) | 507 | if ( (NULL != rh->addr_callback) && |
507 | rh->addr_callback (rh->cls, | 508 | (GNUNET_SYSERR != rh->was_transmitted) ) |
509 | rh->addr_callback (rh->cls, | ||
508 | NULL, | 510 | NULL, |
509 | 0); | 511 | 0); |
510 | } | 512 | } |
@@ -637,6 +639,7 @@ numeric_resolution (void *cls) | |||
637 | (const struct sockaddr *) &v4, | 639 | (const struct sockaddr *) &v4, |
638 | sizeof (v4)); | 640 | sizeof (v4)); |
639 | if ( (rh->af == AF_UNSPEC) && | 641 | if ( (rh->af == AF_UNSPEC) && |
642 | (GNUNET_SYSERR != rh->was_transmitted) && | ||
640 | (1 == inet_pton (AF_INET6, | 643 | (1 == inet_pton (AF_INET6, |
641 | hostname, | 644 | hostname, |
642 | &v6.sin6_addr)) ) | 645 | &v6.sin6_addr)) ) |
@@ -646,9 +649,10 @@ numeric_resolution (void *cls) | |||
646 | (const struct sockaddr *) &v6, | 649 | (const struct sockaddr *) &v6, |
647 | sizeof (v6)); | 650 | sizeof (v6)); |
648 | } | 651 | } |
649 | rh->addr_callback (rh->cls, | 652 | if (GNUNET_SYSERR != rh->was_transmitted) |
650 | NULL, | 653 | rh->addr_callback (rh->cls, |
651 | 0); | 654 | NULL, |
655 | 0); | ||
652 | GNUNET_free (rh); | 656 | GNUNET_free (rh); |
653 | return; | 657 | return; |
654 | } | 658 | } |
@@ -661,9 +665,10 @@ numeric_resolution (void *cls) | |||
661 | rh->addr_callback (rh->cls, | 665 | rh->addr_callback (rh->cls, |
662 | (const struct sockaddr *) &v6, | 666 | (const struct sockaddr *) &v6, |
663 | sizeof (v6)); | 667 | sizeof (v6)); |
664 | rh->addr_callback (rh->cls, | 668 | if (GNUNET_SYSERR != rh->was_transmitted) |
665 | NULL, | 669 | rh->addr_callback (rh->cls, |
666 | 0); | 670 | NULL, |
671 | 0); | ||
667 | GNUNET_free (rh); | 672 | GNUNET_free (rh); |
668 | return; | 673 | return; |
669 | } | 674 | } |
@@ -725,9 +730,10 @@ loopback_resolution (void *cls) | |||
725 | GNUNET_break (0); | 730 | GNUNET_break (0); |
726 | break; | 731 | break; |
727 | } | 732 | } |
728 | rh->addr_callback (rh->cls, | 733 | if (GNUNET_SYSERR != rh->was_transmitted) |
729 | NULL, | 734 | rh->addr_callback (rh->cls, |
730 | 0); | 735 | NULL, |
736 | 0); | ||
731 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 737 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
732 | "Finished resolving hostname `%s'.\n", | 738 | "Finished resolving hostname `%s'.\n", |
733 | (const char *) &rh[1]); | 739 | (const char *) &rh[1]); |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 51afc85e5..e00ca444b 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -520,8 +520,8 @@ GNUNET_SCHEDULER_shutdown () | |||
520 | { | 520 | { |
521 | struct GNUNET_SCHEDULER_Task *pos; | 521 | struct GNUNET_SCHEDULER_Task *pos; |
522 | 522 | ||
523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 523 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
524 | "GNUNET_SCHEDULER_shutdown\n"); | 524 | "GNUNET_SCHEDULER_shutdown\n"); |
525 | if (NULL != install_parent_control_task) | 525 | if (NULL != install_parent_control_task) |
526 | { | 526 | { |
527 | GNUNET_SCHEDULER_cancel (install_parent_control_task); | 527 | GNUNET_SCHEDULER_cancel (install_parent_control_task); |
@@ -1953,7 +1953,7 @@ GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task, | |||
1953 | /** | 1953 | /** |
1954 | * Function called by external event loop implementations to tell the | 1954 | * Function called by external event loop implementations to tell the |
1955 | * scheduler to run some of the tasks that are ready. Must be called | 1955 | * scheduler to run some of the tasks that are ready. Must be called |
1956 | * only after #GNUNET_SCHEDULER_driver_init has been called and before | 1956 | * only after #GNUNET_SCHEDULER_driver_init has been called and before |
1957 | * #GNUNET_SCHEDULER_driver_done is called. | 1957 | * #GNUNET_SCHEDULER_driver_done is called. |
1958 | * This function may return even though there are tasks left to run | 1958 | * This function may return even though there are tasks left to run |
1959 | * just to give other tasks a chance as well. If we return #GNUNET_YES, | 1959 | * just to give other tasks a chance as well. If we return #GNUNET_YES, |
@@ -2023,9 +2023,9 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) | |||
2023 | * waiting for the timeout, so we handle this gracefully. It might | 2023 | * waiting for the timeout, so we handle this gracefully. It might |
2024 | * also be a programming error in the driver though. | 2024 | * also be a programming error in the driver though. |
2025 | */ | 2025 | */ |
2026 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 2026 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2027 | "GNUNET_SCHEDULER_do_work did not find any ready " | 2027 | "GNUNET_SCHEDULER_do_work did not find any ready " |
2028 | "tasks and timeout has not been reached yet."); | 2028 | "tasks and timeout has not been reached yet.\n"); |
2029 | return GNUNET_NO; | 2029 | return GNUNET_NO; |
2030 | } | 2030 | } |
2031 | /** | 2031 | /** |
@@ -2128,7 +2128,7 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) | |||
2128 | * Function called by external event loop implementations to initialize | 2128 | * Function called by external event loop implementations to initialize |
2129 | * the scheduler. An external implementation has to provide @a driver | 2129 | * the scheduler. An external implementation has to provide @a driver |
2130 | * which contains callbacks for the scheduler (see definition of struct | 2130 | * which contains callbacks for the scheduler (see definition of struct |
2131 | * #GNUNET_SCHEDULER_Driver). The callbacks are used to instruct the | 2131 | * #GNUNET_SCHEDULER_Driver). The callbacks are used to instruct the |
2132 | * external implementation to watch for events. If it detects any of | 2132 | * external implementation to watch for events. If it detects any of |
2133 | * those events it is expected to call #GNUNET_SCHEDULER_do_work to let | 2133 | * those events it is expected to call #GNUNET_SCHEDULER_do_work to let |
2134 | * the scheduler handle it. If an event is related to a specific task | 2134 | * the scheduler handle it. If an event is related to a specific task |
@@ -2137,11 +2137,11 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) | |||
2137 | * before by calling #GNUNET_SCHEDULER_task_ready. | 2137 | * before by calling #GNUNET_SCHEDULER_task_ready. |
2138 | 2138 | ||
2139 | * This function has to be called before any tasks are scheduled and | 2139 | * This function has to be called before any tasks are scheduled and |
2140 | * before GNUNET_SCHEDULER_do_work is called for the first time. It | 2140 | * before GNUNET_SCHEDULER_do_work is called for the first time. It |
2141 | * allocates resources that have to be freed again by calling | 2141 | * allocates resources that have to be freed again by calling |
2142 | * #GNUNET_SCHEDULER_driver_done. | 2142 | * #GNUNET_SCHEDULER_driver_done. |
2143 | * | 2143 | * |
2144 | * This function installs the same signal handlers as | 2144 | * This function installs the same signal handlers as |
2145 | * #GNUNET_SCHEDULER_run. This means SIGTERM (and other similar signals) | 2145 | * #GNUNET_SCHEDULER_run. This means SIGTERM (and other similar signals) |
2146 | * will induce a call to #GNUNET_SCHEDULER_shutdown during the next | 2146 | * will induce a call to #GNUNET_SCHEDULER_shutdown during the next |
2147 | * call to #GNUNET_SCHEDULER_do_work. As a result, SIGTERM causes all | 2147 | * call to #GNUNET_SCHEDULER_do_work. As a result, SIGTERM causes all |
@@ -2228,7 +2228,7 @@ GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver) | |||
2228 | * by external event loop implementations after the scheduler has | 2228 | * by external event loop implementations after the scheduler has |
2229 | * shut down. This is the case if both of the following conditions | 2229 | * shut down. This is the case if both of the following conditions |
2230 | * are met: | 2230 | * are met: |
2231 | * | 2231 | * |
2232 | * - all tasks the scheduler has added through the driver's add | 2232 | * - all tasks the scheduler has added through the driver's add |
2233 | * callback have been removed again through the driver's del | 2233 | * callback have been removed again through the driver's del |
2234 | * callback | 2234 | * callback |
@@ -2376,8 +2376,8 @@ select_loop (struct GNUNET_SCHEDULER_Handle *sh, struct DriverContext *context) | |||
2376 | } | 2376 | } |
2377 | if (GNUNET_YES == GNUNET_SCHEDULER_do_work (sh)) | 2377 | if (GNUNET_YES == GNUNET_SCHEDULER_do_work (sh)) |
2378 | { | 2378 | { |
2379 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2379 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2380 | "scheduler has more tasks ready!\n"); | 2380 | "scheduler has more tasks ready!\n"); |
2381 | } | 2381 | } |
2382 | } | 2382 | } |
2383 | GNUNET_NETWORK_fdset_destroy (rs); | 2383 | GNUNET_NETWORK_fdset_destroy (rs); |
@@ -2451,7 +2451,7 @@ select_set_wakeup (void *cls, | |||
2451 | struct GNUNET_TIME_Absolute dt) | 2451 | struct GNUNET_TIME_Absolute dt) |
2452 | { | 2452 | { |
2453 | struct DriverContext *context = cls; | 2453 | struct DriverContext *context = cls; |
2454 | 2454 | ||
2455 | GNUNET_assert (NULL != context); | 2455 | GNUNET_assert (NULL != context); |
2456 | context->timeout = dt; | 2456 | context->timeout = dt; |
2457 | } | 2457 | } |