Blame SOURCES/dhcp-addignore.patch

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