philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-addignore.patch

45d60a
diff -Naur ./common/conflex.c ../dhcp-4.2.5/common/conflex.c
45d60a
--- ./common/conflex.c	2016-02-11 13:03:38.892135723 +0100
45d60a
+++ ../dhcp-4.2.5/common/conflex.c	2016-02-11 13:05:18.447135723 +0100
45d60a
@@ -1067,6 +1067,8 @@
45d60a
 			return IF;
45d60a
 		if (!strcasecmp (atom + 1, "s"))
45d60a
 			return IS;
45d60a
+		if (!strcasecmp (atom + 1, "gnore-client-uids"))
45d60a
+			return IGNORE_CLIENT_UIDS;
45d60a
 		if (!strcasecmp (atom + 1, "gnore"))
45d60a
 			return IGNORE;
45d60a
 		break;
45d60a
diff -Naur ./includes/dhcpd.h ../dhcp-4.2.5/includes/dhcpd.h
45d60a
--- ./includes/dhcpd.h	2016-02-11 13:03:38.903135723 +0100
45d60a
+++ ../dhcp-4.2.5/includes/dhcpd.h	2016-02-11 13:12:20.398135723 +0100
45d60a
@@ -766,6 +766,8 @@
45d60a
 #endif
45d60a
 #endif
45d60a
 
45d60a
+#define SV_IGNORE_CLIENT_UIDS 78
45d60a
+
45d60a
 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
45d60a
 # define DEFAULT_DEFAULT_LEASE_TIME 43200
45d60a
 #endif
45d60a
diff -Naur ./includes/dhctoken.h ../dhcp-4.2.5/includes/dhctoken.h
45d60a
--- ./includes/dhctoken.h	2016-02-11 13:03:38.901135723 +0100
45d60a
+++ ../dhcp-4.2.5/includes/dhctoken.h	2016-02-11 13:13:09.958135723 +0100
45d60a
@@ -366,7 +366,8 @@
45d60a
 	SECONDARY6 = 667,
45d60a
 	TOKEN_INFINIBAND = 668,
45d60a
 	BOOTP_BROADCAST_ALWAYS = 669,
45d60a
-	DESTINATION_DESCRIPTOR = 670
45d60a
+	DESTINATION_DESCRIPTOR = 670,
45d60a
+	IGNORE_CLIENT_UIDS = 671
45d60a
 };
45d60a
 
45d60a
 #define is_identifier(x)	((x) >= FIRST_TOKEN &&	\
45d60a
diff -Naur ./server/confpars.c ../dhcp-4.2.5/server/confpars.c
45d60a
--- ./server/confpars.c	2016-02-11 13:03:38.915135723 +0100
45d60a
+++ ../dhcp-4.2.5/server/confpars.c	2016-02-11 13:15:48.269135723 +0100
45d60a
@@ -332,6 +332,7 @@
45d60a
 	       | ONE_LEASE_PER_CLIENT boolean
45d60a
 	       | GET_LEASE_HOSTNAMES boolean
45d60a
 	       | USE_HOST_DECL_NAME boolean
45d60a
+	       | IGNORE_CLIENT_UIDS boolean
45d60a
 	       | NEXT_SERVER ip-addr-or-hostname SEMI
45d60a
 	       | option_parameter
45d60a
 	       | SERVER-IDENTIFIER ip-addr-or-hostname SEMI
45d60a
@@ -4125,6 +4126,10 @@
45d60a
 		code = SV_LEASEQUERY;
45d60a
 		break;
45d60a
 
45d60a
+	      case IGNORE_CLIENT_UIDS:
45d60a
+		code = SV_IGNORE_CLIENT_UIDS;
45d60a
+		break;
45d60a
+
45d60a
 	      default:
45d60a
 		parse_warn (cfile, "expecting allow/deny key");
45d60a
 		skip_to_semi (cfile);
45d60a
@@ -4138,7 +4143,6 @@
45d60a
 	status = option_cache(oc, NULL, data, option, MDL);
45d60a
 	expression_dereference (&data, MDL);
45d60a
 	parse_semi (cfile);
45d60a
-	return status;
45d60a
 }
45d60a
 
45d60a
 void
45d60a
diff -Naur ./server/dhcp.c ../dhcp-4.2.5/server/dhcp.c
45d60a
--- ./server/dhcp.c	2016-02-11 13:03:38.916135723 +0100
45d60a
+++ ../dhcp-4.2.5/server/dhcp.c	2016-02-11 13:24:06.173135723 +0100
45d60a
@@ -2393,34 +2393,39 @@
45d60a
 	/* Update Client Last Transaction Time. */
45d60a
 	lt->cltt = cur_time;
45d60a
 
45d60a
-	/* Record the uid, if given... */
45d60a
-	oc = lookup_option (&dhcp_universe, packet -> options,
45d60a
-			    DHO_DHCP_CLIENT_IDENTIFIER);
45d60a
-	if (!oc)
45d60a
+	/* See if we want to record the uid for this client */
45d60a
+	oc = lookup_option(&server_universe, state->options,
45d60a
+		SV_IGNORE_CLIENT_UIDS);
45d60a
+	if ((oc == NULL) ||
45d60a
+		!evaluate_boolean_option_cache(&ignorep, packet, lease, NULL,
45d60a
+			packet->options, state->options,
45d60a
+			&lease->scope, oc, MDL)) {
45d60a
+
45d60a
+		/* Record the uid, if given... */
45d60a
 		oc = lookup_option (&dhcp_universe, packet -> options,
45d60a
-				    DHO_PXE_CLIENT_ID);
45d60a
-	if (oc &&
45d60a
-	    evaluate_option_cache (&d1, packet, lease,
45d60a
-				   (struct client_state *)0,
45d60a
-				   packet -> options, state -> options,
45d60a
-				   &lease -> scope, oc, MDL)) {
45d60a
-		if (d1.len <= sizeof lt -> uid_buf) {
45d60a
-			memcpy (lt -> uid_buf, d1.data, d1.len);
45d60a
-			lt -> uid = lt -> uid_buf;
45d60a
-			lt -> uid_max = sizeof lt -> uid_buf;
45d60a
-			lt -> uid_len = d1.len;
45d60a
-		} else {
45d60a
-			unsigned char *tuid;
45d60a
-			lt -> uid_max = d1.len;
45d60a
-			lt -> uid_len = d1.len;
45d60a
-			tuid = (unsigned char *)dmalloc (lt -> uid_max, MDL);
45d60a
-			/* XXX inelegant */
45d60a
-			if (!tuid)
45d60a
-				log_fatal ("no memory for large uid.");
45d60a
-			memcpy (tuid, d1.data, lt -> uid_len);
45d60a
-			lt -> uid = tuid;
45d60a
+			DHO_DHCP_CLIENT_IDENTIFIER);
45d60a
+		if (oc &&
45d60a
+		    evaluate_option_cache(&d1, packet, lease, NULL,
45d60a
+					packet->options, state->options,
45d60a
+					&lease->scope, oc, MDL)) {
45d60a
+			if (d1.len <= sizeof(lt->uid_buf)) {
45d60a
+				memcpy(lt->uid_buf, d1.data, d1.len);
45d60a
+				lt->uid = lt->uid_buf;
45d60a
+				lt->uid_max = sizeof(lt->uid_buf);
45d60a
+				lt->uid_len = d1.len;
45d60a
+			} else {
45d60a
+				unsigned char *tuid;
45d60a
+				lt->uid_max = d1.len;
45d60a
+				lt->uid_len = d1.len;
45d60a
+				tuid = (unsigned char *)dmalloc(lt->uid_max, MDL);
45d60a
+				/* XXX inelegant */
45d60a
+				if (!tuid)
45d60a
+					log_fatal ("no memory for large uid.");
45d60a
+				memcpy(tuid, d1.data, lt->uid_len);
45d60a
+				lt->uid = tuid;
45d60a
+			}
45d60a
+			data_string_forget (&d1, MDL);
45d60a
 		}
45d60a
-		data_string_forget (&d1, MDL);
45d60a
 	}
45d60a
 
45d60a
 	if (host) {
45d60a
diff -Naur ./server/stables.c ../dhcp-4.2.5/server/stables.c
45d60a
--- ./server/stables.c	2016-02-11 13:03:38.909135723 +0100
45d60a
+++ ../dhcp-4.2.5/server/stables.c	2016-02-11 13:25:00.081135723 +0100
45d60a
@@ -266,6 +266,7 @@
45d60a
 	{ "ldap-tls-randfile", "t",		&server_universe,  77, 1 },
45d60a
 #endif /* LDAP_USE_SSL */
45d60a
 #endif /* LDAP_CONFIGURATION */
45d60a
+	{ "ignore-client-uids", "f", &server_universe, 78, 1 },
45d60a
 	{ NULL, NULL, NULL, 0, 0 }
45d60a
 };
45d60a