Blame SOURCES/dhcp-addignore.patch

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