Skip to content

Commit

Permalink
tolerate white spaces in the config file and more in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kamarya committed Oct 30, 2016
1 parent 766c0bb commit bb74270
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 11 deletions.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DNSd is a daemon a.k.a. service for Unix-like systems. It provides a local DNS b
- Minimalistic implementation approach.
- Highly configurable through a simple config. file.
- A Self contained package that depends only on [libcurl](https://curl.haxx.se/libcurl/).
- Suppoted records are **A**,**AAAA**,**CNAME**,**NS** and **MX**.
- Supported records are **A**,**AAAA**,**CNAME**,**NS** and **MX**.

# Build and Install
Build the software by running the following commands in the terminal.
Expand All @@ -32,6 +32,36 @@ make linux-service
systemctl daemon-reload
service dnsd start
```
### Verification
You can verify wether the service is accessible through ```host -va github.com localhost```.
```
Trying "github.com"
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61907
;; flags: qr rd; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;github.com. IN ANY
;; ANSWER SECTION:
github.com. 299 IN A 192.30.253.112
github.com. 299 IN A 192.30.253.113
github.com. 899 IN NS ns-1283.awsdns-32.org.
github.com. 899 IN NS ns-1707.awsdns-21.co.uk.
github.com. 899 IN NS ns-421.awsdns-52.com.
github.com. 899 IN NS ns-520.awsdns-01.net.
github.com. 3599 IN MX 1 aspmx.l.google.com.
github.com. 3599 IN MX 10 alt3.aspmx.l.google.com.
github.com. 3599 IN MX 10 alt4.aspmx.l.google.com.
github.com. 3599 IN MX 5 alt1.aspmx.l.google.com.
github.com. 3599 IN MX 5 alt2.aspmx.l.google.com.
Received 390 bytes from 127.0.0.1#53 in 178 ms
```
# License

This software is licensed under the GNU GPLv3 license.
Expand Down
4 changes: 2 additions & 2 deletions dnsd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# https_proxy=<IP>:<PORT>

# The default server URL is set below.
server_url=https://dns.google.com/
server_url=https://dns.goog le .com/

# The local service port
service_port=53
service_port = 53
14 changes: 14 additions & 0 deletions dnssec.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ int parse_options()
--read;
}

remove_spaces(line);

// skip too short lines
if (read < 3) continue;

Expand Down Expand Up @@ -770,3 +772,15 @@ int create_pidfile()

return EXIT_SUCCESS;
}

void remove_spaces(char* str)
{
char* stra = str;
char* strb = str;

do
{
*stra = *strb;
if(*stra != ' ') stra++;
} while(*strb++ != 0);
}
18 changes: 10 additions & 8 deletions dnssec.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,24 +140,26 @@ struct dns_answer
/* functions */


int json_to_answer(char* answer, struct dns_header_detail* header);
int json_to_answer(char*, struct dns_header_detail*);

void format(char* name, size_t length);
void format(char*, size_t);

void copy(char* const dst,const char* src, size_t length);
void copy(char* const, const char*, size_t);

char* getTypeString(uint16_t type, int unknown);
char* getTypeString(uint16_t, int);

void hexdump (char *desc, void *addr, int len);
void handle_signal(int);

void handle_signal(int signal);

void usage(char* exec_name);
void usage(char*);

int parse_options();

int create_pidfile();

void remove_spaces(char*);

void hexdump (char*, void*, int);

#endif /* DNSSL_H */

/*
Expand Down

0 comments on commit bb74270

Please sign in to comment.