Ah.... readded accidentially removed patches :-/
OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=155
This commit is contained in:
parent
d2a944c552
commit
d11e18a5a5
44
0001-dhcp-4.1.1-default-paths.patch
Normal file
44
0001-dhcp-4.1.1-default-paths.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From b6ba495cc0b6f578a5cc444af39cab424f63d996 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marius Tomaschewski <mt@suse.de>
|
||||||
|
Date: Thu, 18 Aug 2011 09:50:30 +0200
|
||||||
|
Subject: [PATCH] dhcp-4.1.1-default-paths
|
||||||
|
|
||||||
|
---
|
||||||
|
includes/dhcpd.h | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
|
||||||
|
index b0f73fb..5830bdb 100644
|
||||||
|
--- a/includes/dhcpd.h
|
||||||
|
+++ b/includes/dhcpd.h
|
||||||
|
@@ -1420,11 +1420,11 @@ typedef unsigned char option_mask [16];
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
#ifndef _PATH_DHCPD_DB
|
||||||
|
-#define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
|
||||||
|
+#define _PATH_DHCPD_DB LOCALSTATEDIR"/lib/dhcp/db/dhcpd.leases"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PATH_DHCPD6_DB
|
||||||
|
-#define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
|
||||||
|
+#define _PATH_DHCPD6_DB LOCALSTATEDIR"/lib/dhcp6/db/dhcpd6.leases"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PATH_DHCPD_PID
|
||||||
|
@@ -1454,11 +1454,11 @@ typedef unsigned char option_mask [16];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PATH_DHCLIENT_DB
|
||||||
|
-#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
|
||||||
|
+#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/lib/dhcp/dhclient.leases"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PATH_DHCLIENT6_DB
|
||||||
|
-#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
|
||||||
|
+#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/lib/dhcp6/dhclient6.leases"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PATH_RESOLV_CONF
|
||||||
|
--
|
||||||
|
1.8.4
|
||||||
|
|
75
0002-dhcp-4.1.1-paranoia.patch
Normal file
75
0002-dhcp-4.1.1-paranoia.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From 1561b8cb9bacabc5e6064b84ba7a187bfb97d0ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marius Tomaschewski <mt@suse.de>
|
||||||
|
Date: Thu, 18 Aug 2011 09:53:00 +0200
|
||||||
|
Subject: [PATCH] dhcp-4.1.1-paranoia
|
||||||
|
|
||||||
|
---
|
||||||
|
server/dhcpd.c | 24 ++++++++++++++++++++----
|
||||||
|
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/server/dhcpd.c b/server/dhcpd.c
|
||||||
|
index 7dc7dd2..b4c1bef 100644
|
||||||
|
--- a/server/dhcpd.c
|
||||||
|
+++ b/server/dhcpd.c
|
||||||
|
@@ -207,7 +207,11 @@ static void omapi_listener_start (void *foo)
|
||||||
|
#if defined (PARANOIA)
|
||||||
|
/* to be used in one of two possible scenarios */
|
||||||
|
static void setup_chroot (char *chroot_dir) {
|
||||||
|
- if (geteuid())
|
||||||
|
+ /*
|
||||||
|
+ ** getuid() instead of geteuid(), see
|
||||||
|
+ ** comment by thomas@suse.de bellow
|
||||||
|
+ */
|
||||||
|
+ if (getuid())
|
||||||
|
log_fatal ("you must be root to use chroot");
|
||||||
|
|
||||||
|
if (chroot(chroot_dir)) {
|
||||||
|
@@ -413,7 +417,7 @@ main(int argc, char **argv) {
|
||||||
|
log_fatal ("Insufficient memory to %s %s: %s",
|
||||||
|
"record interface", argv [i],
|
||||||
|
isc_result_totext (result));
|
||||||
|
- strcpy (tmp -> name, argv [i]);
|
||||||
|
+ strncpy (tmp -> name, argv [i], sizeof(tmp->name)-1);
|
||||||
|
if (interfaces) {
|
||||||
|
interface_reference (&tmp -> next,
|
||||||
|
interfaces, MDL);
|
||||||
|
@@ -499,7 +503,15 @@ main(int argc, char **argv) {
|
||||||
|
if (set_user) {
|
||||||
|
struct passwd *tmp_pwd;
|
||||||
|
|
||||||
|
- if (geteuid())
|
||||||
|
+ /*
|
||||||
|
+ ** I query for the real UID and not for the effective UID
|
||||||
|
+ ** just to force the user to run this server as root and
|
||||||
|
+ ** not setting it suid. It should be a paranoia patch and
|
||||||
|
+ ** not a teletubbie patch. *eg*
|
||||||
|
+ ** Note: That the user is still able to set it suid! *zitter*
|
||||||
|
+ ** thomas@suse.de
|
||||||
|
+ */
|
||||||
|
+ if (getuid())
|
||||||
|
log_fatal ("you must be root to set user");
|
||||||
|
|
||||||
|
if (!(tmp_pwd = getpwnam(set_user)))
|
||||||
|
@@ -517,7 +529,10 @@ main(int argc, char **argv) {
|
||||||
|
#define group real_group
|
||||||
|
struct group *tmp_grp;
|
||||||
|
|
||||||
|
- if (geteuid())
|
||||||
|
+ /*
|
||||||
|
+ ** getuid() instead of geteuid(), see above
|
||||||
|
+ */
|
||||||
|
+ if (getuid())
|
||||||
|
log_fatal ("you must be root to set group");
|
||||||
|
|
||||||
|
if (!(tmp_grp = getgrnam(set_group)))
|
||||||
|
@@ -771,6 +786,7 @@ main(int argc, char **argv) {
|
||||||
|
/* change uid to the specified one */
|
||||||
|
|
||||||
|
if (set_gid) {
|
||||||
|
+ /* setgroups is done, OK */
|
||||||
|
if (setgroups (0, (void *)0))
|
||||||
|
log_fatal ("setgroups: %m");
|
||||||
|
if (setgid (set_gid))
|
||||||
|
--
|
||||||
|
1.8.4
|
||||||
|
|
41
0003-dhcp-4.2.2-man-includes.patch
Normal file
41
0003-dhcp-4.2.2-man-includes.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 3c393c65c158048f55017e48aedcc304c9ebd075 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marius Tomaschewski <mt@suse.de>
|
||||||
|
Date: Thu, 18 Aug 2011 10:01:04 +0200
|
||||||
|
Subject: [PATCH] dhcp-4.2.2-man-includes
|
||||||
|
|
||||||
|
---
|
||||||
|
dhcpctl/dhcpctl.3 | 4 ++--
|
||||||
|
omapip/omapi.3 | 2 +-
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dhcpctl/dhcpctl.3 b/dhcpctl/dhcpctl.3
|
||||||
|
index ae42a71..d699f4a 100644
|
||||||
|
--- a/dhcpctl/dhcpctl.3
|
||||||
|
+++ b/dhcpctl/dhcpctl.3
|
||||||
|
@@ -430,8 +430,8 @@ that most error checking has been omitted for brevity.
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
-#include "omapip/result.h"
|
||||||
|
-#include "dhcpctl.h"
|
||||||
|
+#include <omapip/result.h>
|
||||||
|
+#include <dhcpctl/dhcpctl.h>
|
||||||
|
|
||||||
|
int main (int argc, char **argv) {
|
||||||
|
dhcpctl_data_string ipaddrstring = NULL;
|
||||||
|
diff --git a/omapip/omapi.3 b/omapip/omapi.3
|
||||||
|
index 8fa8105..a616fd3 100644
|
||||||
|
--- a/omapip/omapi.3
|
||||||
|
+++ b/omapip/omapi.3
|
||||||
|
@@ -88,7 +88,7 @@ the lease ends.
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
- #include <isc/result.h>
|
||||||
|
+ #include <omapip/result.h>
|
||||||
|
#include <dhcpctl/dhcpctl.h>
|
||||||
|
|
||||||
|
int main (int argc, char **argv) {
|
||||||
|
--
|
||||||
|
1.8.4
|
||||||
|
|
37
0004-dhcp-4.1.1-tmpfile.patch
Normal file
37
0004-dhcp-4.1.1-tmpfile.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 70f2683580a88180238804546dd24a6a41427282 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marius Tomaschewski <mt@suse.de>
|
||||||
|
Date: Thu, 18 Aug 2011 10:06:01 +0200
|
||||||
|
Subject: [PATCH] dhcp-4.1.1-tmpfile
|
||||||
|
|
||||||
|
Signed-off-by: Marius Tomaschewski <mt@suse.de>
|
||||||
|
|
||||||
|
diff --git a/server/db.c b/server/db.c
|
||||||
|
index 5238ed8..0c642ad 100644
|
||||||
|
--- a/server/db.c
|
||||||
|
+++ b/server/db.c
|
||||||
|
@@ -1116,15 +1116,19 @@ int new_lease_file ()
|
||||||
|
* either by malice or ignorance, we panic, since the potential
|
||||||
|
* for havoc is high.
|
||||||
|
*/
|
||||||
|
- if (snprintf (newfname, sizeof newfname, "%s.%d",
|
||||||
|
- path_dhcpd_db, (int)t) >= sizeof newfname)
|
||||||
|
+ if (snprintf (newfname, sizeof newfname, "%s.XXXXXX",
|
||||||
|
+ path_dhcpd_db) >= sizeof newfname)
|
||||||
|
log_fatal("new_lease_file: lease file path too long");
|
||||||
|
|
||||||
|
- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664);
|
||||||
|
+ db_fd = mkstemp (newfname);
|
||||||
|
if (db_fd < 0) {
|
||||||
|
log_error ("Can't create new lease file: %m");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+ if (fchmod(db_fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) {
|
||||||
|
+ log_error ("Can't fchmod new lease file: %m");
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
#if defined (PARANOIA)
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
2.1.4
|
||||||
|
|
29
0005-dhcp-4.1.1-dhclient-exec-filedes.patch
Normal file
29
0005-dhcp-4.1.1-dhclient-exec-filedes.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 92a611b4b05ef420e81c2c78f8c1eb3b38c31627 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marius Tomaschewski <mt@suse.de>
|
||||||
|
Date: Thu, 18 Aug 2011 10:28:04 +0200
|
||||||
|
Subject: [PATCH] dhcp-4.1.1-dhclient-exec-filedes
|
||||||
|
|
||||||
|
---
|
||||||
|
client/dhclient.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/client/dhclient.c b/client/dhclient.c
|
||||||
|
index 52121be..203d3d1 100644
|
||||||
|
--- a/client/dhclient.c
|
||||||
|
+++ b/client/dhclient.c
|
||||||
|
@@ -3369,6 +3369,12 @@ int script_go (client)
|
||||||
|
*/
|
||||||
|
if (leaseFile != NULL)
|
||||||
|
fclose(leaseFile);
|
||||||
|
+ if ((i = open("/dev/null", O_RDWR)) != -1) {
|
||||||
|
+ dup2(i, STDIN_FILENO);
|
||||||
|
+ dup2(i, STDOUT_FILENO);
|
||||||
|
+ if (i > STDERR_FILENO)
|
||||||
|
+ close(i);
|
||||||
|
+ }
|
||||||
|
execve (scriptName, argv, envp);
|
||||||
|
log_error ("execve (%s, ...): %m", scriptName);
|
||||||
|
exit (0);
|
||||||
|
--
|
||||||
|
1.8.4
|
||||||
|
|
131
0006-dhcp-4.3.2-dhclient-send-hostname-or-fqdn.patch
Normal file
131
0006-dhcp-4.3.2-dhclient-send-hostname-or-fqdn.patch
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
From ec55fe43e597e5ea0f8dff5b8edef091c0911801 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marius Tomaschewski <mt@suse.de>
|
||||||
|
Date: Thu, 18 Aug 2011 10:49:07 +0200
|
||||||
|
Subject: [PATCH] dhcp-4.3.2-dhclient-send-hostname-or-fqdn
|
||||||
|
|
||||||
|
Signed-off-by: Marius Tomaschewski <mt@suse.de>
|
||||||
|
|
||||||
|
diff --git a/client/dhclient.8 b/client/dhclient.8
|
||||||
|
index 5b05698..d9a26b7 100644
|
||||||
|
--- a/client/dhclient.8
|
||||||
|
+++ b/client/dhclient.8
|
||||||
|
@@ -66,6 +66,10 @@ dhclient - Dynamic Host Configuration Protocol Client
|
||||||
|
.I LL|LLT
|
||||||
|
]
|
||||||
|
[
|
||||||
|
+.B -H
|
||||||
|
+.I hostname
|
||||||
|
+]
|
||||||
|
+[
|
||||||
|
.B -p
|
||||||
|
.I port-number
|
||||||
|
]
|
||||||
|
@@ -326,6 +330,11 @@ transmits these messages to 255.255.255.255 (the IP limited broadcast
|
||||||
|
address). Overriding this is mostly useful for debugging purposes. This
|
||||||
|
feature is not supported in DHCPv6 (\fB-6\fR) mode.
|
||||||
|
.TP
|
||||||
|
+.BI \-H \ hostname
|
||||||
|
+This flag may be used to specify a client hostname that should be sent to
|
||||||
|
+the DHCP server as host-name (ipv4 only) or fqdn to perform dns update.
|
||||||
|
+Note, that this option is a SUSE/Novell extension.
|
||||||
|
+.TP
|
||||||
|
.BI \-g \ relay
|
||||||
|
.\" mockup relay
|
||||||
|
Set the giaddr field of all packets to the \fIrelay\fR IP address
|
||||||
|
diff --git a/client/dhclient.c b/client/dhclient.c
|
||||||
|
index cf612d1..0e39161 100644
|
||||||
|
--- a/client/dhclient.c
|
||||||
|
+++ b/client/dhclient.c
|
||||||
|
@@ -124,6 +124,7 @@ main(int argc, char **argv) {
|
||||||
|
int no_dhclient_db = 0;
|
||||||
|
int no_dhclient_pid = 0;
|
||||||
|
int no_dhclient_script = 0;
|
||||||
|
+ char *dhclient_hostname = NULL;
|
||||||
|
#ifdef DHCPv6
|
||||||
|
int local_family_set = 0;
|
||||||
|
#endif /* DHCPv6 */
|
||||||
|
@@ -241,6 +242,24 @@ main(int argc, char **argv) {
|
||||||
|
if (++i == argc)
|
||||||
|
usage();
|
||||||
|
mockup_relay = argv[i];
|
||||||
|
+ } else if (!strcmp (argv[i], "-H")) {
|
||||||
|
+ size_t len;
|
||||||
|
+ if (++i == argc || !argv[i] || *(argv[i]) == '\0')
|
||||||
|
+ usage ();
|
||||||
|
+ len = strlen (argv[i]);
|
||||||
|
+ if (len > HOST_NAME_MAX) {
|
||||||
|
+ log_error("-H option hostname string \"%s\" is too long:"
|
||||||
|
+ "maximum length is %d characters",
|
||||||
|
+ argv[i], HOST_NAME_MAX);
|
||||||
|
+ exit(1);
|
||||||
|
+ } else if(check_domain_name(argv[i], len,
|
||||||
|
+ local_family == AF_INET6 ? 1 : 0) != 0) {
|
||||||
|
+ log_error("suspect %s in -H option: \"%s\"",
|
||||||
|
+ local_family == AF_INET6 ? "fqdn" : "hostname",
|
||||||
|
+ argv[i]);
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ dhclient_hostname = argv [i];
|
||||||
|
} else if (!strcmp(argv[i], "-nw")) {
|
||||||
|
nowait = 1;
|
||||||
|
} else if (!strcmp(argv[i], "-n")) {
|
||||||
|
@@ -510,6 +529,48 @@ main(int argc, char **argv) {
|
||||||
|
/* Parse the dhclient.conf file. */
|
||||||
|
read_client_conf();
|
||||||
|
|
||||||
|
+ /* If the user specified a hostname, send it here and now */
|
||||||
|
+ if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) {
|
||||||
|
+ struct parse *cfile = NULL;
|
||||||
|
+ char buf[1024] = {'\0'};
|
||||||
|
+ int len;
|
||||||
|
+
|
||||||
|
+ if (strchr(dhclient_hostname, '.')) {
|
||||||
|
+ len = strlen(dhclient_hostname);
|
||||||
|
+ snprintf (buf, sizeof(buf),
|
||||||
|
+ "send fqdn.fqdn \"%s%s\";\n"
|
||||||
|
+ "send fqdn.encoded on;\n"
|
||||||
|
+ "send fqdn.server-update on;\n"
|
||||||
|
+ "also request %s;\n",
|
||||||
|
+ dhclient_hostname,
|
||||||
|
+ dhclient_hostname[len - 1] == '.' ? "" : ".",
|
||||||
|
+ local_family == AF_INET6 ? "dhcp6.fqdn" : "fqdn");
|
||||||
|
+ } else if (local_family == AF_INET) {
|
||||||
|
+ snprintf (buf, sizeof(buf),
|
||||||
|
+ "send host-name \"%s\";",
|
||||||
|
+ dhclient_hostname);
|
||||||
|
+ }
|
||||||
|
+ if ((len = strlen(buf))) {
|
||||||
|
+ status = new_parse (&cfile, -1, buf, len,
|
||||||
|
+ "hostname update options", 0);
|
||||||
|
+ if (status != ISC_R_SUCCESS)
|
||||||
|
+ log_fatal ("Cannot parse send host-name statement!");
|
||||||
|
+
|
||||||
|
+ for (;;) {
|
||||||
|
+ const char *val = NULL;
|
||||||
|
+ int token;
|
||||||
|
+
|
||||||
|
+ token = peek_token (&val, (unsigned *)0, cfile);
|
||||||
|
+ if (token == END_OF_FILE)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ parse_client_statement (cfile, NULL,
|
||||||
|
+ &top_level_config);
|
||||||
|
+ }
|
||||||
|
+ end_parse (&cfile);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Parse the lease database. */
|
||||||
|
read_client_leases();
|
||||||
|
|
||||||
|
@@ -756,6 +817,7 @@ static void usage()
|
||||||
|
#else /* DHCPv6 */
|
||||||
|
"[-I1dvrxi] [-nw] [-p <port>] [-D LL|LLT] \n"
|
||||||
|
#endif /* DHCPv6 */
|
||||||
|
+ " [-H hostname]\n"
|
||||||
|
" [-s server-addr] [-cf config-file]\n"
|
||||||
|
" [-df duid-file] [-lf lease-file]\n"
|
||||||
|
" [-pf pid-file] [--no-pid] [-e VAR=val]\n"
|
||||||
|
--
|
||||||
|
2.1.4
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user