diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | dyndhcpd.c | 15 | ||||
-rw-r--r-- | dyndhcpd.h | 2 | ||||
-rw-r--r-- | systemd/dyndhcpd@.service | 2 |
5 files changed, 11 insertions, 12 deletions
@@ -13,7 +13,7 @@ LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie # this is just a fallback in case you do not use git but downloaded # a release tarball... -VERSION := 0.1.6 +VERSION := 0.1.8 all: dyndhcpd README.html diff --git a/config.def.h b/config.def.h index 3384037..0ea7418 100644 --- a/config.def.h +++ b/config.def.h @@ -1,5 +1,5 @@ /* - * (C) 2013-2021 by Christian Hesse <mail@eworm.de> + * (C) 2013-2024 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,5 +1,5 @@ /* - * (C) 2013-2021 by Christian Hesse <mail@eworm.de> + * (C) 2013-2024 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ int replace(char ** config, size_t *length, const char ** tmp, if (strncmp(template, *tmp, templatelength) == 0) { *config = realloc(*config, *length + strlen(value) + 1); - *length += sprintf(*config + *length, value); + *length += sprintf(*config + *length, "%s", value); *tmp += templatelength; return 1; } @@ -57,8 +57,7 @@ int main(int argc, char ** argv) { char * interface = NULL; char hostname[HOST_NAME_MAX]; - const char * domainname; - struct hostent *hp; + char * domainname; char * template = NULL; FILE * templatefile; @@ -140,11 +139,11 @@ int main(int argc, char ** argv) { goto out; } - /* get the domainname */ - hp = gethostbyname(hostname); - if ((domainname = strchr(hp->h_name, '.')) != NULL) + /* get the domainname and strip it from hostname */ + if ((domainname = strchr(hostname, '.')) != NULL) { + *domainname = 0; domainname++; - else { + } else { fprintf(stderr, "Could not get domainname, using '" FALLBACKDOMAIN "'\n"); domainname = FALLBACKDOMAIN; } @@ -1,5 +1,5 @@ /* - * (C) 2013-2021 by Christian Hesse <mail@eworm.de> + * (C) 2013-2024 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/systemd/dyndhcpd@.service b/systemd/dyndhcpd@.service index 85dfc30..9be7ee9 100644 --- a/systemd/dyndhcpd@.service +++ b/systemd/dyndhcpd@.service @@ -1,4 +1,4 @@ -# (C) 2013-2021 by Christian Hesse <mail@eworm.de> +# (C) 2013-2024 by Christian Hesse <mail@eworm.de> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |