]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp-ignore-client-uids.patch
- x32 rebuild
[packages/dhcp.git] / dhcp-ignore-client-uids.patch
1 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/common/conflex.c dhcp-4.2.5-P1/common/conflex.c
2 --- dhcp-4.2.5-P1.orig/common/conflex.c 2014-01-03 20:59:11.105475789 +0100
3 +++ dhcp-4.2.5-P1/common/conflex.c      2014-01-03 20:59:51.775476160 +0100
4 @@ -1067,6 +1067,8 @@
5                         return IF;
6                 if (!strcasecmp (atom + 1, "s"))
7                         return IS;
8 +               if (!strcasecmp (atom + 1, "gnore-client-uids"))
9 +                       return IGNORE_CLIENT_UIDS;
10                 if (!strcasecmp (atom + 1, "gnore"))
11                         return IGNORE;
12                 break;
13 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/includes/dhcpd.h dhcp-4.2.5-P1/includes/dhcpd.h
14 --- dhcp-4.2.5-P1.orig/includes/dhcpd.h 2014-01-03 20:59:11.115475790 +0100
15 +++ dhcp-4.2.5-P1/includes/dhcpd.h      2014-01-03 20:59:51.775476160 +0100
16 @@ -763,6 +763,8 @@
17  #endif
18  #endif
19  
20 +#define SV_IGNORE_CLIENT_UIDS          78
21 +
22  #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
23  # define DEFAULT_DEFAULT_LEASE_TIME 43200
24  #endif
25 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/includes/dhctoken.h dhcp-4.2.5-P1/includes/dhctoken.h
26 --- dhcp-4.2.5-P1.orig/includes/dhctoken.h      2014-01-03 20:59:11.105475789 +0100
27 +++ dhcp-4.2.5-P1/includes/dhctoken.h   2014-01-03 21:00:27.588809818 +0100
28 @@ -365,7 +365,8 @@
29         PRIMARY6 = 666,
30         SECONDARY6 = 667,
31         TOKEN_INFINIBAND = 668,
32 -       BOOTP_BROADCAST_ALWAYS = 669
33 +       BOOTP_BROADCAST_ALWAYS = 669,
34 +       IGNORE_CLIENT_UIDS = 670
35  };
36  
37  #define is_identifier(x)       ((x) >= FIRST_TOKEN &&  \
38 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/server/confpars.c dhcp-4.2.5-P1/server/confpars.c
39 --- dhcp-4.2.5-P1.orig/server/confpars.c        2013-03-04 19:35:09.000000000 +0100
40 +++ dhcp-4.2.5-P1/server/confpars.c     2014-01-03 20:59:51.775476160 +0100
41 @@ -328,6 +328,7 @@
42                | ONE_LEASE_PER_CLIENT boolean
43                | GET_LEASE_HOSTNAMES boolean
44                | USE_HOST_DECL_NAME boolean
45 +              | IGNORE_CLIENT_UIDS boolean
46                | NEXT_SERVER ip-addr-or-hostname SEMI
47                | option_parameter
48                | SERVER-IDENTIFIER ip-addr-or-hostname SEMI
49 @@ -4104,6 +4105,10 @@
50                 code = SV_LEASEQUERY;
51                 break;
52  
53 +             case IGNORE_CLIENT_UIDS:
54 +               code = SV_IGNORE_CLIENT_UIDS;
55 +               break;
56 +
57               default:
58                 parse_warn (cfile, "expecting allow/deny key");
59                 skip_to_semi (cfile);
60 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/server/dhcp.c dhcp-4.2.5-P1/server/dhcp.c
61 --- dhcp-4.2.5-P1.orig/server/dhcp.c    2014-01-03 20:59:11.112142457 +0100
62 +++ dhcp-4.2.5-P1/server/dhcp.c 2014-01-03 20:59:51.778809492 +0100
63 @@ -2337,31 +2337,42 @@
64         /* Update Client Last Transaction Time. */
65         lt->cltt = cur_time;
66  
67 -       /* Record the uid, if given... */
68 -       oc = lookup_option (&dhcp_universe, packet -> options,
69 -                           DHO_DHCP_CLIENT_IDENTIFIER);
70 -       if (oc &&
71 -           evaluate_option_cache (&d1, packet, lease,
72 +       /* Only record the uid if we're not ignoring them */
73 +       oc = lookup_option (&server_universe, state -> options,
74 +                           SV_IGNORE_CLIENT_UIDS);
75 +       if (!oc ||
76 +           !evaluate_boolean_option_cache (&ignorep, packet, lease,
77                                    (struct client_state *)0,
78                                    packet -> options, state -> options,
79                                    &lease -> scope, oc, MDL)) {
80 -               if (d1.len <= sizeof lt -> uid_buf) {
81 -                       memcpy (lt -> uid_buf, d1.data, d1.len);
82 -                       lt -> uid = lt -> uid_buf;
83 -                       lt -> uid_max = sizeof lt -> uid_buf;
84 -                       lt -> uid_len = d1.len;
85 -               } else {
86 -                       unsigned char *tuid;
87 -                       lt -> uid_max = d1.len;
88 -                       lt -> uid_len = d1.len;
89 -                       tuid = (unsigned char *)dmalloc (lt -> uid_max, MDL);
90 -                       /* XXX inelegant */
91 -                       if (!tuid)
92 -                               log_fatal ("no memory for large uid.");
93 -                       memcpy (tuid, d1.data, lt -> uid_len);
94 -                       lt -> uid = tuid;
95 +               /* Record the uid, if given... */
96 +               oc = lookup_option (&dhcp_universe, packet -> options,
97 +                                   DHO_DHCP_CLIENT_IDENTIFIER);
98 +               if (oc &&
99 +                   evaluate_option_cache (&d1, packet, lease,
100 +                                          (struct client_state *)0,
101 +                                          packet -> options,
102 +                                          state -> options,
103 +                                          &lease -> scope, oc, MDL)) {
104 +                       if (d1.len <= sizeof lt -> uid_buf) {
105 +                               memcpy (lt -> uid_buf, d1.data, d1.len);
106 +                               lt -> uid = lt -> uid_buf;
107 +                               lt -> uid_max = sizeof lt -> uid_buf;
108 +                               lt -> uid_len = d1.len;
109 +                       } else {
110 +                               unsigned char *tuid;
111 +                               lt -> uid_max = d1.len;
112 +                               lt -> uid_len = d1.len;
113 +                               tuid = (unsigned char *)
114 +                                       dmalloc (lt -> uid_max, MDL);
115 +                               /* XXX inelegant */
116 +                               if (!tuid)
117 +                                       log_fatal ("no memory for large uid.");
118 +                               memcpy (tuid, d1.data, lt -> uid_len);
119 +                               lt -> uid = tuid;
120 +                       }
121 +                       data_string_forget (&d1, MDL);
122                 }
123 -               data_string_forget (&d1, MDL);
124         }
125  
126         if (host) {
127 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/server/dhcpd.conf.5 dhcp-4.2.5-P1/server/dhcpd.conf.5
128 --- dhcp-4.2.5-P1.orig/server/dhcpd.conf.5      2014-01-03 20:59:11.118809123 +0100
129 +++ dhcp-4.2.5-P1/server/dhcpd.conf.5   2014-01-03 20:59:51.778809492 +0100
130 @@ -2338,6 +2338,20 @@
131  must be a constant value.
132  .RE
133  .PP
134 +The 
135 +.I ignore-client-uids
136 +statement
137 +.RS 0.25i
138 +.PP
139 +.B ignore-client-uids \fIflag\fB;\fR
140 +.PP
141 +If the \fIignore-client-uids\fR statement is present and has a value of
142 +\fItrue\fR or \fIon\fR, clients will be handled as though they provided no UID
143 +and the actual provided UID will not be recorded.  If this statement is not
144 +present or has a value of \fIfalse\fR or \fIoff\fR, then client UIDs will be
145 +parsed and used as normal.
146 +.RE
147 +.PP
148  The
149  .I infinite-is-reserved
150  statement
151 diff -dur -x '*~' -x '*.orig' dhcp-4.2.5-P1.orig/server/stables.c dhcp-4.2.5-P1/server/stables.c
152 --- dhcp-4.2.5-P1.orig/server/stables.c 2013-03-05 19:26:51.000000000 +0100
153 +++ dhcp-4.2.5-P1/server/stables.c      2014-01-03 20:59:51.778809492 +0100
154 @@ -266,6 +266,7 @@
155         { "ldap-tls-randfile", "t",             &server_universe,  77, 1 },
156  #endif /* LDAP_USE_SSL */
157  #endif /* LDAP_CONFIGURATION */
158 +       { "ignore-client-uids", "f",            &server_universe,  78, 1 },
159         { NULL, NULL, NULL, 0, 0 }
160  };
161  
This page took 0.042134 seconds and 3 git commands to generate.