aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--README.md3
-rw-r--r--config.def.h2
-rw-r--r--dyndhcpd.c15
-rw-r--r--dyndhcpd.h2
-rw-r--r--systemd/dyndhcpd@.service2
6 files changed, 14 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index d6d69e4..ce30158 100644
--- a/Makefile
+++ b/Makefile
@@ -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/README.md b/README.md
index c4940d3..7dffc74 100644
--- a/README.md
+++ b/README.md
@@ -55,3 +55,6 @@ URL:
Mirror:
[eworm.de](https://git.eworm.de/cgit.cgi/dyndhcpd/)
[GitLab.com](https://gitlab.com/eworm-de/dyndhcpd#dyndhcpd)
+
+---
+[⬆️ Go back to top](#top)
diff --git a/config.def.h b/config.def.h
index 3384037..7ebe467 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,5 +1,5 @@
/*
- * (C) 2013-2021 by Christian Hesse <mail@eworm.de>
+ * (C) 2013-2025 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/dyndhcpd.c b/dyndhcpd.c
index 82c20ee..5ebc2ac 100644
--- a/dyndhcpd.c
+++ b/dyndhcpd.c
@@ -1,5 +1,5 @@
/*
- * (C) 2013-2021 by Christian Hesse <mail@eworm.de>
+ * (C) 2013-2025 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;
}
diff --git a/dyndhcpd.h b/dyndhcpd.h
index 3237682..77fd4bf 100644
--- a/dyndhcpd.h
+++ b/dyndhcpd.h
@@ -1,5 +1,5 @@
/*
- * (C) 2013-2021 by Christian Hesse <mail@eworm.de>
+ * (C) 2013-2025 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..b271bd0 100644
--- a/systemd/dyndhcpd@.service
+++ b/systemd/dyndhcpd@.service
@@ -1,4 +1,4 @@
-# (C) 2013-2021 by Christian Hesse <mail@eworm.de>
+# (C) 2013-2025 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