Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 160979 | Differences between
and this patch

Collapse All | Expand All

(-)dhcp-3.0.5/Changelog-LDAP (+215 lines)
Line 0 Link Here
1
2006-12-15 Brian Masney <masneyb@ntelos.net>
2
	* server/ldap.c (ldap_read_config) - unbind from the LDAP server after
3
	the config file has been ran if the server is being ran in static mode
4
	(from Tomas Hoger <thoger@pobox.sk>)
5
6
	* server/ldap.c (ldap_read_function) - fixed bug where the entire
7
	configuration was not being processed in the LDAP directory.
8
9
	* server/ldap.c - added the following functions for reading values
10
	from the config file: _do_lookup_dhcp_string_option(),
11
	_do_lookup_dhcp_int_option() and _do_lookup_dhcp_enum_option(). This
12
	helped to clean up ldap_start() start a bit. Also, various small
13
	formatting changes to the code.
14
15
2006-12-15 Marius Tomaschewski <mt@suse.de>
16
	* Changelog-LDAP - Added / changed some of entries in
17
	Changelog-LDAP, e.g.  changes to the dhcpServer and
18
	dhcpService objectclasses in schema file was not mentioned.
19
20
        * server/ldap.c Some a little bit paranoid checks to strchr results
21
	in the group patch, avoided allocation of groupname using snprintf
22
	with a "%.*s" format.
23
24
        * server/ldap.c - Readded FIXME comment about one space in
25
	dhcpHWAddress.
26
27
        * server/ldap.c Changed "dhcpdnsZone" and "dhcpdnszoneServer" into
28
	"dhcpDnsZone" and "dhcpDnsZoneServer".
29
30
        * Fixed memory leak in ldap_parse_zone (dfree of keyCn), added checks
31
	for dmalloc and strchr results.
32
33
	* ldap_casa.c, ldap_casa.h - surrounded content of ldap_casa.h and
34
	ldap_casa.c with if defined(LDAP_CASA_AUTH).
35
36
	* contrib/dhcp.schema  - Reverted the equality change for dhcpOption.
37
	The dhcp options are case-insensitive in dhcpd.conf.
38
39
	* Changed "dhcpdnsZone" and "dhcpdnszoneServer" into "dhcpDnsZone"
40
	and "dhcpDnsZoneServer".
41
42
	* Changed "FQDNs" into "DNs" in dhcpLocatorDN description (DN is already
43
	absolute, RDN is relative DN, FQDN means a full qualified domain name).
44
45
2006-12-15 Kalyan <skalyanasundaram@novell.com>
46
	* includes/ldap_casa.h server/ldap_casa.c - updated to support CASA
47
	1.7
48
49
2006-8-15 Kalyan <skalyanasundaram@novell.com>
50
	* server/ldap.c (ldap_parse_options) - fetch option from the group
51
	if the host belongs to that group in the dynamic method.
52
53
	* contrib/dhcp.schema - modified dhcpServiceDN attribute in dhcpServer
54
	objectclasses to be optional instead of mandatory
55
56
	* contrib/dhcp.schema - modified dhcpPrimaryDN attribute in dhcpService
57
	objectclasses to be optional instead of mandatory
58
59
	* contrib/dhcp.schema - schema has been updated with
60
	new objectclasses dhcpLocator,dhcpTsigKey,dhcpdnsZone,dhcpFailOver and
61
	many attributes.
62
63
	* contrib/dhcp.schema - dhcpHWAddress's equality has been modified to
64
	caseIgnoreIA5Match.
65
66
	* server/ldap.c - added support for reading the dhcpTsigKey and
67
	dhcpdnsZone objects. 
68
69
	* server/ldap.c (ldap_parse_options) Fetch option from the group if
70
	the host belongs to that group in the dynamic method.
71
72
	* server/ldap.c - CASA authentication is enabled.
73
74
	* server/ldap.c - introduced new attribute ldap-server-cn to mention
75
	the dhcpServer object name in configuration.
76
77
2006-7-17 Brian Masney <masneyb@ntelos.net>
78
	* server/ldap.c (ldap_read_function) - fixes for reading the data
79
	from the LDAP tree in some cases (patch from
80
	Darrin Smith <beldin@beldin.org>)
81
82
2006-3-17 Brian Masney <masneyb@ntelos.net>
83
	* server/ldap.c (ldap_read_function) - added patch from 
84
	Dmitriy Bogun <kabanyura@gmail.com>. This patch fixes a bug when
85
	EOF wasn't returned in some cases.
86
87
2005-9-26 Brian Masney <masneyb@ntelos.net>
88
	* server/ldap.c (ldap_start) - added support for reading the
89
	ldap-port option. This option was not being used.
90
91
2005-5-24 Brian Masney <masneyb@ntelos.net>
92
	* server/ldap.c (ldap_parse_host) - allow dhcpHost entries that do
93
	not have a hardware address associated with them
94
95
2005-4-11 Brian Masney <masneyb@ntelos.net>
96
	* README.ldap - updated directions on how to use LDAP over SSL on
97
	non-Linux machines
98
99
2005-2-23 Brian Masney <masneyb@ntelos.net>
100
	* server/ldap.c (ldap_generate_config_string) - do a case insensitive
101
	string comparsion when comparing the object classes
102
103
2004-11-8 Brian Masney <masneyb@ntelos.net>
104
	* debian/control - updated the depends and build-depends line
105
	(from Andrew Pollock <me@andrew.net.au>)
106
107
2004-10-13 Brian Masney <masneyb@ntelos.net>
108
	* server/ldap.c (ldap_start) - allow doing an anonymous bind to the
109
	LDAP server
110
111
2004-9-27 Brian Masney <masneyb@ntelos.net>
112
	* contrib/dhcpd-conf-to-ldap.pl - make sure the DHCP hardware address
113
	is always lowercased
114
115
2004-7-30 Brian Masney <masneyb@ntelos.net>
116
	* server/ldap.c - added more debbuging statements. Fixed possible crash
117
	that could occur whenever more than 1 external DN is added to an LDAP
118
	entry. Fixed possible infinite loop when reading the external DNs.
119
	(from Sebastian Hetze <s.hetze@linux-ag.de>)
120
121
2004-7-1 Brian Masney <masneyb@ntelos.net>
122
	* README.ldap - updated build instructions paragraph
123
	(from Mason Schmitt <sysadmin@sunwave.net>)
124
125
2004-6-29 Brian Masney <masneyb@ntelos.net>
126
	* debian/control - set the minimum required version of the DHCP server
127
	to be 3.0.1rc9
128
129
	* configure - fix for sed when configure was run from an older shell
130
131
2004-6-22 Brian Masney <masneyb@ntelos.net>
132
	* Updated patch to use ISC DHCP 3.0.1rc14
133
134
2004-5-24 Brian Masney <masneyb@ntelos.net>
135
	* server/ldap.c - don't append a ; to the end of a dhcpStatement if it
136
	ends in }
137
138
	* server/ldap.c contrib/dhcpd-conf-to-ldap.pl - support having multiple
139
	dhcpRange statements (from Marco D'Ettorre <marco.dettorre@sys-net.it>)
140
141
2004-5-5 Brian Masney <masneyb@ntelos.net>
142
	* server/ldap.c - added more debugging statements when
143
	it is compiled in to help troubleshoot parsing errors. Don't free
144
	a LDAP connection prematurely when there is a reference to another
145
	LDAP tree. If the config entry ends in }, make sure a ; gets tacked
146
	on
147
148
	* debian/* - Updated version number. Renamed package from
149
	dhcp3-ldap-ntelos to dhcp3-server-ldap.
150
151
	* server/ldap.c - enclose the shared-network name in quotes so
152
	that there can be shared network statements in LDAP that have spaces
153
	in them
154
155
	* configure - after the work directory is setup, add -lldap -llber
156
	to the server Makefile
157
158
Wed Apr 21 15:09:08 CEST 2004 - mt@suse.de
159
	* contrib/dhcpd-conf-to-ldap.pl:
160
	  - added "--conf=file" option usable instead of stdin
161
	  - added "--ldif=file" option usable instead of stdout
162
	  - added "--second=host|dn" option usefull for failover
163
	  - added "--use=feature" option to enable extended features;
164
	    currently used to enable failover (default is disabled).
165
	  - extended remaining_line() to support block statements
166
	  - fixed / improved failover support, added notes about
167
168
	* server/ldap.c:
169
	  - moved code checking statement ends to check_statement_end()
170
	  - moved parsing of entry options/statements to
171
	    ldap_parse_entry_options()
172
	  - moved code closing debug fd into ldap_close_debug_fd()
173
	  - moved code writing to debug fd into ldap_write_debug()
174
	  - added support for full hostname in dhcpServer search filter
175
	  - added support for multiple dhcpService entries in dhcpServer object
176
	  - added parsing of options and statements for dhcpServer object
177
	  - added verify if dhcpService contains server dn as primary or
178
	    secondary
179
	  - changed to search for dhcpHost,dhcpSubClass bellow of all
180
	    dhcpService trees instead of base-dn (avoids finding of hosts in
181
	    foreign configs)
182
	  - fixes to free all dn's fetched by ldap_get_dn (e.g. debug output)
183
	  - fixes to free ldap results, mainly in cases where no LDAP_SUCCESS
184
	    returned or other error conditions happened
185
	  - fixed/improved some log messages
186
187
2004-3-30 Brian Masney <masneyb@ntelos.net>
188
	* contrib/dhcpd-conf-to-ldap.pl - added option to control the
189
	DHCP Config DN. Wrap the DHCP Statements in { }
190
	This patch was contributed by Marius Tomaschewski <mt@suse.de>
191
192
	* server/ldap.c - changed ldap_username and ldap_password to
193
	be optional (anonymous bind is used then). Added {} block support
194
	to dhcpStatements. (no ";" at end if statement ends with a "}").
195
	Fixed writing to ldap-debug-file. Changed find_haddr_in_ldap() to
196
	use dhcpHost objectClass in its filter
197
	This patch was contributed by Marius Tomaschewski <mt@suse.de>
198
199
2004-3-23 Brian Masney <masneyb@ntelos.net>
200
	* contrib/dhcpd-conf-to-ldap.pl - added options for server, basedn
201
	options and usage message (Net::Domain instead of SYS::Hostname).
202
	Added handling of zone, authoritative and failover (config and
203
	pool-refs) statements. Added numbering of groups and pools per
204
	subnet. This patch was contributed by Marius Tomaschewski <mt@suse.de>
205
206
2004-2-26 Brian Masney <masneyb@ntelos.net>
207
	* fixed an instance where the LDAP server would restart, but the DHCP
208
	server would not reconnect
209
210
2004-2-18 Brian Masney <masneyb@ntelos.net>
211
	* allow multiple dhcp*DN entries in the LDAP entry.
212
213
2003-9-11 Brian Masney <masneyb@ntelos.net>
214
	* updated patch to work with 3.0.1rc12
215
(-)dhcp-3.0.5/README.ldap (+172 lines)
Line 0 Link Here
1
LDAP Support in DHCP
2
Brian Masney <masneyb@ntelos.net>
3
Last updated 3/23/2003
4
5
This document describes setting up the DHCP server to read it's configuration 
6
from LDAP. This work is based on the IETF document 
7
draft-ietf-dhc-ldap-schema-01.txt included in the doc directory. For the latest
8
version of this document, please see http://home.ntelos.net/~masneyb.
9
10
First question on most people's mind is "Why do I want to store my 
11
configuration in LDAP?" If you run a small DHCP server, and the configuration
12
on it rarely changes, then you won't need to store your configuration in LDAP.
13
But, if you have several DHCP servers, and you want an easy way to manage your 
14
configuration, this can be a solution. 
15
16
The first step will be to setup your LDAP server. I am using OpenLDAP from
17
www.openldap.org. Building and installing OpenLDAP is beyond the scope of this 
18
document. There is plenty of documentation out there about this. Once you have 
19
OpenLDAP installed, you will have to edit your slapd.conf file. I added the 
20
following 2 lines to my configuration file:
21
22
include         /etc/ldap/schema/dhcp.schema
23
index           dhcpHWAddress 	eq
24
index           dhcpClassData	eq
25
26
The first line tells it to include the dhcp schema file. You will find this 
27
file under the contrib directory in this distribution. You will need to copy 
28
this file to where your other schema files are (maybe
29
/usr/local/openldap/etc/openldap/schema/). The second line sets up
30
an index for the dhcpHWAddress parameter. The third parameter is for reading 
31
subclasses from LDAP every time a DHCP request comes in. Make sure you run the 
32
slapindex command and restart slapd to have these changes to into effect.
33
34
Now that you have LDAP setup, you should be able to use gq (http://biot.com/gq/)
35
to verify that the dhcp schema file is loaded into LDAP. Pull up gq, and click
36
on the Schema tab. Go under objectClasses, and you should see at least the 
37
following object classes listed: dhcpClass, dhcpGroup, dhcpHost, dhcpOptions, 
38
dhcpPool, dhcpServer, dhcpService, dhcpSharedNetwork, dhcpSubClass, and 
39
dhcpSubnet. If you do not see these, you need to check over your LDAP 
40
configuration before you go any further.
41
42
You should now be ready to build DHCP. If you would like to enable LDAP over
43
SSL, you will need to perform the following steps:
44
45
  * Edit the includes/site.h file and uncomment the USE_SSL line
46
  * Edit the dst/Makefile.dist file and remove md5_dgst.c and md5_dgst.o
47
    from the SRC= and OBJ= lines (around line 24)
48
  * Now run configure in the base source directory. If you chose to enable
49
    LDAP over SSL, you must append -lcrypto -lssl to the LIBS= line in the file
50
    work.os/server/Makefile (replace os with your operating system, linux-2.2 on
51
    my machine).  You should now be able to type make to build your DHCP server.
52
53
If you choose to not enable LDAP over SSL, then you only need to run configure
54
and make in the toplevel source directory.
55
56
Once you have DHCP installed, you will need to setup your initial plaintext 
57
config file. In my /etc/dhcpd.conf file, I have:
58
59
ldap-server "localhost";
60
ldap-port 389;
61
ldap-username "cn=DHCP User, dc=ntelos, dc=net";
62
ldap-password "blah";
63
ldap-base-dn "dc=ntelos, dc=net";
64
ldap-method dynamic;
65
ldap-debug-file "/var/log/dhcp-ldap-startup.log";
66
67
All of these parameters should be self explanatory except for the ldap-method.
68
You can set this to static or dynamic. If you set it to static, the 
69
configuration is read once on startup, and LDAP isn't used anymore. But, if you
70
set this to dynamic, the configuration is read once on startup, and the 
71
hosts that are stored in LDAP are looked up every time a DHCP request comes in.
72
73
When the optional statement ldap-debug-file is specified, on startup the DHCP
74
server will write out the configuration that it generated from LDAP. If you are
75
getting errors about your LDAP configuration, this is a good place to start
76
looking.
77
78
The next step is to set up your LDAP tree. Here is an example config that will
79
give a 10.100.0.x address to machines that have a host entry in LDAP. 
80
Otherwise, it will give a 10.200.0.x address to them. (NOTE: replace 
81
dc=ntelos, dc=net with your base dn). If you would like to convert your 
82
existing dhcpd.conf file to LDIF format, there is a script 
83
contrib/dhcpd-conf-to-ldap.pl that will convert it for you. Type
84
dhcpd-conf-to-ldap.pl --help to see the usage information for this script.
85
86
# You must specify the server's host name in LDAP that you are going to run
87
# DHCP on and point it to which config tree you want to use. Whenever DHCP 
88
# first starts up, it will do a search for this entry to find out which 
89
# config to use
90
dn: cn=brian.ntelos.net, dc=ntelos, dc=net
91
objectClass: top
92
objectClass: dhcpServer
93
cn: brian.ntelos.net
94
dhcpServiceDN: cn=DHCP Service Config, dc=ntelos, dc=net
95
96
# Here is the config tree that brian.ntelos.net points to. 
97
dn: cn=DHCP Service Config, dc=ntelos, dc=net
98
cn: DHCP Service Config
99
objectClass: top
100
objectClass: dhcpService
101
dhcpPrimaryDN: dc=ntelos, dc=net
102
dhcpStatements: ddns-update-style none
103
dhcpStatements: default-lease-time 600
104
dhcpStatements: max-lease-time 7200
105
106
# Set up a shared network segment
107
dn: cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
108
cn: WV
109
objectClass: top
110
objectClass: dhcpSharedNetwork
111
112
# Set up a subnet declaration with a pool statement. Also note that we have
113
# a dhcpOptions object with this entry
114
dn: cn=10.100.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
115
cn: 10.100.0.0
116
objectClass: top
117
objectClass: dhcpSubnet
118
objectClass: dhcpOptions
119
dhcpOption: domain-name-servers 10.100.0.2
120
dhcpOption: routers 10.100.0.1
121
dhcpOption: subnet-mask 255.255.255.0
122
dhcpOption: broadcast-address 10.100.0.255
123
dhcpNetMask: 24
124
125
# Set up a pool for this subnet. Only known hosts will get these IPs
126
dn: cn=Known Pool, cn=10.100.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
127
cn: Known Pool
128
objectClass: top
129
objectClass: dhcpPool
130
dhcpRange: 10.100.0.3 10.100.0.254
131
dhcpPermitList: deny unknown-clients
132
133
# Set up another subnet declaration with a pool statement
134
dn: cn=10.200.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
135
cn: 10.200.0.0
136
objectClass: top
137
objectClass: dhcpSubnet
138
objectClass: dhcpOptions
139
dhcpOption: domain-name-servers 10.200.0.2
140
dhcpOption: routers 10.200.0.1
141
dhcpOption: subnet-mask 255.255.255.0
142
dhcpOption: broadcast-address 10.200.0.255
143
dhcpNetMask: 24
144
145
# Set up a pool for this subnet. Only unknown hosts will get these IPs
146
dn: cn=Known Pool, cn=10.200.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
147
cn: Known Pool
148
objectClass: top
149
objectClass: dhcpPool
150
dhcpRange: 10.200.0.3 10.200.0.254
151
dhcpPermitList: deny known clients
152
153
# Set aside a group for all of our known MAC addresses
154
dn: cn=Customers, cn=DHCP Service Config, dc=ntelos, dc=net
155
objectClass: top
156
objectClass: dhcpGroup
157
cn: Customers
158
159
# Host entry for my laptop
160
dn: cn=brianlaptop, cn=Customers, cn=DHCP Service Config, dc=ntelos, dc=net
161
objectClass: top
162
objectClass: dhcpHost
163
cn: brianlaptop
164
dhcpHWAddress: ethernet 00:00:00:00:00:00
165
166
You can use the command slapadd to load all of these entries into your LDAP 
167
server. After you load this, you should be able to start up DHCP. If you run
168
into problems reading the configuration, try running dhcpd with the -d flag. 
169
If you still have problems, edit the site.conf file in the DHCP source and
170
add the line: COPTS= -DDEBUG_LDAP and recompile DHCP. (make sure you run make 
171
clean and rerun configure before you rebuild).
172
(-)dhcp-3.0.5/common/conflex.c (-15 / +31 lines)
Lines 47-52 Link Here
47
static enum dhcp_token read_number PROTO ((int, struct parse *));
47
static enum dhcp_token read_number PROTO ((int, struct parse *));
48
static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
48
static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
49
static enum dhcp_token intern PROTO ((char *, enum dhcp_token));
49
static enum dhcp_token intern PROTO ((char *, enum dhcp_token));
50
static int read_function PROTO ((struct parse *));
50
51
51
isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp)
52
isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp)
52
	struct parse **cfile;
53
	struct parse **cfile;
Lines 74-79 Link Here
74
	tmp -> file = file;
75
	tmp -> file = file;
75
	tmp -> eol_token = eolp;
76
	tmp -> eol_token = eolp;
76
77
78
	if (file != -1) {
79
		tmp -> read_function = read_function;;
80
	}
81
77
	tmp -> bufix = 0;
82
	tmp -> bufix = 0;
78
	tmp -> buflen = buflen;
83
	tmp -> buflen = buflen;
79
	if (inbuf) {
84
	if (inbuf) {
Lines 113-134 Link Here
113
	int c;
118
	int c;
114
119
115
	if (cfile -> bufix == cfile -> buflen) {
120
	if (cfile -> bufix == cfile -> buflen) {
116
		if (cfile -> file != -1) {
121
		if (cfile -> read_function) {
117
			cfile -> buflen =
122
			c = cfile -> read_function (cfile);
118
				read (cfile -> file,
123
		} else {
119
				      cfile -> inbuf, cfile -> bufsiz);
120
			if (cfile -> buflen == 0) {
121
				c = EOF;
122
				cfile -> bufix = 0;
123
			} else if (cfile -> buflen < 0) {
124
				c = EOF;
125
				cfile -> bufix = cfile -> buflen = 0;
126
			} else {
127
				c = cfile -> inbuf [0];
128
				cfile -> bufix = 1;
129
			}
130
		} else
131
			c = EOF;
124
			c = EOF;
125
		}
132
	} else {
126
	} else {
133
		c = cfile -> inbuf [cfile -> bufix];
127
		c = cfile -> inbuf [cfile -> bufix];
134
		cfile -> bufix++;
128
		cfile -> bufix++;
Lines 1128-1130 Link Here
1128
	}
1122
	}
1129
	return dfv;
1123
	return dfv;
1130
}
1124
}
1125
1126
1127
static int
1128
read_function (struct parse * cfile)
1129
{
1130
  int c;
1131
1132
	cfile -> buflen = read (cfile -> file, cfile -> inbuf, cfile -> bufsiz);
1133
	if (cfile -> buflen == 0) {
1134
		c = EOF;
1135
		cfile -> bufix = 0;
1136
	} else if (cfile -> buflen < 0) {
1137
		c = EOF;
1138
		cfile -> bufix = cfile -> buflen = 0;
1139
	} else {
1140
		c = cfile -> inbuf [0];
1141
		cfile -> bufix = 1;
1142
	}
1143
1144
	return c;
1145
}
1146
(-)dhcp-3.0.5/common/print.c (-3 / +3 lines)
Lines 166-174 Link Here
166
}
166
}
167
167
168
char *print_hw_addr (htype, hlen, data)
168
char *print_hw_addr (htype, hlen, data)
169
	int htype;
169
	const int htype;
170
	int hlen;
170
	const int hlen;
171
	unsigned char *data;
171
	const unsigned char *data;
172
{
172
{
173
	static char habuf [49];
173
	static char habuf [49];
174
	char *s;
174
	char *s;
(-)dhcp-3.0.5/contrib/dhcp.schema (+467 lines)
Line 0 Link Here
1
attributetype ( 2.16.840.1.113719.1.203.4.1 
2
	NAME 'dhcpPrimaryDN' 
3
	EQUALITY distinguishedNameMatch
4
	DESC 'The DN of the dhcpServer which is the primary server for the configuration.' 
5
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
6
7
attributetype ( 2.16.840.1.113719.1.203.4.2 
8
	NAME 'dhcpSecondaryDN' 
9
	EQUALITY distinguishedNameMatch
10
	DESC 'The DN of dhcpServer(s) which provide backup service for the configuration.'
11
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
12
13
attributetype ( 2.16.840.1.113719.1.203.4.3 
14
	NAME 'dhcpStatements' 
15
	EQUALITY caseIgnoreIA5Match
16
	DESC 'Flexible storage for specific data depending on what object this exists in. Like conditional statements, server parameters, etc. This allows the standard to evolve without needing to adjust the schema.' 
17
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
18
19
attributetype ( 2.16.840.1.113719.1.203.4.4 
20
	NAME 'dhcpRange' 
21
	EQUALITY caseIgnoreIA5Match
22
	DESC 'The starting & ending IP Addresses in the range (inclusive), separated by a hyphen; if the range only contains one address, then just the address can be specified with no hyphen.  Each range is defined as a separate value.'
23
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
24
25
attributetype ( 2.16.840.1.113719.1.203.4.5 
26
	NAME 'dhcpPermitList' 
27
	EQUALITY caseIgnoreIA5Match
28
	DESC 'This attribute contains the permit lists associated with a pool. Each permit list is defined as a separate value.' 
29
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
30
31
attributetype ( 2.16.840.1.113719.1.203.4.6 
32
	NAME 'dhcpNetMask' 
33
	EQUALITY integerMatch
34
	DESC 'The subnet mask length for the subnet.  The mask can be easily computed from this length.' 
35
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
36
37
attributetype ( 2.16.840.1.113719.1.203.4.7 
38
	NAME 'dhcpOption' 
39
	EQUALITY caseIgnoreIA5Match
40
	DESC 'Encoded option values to be sent to clients.  Each value represents a single option and contains (OptionTag, Length, OptionValue) encoded in the format used by DHCP.' 
41
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
42
43
attributetype ( 2.16.840.1.113719.1.203.4.8 
44
	NAME 'dhcpClassData' 
45
	EQUALITY caseIgnoreIA5Match
46
	DESC 'Encoded text string or list of bytes expressed in hexadecimal, separated by colons.  Clients match subclasses based on matching the class data with the results of match or spawn with statements in the class name declarations.' 
47
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
48
49
attributetype ( 2.16.840.1.113719.1.203.4.9 
50
	NAME 'dhcpOptionsDN' 
51
	EQUALITY distinguishedNameMatch
52
	DESC 'The distinguished name(s) of the dhcpOption objects containing the configuration options provided by the server.' 
53
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
54
55
attributetype ( 2.16.840.1.113719.1.203.4.10 
56
	NAME 'dhcpHostDN' 
57
	EQUALITY distinguishedNameMatch
58
	DESC 'the distinguished name(s) of the dhcpHost objects.' 
59
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 ) 
60
61
attributetype ( 2.16.840.1.113719.1.203.4.11 
62
	NAME 'dhcpPoolDN' 
63
	EQUALITY distinguishedNameMatch
64
	DESC 'The distinguished name(s) of pools.' 
65
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
66
67
attributetype ( 2.16.840.1.113719.1.203.4.12 
68
	NAME 'dhcpGroupDN' 
69
	EQUALITY distinguishedNameMatch
70
	DESC 'The distinguished name(s)   of the groups.' 
71
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
72
73
attributetype ( 2.16.840.1.113719.1.203.4.13 
74
	NAME 'dhcpSubnetDN' 
75
	EQUALITY distinguishedNameMatch
76
	DESC 'The distinguished name(s) of the subnets.' 
77
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
78
79
attributetype ( 2.16.840.1.113719.1.203.4.14 
80
	NAME 'dhcpLeaseDN' 
81
	EQUALITY distinguishedNameMatch
82
	DESC 'The distinguished name of a client address.' 
83
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE)
84
85
attributetype ( 2.16.840.1.113719.1.203.4.15 
86
	NAME 'dhcpLeasesDN' 
87
	DESC 'The distinguished name(s) client addresses.' 
88
	EQUALITY distinguishedNameMatch
89
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
90
91
attributetype ( 2.16.840.1.113719.1.203.4.16 
92
	NAME 'dhcpClassesDN' 
93
	EQUALITY distinguishedNameMatch
94
	DESC 'The distinguished name(s) of a class(es) in a subclass.' 
95
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
96
97
attributetype ( 2.16.840.1.113719.1.203.4.17 
98
	NAME 'dhcpSubclassesDN' 
99
	EQUALITY distinguishedNameMatch
100
	DESC 'The distinguished name(s) of subclass(es).' 
101
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
102
103
attributetype ( 2.16.840.1.113719.1.203.4.18 
104
	NAME 'dhcpSharedNetworkDN' 
105
	EQUALITY distinguishedNameMatch
106
	DESC 'The distinguished name(s) of sharedNetworks.' 
107
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
108
109
attributetype ( 2.16.840.1.113719.1.203.4.19 
110
	NAME 'dhcpServiceDN' 
111
	EQUALITY distinguishedNameMatch
112
	DESC 'The DN of dhcpService object(s)which contain the configuration information. Each dhcpServer object has this attribute identifying the DHCP configuration(s) that the server is associated with.' 
113
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
114
115
attributetype ( 2.16.840.1.113719.1.203.4.20 
116
	NAME 'dhcpVersion'
117
	DESC 'The version attribute of this object.'
118
	EQUALITY caseIgnoreIA5Match
119
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
120
121
attributetype ( 2.16.840.1.113719.1.203.4.21 
122
	NAME 'dhcpImplementation' 
123
	EQUALITY caseIgnoreIA5Match
124
	DESC 'Description of the DHCP Server implementation e.g. DHCP Servers vendor.' 
125
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
126
127
attributetype ( 2.16.840.1.113719.1.203.4.22 
128
	NAME 'dhcpAddressState' 
129
	EQUALITY caseIgnoreIA5Match
130
	DESC 'This stores information about the current binding-status of an address.  For dynamic addresses managed by DHCP, the values should be restricted to the following: "FREE", "ACTIVE", "EXPIRED", "RELEASED", "RESET", "ABANDONED", "BACKUP".  For other addresses, it SHOULD be one of the following: "UNKNOWN", "RESERVED" (an address that is managed by DHCP that is reserved for a specific client), "RESERVED-ACTIVE" (same as reserved, but address is currently in use), "ASSIGNED" (assigned manually or by some other mechanism), "UNASSIGNED", "NOTASSIGNABLE".'
131
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
132
133
attributetype ( 2.16.840.1.113719.1.203.4.23 
134
	NAME 'dhcpExpirationTime' 
135
	EQUALITY generalizedTimeMatch 
136
	DESC 'This is the time the current lease for an address expires.' 
137
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
138
139
attributetype ( 2.16.840.1.113719.1.203.4.24 
140
	NAME 'dhcpStartTimeOfState' 
141
	EQUALITY generalizedTimeMatch 
142
	DESC 'This is the time of the last state change for a leased address.' 
143
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
144
145
attributetype ( 2.16.840.1.113719.1.203.4.25 
146
	NAME 'dhcpLastTransactionTime' 
147
	EQUALITY generalizedTimeMatch 
148
	DESC 'This is the last time a valid DHCP packet was received from the client.'
149
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
150
151
attributetype ( 2.16.840.1.113719.1.203.4.26 
152
	NAME 'dhcpBootpFlag' 
153
	EQUALITY booleanMatch 
154
	DESC 'This indicates whether the address was assigned via BOOTP.' 
155
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
156
157
attributetype ( 2.16.840.1.113719.1.203.4.27 
158
	NAME 'dhcpDomainName' 
159
	EQUALITY caseIgnoreIA5Match
160
	DESC 'This is the name of the domain sent to the client by the server.  It is essentially the same as the value for DHCP option 15 sent to the client, and represents only the domain - not the full FQDN.  To obtain the full FQDN assigned to the client you must prepend the "dhcpAssignedHostName" to this value with a ".".' 
161
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
162
163
attributetype ( 2.16.840.1.113719.1.203.4.28 
164
	NAME 'dhcpDnsStatus' 
165
	EQUALITY integerMatch
166
	DESC 'This indicates the status of updating DNS resource records on behalf of the client by the DHCP server for this address.  The value is a 16-bit bitmask.'
167
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
168
169
attributetype ( 2.16.840.1.113719.1.203.4.29 
170
	NAME 'dhcpRequestedHostName' 
171
	EQUALITY caseIgnoreIA5Match
172
	DESC 'This is the hostname that was requested by the client.' 
173
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
174
175
attributetype ( 2.16.840.1.113719.1.203.4.30 
176
	NAME 'dhcpAssignedHostName' 
177
	EQUALITY caseIgnoreIA5Match
178
	DESC 'This is the actual hostname that was assigned to a client. It may not be the name that was requested by the client.  The fully qualified domain name can be determined by appending the value of "dhcpDomainName" (with a dot separator) to this name.' 
179
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
180
181
attributetype ( 2.16.840.1.113719.1.203.4.31 
182
	NAME 'dhcpReservedForClient' 
183
	EQUALITY distinguishedNameMatch
184
	DESC 'The distinguished name of a "dhcpClient" that an address is reserved for.  This may not be the same as the "dhcpAssignedToClient" attribute if the address is being reassigned but the current lease has not yet expired.'
185
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
186
187
attributetype ( 2.16.840.1.113719.1.203.4.32 
188
	NAME 'dhcpAssignedToClient' 
189
	EQUALITY distinguishedNameMatch
190
	DESC 'This is the distinguished name of a "dhcpClient" that an address is currently assigned to.  This attribute is only present in the class when the address is leased.' 
191
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
192
193
attributetype ( 2.16.840.1.113719.1.203.4.33 
194
	NAME 'dhcpRelayAgentInfo' 
195
	EQUALITY octetStringMatch
196
	DESC 'If the client request was received via a relay agent, this contains information about the relay agent that was available from the DHCP request.  This is a hex-encoded option value.' 
197
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
198
199
attributetype ( 2.16.840.1.113719.1.203.4.34 
200
	NAME 'dhcpHWAddress' 
201
	EQUALITY caseIgnoreIA5Match
202
	DESC 'The clients hardware address that requested this IP address.' 
203
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
204
205
attributetype ( 2.16.840.1.113719.1.203.4.35 
206
	NAME 'dhcpHashBucketAssignment' 
207
	EQUALITY octetStringMatch
208
	DESC 'HashBucketAssignment bit map for the DHCP Server, as defined in DHC Load Balancing Algorithm [RFC 3074].' 
209
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
210
211
attributetype ( 2.16.840.1.113719.1.203.4.36 
212
	NAME 'dhcpDelayedServiceParameter' 
213
	EQUALITY integerMatch
214
	DESC 'Delay in seconds corresponding to Delayed Service Parameter configuration, as defined in  DHC Load Balancing Algorithm [RFC 3074]. '
215
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
216
217
attributetype ( 2.16.840.1.113719.1.203.4.37 
218
	NAME 'dhcpMaxClientLeadTime' 
219
	EQUALITY integerMatch
220
	DESC 'Maximum Client Lead Time configuration in seconds, as defined in DHCP Failover Protocol [FAILOVR]' 
221
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
222
223
attributetype ( 2.16.840.1.113719.1.203.4.38 
224
	NAME 'dhcpFailOverEndpointState' 
225
	EQUALITY caseIgnoreIA5Match
226
	DESC 'Server (Failover Endpoint) state, as defined in DHCP Failover Protocol [FAILOVR]' 
227
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
228
229
attributetype ( 2.16.840.1.113719.1.203.4.39 
230
	NAME 'dhcpErrorLog' 
231
	EQUALITY caseIgnoreIA5Match
232
	DESC 'Generic error log attribute that allows logging error conditions within a dhcpService or a dhcpSubnet, like no IP addresses available for lease.'
233
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
234
235
attributetype ( 2.16.840.1.113719.1.203.4.40 
236
	NAME 'dhcpLocatorDN' 
237
	EQUALITY distinguishedNameMatch 
238
	DESC 'The DN of dhcpLocator object which contain the DNs of all DHCP configuration objects. There will be a single dhcpLocator object in the tree with links to all the DHCP objects in the tree' 
239
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
240
241
attributetype  ( 2.16.840.1.113719.1.203.4.41 
242
	NAME 'dhcpKeyAlgorithm' 
243
	EQUALITY caseIgnoreIA5Match 
244
	DESC 'Algorithm to generate TSIG Key' 
245
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
246
247
attributetype  ( 2.16.840.1.113719.1.203.4.42 
248
	NAME 'dhcpKeySecret' 
249
	EQUALITY octetStringMatch 
250
	DESC 'Secret to generate TSIG Key' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
251
252
attributetype ( 2.16.840.1.113719.1.203.4.43 
253
	NAME 'dhcpDnsZoneServer' 
254
	EQUALITY caseIgnoreIA5Match 
255
	DESC 'Master server of the DNS Zone' 
256
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
257
258
attributetype ( 2.16.840.1.113719.1.203.4.44 
259
	NAME 'dhcpKeyDN' 
260
	EQUALITY distinguishedNameMatch 
261
	DESC 'The DNs of TSIG Key to use in secure dynamic updates. In case of locator object, this will be list of TSIG keys.  In case of DHCP Service, Shared Network, Subnet and DNS Zone, it will be a single key.' 
262
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12)
263
264
attributetype ( 2.16.840.1.113719.1.203.4.45 
265
	NAME 'dhcpZoneDN' 
266
	EQUALITY distinguishedNameMatch 
267
	DESC 'The DNs of DNS Zone. In case of locator object, this will be list of DNS Zones in the tree. In case of DHCP Service, Shared Network and Subnet, it will be a single DNS Zone.' 
268
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12)
269
270
attributetype ( 2.16.840.1.113719.1.203.4.46 
271
	NAME 'dhcpFailOverRole' 
272
	EQUALITY caseIgnoreIA5Match 
273
	DESC 'Role of the DHCP Server. Either primary or secondary' 
274
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26  )
275
276
attributetype ( 2.16.840.1.113719.1.203.4.47 
277
	NAME 'dhcpFailOverReceiveAddress' 
278
	EQUALITY caseIgnoreIA5Match 
279
	DESC 'IP address or DNS  name  on  which the server should listen for connections from its fail over peer' 
280
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26  )
281
282
attributetype ( 2.16.840.1.113719.1.203.4.48 
283
	NAME 'dhcpFailOverPeerAddress' 
284
	EQUALITY caseIgnoreIA5Match 
285
	DESC 'IP address  or  DNS  name  to which  the  server  should  connect  to  reach  its fail over peer' 
286
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26  )
287
288
attributetype ( 2.16.840.1.113719.1.203.4.49 
289
	NAME 'dhcpFailOverPeerPort' 
290
	EQUALITY integerMatch 
291
	DESC 'Port to which server should connect to reach its fail over peer' 
292
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27  )
293
	
294
attributetype ( 2.16.840.1.113719.1.203.4.50 
295
	NAME 'dhcpFailOverReceivePort' 
296
	EQUALITY integerMatch 
297
	DESC 'Port on which server should listen for connections from its fail over peer' 
298
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27  )
299
300
attributetype ( 2.16.840.1.113719.1.203.4.51 
301
	NAME 'dhcpFailOverResponseDelay' 
302
	EQUALITY integerMatch 
303
	DESC 'Maximum response time in seconds, before Server assumes that connection to fail over peer has failed' 
304
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27  )
305
306
attributetype ( 2.16.840.1.113719.1.203.4.52 
307
	NAME 'dhcpFailOverUnpackedUpdates' 
308
	EQUALITY integerMatch 
309
	DESC 'Number of BNDUPD messages that server can send before it receives BNDACK from its fail over peer' 
310
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27  )
311
312
attributetype ( 2.16.840.1.113719.1.203.4.53 
313
	NAME 'dhcpFailOverSplit' 
314
	EQUALITY integerMatch 
315
	DESC 'Split between the primary and secondary servers for fail over purpose' 
316
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27  )
317
318
attributetype ( 2.16.840.1.113719.1.203.4.54 
319
	NAME 'dhcpFailOverLoadBalanceTime' 
320
	EQUALITY integerMatch 
321
	DESC 'Cutoff time in seconds, after which load balance is disabled' 
322
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27  )
323
324
attributetype ( 2.16.840.1.113719.1.203.4.55 
325
	NAME 'dhcpFailOverPeerDN' 
326
	EQUALITY distinguishedNameMatch 
327
	DESC 'The DNs of Fail over peers. In case of locator object, this will be list of fail over peers in the tree. In case of Subnet and pool, it will be a single Fail Over Peer' 
328
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 ) 
329
330
#List of all servers in the tree
331
attributetype ( 2.16.840.1.113719.1.203.4.56 
332
	NAME 'dhcpServerDN' 
333
	EQUALITY distinguishedNameMatch 
334
	DESC 'List of all  DHCP Servers in the tree. Used by dhcpLocatorObject' 
335
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
336
337
attributetype ( 2.16.840.1.113719.1.203.4.57 
338
	NAME 'dhcpComments' 
339
	EQUALITY caseIgnoreIA5Match 
340
	DESC 'Generic attribute that allows coments  within any DHCP object' 
341
	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
342
343
# Classes
344
345
objectclass ( 2.16.840.1.113719.1.203.6.1 
346
	NAME 'dhcpService' 
347
	DESC 'Service object that represents the actual DHCP Service configuration. This is a container object.' 
348
	SUP top 
349
	MUST (cn) 
350
	MAY ( dhcpPrimaryDN $ dhcpSecondaryDN $ dhcpServerDN $ dhcpSharedNetworkDN $ dhcpSubnetDN $ dhcpGroupDN $ dhcpHostDN $  dhcpClassesDN $ dhcpOptionsDN $ dhcpZoneDN $ dhcpKeyDN $ dhcpFailOverPeerDN $ dhcpStatements $dhcpComments $ dhcpOption) )
351
352
objectclass ( 2.16.840.1.113719.1.203.6.2 
353
	NAME 'dhcpSharedNetwork' 
354
	DESC 'This stores configuration information for a shared network.' 
355
	SUP top 
356
	MUST cn 
357
	MAY ( dhcpSubnetDN $ dhcpPoolDN $ dhcpOptionsDN $ dhcpZoneDN $ dhcpStatements $dhcpComments $ dhcpOption) X-NDS_CONTAINMENT ('dhcpService' ) )
358
359
objectclass ( 2.16.840.1.113719.1.203.6.3 
360
	NAME 'dhcpSubnet' 
361
	DESC 'This class defines a subnet. This is a container object.' 
362
	SUP top 
363
	MUST ( cn $ dhcpNetMask ) 
364
	MAY ( dhcpRange $ dhcpPoolDN $ dhcpGroupDN $ dhcpHostDN $ dhcpClassesDN $ dhcpLeasesDN $ dhcpOptionsDN $ dhcpZoneDN $ dhcpKeyDN $ dhcpFailOverPeerDN $ dhcpStatements $ dhcpComments $ dhcpOption ) X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork') )
365
366
objectclass ( 2.16.840.1.113719.1.203.6.4 
367
	NAME 'dhcpPool' 
368
	DESC 'This stores configuration information about a pool.' 
369
	SUP top 
370
	MUST ( cn $ dhcpRange ) 
371
	MAY ( dhcpClassesDN $ dhcpPermitList $ dhcpLeasesDN $ dhcpOptionsDN $ dhcpZoneDN $dhcpKeyDN $ dhcpStatements $ dhcpComments $ dhcpOption ) 
372
	X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpSharedNetwork') )
373
374
objectclass ( 2.16.840.1.113719.1.203.6.5 
375
	NAME 'dhcpGroup' 
376
	DESC 'Group object that lists host DNs and parameters. This is a container object.' 
377
	SUP top 
378
	MUST cn 
379
	MAY ( dhcpHostDN $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption )
380
	X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpService' ) )
381
382
objectclass ( 2.16.840.1.113719.1.203.6.6 
383
	NAME 'dhcpHost' 
384
	DESC 'This represents information about a particular client' 
385
	SUP top 
386
	MUST cn 
387
	MAY  (dhcpLeaseDN $ dhcpHWAddress $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption) 
388
	X-NDS_CONTAINMENT ('dhcpService' 'dhcpSubnet' 'dhcpGroup') )
389
390
objectclass ( 2.16.840.1.113719.1.203.6.7 
391
	NAME 'dhcpClass' 
392
	DESC 'Represents information about a collection of related clients.' 
393
	SUP top 
394
	MUST cn 
395
	MAY (dhcpSubClassesDN $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption) 
396
	X-NDS_CONTAINMENT ('dhcpService' 'dhcpSubnet' ) )
397
398
objectclass ( 2.16.840.1.113719.1.203.6.8 
399
	NAME 'dhcpSubClass' 
400
	DESC 'Represents information about a collection of related classes.' 
401
	SUP top 
402
	MUST cn 
403
	MAY (dhcpClassData $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption) X-NDS_CONTAINMENT 'dhcpClass' )
404
405
objectclass ( 2.16.840.1.113719.1.203.6.9 
406
	NAME 'dhcpOptions' 
407
	DESC 'Represents information about a collection of options defined.' 
408
	SUP top AUXILIARY
409
	MUST cn 
410
	MAY ( dhcpOption $ dhcpComments ) 
411
	X-NDS_CONTAINMENT  ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet' 'dhcpPool' 'dhcpGroup' 'dhcpHost' 'dhcpClass' ) )
412
413
objectclass ( 2.16.840.1.113719.1.203.6.10 
414
	NAME 'dhcpLeases' 
415
	DESC 'This class represents an IP Address, which may or may not have been leased.' 
416
	SUP top 
417
	MUST ( cn $ dhcpAddressState ) 
418
	MAY ( dhcpExpirationTime $ dhcpStartTimeOfState $ dhcpLastTransactionTime $ dhcpBootpFlag $ dhcpDomainName $ dhcpDnsStatus $ dhcpRequestedHostName $ dhcpAssignedHostName $ dhcpReservedForClient $ dhcpAssignedToClient $ dhcpRelayAgentInfo $ dhcpHWAddress $ dhcpOption ) 
419
	X-NDS_CONTAINMENT ( 'dhcpService' 'dhcpSubnet' 'dhcpPool') )
420
421
objectclass ( 2.16.840.1.113719.1.203.6.11 
422
	NAME 'dhcpLog' 
423
	DESC 'This is the object that holds past information about the IP address. The cn is the time/date stamp when the address was assigned or released, the address state at the time, if the address was assigned or released.' 
424
	SUP top 
425
	MUST ( cn ) 
426
	MAY ( dhcpAddressState $ dhcpExpirationTime $ dhcpStartTimeOfState $ dhcpLastTransactionTime $ dhcpBootpFlag $ dhcpDomainName $ dhcpDnsStatus $ dhcpRequestedHostName $ dhcpAssignedHostName $ dhcpReservedForClient $ dhcpAssignedToClient $ dhcpRelayAgentInfo $ dhcpHWAddress $ dhcpErrorLog) 
427
	X-NDS_CONTAINMENT ('dhcpLeases' 'dhcpPool' 'dhcpSubnet' 'dhcpSharedNetwork' 'dhcpService' ) )
428
429
objectclass ( 2.16.840.1.113719.1.203.6.12 
430
	NAME 'dhcpServer' 
431
	DESC 'DHCP Server Object' 
432
	SUP top 
433
	MUST ( cn ) 
434
	MAY (dhcpServiceDN  $ dhcpLocatorDN $ dhcpVersion $ dhcpImplementation $ dhcpHashBucketAssignment $ dhcpDelayedServiceParameter $ dhcpMaxClientLeadTime $ dhcpFailOverEndpointState $ dhcpStatements $ dhcpComments $ dhcpOption) 
435
	X-NDS_CONTAINMENT ('organization' 'organizationalunit' 'domain') )
436
437
objectclass ( 2.16.840.1.113719.1.203.6.13 
438
	NAME 'dhcpTSigKey' 
439
	DESC 'TSIG key for secure dynamic updates' 
440
	SUP top 
441
	MUST (cn $ dhcpKeyAlgorithm $ dhcpKeySecret ) 
442
	MAY ( dhcpComments ) 
443
	X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet') )
444
445
objectclass ( 2.16.840.1.113719.1.203.6.14 
446
	NAME 'dhcpDnsZone' 
447
	DESC 'DNS Zone for updating leases' 
448
	SUP top 
449
	MUST (cn $ dhcpDnsZoneServer ) 
450
	MAY (dhcpKeyDN $ dhcpComments) 
451
	X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet') )
452
453
objectclass ( 2.16.840.1.113719.1.203.6.15 
454
	NAME 'dhcpFailOverPeer' 
455
	DESC 'This class defines the Fail over peer' 
456
	SUP top 
457
	MUST ( cn $ dhcpFailOverRole $ dhcpFailOverReceiveAddress $ dhcpFailOverPeerAddress $ dhcpFailoverReceivePort $ dhcpFailOverPeerPort ) MAY ( dhcpFailOverResponseDelay  $ dhcpFailOverUnackedUpdates $ dhcpMaxClientLeadTime $ dhcpFailOverSplit $ dhcpHashBucketAssignment $ dhcpFailOverLoadBalanceTime $ dhcpComments $ dhcpOption) X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet') )
458
459
objectclass ( 2.16.840.1.113719.1.203.6.16 
460
	NAME 'dhcpLocator' 
461
	DESC 'Locator object for DHCP configuration in the tree. There will be a single dhcpLocator object in the tree with links to all the DHCP objects in the tree' 
462
	SUP top 
463
	MUST ( cn ) 
464
	MAY ( dhcpServiceDN $dhcpServerDN $ dhcpSharedNetworkDN $ dhcpSubnetDN $ dhcpPoolDN $ dhcpGroupDN $ dhcpHostDN $  dhcpClassesDN $ dhcpKeyDN $ dhcpZoneDN $ dhcpFailOverPeerDN $ dhcpOption $ dhcpComments) 
465
	X-NDS_CONTAINMENT ('organization' 'organizationalunit' 'domain') )
466
467
(-)dhcp-3.0.5/contrib/dhcpd-conf-to-ldap.pl (+752 lines)
Line 0 Link Here
1
#!/usr/bin/perl -w
2
3
# Brian Masney <masneyb@ntelos.net>
4
# To use this script, set your base DN below. Then run 
5
# ./dhcpd-conf-to-ldap.pl < /path-to-dhcpd-conf/dhcpd.conf > output-file
6
# The output of this script will generate entries in LDIF format. You can use
7
# the slapadd command to add these entries into your LDAP server. You will
8
# definately want to double check that your LDAP entries are correct before
9
# you load them into LDAP.
10
11
# This script does not do much error checking. Make sure before you run this
12
# that the DHCP server doesn't give any errors about your config file
13
14
# FailOver notes:
15
#   Failover is disabled by default, since it may need manually intervention.
16
#   You can try the '--use=failover' option to see what happens :-)
17
#
18
#   If enabled, the failover pool references will be written to LDIF output.
19
#   The failover configs itself will be added to the dhcpServer statements
20
#   and not to the dhcpService object (since this script uses only one and
21
#   it may be usefull to have multiple service containers in failover mode).
22
#   Further, this script does not check if primary or secondary makes sense,
23
#   it simply converts what it gets...
24
25
use Net::Domain qw(hostname hostfqdn hostdomain);
26
use Getopt::Long;
27
28
my $domain = hostdomain();           # your.domain
29
my $basedn = "dc=".$domain;
30
   $basedn =~ s/\./,dc=/g;           # dc=your,dc=domain
31
my $server = hostname();             # hostname (nodename)
32
my $dhcpcn = 'DHCP Config';          # CN of DHCP config tree
33
my $dhcpdn = "cn=$dhcpcn, $basedn";  # DHCP config tree DN
34
my $second = '';                     # secondary server DN / hostname
35
my $i_conf = '';                     # dhcp.conf file to read or stdin
36
my $o_ldif = '';                     # output ldif file name or stdout
37
my @use    = ();                     # extended flags (failover)
38
39
sub usage($;$)
40
{
41
  my $rc = shift;
42
  my $err= shift;
43
44
  print STDERR "Error: $err\n\n" if(defined $err);
45
  print STDERR <<__EOF_USAGE__;
46
usage: 
47
  $0 [options] < dhcpd.conf > dhcpd.ldif
48
49
options:
50
51
  --basedn  "dc=your,dc=domain"        ("$basedn")
52
53
  --dhcpdn  "dhcp config DN"           ("$dhcpdn")
54
55
  --server  "dhcp server name"         ("$server")
56
57
  --second  "secondary server or DN"   ("$second")
58
59
  --conf    "/path/to/dhcpd.conf"      (default is stdin)
60
  --ldif    "/path/to/output.ldif"     (default is stdout)
61
62
  --use     "extended features"        (see source comments)
63
__EOF_USAGE__
64
  exit($rc);
65
}
66
67
68
sub next_token
69
{
70
  local ($lowercase) = @_;
71
  local ($token, $newline);
72
73
  do 
74
    {
75
      if (!defined ($line) || length ($line) == 0)
76
        {
77
          $line = <>;
78
          return undef if !defined ($line);
79
          chop $line;
80
          $line_number++;
81
          $token_number = 0;
82
        }
83
84
      $line =~ s/#.*//;
85
      $line =~ s/^\s+//;
86
      $line =~ s/\s+$//;
87
    }
88
  while (length ($line) == 0);
89
90
  if (($token, $newline) = $line =~ /^(.*?)\s+(.*)/)
91
    {
92
      $line = $newline;
93
    }
94
  else
95
    {
96
      $token = $line;
97
      $line = '';
98
    }
99
  $token_number++;
100
101
  $token =~ y/[A-Z]/[a-z]/ if $lowercase;
102
103
  return ($token);
104
}
105
106
107
sub remaining_line
108
{
109
  local ($block) = shift || 0;
110
  local ($tmp, $str);
111
112
  $str = "";
113
  while (defined($tmp = next_token (0)))
114
    {
115
      $str .= ' ' if !($str eq "");
116
      $str .= $tmp;
117
      last if $tmp =~ /;\s*$/;
118
      last if($block and $tmp =~ /\s*[}{]\s*$/);
119
    }
120
121
  $str =~ s/;$//;
122
  return ($str);
123
}
124
125
126
sub
127
add_dn_to_stack
128
{
129
  local ($dn) = @_;
130
131
  $current_dn = "$dn, $current_dn";
132
}
133
134
135
sub
136
remove_dn_from_stack
137
{
138
  $current_dn =~ s/^.*?,\s*//;
139
}
140
141
142
sub
143
parse_error
144
{
145
  print "Parse error on line number $line_number at token number $token_number\n";
146
  exit (1);
147
}
148
149
150
sub
151
print_entry
152
{
153
  return if (scalar keys %curentry == 0);
154
155
  if (!defined ($curentry{'type'}))
156
    {
157
      $hostdn = "cn=$server, $basedn";
158
      print "dn: $hostdn\n";
159
      print "cn: $server\n";
160
      print "objectClass: top\n";
161
      print "objectClass: dhcpServer\n";
162
      print "dhcpServiceDN: $current_dn\n";
163
      if(grep(/FaIlOvEr/i, @use))
164
        {
165
          foreach my $fo_peer (keys %failover)
166
            {
167
              next if(scalar(@{$failover{$fo_peer}}) <= 1);
168
              print "dhcpStatements: failover peer $fo_peer { ",
169
                    join('; ', @{$failover{$fo_peer}}), "; }\n";
170
            }
171
        }
172
      print "\n";
173
174
      print "dn: $current_dn\n";
175
      print "cn: $dhcpcn\n";
176
      print "objectClass: top\n";
177
      print "objectClass: dhcpService\n";
178
      if (defined ($curentry{'options'}))
179
        {
180
          print "objectClass: dhcpOptions\n";
181
        }
182
      print "dhcpPrimaryDN: $hostdn\n";
183
      if(grep(/FaIlOvEr/i, @use) and ($second ne ''))
184
        {
185
          print "dhcpSecondaryDN: $second\n";
186
        }
187
    }
188
  elsif ($curentry{'type'} eq 'subnet')
189
    {
190
      print "dn: $current_dn\n";
191
      print "cn: " . $curentry{'ip'} . "\n";
192
      print "objectClass: top\n";
193
      print "objectClass: dhcpSubnet\n";
194
      if (defined ($curentry{'options'}))
195
        {
196
          print "objectClass: dhcpOptions\n";
197
        }
198
      
199
      print "dhcpNetMask: " . $curentry{'netmask'} . "\n";
200
      if (defined ($curentry{'ranges'}))
201
        {
202
          foreach $statement (@{$curentry{'ranges'}})
203
            {
204
              print "dhcpRange: $statement\n";
205
            }
206
        }
207
    }
208
  elsif ($curentry{'type'} eq 'shared-network')
209
    {
210
      print "dn: $current_dn\n";
211
      print "cn: " . $curentry{'descr'} . "\n";
212
      print "objectClass: top\n";
213
      print "objectClass: dhcpSharedNetwork\n";
214
      if (defined ($curentry{'options'}))
215
        {
216
          print "objectClass: dhcpOptions\n";
217
        }
218
    }
219
  elsif ($curentry{'type'} eq 'group')
220
    {
221
      print "dn: $current_dn\n";
222
      print "cn: group", $curentry{'idx'}, "\n";
223
      print "objectClass: top\n";
224
      print "objectClass: dhcpGroup\n";
225
      if (defined ($curentry{'options'}))
226
        {
227
          print "objectClass: dhcpOptions\n";
228
        }
229
    }
230
  elsif ($curentry{'type'} eq 'host')
231
    {
232
      print "dn: $current_dn\n";
233
      print "cn: " . $curentry{'host'} . "\n";
234
      print "objectClass: top\n";
235
      print "objectClass: dhcpHost\n";
236
      if (defined ($curentry{'options'}))
237
        {
238
          print "objectClass: dhcpOptions\n";
239
        }
240
241
      if (defined ($curentry{'hwaddress'}))
242
        {
243
          $curentry{'hwaddress'} =~ y/[A-Z]/[a-z]/;
244
          print "dhcpHWAddress: " . $curentry{'hwaddress'} . "\n";
245
        }
246
    }
247
  elsif ($curentry{'type'} eq 'pool')
248
    {
249
      print "dn: $current_dn\n";
250
      print "cn: pool", $curentry{'idx'}, "\n";
251
      print "objectClass: top\n";
252
      print "objectClass: dhcpPool\n";
253
      if (defined ($curentry{'options'}))
254
        {
255
          print "objectClass: dhcpOptions\n";
256
        }
257
258
      if (defined ($curentry{'ranges'}))
259
        {
260
          foreach $statement (@{$curentry{'ranges'}})
261
            {
262
              print "dhcpRange: $statement\n";
263
            }
264
        }
265
    }
266
  elsif ($curentry{'type'} eq 'class')
267
    {
268
      print "dn: $current_dn\n";
269
      print "cn: " . $curentry{'class'} . "\n";
270
      print "objectClass: top\n";
271
      print "objectClass: dhcpClass\n";
272
      if (defined ($curentry{'options'}))
273
        {
274
          print "objectClass: dhcpOptions\n";
275
        }
276
    }
277
  elsif ($curentry{'type'} eq 'subclass')
278
    {
279
      print "dn: $current_dn\n";
280
      print "cn: " . $curentry{'subclass'} . "\n";
281
      print "objectClass: top\n";
282
      print "objectClass: dhcpSubClass\n";
283
      if (defined ($curentry{'options'}))
284
        {
285
          print "objectClass: dhcpOptions\n";
286
        }
287
      print "dhcpClassData: " . $curentry{'class'} . "\n";
288
    }
289
290
  if (defined ($curentry{'statements'}))
291
    {
292
      foreach $statement (@{$curentry{'statements'}})
293
        {
294
          print "dhcpStatements: $statement\n";
295
        }
296
    }
297
298
  if (defined ($curentry{'options'}))
299
    {
300
      foreach $statement (@{$curentry{'options'}})
301
        {
302
          print "dhcpOption: $statement\n";
303
        }
304
    }
305
306
  print "\n";
307
  undef (%curentry);
308
}
309
310
311
sub parse_netmask
312
{
313
  local ($netmask) = @_;
314
  local ($i);
315
316
  if ((($a, $b, $c, $d) = $netmask =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) != 4)
317
    {
318
      parse_error ();
319
    }
320
321
  $num = (($a & 0xff) << 24) |
322
         (($b & 0xff) << 16) |
323
         (($c & 0xff) << 8) |
324
          ($d & 0xff);
325
326
  for ($i=1; $i<=32 && $num & (1 << (32 - $i)); $i++)
327
    {
328
    }
329
  $i--;
330
331
  return ($i);
332
}
333
334
335
sub parse_subnet
336
{
337
  local ($ip, $tmp, $netmask);
338
339
  print_entry () if %curentry;
340
    
341
  $ip = next_token (0);
342
  parse_error () if !defined ($ip);
343
344
  $tmp = next_token (1);
345
  parse_error () if !defined ($tmp);
346
  parse_error () if !($tmp eq 'netmask');
347
348
  $tmp = next_token (0);
349
  parse_error () if !defined ($tmp);
350
  $netmask = parse_netmask ($tmp);
351
352
  $tmp = next_token (0);
353
  parse_error () if !defined ($tmp);
354
  parse_error () if !($tmp eq '{');
355
356
  add_dn_to_stack ("cn=$ip");
357
  $curentry{'type'} = 'subnet';
358
  $curentry{'ip'} = $ip;
359
  $curentry{'netmask'} = $netmask;
360
  $cursubnet = $ip;
361
  $curcounter{$ip} = { pool  => 0, group => 0 };
362
}
363
364
365
sub parse_shared_network
366
{
367
  local ($descr, $tmp);
368
369
  print_entry () if %curentry;
370
371
  $descr = next_token (0);
372
  parse_error () if !defined ($descr);
373
374
  $tmp = next_token (0);
375
  parse_error () if !defined ($tmp);
376
  parse_error () if !($tmp eq '{');
377
378
  add_dn_to_stack ("cn=$descr");
379
  $curentry{'type'} = 'shared-network';
380
  $curentry{'descr'} = $descr;
381
}
382
383
384
sub parse_host
385
{
386
  local ($descr, $tmp);
387
388
  print_entry () if %curentry;
389
390
  $host = next_token (0);
391
  parse_error () if !defined ($host);
392
393
  $tmp = next_token (0);
394
  parse_error () if !defined ($tmp);
395
  parse_error () if !($tmp eq '{');
396
397
  add_dn_to_stack ("cn=$host");
398
  $curentry{'type'} = 'host';
399
  $curentry{'host'} = $host;
400
}
401
402
403
sub parse_group
404
{
405
  local ($descr, $tmp);
406
407
  print_entry () if %curentry;
408
409
  $tmp = next_token (0);
410
  parse_error () if !defined ($tmp);
411
  parse_error () if !($tmp eq '{');
412
413
  my $idx;
414
  if(exists($curcounter{$cursubnet})) {
415
    $idx = ++$curcounter{$cursubnet}->{'group'};
416
  } else {
417
    $idx = ++$curcounter{''}->{'group'};
418
  }
419
420
  add_dn_to_stack ("cn=group".$idx);
421
  $curentry{'type'} = 'group';
422
  $curentry{'idx'} = $idx;
423
}
424
425
426
sub parse_pool
427
{
428
  local ($descr, $tmp);
429
430
  print_entry () if %curentry;
431
432
  $tmp = next_token (0);
433
  parse_error () if !defined ($tmp);
434
  parse_error () if !($tmp eq '{');
435
436
  my $idx;
437
  if(exists($curcounter{$cursubnet})) {
438
    $idx = ++$curcounter{$cursubnet}->{'pool'};
439
  } else {
440
    $idx = ++$curcounter{''}->{'pool'};
441
  }
442
443
  add_dn_to_stack ("cn=pool".$idx);
444
  $curentry{'type'} = 'pool';
445
  $curentry{'idx'} = $idx;
446
}
447
448
449
sub parse_class
450
{
451
  local ($descr, $tmp);
452
453
  print_entry () if %curentry;
454
455
  $class = next_token (0);
456
  parse_error () if !defined ($class);
457
458
  $tmp = next_token (0);
459
  parse_error () if !defined ($tmp);
460
  parse_error () if !($tmp eq '{');
461
462
  $class =~ s/\"//g;
463
  add_dn_to_stack ("cn=$class");
464
  $curentry{'type'} = 'class';
465
  $curentry{'class'} = $class;
466
}
467
468
469
sub parse_subclass
470
{
471
  local ($descr, $tmp);
472
473
  print_entry () if %curentry;
474
475
  $class = next_token (0);
476
  parse_error () if !defined ($class);
477
478
  $subclass = next_token (0);
479
  parse_error () if !defined ($subclass);
480
481
  $tmp = next_token (0);
482
  parse_error () if !defined ($tmp);
483
  parse_error () if !($tmp eq '{');
484
485
  add_dn_to_stack ("cn=$subclass");
486
  $curentry{'type'} = 'subclass';
487
  $curentry{'class'} = $class;
488
  $curentry{'subclass'} = $subclass;
489
}
490
491
492
sub parse_hwaddress
493
{
494
  local ($type, $hw, $tmp);
495
496
  $type = next_token (1);
497
  parse_error () if !defined ($type);
498
499
  $hw = next_token (1);
500
  parse_error () if !defined ($hw);
501
  $hw =~ s/;$//;
502
503
  $curentry{'hwaddress'} = "$type $hw";
504
}
505
506
    
507
sub parse_range
508
{
509
  local ($tmp, $str);
510
511
  $str = remaining_line ();
512
513
  if (!($str eq ''))
514
    {
515
      $str =~ s/;$//;
516
      push (@{$curentry{'ranges'}}, $str);
517
    }
518
}
519
520
521
sub parse_statement
522
{
523
  local ($token) = shift;
524
  local ($str);
525
526
  if ($token eq 'option')
527
    {
528
      $str = remaining_line ();
529
      push (@{$curentry{'options'}}, $str);
530
    }
531
  elsif($token eq 'failover')
532
    {
533
      $str = remaining_line (1); # take care on block
534
      if($str =~ /[{]/)
535
        {
536
          my ($peername, @statements);
537
538
          parse_error() if($str !~ /^\s*peer\s+(.+?)\s+[{]\s*$/);
539
          parse_error() if(($peername = $1) !~ /^\"?[^\"]+\"?$/);
540
541
          #
542
          # failover config block found:
543
          # e.g. 'failover peer "some-name" {'
544
          #
545
          if(not grep(/FaIlOvEr/i, @use))
546
            {
547
              print STDERR "Warning: Failover config 'peer $peername' found!\n";
548
              print STDERR "         Skipping it, since failover disabled!\n";
549
              print STDERR "         You may try out --use=failover option.\n";
550
            }
551
552
          until($str =~ /[}]/ or $str eq "")
553
            {
554
                $str = remaining_line (1);
555
                # collect all statements, except ending '}'
556
                push(@statements, $str) if($str !~ /[}]/);
557
            }
558
          $failover{$peername} = [@statements];
559
        }
560
      else
561
        {
562
          #
563
          # pool reference to failover config is fine
564
          # e.g. 'failover peer "some-name";'
565
          #
566
          if(not grep(/FaIlOvEr/i, @use))
567
            {
568
              print STDERR "Warning: Failover reference '$str' found!\n";
569
              print STDERR "         Skipping it, since failover disabled!\n";
570
              print STDERR "         You may try out --use=failover option.\n";
571
            }
572
          else
573
            {
574
              push (@{$curentry{'statements'}}, $token. " " . $str);
575
            }
576
        }
577
    }
578
  elsif($token eq 'zone')
579
    {
580
      $str = $token;
581
      while($str !~ /}$/) {
582
        $str .= ' ' . next_token (0);
583
      }
584
      push (@{$curentry{'statements'}}, $str);
585
    }
586
  elsif($token =~ /^(authoritative)[;]*$/)
587
    {
588
      push (@{$curentry{'statements'}}, $1);
589
    }
590
  else
591
    {
592
      $str = $token . " " . remaining_line ();
593
      push (@{$curentry{'statements'}}, $str);
594
    }
595
}
596
597
598
my $ok = GetOptions(
599
    'basedn=s'      => \$basedn,
600
    'dhcpdn=s'      => \$dhcpdn,
601
    'server=s'      => \$server,
602
    'second=s'      => \$second,
603
    'conf=s'        => \$i_conf,
604
    'ldif=s'        => \$o_ldif,
605
    'use=s'         => \@use,
606
    'h|help|usage'  => sub { usage(0); },
607
);
608
609
unless($server =~ /^\w+/)
610
  {
611
    usage(1, "invalid server name '$server'");
612
  }
613
unless($basedn =~ /^\w+=[^,]+/)
614
  {
615
    usage(1, "invalid base dn '$basedn'");
616
  }
617
618
if($dhcpdn =~ /^cn=([^,]+)/i)
619
  {
620
    $dhcpcn = "$1";
621
  }
622
$second = '' if not defined $second;
623
unless($second eq '' or $second =~ /^cn=[^,]+\s*,\s*\w+=[^,]+/i)
624
  {
625
    if($second =~ /^cn=[^,]+$/i)
626
      {
627
        # relative DN 'cn=name'
628
        $second = "$second, $basedn";
629
      }
630
    elsif($second =~ /^\w+/)
631
      {
632
        # assume hostname only
633
        $second = "cn=$second, $basedn";
634
      }
635
    else
636
      {
637
        usage(1, "invalid secondary '$second'")
638
      }
639
  }
640
641
usage(1) unless($ok);
642
643
if($i_conf ne "" and -f $i_conf)
644
  {
645
    if(not open(STDIN, '<', $i_conf))
646
      {
647
        print STDERR "Error: can't open conf file '$i_conf': $!\n";
648
        exit(1);
649
      }
650
  }
651
if($o_ldif ne "")
652
  {
653
    if(-e $o_ldif)
654
      {
655
        print STDERR "Error: output ldif name '$o_ldif' already exists!\n";
656
        exit(1);
657
      }
658
    if(not open(STDOUT, '>', $o_ldif))
659
      {
660
        print STDERR "Error: can't open ldif file '$o_ldif': $!\n";
661
        exit(1);
662
      }
663
  }
664
665
666
print STDERR "Creating LDAP Configuration with the following options:\n";
667
print STDERR "\tBase DN: $basedn\n";
668
print STDERR "\tDHCP DN: $dhcpdn\n";
669
print STDERR "\tServer DN: cn=$server, $basedn\n";
670
print STDERR "\tSecondary DN: $second\n"
671
             if(grep(/FaIlOvEr/i, @use) and $second ne '');
672
print STDERR "\n";
673
674
my $token;
675
my $token_number = 0;
676
my $line_number = 0;
677
my %curentry;
678
my $cursubnet = '';
679
my %curcounter = ( '' => { pool => 0, group => 0 } );
680
681
$current_dn = "$dhcpdn";
682
$curentry{'descr'} = $dhcpcn;
683
$line = '';
684
%failover = ();
685
686
while (($token = next_token (1)))
687
  {
688
    if ($token eq '}')
689
      {
690
        print_entry () if %curentry;
691
        if($current_dn =~ /.+?,\s*${dhcpdn}$/) {
692
          # don't go below dhcpdn ...
693
          remove_dn_from_stack ();
694
        }
695
      }
696
    elsif ($token eq 'subnet')
697
      {
698
        parse_subnet ();
699
        next;
700
      }
701
    elsif ($token eq 'shared-network')
702
      {
703
        parse_shared_network ();
704
        next;
705
      }
706
    elsif ($token eq 'class')
707
      {
708
        parse_class ();
709
        next;
710
      }
711
    elsif ($token eq 'subclass')
712
      {
713
        parse_subclass ();
714
        next;
715
      }
716
    elsif ($token eq 'pool')
717
      {
718
        parse_pool ();
719
        next;
720
      }
721
    elsif ($token eq 'group')
722
      {
723
        parse_group ();
724
        next;
725
      }
726
    elsif ($token eq 'host')
727
      {
728
        parse_host ();
729
        next;
730
      }
731
    elsif ($token eq 'hardware')
732
      {
733
        parse_hwaddress ();
734
        next;
735
      }
736
    elsif ($token eq 'range')
737
      {
738
        parse_range ();
739
        next;
740
      }
741
    else
742
      {
743
        parse_statement ($token);
744
        next;
745
      }
746
  }
747
748
close(STDIN)  if($i_conf);
749
close(STDOUT) if($o_ldif);
750
751
print STDERR "Done.\n";
752
(-)dhcp-3.0.5/debian/changelog (+25 lines)
Line 0 Link Here
1
dhcp3-server-ldap (3.0.4-1) unstable; urgency=low
2
3
  * See ChangeLog-LDAP for changes in this release
4
5
 -- Brian Masney <masneyb@gftp.org>  Mon, 08 May 2006 08:31:46 -0400
6
7
dhcp3-server-ldap (3.0.1rc13-1) unstable; urgency=low
8
9
  * See ChangeLog-LDAP for changes in this release
10
11
 -- Brian Masney <masneyb@gftp.org>  Wed, 05 May 2004 07:20:13 -0400
12
13
dhcp3-server-ldap (3.0.1rc12-1) unstable; urgency=low
14
15
  * Updated patch to work against ISC DHCPD 3.0.1rc12
16
17
 -- Brian Masney <masneyb@gftp.org>  Mon, 08 Sep 2003 16:34:00 -0400
18
19
dhcp3-server-ldap (3.0.1rc11-2) unstable; urgency=low
20
21
  * Added these Debian files. They are mostly from the existing dhcp3-server
22
    package in Debian.
23
24
 -- Brian Masney <masneyb@gftp.org>  Mon, 04 Aug 2003 13:34:00 -0400
25
(-)dhcp-3.0.5/debian/control (+12 lines)
Line 0 Link Here
1
Source: dhcp3-server-ldap
2
Section: net
3
Priority: optional
4
Maintainer: Brian Masney <masneyb@gftp.org>
5
Build-Depends: debhelper (>= 2.1.18), dpkg-dev (>= 1.7.0), groff, libldap2-dev
6
Standards-Version: 2.4.0.0
7
8
Package: dhcp3-server-ldap
9
Architecture: any
10
Depends: ${shlibs:Depends}, debconf, debianutils (>= 1.7), dhcp3-server (>= 3.0+3.0.1rc9)
11
Conflicts: dhcp, dhcp3-ldap-ntelos
12
Description: This is the DHCP server with LDAP patches applied to it
(-)dhcp-3.0.5/debian/copyright (+30 lines)
Line 0 Link Here
1
/*
2
 * Copyright (c) 1996, 1997 The Internet Software Consortium.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 * 3. Neither the name of The Internet Software Consortium nor the names of its
15
 *    contributors may be used to endorse or promote products derived
16
 *    from this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
19
 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
20
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
22
 * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29
 * OF THE POSSIBILITY OF SUCH DAMAGE.
30
 */
(-)dhcp-3.0.5/debian/dhcp3-server-ldap.files (+1 lines)
Line 0 Link Here
1
usr/sbin/dhcpd3
(-)dhcp-3.0.5/debian/dhcp3-server-ldap.postinst (+13 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
set -e 
4
5
# Removes the left over diversions of the old package
6
7
if [ "$1" = remove -o "$1" = upgrade ]; then
8
	for v in `list_versions`; do
9
	        dpkg-divert --package dhcp3-server-ldap --remove \
10
			--rename --divert /usr/sbin/dhcpd3-noldap \
11
			/usr/sbin/dhcpd3
12
	done
13
fi
(-)dhcp-3.0.5/debian/dhcp3-server-ldap.postrm (+8 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
set -e 
4
5
if [ "$1" = remove ]; then
6
	dpkg-divert --package dhcp3-server-ldap --remove --rename \
7
		--divert /usr/sbin/dhcpd3-noldap /usr/sbin/dhcpd3
8
fi
(-)dhcp-3.0.5/debian/dhcp3-server-ldap.preinst (+14 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
set -e 
4
5
if [ "$1" = install -o "$1" = upgrade ]; then
6
	if dpkg-divert --list /usr/sbin/dhcpd3 \
7
		| grep -q "by dhcp3-server-ldap";
8
	then
9
		exit 0
10
	fi
11
		
12
	dpkg-divert --package dhcp3-server-ldap --add --rename \
13
		--divert /usr/sbin/dhcpd3-noldap /usr/sbin/dhcpd3
14
fi
(-)dhcp-3.0.5/debian/dirs (+1 lines)
Line 0 Link Here
1
usr/sbin
(-)dhcp-3.0.5/debian/rules (+87 lines)
Line 0 Link Here
1
#!/usr/bin/make -f
2
# Made with the iad of dh_make, by Craig Small
3
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4
# Also some stuff taken from debmake scripts, by Cristopt Lameter.
5
6
# Uncomment this to turn on verbose mode.
7
#export DH_VERBOSE=1
8
9
export DH_COMPAT=3
10
11
DESTDIR = `pwd`/debian/tmp
12
13
IVARS = DESTDIR=$(DESTDIR)
14
15
BVARS = PREDEFINES='-D_PATH_DHCPD_DB=\"/var/lib/dhcp3/dhcpd.leases\" \
16
	-D_PATH_DHCLIENT_DB=\"/var/lib/dhcp3/dhclient.leases\" \
17
	-D_PATH_DHCLIENT_SCRIPT=\"/etc/dhcp3/dhclient-script\" \
18
	-D_PATH_DHCPD_CONF=\"/etc/dhcp3/dhcpd.conf\" \
19
        -D_PATH_DHCLIENT_CONF=\"/etc/dhcp3/dhclient.conf\"'
20
21
build: build-stamp
22
build-stamp:
23
	dh_testdir
24
25
	./configure
26
	$(MAKE) $(BVARS)
27
28
	touch build-stamp
29
30
clean: 
31
	dh_testdir
32
	rm -f build-stamp install-stamp
33
34
	# Add here commands to clean up after the build process.
35
	-$(MAKE) distclean
36
37
	# Remove leftover junk...
38
	rm -Rf work.linux-2.2/
39
40
	dh_clean
41
42
install: install-stamp
43
install-stamp: build-stamp
44
	dh_testdir
45
	dh_testroot
46
	dh_clean -k
47
	dh_installdirs
48
49
	# Add here commands to install the package into debian/tmp.
50
	$(MAKE) install $(IVARS)
51
52
	mv $(DESTDIR)/usr/sbin/dhcpd $(DESTDIR)/usr/sbin/dhcpd3
53
54
	dh_movefiles
55
56
	# Remove unwanted directories that dh_movefiles leaves around
57
	rmdir $(DESTDIR)/etc
58
	rm -Rf $(DESTDIR)/sbin/
59
	rm -Rf $(DESTDIR)/usr/bin/
60
	rm -Rf $(DESTDIR)/usr/include/
61
	rm -Rf $(DESTDIR)/usr/lib/
62
	rm -Rf $(DESTDIR)/usr/local/
63
	rm -Rf $(DESTDIR)/usr/man/
64
	rm -Rf $(DESTDIR)/var/
65
	rm -f $(DESTDIR)/usr/sbin/dhcrelay
66
67
	touch install-stamp
68
69
# Build architecture-dependent files here (this package does not contain
70
#	architecture-independent files).
71
binary-arch: build install
72
	dh_testdir -a
73
	dh_testroot -a
74
	dh_strip -a
75
	dh_compress -a
76
	dh_fixperms -a
77
	dh_installdeb -a
78
	dh_shlibdeps -a
79
	dh_gencontrol -a
80
	dh_md5sums -a
81
	dh_builddeb -a
82
83
source diff:                                                                  
84
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
85
86
binary: binary-arch
87
.PHONY: build clean binary-indep binary-arch binary
(-)dhcp-3.0.5/doc/draft-ietf-dhc-ldap-schema-01.txt (+1089 lines)
Line 0 Link Here
1
2
3
4
5
6
Network Working Group                                  M. Meredith,
7
Internet Draft                                         V. Nanjundaswamy,
8
Document: <draft-ietf-dhc-ldap-schema-00.txt>          M. Hinckley
9
Category: Proposed Standard                            Novell Inc.
10
Expires: 15th December 2001                            16th June 2001
11
12
13
                          LDAP Schema for DHCP
14
15
Status of this Memo
16
17
This document is an Internet-Draft and is in full conformance with all
18
provisions of Section 10 of RFC2026 [ ].
19
20
Internet-Drafts are working documents of the Internet Engineering Task
21
Force (IETF), its areas, and its working groups.  Note that other groups
22
may also distribute working documents as Internet-Drafts. Internet-
23
Drafts are draft documents valid for a maximum of six months and may be
24
updated, replaced, or obsolete by other documents at any time.  It is
25
inappropriate to use Internet-Drafts as reference material or to cite
26
them other than as "work in progress."  The list of current Internet-
27
Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The
28
list of Internet-Draft Shadow Directories can be accessed at
29
http://www.ietf.org/shadow.html.
30
31
1. Abstract
32
33
This document defines a schema for representing DHCP configuration in an
34
LDAP directory. It can be used to represent the DHCP Service
35
configuration(s) for an entire enterprise network, a subset of the
36
network, or even a single server. Representing DHCP configuration in an
37
LDAP directory enables centralized management of DHCP services offered
38
by one or more DHCP Servers within the enterprise.
39
40
2. Conventions used in this document
41
42
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
43
"SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this
44
document are to be interpreted as described in RFC-2119 [ ].
45
46
In places where different sets of terminology are commonly used to
47
represent similar DHCP concepts, this schema uses the terminology of the
48
Internet Software Consortium's DHCP server reference implementation.
49
For more information see www.isc.org.
50
51
3. Design Considerations
52
53
The DHCP LDAP schema is designed to be a simple multi-server schema. The
54
55
56
57
M. Meredith et al.        Expires December 2001                 [Page 1]
58
59
60
61
62
63
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
64
65
66
intent of this schema is to provide a basic framework for representing
67
the most common elements used in the configuration of DHCP Server.  This
68
should allow other network services to obtain and use basic DHCP
69
configuration information in a server-independent but knowledgeable way.
70
71
It is expected that some implementations may need to extend the schema
72
objects, in order to implement all of their features or needs. It is
73
recommended that you use the schema defined in this draft to represent
74
DHCP configuration information in an LDAP directory.  Conforming to a
75
standard schema improves interoperability between DHCP implementations
76
from different vendors.
77
78
Some implementations may choose not to support all of the objects
79
defined here.
80
81
Two decisions are explicitly left up to each implementation:
82
83
First, implementations may choose not to store the lease information in
84
the directory, so those objects would not be used.
85
86
Second, implementations may choose not to implement the auditing
87
information.
88
89
It is up to the implementation to determine if the data in the directory
90
is considered "authoritative", or if it is simply a copy of data from an
91
authoritative source. Validity of the information if used as a copy is
92
to be ensured by the implementation.
93
94
Primarily two types of applications will use the information in this
95
schema: 1. DHCP servers (for loading their configuration) 2. Management
96
Interfaces (for defining/editing configurations).
97
98
The schema should be efficient for the needs of both types of
99
applications.  The schema is designed to allow objects managed by DHCP
100
(such as computers, subnets, etc) to be present anywhere in a directory
101
hierarchy (to allow those objects to be placed in the directory for
102
managing administrative control and access to the objects).
103
104
The schema uses a few naming conventions - all object classes and
105
attributes are prefixed with "dhcp" to decrease the chance that object
106
classes and attributes will have the same name.  The schema also uses
107
standard naming attributes ("cn", "ou", etc) for all objects.
108
109
4. Common DHCP Configuration Attributes
110
111
Although DHCP manages several different types of objects, the
112
configuration of those objects is often similar.  Consequently, most of
113
these objects have a common set of attributes, which are defined below.
114
115
116
117
M. Meredith et al.        Expires December 2001                 [Page 2]
118
119
120
121
122
123
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
124
125
126
4.1. Attributes Definitions
127
128
The schema definitions listed below are for readability.  The LDIF
129
layout for this schema will follow in section 8.
130
131
Name: dhcpPrimaryDN Description: The Distinguished Name of the
132
dhcpServer object, which is the primary server for the configuration.
133
Syntax: DN Flags: SINGLE-VALUE
134
135
Named: dhcpSecondaryDN Description: The Distinguished Name(s) of the
136
dhcpServer object(s), which are secondary servers for the configuration.
137
Syntax: DN
138
139
Name: dhcpStatements Description: Flexible storage for representing any
140
specific data depending on the object to which it is attached. Examples
141
include conditional statements, Server parameters, etc.  This also
142
serves as a 'catch-all' attribute that allows the standard to evolve
143
without needing to update the schema.  Syntax: IA5String
144
145
Name: dhcpRange Description: The starting and ending IP Addresses in the
146
range (inclusive), separated by a hyphen; if the range only contains one
147
address, then just the address can be specified with no hyphen.  Each
148
range is defined as a separate value.  Syntax: IA5String
149
150
Name: dhcpPermitList Description: This attribute contains the permit
151
lists associated with a pool. Each permit list is defined as a separate
152
value.  Syntax: IA5String
153
154
Name: dhcpNetMask Description: The subnet mask length for the subnet.
155
The mask can be easily computed from this length.  Syntax: Integer
156
Flags: SINGLE-VALUE
157
158
Name: dhcpOption Description: Encoded option values to be sent to
159
clients.  Each value represents a single option and contains (OptionTag,
160
Length, OptionData) encoded in the format used by DHCP.  For more
161
information see [DHCPOPT].  Syntax: OctetString
162
163
Name: dhcpClassData Description: Encoded text string or list of bytes
164
expressed in hexadecimal, separated by colons. Clients match subclasses
165
based on matching the class data with the results of a 'match' or 'spawn
166
with' statement in the class name declarations.  Syntax: IA5String
167
Flags: SINGLE-VALUE
168
169
Name: dhcpSubclassesDN Description: List of subclasses, these are the
170
actual DN of each subclass object.  Syntax: DN
171
172
Name: dhcpClassesDN Description: List of classes, these are the actual
173
DN of each class object.  Syntax: DN
174
175
176
177
M. Meredith et al.        Expires December 2001                 [Page 3]
178
179
180
181
182
183
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
184
185
186
Name: dhcpSubnetDN Description: List of subnets, these are the actual DN
187
of each subnet object.  Syntax: DN
188
189
Name: dhcpPoolDN Description: List of pools, these are the actual DN of
190
each Pool object.  Syntax: DN
191
192
Name: dhcpOptionsDN Description: List of options, these are the actual
193
DN of each Options object.  Syntax: DN
194
195
Name: dhcpHostDN Description: List of hosts, these are the actual DN of
196
each host object.  Syntax: DN
197
198
Name: dhcpSharedNetworkDN Description: List of shared networks, these
199
are the actual DN of each shared network object.  Syntax: DN
200
201
Name: dhcpGroupDN Description: List of groups, these are the actual DN
202
of each Group object.  Syntax: DN
203
204
Name: dhcpLeaseDN Description: Single Lease DN. A dhcpHost configuration
205
uses this attribute to identify a static IP address assignment.  Syntax:
206
DN Flags: SINGLE-VALUE
207
208
Name: dhcpLeasesDN Description: List of leases, these are the actual DN
209
of each lease object.  Syntax: DN
210
211
Name: dhcpServiceDN Description: The DN of dhcpService object(s)which
212
contain the configuration information. Each dhcpServer object has this
213
attribute identifying the DHCP configuration(s) that the server is
214
associated with.  Syntax: DN
215
216
Name: dhcpHWAddress Description: The hardware address of the client
217
associated with a lease Syntax: OctetString Flags: SINGLE-VALUE
218
219
Name: dhcpVersion Description: This is the version identified for the
220
object that this attribute is part of. In case of the dhcpServer object,
221
this represents the DHCP software version.  Syntax: IA5String Flags:
222
SINGLE-VALUE
223
224
Name: dhcpImplementation Description: DHCP Server implementation
225
description e.g. DHCP Vendor information.  Syntax: IA5String Flags:
226
SINGLE-VALUE
227
228
Name: dhcpHashBucketAssignment Description: HashBucketAssignment bit map
229
for the DHCP Server, as defined in DHC Load Balancing Algorithm [RFC
230
3074].  Syntax: Octet String Flags: SINGLE-VALUE
231
232
Name: dhcpDelayedServiceParameter Description: Delay in seconds
233
corresponding to Delayed Service Parameter configuration, as defined in
234
235
236
237
M. Meredith et al.        Expires December 2001                 [Page 4]
238
239
240
241
242
243
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
244
245
246
DHC Load Balancing Algorithm [RFC 3074].  Syntax: Integer Flags: SINGLE-
247
VALUE
248
249
Name: dhcpMaxClientLeadTime Description: Maximum Client Lead Time
250
configuration in seconds, as defined in DHCP Failover Protocol [FAILOVR]
251
Syntax: Integer Flags: SINGLE-VALUE
252
253
Name: dhcpFailOverEndpointState Description: Server (Failover Endpoint)
254
state, as defined in DHCP Failover Protocol [FAILOVR] Syntax: IA5String
255
Flags: SINGLE-VALUE
256
257
5. Configurations and Services
258
259
The schema definitions below are for readability the LDIF layout for
260
this schema will follow in section 8.
261
262
The DHC working group is currently considering several proposals for
263
fail-over and redundancy of DHCP servers.  These may require sharing of
264
configuration information between servers.  This schema provides a
265
generalized mechanism for supporting any of these proposals, by
266
separating the definition of a server from the definition of
267
configuration service provided by the server.
268
269
Separating the DHCP Server (dhcpServer) and the DHCP Configuration
270
(dhcpService) representations allows a configuration service to be
271
provided by one or more servers. Similarly, a server may provide one or
272
more configurations. The schema allows a server to be configured as
273
either a primary or secondary provider of a DHCP configuration.
274
275
Configurations are also defined so that one configuration can include
276
some of the objects that are defined in another configuration.  This
277
allows for sharing and/or a hierarchy of related configuration items.
278
279
Name: dhcpService Description:  Service object that represents the
280
actual DHCP Service configuration. This will be a container with the
281
following attributes.  Must: cn, dhcpPrimaryDN May: dhcpSecondaryDN,
282
dhcpSharedNetworkDN, dhcpSubnetDN, dhcpGroupDN, dhcpHostDN,
283
dhcpClassesDN, dhcpOptionsDN, dhcpStatements
284
285
The following objects could exist inside the dhcpService container:
286
dhcpSharedNetwork, dhcpSubnet, dhcpGroup, dhcpHost, dhcpClass,
287
dhcpOptions, dhcpLog
288
289
Name: dhcpServer Description:  Server object that the DHCP server will
290
login as.  The configuration information is in the dhcpService container
291
that the dhcpServiceDN points to.  Must: cn, dhcpServiceDN May:
292
dhcpVersion, dhcpImplementation, dhcpHashBucketAssignment,
293
dhcpDelayedServiceParameter, dhcpMaxClientLeadTime, 
294
295
296
297
M. Meredith et al.        Expires December 2001                 [Page 5]
298
299
300
301
302
303
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
304
dhcpFailOverEndpointState, dhcpStatements
305
306
5.1. DHCP Declaration related classes:
307
308
Name: dhcpSharedNetwork Description: Shared Network class will list what
309
pools and subnets are in this network.
310
311
This will be a container with the following attributes.  Must: cn May:
312
dhcpSubnetDN, dhcpPoolDN, dhcpOptionsDN, dhcpStatements
313
314
The following objects can exist within a dhcpSharedNetwork container:
315
dhcpSubnet, dhcpPool, dhcpOptions, dhcpLog
316
317
Name: dhcpSubnet Description: Subnet object will include configuration
318
information associated with a subnet, including a range and a net mask.
319
320
This will be a container with the following attributes.  Must: cn
321
(Subnet address), dhcpNetMask May: dhcpRange, dhcpPoolDN, dhcpGroupDN,
322
dhcpHostDN, dhcpClassesDN, dhcpLeasesDN, dhcpOptionsDN, dhcpStatements
323
324
The following objects can exist within a dhcpSubnet container: dhcpPool,
325
dhcpGroup, dhcpHost, dhcpClass, dhcpOptions, dhcpLease, dhcpLog
326
327
Name: dhcpGroup Description: Group object will have configuration
328
information associated with a group.
329
330
This will be a container with the following attributes.  Must: cn May:
331
dhcpHostDN, dhcpOptionsDN, dhcpStatements
332
333
The following objects can exist within a dhcpGroup container: dhcpHost,
334
dhcpOptions
335
336
Name: dhcpHost Description: The host object includes DHCP host
337
declarations to assign a static IP address or declare the client as
338
known or specify statements for a specific client.  Must: cn May:
339
dhcpLeaseDN, dhcpHWAddress, dhcpOptionsDN, dhcpStatements
340
341
The following objects can exist within a dhcpHost container: dhcpLease,
342
dhcpOptions
343
344
Name: dhcpOptions Description: The options class is for option space
345
declarations, it contains a list of options.  Must: cn, dhcpOption
346
347
Name: dhcpClass Description: This is a class to group clients together
348
based on matching rules.
349
350
This will be a container with the following attributes.  Must: cn May:
351
dhcpSubClassesDN, dhcpOptionsDN, dhcpStatements
352
353
The following object can exist within a dhcpClass container:
354
dhcpSubclass, dhcpOptions
355
356
357
358
M. Meredith et al.        Expires December 2001                 [Page 6]
359
360
361
362
363
364
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
365
366
367
Name: dhcpSubClass Description: This includes configuration information
368
for a subclass associated with a class. The dhcpSubClass object will
369
always be contained within the corresponding class container object.
370
Must: cn May:  dhcpClassData, dhcpOptionsDN, dhcpStatements
371
372
Name: dhcpPool Description: This contains configuration for a pool that
373
will have the range of addresses, permit lists and point to classes and
374
leases that are members of this pool.
375
376
This will be a container that could be contained by dhcpSubnet or a
377
dhcpSharedNetwork.  Must: cn, dhcpRange May: dhcpClassesDN,
378
dhcpPermitList, dhcpLeasesDN, dhcpOptionsDN, dhcpStatements
379
380
The following objects can exist within a dhcpPool container: dhcpClass,
381
dhcpOptions, dhcpLease, dhcpLog
382
383
6. Tracking Address Assignments
384
385
The behavior of a DHCP server is influenced by two factors - it's
386
configuration and the current state of the addresses that have been
387
assigned to clients. This schema defines a set of objects for
388
representing the DHCP configuration associated with a server. The
389
following object classes provide the ability to record how addresses are
390
used including maintaining history (audit log) on individual leases.
391
Recording lease information in a directory could result in a significant
392
performance impact and is therefore optional. Implementations supporting
393
logging of leases need to consider the performance impact.
394
395
6.1. dhcpLeases Attribute Definitions
396
397
The schema definitions below are for readability the LDIF layout for
398
this schema will follow in section 8.
399
400
Name: dhcpAddressState Description: This stores information about the
401
current binding-status of an address.  For dynamic addresses managed by
402
DHCP, the values should be restricted to the states defined in the DHCP
403
Failover Protocol draft [FAILOVR]: 'FREE', 'ACTIVE', 'EXPIRED',
404
'RELEASED', 'RESET', 'ABANDONED', 'BACKUP'.  For more information on
405
these states see [FAILOVR].  For other addresses, it SHOULD be one of
406
the following: 'UNKNOWN', 'RESERVED' (an address that is managed by DHCP
407
that is reserved for a specific client), 'RESERVED-ACTIVE' (same as
408
reserved, but address is currently in use),  'ASSIGNED' (assigned
409
manually or by some other mechanism), 'UNASSIGNED', 'NOTASSIGNABLE'.
410
Syntax: IA5String Flags: SINGLE-VALUE
411
412
Name: dhcpExpirationTime Description: This is the time the current lease
413
for an address expires.  Syntax: DateTime Flags: SINGLE-VALUE
414
415
416
417
418
M. Meredith et al.        Expires December 2001                 [Page 7]
419
420
421
422
423
424
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
425
426
427
Name: dhcpStartTimeOfState Description: This is the time of the last
428
state change for a leased address.  Syntax: DateTime Flags: SINGLE-VALUE
429
430
Name: dhcpLastTransactionTime Description: This is the last time a valid
431
DHCP packet was received from the client.  Syntax: DateTime Flags:
432
SINGLE-VALUE
433
434
Name: dhcpBootpFlag Description: This indicates whether the address was
435
assigned via BOOTP Syntax: Boolean Flags: SINGLE-VALUE
436
437
Name: dhcpDomainName Description: This is the name of the domain sent to
438
the client by the server.  It is essentially the same as the value for
439
DHCP option 15 sent to the client, and represents only the domain - not
440
the full FQDN.  To obtain the full FQDN assigned to the client you must
441
prepend the "dhcpAssignedHostName" to this value with a ".".  Syntax:
442
IA5String Flags: SINGLE-VALUE
443
444
Name: dhcpDnsStatus Description: This indicates the status of updating
445
DNS resource records on behalf of the client by the DHCP server for this
446
address.  The value is a 16-bit bitmask that has the same values as
447
specified by the Failover-DDNS option (see [FAILOVR]).  Syntax: Integer
448
Flags: SINGLE-VALUE
449
450
Name: dhcpRequestedHostName Description: This is the hostname that was
451
requested by the client.  Syntax: IA5String Flags: SINGLE-VALUE
452
453
Name: dhcpAssignedHostName Description: This is the actual hostname that
454
was assigned to a client. It may not be the name that was requested by
455
the client.  The fully qualified domain name can be determined by
456
appending the value of "dhcpDomainName" (with a dot separator) to this
457
name.  Syntax: IA5String Flags: SINGLE-VALUE
458
459
Name: dhcpReservedForClient Description: This is the distinguished name
460
of the "dhcpHost" that an address is reserved for.  This may not be the
461
same as the "dhcpAssignedToClient" attribute if the address is being
462
reassigned but the current lease has not yet expired.  Syntax: DN Flags:
463
SINGLE-VALUE
464
465
Name: dhcpAssignedToClient Description: This is the distinguished name
466
of a "dhcpHost" that an address is currently assigned to.  This
467
attribute is only present in the class when the address is leased.
468
Syntax: DN Flags: SINGLE-VALUE
469
470
Name: dhcpRelayAgentInfo Description: If the client request was received
471
via a relay agent, this contains information about the relay agent that
472
was available from the DHCP request.  This is a hex-encoded option
473
value.  Syntax: OctetString Flags: SINGLE-VALUE
474
475
Name: dhcpErrorLog Description: Generic error log attribute that allows
476
logging error conditions within a dhcpService or a dhcpSubnet, like no IP 
477
addresses available for lease. Syntax: IA5String 
478
479
M. Meredith et al.        Expires December 2001                 [Page 8]
480
481
482
483
484
485
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
486
487
488
6.2.  dhcpLeases Object Class
489
490
This class represents an IP address.  It may or may not be leaseable,
491
and the object may exist even though a lease is not currently active for
492
the associated IP address.
493
494
It is recommended that all Lease objects for a single DHCP Service be
495
centrally located within a single container. This ensures that the lease
496
objects and the corresponding logs do not have to be relocated, when
497
address ranges allocated to individual DHCP subnets and/or pools change.
498
499
The schema definitions below are for readability the LDIF layout for
500
this schema will follow in section 8.
501
502
Name: dhcpLeases Description: This is the object that holds state
503
information about an IP address. The cn (which is the IP address), and
504
the current address-state are mandatory attributes. If the address is
505
assigned then, some of the optional attributes will have valid data.
506
Must: cn, dhcpAddressState May: dhcpExpirationTime,
507
dhcpStartTimeOfState, dhcpLastTransactionTime, dhcpBootpFlag,
508
dhcpDomainName, dhcpDnsStatus, dhcpRequestedHostName,
509
dhcpAssignedHostName, dhcpReservedForClient, dhcpAssignedToClient,
510
dhcpRelayAgentInfo, dhcpHWAddress
511
512
6.3 Audit Log Information
513
514
A dhcpLog object is created whenever a lease is assigned or released.
515
This object is intended to be created under the corresponding dhcpLeases
516
container, or dhcpPool, dhcpSubnet, dhcpSharedNetwork or dhcpService
517
containers.
518
519
The log information under the dhcpLeases container would be for
520
addresses matching that lease information. The log information in the
521
other containers could be used for errors, i.e. when a pool or subnet is
522
out our addresses or if a server is not able to assign any more
523
addresses for a particular dhcpService.
524
525
Name: dhcpLog Description: This is the object that holds past
526
information about an IP address. The cn is the time/date stamp when the
527
address was assigned or released, the address state at the time, if the
528
address was assigned or released.  Must: cn May: dhcpAddressState,
529
dhcpExpirationTime, dhcpStartTimeOfState, dhcpLastTransactionTime,
530
dhcpBootpFlag, dhcpDomainName, dhcpDnsStatus, dhcpRequestedHostName,
531
dhcpAssignedHostName, dhcpReservedForClient, dhcpAssignedToClient,
532
dhcpRelayAgentInfo, dhcpHWAddress, dhcpErrorLog
533
534
535
536
537
538
539
M. Meredith et al.        Expires December 2001                 [Page 9]
540
541
542
543
544
545
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
546
547
548
7. Determining settings
549
550
The dhcpStatements attribute is the key to DHC enhancements that may
551
come along, and the different key words that a particular server
552
implementation may use. This attribute can be used to hold conditional
553
DHCP Statements and DHCP server parameters. Having a generic settings
554
attribute that is just a string, allows this schema to be extensible and
555
easy to configure.
556
557
All of the attributes that end with DN are references to the class that
558
precedes the DN e.g. the dhcpPrimaryDN and dhcpSecondaryDN attributes
559
hold the Distinguished Names of the dhcpServer objects that are
560
associated with the dhcpService object.
561
562
8. LDIF format for attributes and classes.
563
564
# Attributes
565
566
( 2.16.840.1.113719.1.203.4.1 NAME 'dhcpPrimaryDN' DESC
567
'The DN of the dhcpServer which is the primary server for the
568
configuration.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
569
570
( 2.16.840.1.113719.1.203.4.2 NAME 'dhcpSecondaryDN' DESC 'The DN of
571
dhcpServer(s) which provide backup service for the configuration.'
572
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
573
574
( 2.16.840.1.113719.1.203.4.3 NAME 'dhcpStatements' DESC 'Flexible
575
storage for specific data depending on what object this exists in. Like
576
conditional statements, server parameters, etc. This allows the standard
577
to evolve without needing to adjust the schema.' SYNTAX
578
1.3.6.1.4.1.1466.115.121.1.26 )
579
580
( 2.16.840.1.113719.1.203.4.4 NAME 'dhcpRange' DESC 'The starting &
581
ending IP Addresses in the range (inclusive), separated by a hyphen; if
582
the range only contains one address, then just the address can be
583
specified with no hyphen.  Each range is defined as a separate value.'
584
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
585
586
( 2.16.840.1.113719.1.203.4.5 NAME 'dhcpPermitList' DESC 'This attribute
587
contains the permit lists associated with a pool. Each permit list is
588
defined as a separate value.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
589
590
( 2.16.840.1.113719.1.203.4.6 NAME 'dhcpNetMask' DESC 'The subnet mask
591
length for the subnet.  The mask can be easily computed from this
592
length.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
593
594
( 2.16.840.1.113719.1.203.4.7 NAME 'dhcpOption' DESC 'Encoded option
595
values to be sent to clients.  Each value represents a single option and
596
contains (OptionTag, Length, OptionValue) encoded in the format used by
597
DHCP.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
598
599
M. Meredith et al.        Expires December 2001                [Page 10]
600
601
602
603
604
605
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
606
607
608
( 2.16.840.1.113719.1.203.4.8 NAME 'dhcpClassData' DESC 'Encoded text
609
string or list of bytes expressed in hexadecimal, separated by colons.
610
Clients match subclasses based on matching the class data with the
611
results of match or spawn with statements in the class name
612
declarations.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
613
614
( 2.16.840.1.113719.1.203.4.9 NAME 'dhcpOptionsDN' DESC 'The
615
distinguished name(s) of the dhcpOption objects containing the
616
configuration options provided by the server.' SYNTAX
617
1.3.6.1.4.1.1466.115.121.1.12 )
618
619
( 2.16.840.1.113719.1.203.4.10 NAME 'dhcpHostDN' DESC 'the distinguished
620
name(s) of the dhcpHost objects.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
621
622
( 2.16.840.1.113719.1.203.4.11 NAME 'dhcpPoolDN' DESC 'The distinguished
623
name(s) of pools.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
624
625
( 2.16.840.1.113719.1.203.4.12 NAME 'dhcpGroupDN' DESC 'The
626
distinguished name(s)   of the groups.' SYNTAX
627
1.3.6.1.4.1.1466.115.121.1.12 )
628
629
( 2.16.840.1.113719.1.203.4.13 NAME 'dhcpSubnetDN' DESC 'The
630
distinguished name(s) of the subnets.' SYNTAX
631
1.3.6.1.4.1.1466.115.121.1.12 )
632
633
( 2.16.840.1.113719.1.203.4.14 NAME 'dhcpLeaseDN' DESC 'The
634
distinguished name of a client address.' SYNTAX
635
1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE)
636
637
( 2.16.840.1.113719.1.203.4.15 NAME 'dhcpLeasesDN' DESC 'The
638
distinguished name(s) client addresses.' SYNTAX
639
1.3.6.1.4.1.1466.115.121.1.12 )
640
641
( 2.16.840.1.113719.1.203.4.16 NAME 'dhcpClassesDN' DESC 'The
642
distinguished name(s) of a class(es) in a subclass.' SYNTAX
643
1.3.6.1.4.1.1466.115.121.1.12 )
644
645
( 2.16.840.1.113719.1.203.4.17 NAME 'dhcpSubclassesDN' DESC 'The
646
distinguished name(s) of subclass(es).' SYNTAX
647
1.3.6.1.4.1.1466.115.121.1.12 )
648
649
( 2.16.840.1.113719.1.203.4.18 NAME 'dhcpSharedNetworkDN' DESC 'The
650
distinguished name(s) of sharedNetworks.' SYNTAX
651
1.3.6.1.4.1.1466.115.121.1.12 )
652
653
( 2.16.840.1.113719.1.203.4.19 NAME 'dhcpServiceDN' DESC 'The DN of
654
dhcpService object(s)which contain the configuration information. Each
655
dhcpServer object has this attribute identifying the DHCP
656
657
658
659
M. Meredith et al.        Expires December 2001                [Page 11]
660
661
662
663
664
665
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
666
667
668
configuration(s) that the server is associated with.' SYNTAX
669
1.3.6.1.4.1.1466.115.121.1.12 )
670
671
( 2.16.840.1.113719.1.203.4.20 NAME 'dhcpVersion' DESC 'The version
672
attribute of this object.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-
673
VALUE )
674
675
( 2.16.840.1.113719.1.203.4.21 NAME 'dhcpImplementation' DESC
676
'Description of the DHCP Server implementation e.g. DHCP Server's
677
vendor.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
678
679
( 2.16.840.1.113719.1.203.4.22 NAME 'dhcpAddressState' DESC 'This stores
680
information about the current binding-status of an address.  For dynamic
681
addresses managed by DHCP, the values should be restricted to the
682
following: "FREE", "ACTIVE", "EXPIRED", "RELEASED", "RESET",
683
"ABANDONED", "BACKUP".  For other addresses, it SHOULD be one of the
684
following: "UNKNOWN", "RESERVED" (an address that is managed by DHCP
685
that is reserved for a specific client), "RESERVED-ACTIVE" (same as
686
reserved, but address is currently in use), "ASSIGNED" (assigned
687
manually or by some other mechanism), "UNASSIGNED", "NOTASSIGNABLE".'
688
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
689
690
( 2.16.840.1.113719.1.203.4.23 NAME 'dhcpExpirationTime' DESC 'This is
691
the time the current lease for an address expires.' SYNTAX
692
1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
693
694
( 2.16.840.1.113719.1.203.4.24 NAME 'dhcpStartTimeOfState' DESC 'This is
695
the time of the last state change for a leased address.' SYNTAX
696
1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
697
698
( 2.16.840.1.113719.1.203.4.25 NAME 'dhcpLastTransactionTime' DESC 'This
699
is the last time a valid DHCP packet was received from the client.'
700
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
701
702
( 2.16.840.1.113719.1.203.4.26 NAME 'dhcpBootpFlag' DESC 'This indicates
703
whether the address was assigned via BOOTP.' SYNTAX
704
1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
705
706
( 2.16.840.1.113719.1.203.4.27 NAME 'dhcpDomainName' DESC 'This is the
707
name of the domain sent to the client by the server.  It is essentially
708
the same as the value for DHCP option 15 sent to the client, and
709
represents only the domain - not the full FQDN.  To obtain the full FQDN
710
assigned to the client you must prepend the "dhcpAssignedHostName" to
711
this value with a ".".' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-
712
VALUE )
713
714
( 2.16.840.1.113719.1.203.4.28 NAME 'dhcpDnsStatus' DESC 'This indicates
715
the status of updating DNS resource records on behalf of the client by
716
717
718
719
M. Meredith et al.        Expires December 2001                [Page 12]
720
721
722
723
724
725
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
726
727
728
the DHCP server for this address.  The value is a 16-bit bitmask.'
729
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
730
731
( 2.16.840.1.113719.1.203.4.29 NAME 'dhcpRequestedHostName' DESC 'This
732
is the hostname that was requested by the client.' SYNTAX
733
1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
734
735
( 2.16.840.1.113719.1.203.4.30 NAME 'dhcpAssignedHostName' DESC 'This is
736
the actual hostname that was assigned to a client. It may not be the
737
name that was requested by the client.  The fully qualified domain name
738
can be determined by appending the value of "dhcpDomainName" (with a dot
739
separator) to this name.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-
740
VALUE )
741
742
( 2.16.840.1.113719.1.203.4.31 NAME 'dhcpReservedForClient' DESC 'The
743
distinguished name of a "dhcpClient" that an address is reserved for.
744
This may not be the same as the "dhcpAssignedToClient" attribute if the
745
address is being reassigned but the current lease has not yet expired.'
746
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
747
748
( 2.16.840.1.113719.1.203.4.32 NAME 'dhcpAssignedToClient' DESC 'This is
749
the distinguished name of a "dhcpClient" that an address is currently
750
assigned to.  This attribute is only present in the class when the
751
address is leased.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
752
753
( 2.16.840.1.113719.1.203.4.33 NAME 'dhcpRelayAgentInfo' DESC 'If the
754
client request was received via a relay agent, this contains information
755
about the relay agent that was available from the DHCP request.  This is
756
a hex-encoded option value.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
757
SINGLE-VALUE )
758
759
( 2.16.840.1.113719.1.203.4.34 NAME 'dhcpHWAddress' DESC 'The clients
760
hardware address that requested this IP address.' SYNTAX
761
1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
762
763
( 2.16.840.1.113719.1.203.4.35 NAME 'dhcpHashBucketAssignment' DESC
764
'HashBucketAssignment bit map for the DHCP Server, as defined in DHC
765
Load Balancing Algorithm [RFC 3074].' SYNTAX
766
1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
767
768
( 2.16.840.1.113719.1.203.4.36 NAME 'dhcpDelayedServiceParameter' DESC
769
'Delay in seconds corresponding to Delayed Service Parameter
770
configuration, as defined in  DHC Load Balancing Algorithm [RFC 3074]. '
771
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
772
773
( 2.16.840.1.113719.1.203.4.37 NAME 'dhcpMaxClientLeadTime' DESC
774
'Maximum Client Lead Time configuration in seconds, as defined in DHCP
775
Failover Protocol [FAILOVR]' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
776
777
778
779
M. Meredith et al.        Expires December 2001                [Page 13]
780
781
782
783
784
785
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
786
787
788
SINGLE-VALUE )
789
790
( 2.16.840.1.113719.1.203.4.38 NAME 'dhcpFailOverEndpointState' DESC
791
'Server (Failover Endpoint) state, as defined in DHCP Failover Protocol
792
[FAILOVR]' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
793
794
( 2.16.840.1.113719.1.203.4.39 NAME 'dhcpErrorLog' DESC
795
Generic error log attribute that allows logging error conditions within a 
796
dhcpService or a dhcpSubnet, like no IP addresses available for lease. 
797
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
798
799
#Classes
800
801
( 2.16.840.1.113719.1.203.6.1 NAME 'dhcpService' DESC ' Service object
802
that represents the actual DHCP Service configuration. This is a
803
container object.' SUP top MUST (cn $ dhcpPrimaryDN) MAY
804
(dhcpSecondaryDN $ dhcpSharedNetworkDN $ dhcpSubnetDN $ dhcpGroupDN $
805
dhcpHostDN $  dhcpClassesDN $ dhcpOptionsDN $ dhcpStatements ) )
806
807
( 2.16.840.1.113719.1.203.6.2 NAME 'dhcpSharedNetwork' DESC 'This stores
808
configuration information for a shared network.' SUP top MUST  cn MAY
809
(dhcpSubnetDN $ dhcpPoolDN $ dhcpOptionsDN $ dhcpStatements) X-
810
NDS_CONTAINMENT ('dhcpService' ) )
811
812
( 2.16.840.1.113719.1.203.6.3 NAME 'dhcpSubnet' DESC 'This class defines
813
a subnet. This is a container object.' SUP top MUST ( cn $ dhcpNetMask )
814
MAY (dhcpRange $ dhcpPoolDN $ dhcpGroupDN $ dhcpHostDN $ dhcpClassesDN $
815
dhcpLeasesDN $ dhcpOptionsDN $ dhcpStatements) X-NDS_CONTAINMENT
816
('dhcpService' 'dhcpSharedNetwork') )
817
818
( 2.16.840.1.113719.1.203.6.4 NAME 'dhcpPool' DESC 'This stores
819
configuration information about a pool.' SUP top MUST ( cn $ dhcpRange )
820
MAY (dhcpClassesDN $ dhcpPermitList $ dhcpLeasesDN $ dhcpOptionsDN $
821
dhcpStatements) X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpSharedNetwork') )
822
823
( 2.16.840.1.113719.1.203.6.5 NAME 'dhcpGroup' DESC 'Group object that
824
lists host DNs and parameters. This is a container object.' SUP top MUST
825
cn MAY ( dhcpHostDN $ dhcpOptionsDN $ dhcpStatements ) X-NDS_CONTAINMENT
826
('dhcpSubnet' 'dhcpService' ) )
827
828
( 2.16.840.1.113719.1.203.6.6 NAME 'dhcpHost' DESC 'This represents
829
information about a particular client' SUP top MUST cn MAY  (dhcpLeaseDN
830
$ dhcpHWAddress $ dhcpOptionsDN $ dhcpStatements) X-NDS_CONTAINMENT
831
('dhcpService' 'dhcpSubnet' 'dhcpGroup') )
832
833
( 2.16.840.1.113719.1.203.6.7 NAME 'dhcpClass' DESC 'Represents
834
information about a collection of related clients.' SUP top MUST cn MAY
835
(dhcpSubClassesDN $ dhcpOptionsDN $ dhcpStatements) X-NDS_CONTAINMENT
836
('dhcpService' 'dhcpSubnet' ) )
837
838
( 2.16.840.1.113719.1.203.6.8 NAME 'dhcpSubClass' DESC 'Represents
839
information about a collection of related classes.' SUP top MUST cn MAY
840
(dhcpClassData $ dhcpOptionsDN $ dhcpStatements) X-NDS_CONTAINMENT
841
842
843
844
M. Meredith et al.        Expires December 2001                [Page 14]
845
846
847
848
849
850
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
851
852
853
'dhcpClass' )
854
855
( 2.16.840.1.113719.1.203.6.9 NAME 'dhcpOptions' DESC 'Represents
856
information about a collection of options defined.' SUP top MUST cn MAY
857
( dhcpOption ) X-NDS_CONTAINMENT  ('dhcpService' 'dhcpSharedNetwork'
858
'dhcpSubnet' 'dhcpPool' 'dhcpGroup' 'dhcpHost' 'dhcpClass' )
859
860
( 2.16.840.1.113719.1.203.6.10 NAME 'dhcpLeases' DESC 'This class
861
represents an IP Address, which may or may not have been leased.' SUP
862
top MUST ( cn $ dhcpAddressState ) MAY ( dhcpExpirationTime $
863
dhcpStartTimeOfState $ dhcpLastTransactionTime $ dhcpBootpFlag $
864
dhcpDomainName $ dhcpDnsStatus $ dhcpRequestedHostName $
865
dhcpAssignedHostName $ dhcpReservedForClient $ dhcpAssignedToClient $
866
dhcpRelayAgentInfo $ dhcpHWAddress ) X-NDS_CONTAINMENT ( 'dhcpService'
867
'dhcpSubnet' 'dhcpPool') )
868
869
( 2.16.840.1.113719.1.203.6.11 NAME 'dhcpLog' DESC 'This is the object
870
that holds past information about the IP address. The cn is the
871
time/date stamp when the address was assigned or released, the address
872
state at the time, if the address was assigned or released.' SUP top
873
MUST ( cn ) MAY ( dhcpAddressState $ dhcpExpirationTime $
874
dhcpStartTimeOfState $ dhcpLastTransactionTime $ dhcpBootpFlag $
875
dhcpDomainName $ dhcpDnsStatus $ dhcpRequestedHostName $
876
dhcpAssignedHostName $ dhcpReservedForClient $ dhcpAssignedToClient $
877
dhcpRelayAgentInfo $ dhcpHWAddress $ dhcpErrorLog) X-NDS_CONTAINMENT 
878
('dhcpLeases' 'dhcpPool' 'dhcpSubnet' 'dhcpSharedNetwork' 'dhcpService' ) )
879
880
( 2.16.840.1.113719.1.203.6.12 NAME 'dhcpServer' DESC 'DHCP Server
881
Object' SUP top MUST (cn, dhcpServiceDN) MAY (dhcpVersion $
882
dhcpImplementation $ dhcpHashBucketAssignment $
883
dhcpDelayedServiceParameter $ dhcpMaxClientLeadTime $
884
dhcpFailOverEndpointState $ dhcpStatements) X-NDS_CONTAINMENT ('O' 'OU' 
885
'dc') )
886
887
9. Security Considerations
888
889
Since the DHCP Configuration information is stored in a directory, the
890
security of the information is limited to the security offered by the
891
directory including the security of the objects within that directory.
892
893
10.  Intellectual Property Rights Notices
894
895
The IETF takes no position regarding the validity or scope of any
896
intellectual property or other rights that might be claimed to pertain
897
to the implementation or use of the technology described in this
898
document or the extent to which any license under such rights might or
899
might not be available; neither does it represent that it has made any
900
effort to identify any such rights.  Information on the IETF's
901
procedures with respect to rights in standards-track and standards-
902
903
904
905
M. Meredith et al.        Expires December 2001                [Page 15]
906
907
908
909
910
911
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
912
913
914
related documentation can be found in BCP-11.  Copies of claims of
915
rights made available for publication and any assurances of licenses to
916
be made available, or the result of an attempt made to obtain a general
917
license or permission for the use of such proprietary rights by
918
implementors or users of this specification can be obtained from the
919
IETF Secretariat.
920
921
The IETF invites any interested party to bring to its attention any
922
copyrights, patents or patent applications, or other proprietary rights
923
which may cover technology that may be required to practice this
924
standard.  Please address the information to the IETF Executive
925
Director.
926
927
11.  Full Copyright Statement
928
929
Copyright (C) The Internet Society (2001).  All Rights Reserved.
930
931
This document and translations of it may be copied and furnished to
932
others, and derivative works that comment on or otherwise explain it or
933
assist in its implementation may be prepared, copied, published and
934
distributed, in whole or in part, without restriction of any kind,
935
provided that the above copyright notice and this paragraph are included
936
on all such copies and derivative works.  However, this document itself
937
may not be modified in any way, such as by removing the copyright notice
938
or references to the Internet Society or other Internet organizations,
939
except as needed for the purpose of developing Internet standards in
940
which case the procedures for copyrights defined in the Internet
941
Standards process must be followed, or as required to translate it into
942
languages other than English.
943
944
The limited permissions granted above are perpetual and will not be
945
revoked by the Internet Society or its successors or assigns.
946
947
This document and the information contained herein is provided on an "AS
948
IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK
949
FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
950
LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT
951
INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
952
FITNESS FOR A PARTICULAR PURPOSE.
953
954
12. References
955
956
[RFC2131] Droms, R., "Dynamic Host Configuration Protocol", RFC 2131,
957
March 1997.
958
959
[RFC2132] Alexander, S., Droms, R., "DHCP Options and BOOTP Vendor
960
Extensions", RFC 2132, March 1997.
961
962
963
964
965
M. Meredith et al.        Expires December 2001                [Page 16]
966
967
968
969
970
971
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
972
973
974
[MSDHCP]  Gu, Y., Vyaghrapuri, R., "An LDAP Schema for Dynamic Host
975
Configuration Protocol Service", Internet Draft <draft-gu-dhcp-ldap-
976
schema-00.txt>, August 1998.
977
978
[NOVDHCP] Miller, T., Patel, A., Rao, P., "Lightweight Directory Access
979
Protocol (v3): Schema for Dynamic Host Configuration Protocol (DHCP)",
980
Internet Draft <draft-miller-dhcp-ldap-schema-00.txt>, June 1998.
981
982
[FAILOVR] Droms, R., Rabil, G., Dooley, M., Kapur, A., Gonczi, S., Volz,
983
B., "DHCP Failover Protocol", Internet Draft <draft-ietf-dhc-
984
failover-08.txt>, July 2000.
985
986
[RFC 3074] Volz B., Gonczi S., Lemon T., Stevens R., "DHC Load Balancing
987
Algorithm", February 2001
988
989
[AGENT]   Patrick, M., "DHCP Relay Agent Information Option", Internet
990
Draft <draft-ietf-dhc-agent-options-09.txt>, March 2000.
991
992
[DHCPOPT] Carney, M., "New Option Review Guidelines and Additional
993
Option Namespace", Internet Draft <draft-ietf-dhc-
994
option_review_and_namespace-01.txt>, October 1999.
995
996
[POLICY]  Strassner, J., Elleson, E., Moore, B., "Policy Framework LDAP
997
Core Schema", Internet Draft <draft-ietf-policy-core-schema-06.txt>,
998
November 1999.
999
1000
[RFC2251] Wahl, M., Howes, T., Kille, S., "Lightweight Directory Access
1001
Protocol (v3)", RFC 2251, December 1997.
1002
1003
[RFC2252] Wahl, M., Coulbeck, A., Howes, T., Kille, S., "Lightweight
1004
Directory Access Protocol (v3) Attribute Syntax Definitions", RFC 2252,
1005
December 1997.
1006
1007
[RFC2255] Howes, T., Smith, M., "The LDAP URL Format", RFC 2255,
1008
December 1997.
1009
1010
[RFC951]  Croft, B., Gilmore, J., "Bootstrap Protocol (BOOTP)", RFC 951,
1011
September 1985.
1012
1013
[RFC2119] Bradner, S. "Key words for use in RFCs to Indicate Requirement
1014
Levels", RFC 2119, March 1997.
1015
1016
13. Acknowledgments
1017
1018
This work is partially based on a previous draft draft-ietf-dhc-
1019
schema-02.doc.
1020
1021
1022
1023
1024
1025
M. Meredith et al.        Expires December 2001                [Page 17]
1026
1027
1028
1029
1030
1031
INTERNET-DRAFT            LDAP Schema for DHCP              16 June 2001
1032
1033
1034
14. Author's Addresses
1035
1036
Comments regarding this draft may be sent to the authors at the
1037
following address:
1038
1039
Mark Meredith
1040
Mark Hinckley
1041
Novell Inc.
1042
1800 S. Novell Place
1043
Provo, Utah 84606
1044
1045
Vijay K. Nanjundaswamy
1046
Novell Software Development (I) Ltd
1047
49/1 & 49/3, Garvebhavi Palya,
1048
7th Mile, Hosur Road
1049
Bangalore 560068
1050
1051
email: mark_meredith@novell.com
1052
email: knvijay@novell.com
1053
email: mhinckley@novell.com
1054
1055
This Internet Draft expires December 16, 2001.
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
M. Meredith et al.        Expires December 2001                [Page 18]
1086
1087
1088
1089
(-)dhcp-3.0.5/dst/Makefile.dist (-2 / +2 lines)
Lines 21-28 Link Here
21
#   <info@isc.org>
21
#   <info@isc.org>
22
#   http://www.isc.org/
22
#   http://www.isc.org/
23
23
24
SRC    = dst_support.c dst_api.c hmac_link.c md5_dgst.c base64.c prandom.c
24
SRC    = dst_support.c dst_api.c hmac_link.c base64.c prandom.c
25
OBJ    = dst_support.o dst_api.o hmac_link.o md5_dgst.o base64.o prandom.o
25
OBJ    = dst_support.o dst_api.o hmac_link.o base64.o prandom.o
26
HDRS   = dst_internal.h md5.h md5_locl.h
26
HDRS   = dst_internal.h md5.h md5_locl.h
27
27
28
INCLUDES = $(BINDINC) -I$(TOP)/includes
28
INCLUDES = $(BINDINC) -I$(TOP)/includes
(-)dhcp-3.0.5/includes/dhcpd.h (-1 / +50 lines)
Lines 79-84 Link Here
79
#include <isc-dhcp/result.h>
79
#include <isc-dhcp/result.h>
80
#include <omapip/omapip_p.h>
80
#include <omapip/omapip_p.h>
81
81
82
#if defined(LDAP_CONFIGURATION)
83
# include <ldap.h>
84
# include <sys/utsname.h> /* for uname() */
85
#endif
86
82
#if !defined (OPTION_HASH_SIZE)
87
#if !defined (OPTION_HASH_SIZE)
83
# define OPTION_HASH_SIZE 17
88
# define OPTION_HASH_SIZE 17
84
# define OPTION_HASH_PTWO 32	/* Next power of two above option hash. */
89
# define OPTION_HASH_PTWO 32	/* Next power of two above option hash. */
Lines 139-144 Link Here
139
	char *inbuf;
144
	char *inbuf;
140
	unsigned bufix, buflen;
145
	unsigned bufix, buflen;
141
	unsigned bufsiz;
146
	unsigned bufsiz;
147
148
	int (*read_function) (struct parse *);
142
};
149
};
143
150
144
/* Variable-length array of data. */
151
/* Variable-length array of data. */
Lines 244-249 Link Here
244
	u_int8_t hbuf [17];
251
	u_int8_t hbuf [17];
245
};
252
};
246
253
254
#if defined(LDAP_CONFIGURATION)
255
# define LDAP_BUFFER_SIZE		8192
256
# define LDAP_METHOD_STATIC		0
257
# define LDAP_METHOD_DYNAMIC		1
258
259
/* This is a tree of the current configuration we are building from LDAP */
260
261
struct ldap_config_stack {
262
	LDAPMessage * res; 	/* Pointer returned from ldap_search */
263
	LDAPMessage * ldent; 	/* Current item in LDAP that we're processing 
264
				   in res */
265
	int close_brace;	/* Put a closing } after we're through with
266
				   this item */
267
	int processed; 		/* We set this flag if this base item has been
268
				   processed. After this base item is processed,
269
				   we can start processing the children */
270
	struct ldap_config_stack *next;
271
};
272
#endif
273
247
typedef enum {
274
typedef enum {
248
	server_startup = 0,
275
	server_startup = 0,
249
	server_running = 1,
276
	server_running = 1,
Lines 426-431 Link Here
426
# define DEFAULT_PING_TIMEOUT 1
453
# define DEFAULT_PING_TIMEOUT 1
427
#endif
454
#endif
428
455
456
#if defined(LDAP_CONFIGURATION)
457
# define SV_LDAP_SERVER  		47
458
# define SV_LDAP_PORT  			48
459
# define SV_LDAP_USERNAME  		49
460
# define SV_LDAP_PASSWORD  		50
461
# define SV_LDAP_BASE_DN 		51
462
# define SV_LDAP_METHOD			52
463
# define SV_LDAP_DEBUG_FILE		53
464
# define SV_LDAP_SERVER_CN		54
465
#endif
466
429
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
467
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
430
# define DEFAULT_DEFAULT_LEASE_TIME 43200
468
# define DEFAULT_DEFAULT_LEASE_TIME 43200
431
#endif
469
#endif
Lines 1531-1537 Link Here
1531
char *quotify_string (const char *, const char *, int);
1569
char *quotify_string (const char *, const char *, int);
1532
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
1570
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
1533
char *print_base64 (const unsigned char *, unsigned, const char *, int);
1571
char *print_base64 (const unsigned char *, unsigned, const char *, int);
1534
char *print_hw_addr PROTO ((int, int, unsigned char *));
1572
char *print_hw_addr PROTO ((const int, const int, const unsigned char *));
1535
void print_lease PROTO ((struct lease *));
1573
void print_lease PROTO ((struct lease *));
1536
void dump_raw PROTO ((const unsigned char *, unsigned));
1574
void dump_raw PROTO ((const unsigned char *, unsigned));
1537
void dump_packet_option (struct option_cache *, struct packet *,
1575
void dump_packet_option (struct option_cache *, struct packet *,
Lines 2632-2634 Link Here
2632
#endif /* FAILOVER_PROTOCOL */
2670
#endif /* FAILOVER_PROTOCOL */
2633
2671
2634
const char *binding_state_print (enum failover_state);
2672
const char *binding_state_print (enum failover_state);
2673
2674
/* ldap.c */
2675
#if defined(LDAP_CONFIGURATION)
2676
extern struct enumeration ldap_methods;
2677
isc_result_t ldap_read_config (void);
2678
int find_haddr_in_ldap (struct host_decl **, int, unsigned,
2679
                        const unsigned char *, const char *, int);
2680
int find_subclass_in_ldap (struct class *, struct class **, 
2681
			   struct data_string *);
2682
#endif
2683
(-)dhcp-3.0.5/includes/ldap_casa.h (+83 lines)
Line 0 Link Here
1
/* ldap_casa.h
2
   
3
   Definition for CASA modules... */
4
5
/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
6
 * Copyright (c) 1995-2003 Internet Software Consortium.
7
 * Copyright (c) 2006 Novell, Inc.
8
9
 * All rights reserved.
10
 * Redistribution and use in source and binary forms, with or without 
11
 * modification, are permitted provided that the following conditions are met: 
12
 * 1.Redistributions of source code must retain the above copyright notice, 
13
 *   this list of conditions and the following disclaimer. 
14
 * 2.Redistributions in binary form must reproduce the above copyright notice, 
15
 *   this list of conditions and the following disclaimer in the documentation 
16
 *   and/or other materials provided with the distribution. 
17
 * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors 
18
 *   may be used to endorse or promote products derived from this software 
19
 *   without specific prior written permission. 
20
21
 * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS 
22
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
24
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE 
25
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
26
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
27
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
28
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
29
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
30
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
31
 * POSSIBILITY OF SUCH DAMAGE.
32
33
 * This file was written by S Kalyanasundaram <skalyanasundaram@novell.com>
34
 */
35
36
#if defined(LDAP_CASA_AUTH)
37
#ifndef __LDAP_CASA_H__
38
#define __LDAP_CASA_H__
39
40
#include <micasa_mgmd.h>
41
#include <dlfcn.h>
42
#include <string.h>
43
44
#define MICASA_LIB     "libmicasa.so.1"
45
46
SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
47
(
48
       uint32_t            ssFlags,
49
       SSCS_SECRET_ID_T   *appSecretID,
50
       SSCS_SECRET_ID_T   *sharedSecretID,
51
       uint32_t           *credentialType,
52
       void               *credential,
53
       SSCS_EXT_T         *ext 
54
);
55
SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T)
56
(
57
       uint32_t            ssFlags,
58
       SSCS_SECRET_ID_T   *appSecretID,
59
       SSCS_SECRET_ID_T   *sharedSecretID,
60
       uint32_t            credentialType,
61
       void               *credential,
62
       SSCS_EXT_T         *ext
63
);
64
65
SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T)
66
(
67
       uint32_t            ssFlags,
68
       SSCS_SECRET_ID_T   *appSecretID,
69
       SSCS_SECRET_ID_T   *sharedSecretID,
70
       SSCS_EXT_T         *ext
71
);
72
static CASA_GetCredential_T            p_miCASAGetCredential = NULL;
73
static CASA_SetCredential_T            p_miCASASetCredential = NULL;
74
static CASA_RemoveCredential_T         p_miCASARemoveCredential = NULL;
75
static void                            *casaIDK = NULL;
76
77
int load_casa(void);
78
static void release_casa(void);
79
int load_uname_pwd_from_miCASA(char **, char **);
80
81
#endif /* __LDAP_CASA_H__ */
82
#endif /* LDAP_CASA_AUTH */
83
(-)dhcp-3.0.5/includes/site.h (+10 lines)
Lines 177-179 Link Here
177
   traces. */
177
   traces. */
178
178
179
#define TRACING
179
#define TRACING
180
181
/* Define this if you want to read your config from LDAP. Read README.ldap
182
   about how to set this up */
183
184
#define LDAP_CONFIGURATION
185
186
/* Define this if you want to enable LDAP over a SSL connection. You will need
187
   to add -lcrypto -lssl to the LIBS= line of server/Makefile */
188
189
/* #define USE_SSL */
(-)dhcp-3.0.5/server/Makefile.dist (-2 / +2 lines)
Lines 25-33 Link Here
25
CATMANPAGES = dhcpd.cat8 dhcpd.conf.cat5 dhcpd.leases.cat5
25
CATMANPAGES = dhcpd.cat8 dhcpd.conf.cat5 dhcpd.leases.cat5
26
SEDMANPAGES = dhcpd.man8 dhcpd.conf.man5 dhcpd.leases.man5
26
SEDMANPAGES = dhcpd.man8 dhcpd.conf.man5 dhcpd.leases.man5
27
SRCS   = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
27
SRCS   = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
28
	 omapi.c mdb.c stables.c salloc.c ddns.c
28
	 ldap.c ldap_casa.c omapi.c mdb.c stables.c salloc.c ddns.c
29
OBJS   = dhcpd.o dhcp.o bootp.o confpars.o db.o class.o failover.o \
29
OBJS   = dhcpd.o dhcp.o bootp.o confpars.o db.o class.o failover.o \
30
	 omapi.o mdb.o stables.o salloc.o ddns.o
30
	 ldap.o ldap_casa.o omapi.o mdb.o stables.o salloc.o ddns.o
31
PROG   = dhcpd
31
PROG   = dhcpd
32
MAN    = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
32
MAN    = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
33
33
(-)dhcp-3.0.5/server/class.c (-3 / +14 lines)
Lines 90-95 Link Here
90
	int matched = 0;
90
	int matched = 0;
91
	int status;
91
	int status;
92
	int ignorep;
92
	int ignorep;
93
	int classfound;
93
94
94
	for (class = collection -> classes; class; class = class -> nic) {
95
	for (class = collection -> classes; class; class = class -> nic) {
95
#if defined (DEBUG_CLASS_MATCHING)
96
#if defined (DEBUG_CLASS_MATCHING)
Lines 135-143 Link Here
135
				   class -> submatch, MDL));
136
				   class -> submatch, MDL));
136
			if (status && data.len) {
137
			if (status && data.len) {
137
				nc = (struct class *)0;
138
				nc = (struct class *)0;
138
				if (class_hash_lookup (&nc, class -> hash,
139
                                classfound = class_hash_lookup (&nc, 
139
						       (const char *)data.data,
140
						class -> hash, 
140
						       data.len, MDL)) {
141
						(const char *)data.data,
142
						data.len, MDL);
143
144
#ifdef LDAP_CONFIGURATION
145
                                if (!classfound && 
146
						find_subclass_in_ldap (class, 
147
								&nc, &data)) 
148
					classfound = 1;
149
#endif
150
151
				if (classfound) {
141
#if defined (DEBUG_CLASS_MATCHING)
152
#if defined (DEBUG_CLASS_MATCHING)
142
					log_info ("matches subclass %s.",
153
					log_info ("matches subclass %s.",
143
					      print_hex_1 (data.len,
154
					      print_hex_1 (data.len,
(-)dhcp-3.0.5/server/confpars.c (-1 / +11 lines)
Lines 63-69 Link Here
63
63
64
isc_result_t readconf ()
64
isc_result_t readconf ()
65
{
65
{
66
	return read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
66
	isc_result_t res;
67
68
	res = read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
69
#if defined(LDAP_CONFIGURATION)
70
	if (res != ISC_R_SUCCESS)
71
		return (res);
72
73
	return ldap_read_config ();
74
#else
75
	return (res);
76
#endif
67
}
77
}
68
78
69
isc_result_t read_conf_file (const char *filename, struct group *group,
79
isc_result_t read_conf_file (const char *filename, struct group *group,
(-)dhcp-3.0.5/server/dhcpd.c (+3 lines)
Lines 436-441 Link Here
436
	/* Add the ddns update style enumeration prior to parsing. */
436
	/* Add the ddns update style enumeration prior to parsing. */
437
	add_enumeration (&ddns_styles);
437
	add_enumeration (&ddns_styles);
438
	add_enumeration (&syslog_enum);
438
	add_enumeration (&syslog_enum);
439
#if defined (LDAP_CONFIGURATION)
440
	add_enumeration (&ldap_methods);
441
#endif
439
442
440
	if (!group_allocate (&root_group, MDL))
443
	if (!group_allocate (&root_group, MDL))
441
		log_fatal ("Can't allocate root group!");
444
		log_fatal ("Can't allocate root group!");
(-)dhcp-3.0.5/server/ldap.c (+1741 lines)
Line 0 Link Here
1
/* ldap.c
2
3
   Routines for reading the configuration from LDAP */
4
5
/*
6
 * Copyright (c) 2003-2006 Ntelos, Inc.
7
 * All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 *
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 * 3. Neither the name of The Internet Software Consortium nor the names
19
 *    of its contributors may be used to endorse or promote products derived
20
 *    from this software without specific prior written permission.
21
 *
22
 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23
 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
 * DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34
 * SUCH DAMAGE.
35
 *
36
 * This LDAP module was written by Brian Masney <masneyb@ntelos.net>. Its
37
 * development was sponsored by Ntelos, Inc. (www.ntelos.com).
38
 */
39
40
#include "dhcpd.h"
41
#include <signal.h>
42
43
#if defined(LDAP_CONFIGURATION)
44
45
#if defined(LDAP_CASA_AUTH)
46
#include "ldap_casa.h"
47
#endif
48
49
static LDAP * ld = NULL;
50
static char *ldap_server = NULL, 
51
            *ldap_username = NULL, 
52
            *ldap_password = NULL,
53
            *ldap_base_dn = NULL,
54
            *ldap_server_cn = NULL,
55
            *ldap_debug_file = NULL;
56
static int ldap_port = LDAP_PORT,
57
           ldap_method = LDAP_METHOD_DYNAMIC,
58
           ldap_debug_fd = -1;
59
static struct ldap_config_stack *ldap_stack = NULL;
60
61
typedef struct ldap_dn_node {
62
    struct ldap_dn_node *next;
63
    size_t refs;
64
    char *dn;
65
} ldap_dn_node;
66
67
static ldap_dn_node *ldap_service_dn_head = NULL;
68
static ldap_dn_node *ldap_service_dn_tail = NULL;
69
70
71
static void
72
ldap_parse_class (struct ldap_config_stack *item, struct parse *cfile)
73
{
74
  char **tempstr;
75
76
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) == NULL ||
77
      tempstr[0] == NULL)
78
    {
79
      if (tempstr != NULL)
80
        ldap_value_free (tempstr);
81
82
      return;
83
    }
84
85
  strncat (cfile->inbuf, "class \"", LDAP_BUFFER_SIZE);
86
  strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
87
  strncat (cfile->inbuf, "\" {\n", LDAP_BUFFER_SIZE);
88
89
  item->close_brace = 1;
90
  ldap_value_free (tempstr);
91
}
92
93
94
static void
95
ldap_parse_subclass (struct ldap_config_stack *item, struct parse *cfile)
96
{
97
  char **tempstr, **classdata;
98
99
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) == NULL ||
100
      tempstr[0] == NULL)
101
    {
102
      if (tempstr != NULL)
103
        ldap_value_free (tempstr);
104
105
      return;
106
    }
107
108
  if ((classdata = ldap_get_values (ld, item->ldent, 
109
                                  "dhcpClassData")) == NULL || 
110
      classdata[0] == NULL)
111
    {
112
      if (classdata != NULL)
113
        ldap_value_free (classdata);
114
      ldap_value_free (tempstr);
115
116
      return;
117
    }
118
119
  strncat (cfile->inbuf, "subclass ", LDAP_BUFFER_SIZE);
120
  strncat (cfile->inbuf, classdata[0], LDAP_BUFFER_SIZE);
121
  strncat (cfile->inbuf, " ", LDAP_BUFFER_SIZE);
122
  strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
123
  strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE);
124
125
  item->close_brace = 1;
126
  ldap_value_free (tempstr);
127
  ldap_value_free (classdata);
128
}
129
130
131
static void
132
ldap_parse_host (struct ldap_config_stack *item, struct parse *cfile)
133
{
134
  char **tempstr, **hwaddr;
135
136
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) == NULL ||
137
      tempstr[0] == NULL)
138
    {
139
      if (tempstr != NULL)
140
        ldap_value_free (tempstr);
141
142
      return;
143
    }
144
145
  hwaddr = ldap_get_values (ld, item->ldent, "dhcpHWAddress");
146
147
  strncat (cfile->inbuf, "host ", LDAP_BUFFER_SIZE);
148
  strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
149
150
  if (hwaddr != NULL && hwaddr[0] != NULL)
151
    {
152
      strncat (cfile->inbuf, " {\nhardware ", LDAP_BUFFER_SIZE);
153
      strncat (cfile->inbuf, hwaddr[0], LDAP_BUFFER_SIZE);
154
      strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
155
      ldap_value_free (hwaddr);
156
    }
157
158
  item->close_brace = 1;
159
  ldap_value_free (tempstr);
160
}
161
162
163
static void
164
ldap_parse_shared_network (struct ldap_config_stack *item, struct parse *cfile)
165
{
166
  char **tempstr;
167
168
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) == NULL ||
169
      tempstr[0] == NULL)
170
    {
171
      if (tempstr != NULL)
172
        ldap_value_free (tempstr);
173
174
      return;
175
    }
176
177
  strncat (cfile->inbuf, "shared-network \"", LDAP_BUFFER_SIZE);
178
  strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
179
  strncat (cfile->inbuf, "\" {\n", LDAP_BUFFER_SIZE);
180
181
  item->close_brace = 1;
182
  ldap_value_free (tempstr);
183
}
184
185
186
static void
187
parse_netmask (int netmask, char *netmaskbuf)
188
{
189
  unsigned long nm;
190
  int i;
191
192
  nm = 0;
193
  for (i=1; i <= netmask; i++)
194
    {
195
      nm |= 1 << (32 - i);
196
    }
197
198
  sprintf (netmaskbuf, "%d.%d.%d.%d", (int) (nm >> 24) & 0xff, 
199
                                      (int) (nm >> 16) & 0xff, 
200
                                      (int) (nm >> 8) & 0xff, 
201
                                      (int) nm & 0xff);
202
}
203
204
205
static void
206
ldap_parse_subnet (struct ldap_config_stack *item, struct parse *cfile)
207
{
208
  char **tempstr, **netmaskstr, netmaskbuf[16];
209
  int i;
210
211
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) == NULL ||
212
      tempstr[0] == NULL)
213
    {
214
      if (tempstr != NULL)
215
        ldap_value_free (tempstr);
216
217
      return;
218
    }
219
220
  if ((netmaskstr = ldap_get_values (ld, item->ldent, 
221
                                     "dhcpNetmask")) == NULL || 
222
      netmaskstr[0] == NULL)
223
    {
224
      if (netmaskstr != NULL)
225
        ldap_value_free (netmaskstr);
226
      ldap_value_free (tempstr);
227
228
      return;
229
    }
230
231
  strncat (cfile->inbuf, "subnet ", LDAP_BUFFER_SIZE);
232
  strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
233
234
  strncat (cfile->inbuf, " netmask ", LDAP_BUFFER_SIZE);
235
  parse_netmask (strtol (netmaskstr[0], NULL, 10), netmaskbuf);
236
  strncat (cfile->inbuf, netmaskbuf, LDAP_BUFFER_SIZE);
237
238
  strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE);
239
240
  ldap_value_free (tempstr);
241
  ldap_value_free (netmaskstr);
242
243
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpRange")) != NULL)
244
    {
245
      for (i=0; tempstr[i] != NULL; i++)
246
        {
247
          strncat (cfile->inbuf, "range", LDAP_BUFFER_SIZE);
248
          strncat (cfile->inbuf, " ", LDAP_BUFFER_SIZE);
249
          strncat (cfile->inbuf, tempstr[i], LDAP_BUFFER_SIZE);
250
          strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
251
        }
252
      ldap_value_free (tempstr);
253
    }
254
255
  item->close_brace = 1;
256
}
257
258
259
static void
260
ldap_parse_pool (struct ldap_config_stack *item, struct parse *cfile)
261
{
262
  char **tempstr;
263
  int i;
264
265
  strncat (cfile->inbuf, "pool {\n", LDAP_BUFFER_SIZE);
266
267
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpRange")) != NULL)
268
    {
269
      strncat (cfile->inbuf, "range", LDAP_BUFFER_SIZE);
270
      for (i=0; tempstr[i] != NULL; i++)
271
        {
272
          strncat (cfile->inbuf, " ", LDAP_BUFFER_SIZE);
273
          strncat (cfile->inbuf, tempstr[i], LDAP_BUFFER_SIZE);
274
        }
275
      strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
276
      ldap_value_free (tempstr);
277
    }
278
279
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpPermitList")) != NULL)
280
    {
281
      for (i=0; tempstr[i] != NULL; i++)
282
        {
283
          strncat (cfile->inbuf, tempstr[i], LDAP_BUFFER_SIZE);
284
          strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
285
        }
286
      ldap_value_free (tempstr);
287
    }
288
289
  item->close_brace = 1;
290
}
291
292
293
static void
294
ldap_parse_group (struct ldap_config_stack *item, struct parse *cfile)
295
{
296
  strncat (cfile->inbuf, "group {\n", LDAP_BUFFER_SIZE);
297
  item->close_brace = 1;
298
}
299
300
301
static void
302
ldap_parse_key (struct ldap_config_stack *item, struct parse *cfile)
303
{
304
  char **tempstr;
305
306
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) != NULL)
307
    {
308
      strncat (cfile->inbuf, "key ", LDAP_BUFFER_SIZE);
309
      strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
310
      strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE);
311
      ldap_value_free (tempstr);
312
    }
313
314
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpKeyAlgorithm")) != NULL)
315
    {
316
      strncat (cfile->inbuf, "algorithm ", LDAP_BUFFER_SIZE);
317
      strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
318
      strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
319
      ldap_value_free (tempstr);
320
    }
321
322
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpKeySecret")) != NULL)
323
    {
324
      strncat (cfile->inbuf, "secret ", LDAP_BUFFER_SIZE);
325
      strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
326
      strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
327
      ldap_value_free (tempstr);
328
    }
329
330
  item->close_brace = 1;
331
}
332
333
334
static void
335
ldap_parse_zone (struct ldap_config_stack *item, struct parse *cfile)
336
{
337
  char *cnFindStart, *cnFindEnd;
338
  char **tempstr;
339
  char *keyCn;
340
  size_t len;
341
342
  if ((tempstr = ldap_get_values (ld, item->ldent, "cn")) != NULL)
343
    {
344
      strncat (cfile->inbuf, "zone ", LDAP_BUFFER_SIZE);
345
      strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
346
      strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE);
347
      ldap_value_free (tempstr);
348
    }
349
350
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpDnsZoneServer")) != NULL)
351
    {
352
      strncat (cfile->inbuf, "primary ", LDAP_BUFFER_SIZE);
353
      strncat (cfile->inbuf, tempstr[0], LDAP_BUFFER_SIZE);
354
355
      strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
356
      ldap_value_free (tempstr);
357
    }
358
359
  if ((tempstr = ldap_get_values (ld, item->ldent, "dhcpKeyDN")) != NULL)
360
    {
361
      cnFindStart = strchr(tempstr[0],'=');
362
      if (cnFindStart != NULL)
363
        cnFindEnd = strchr(++cnFindStart,',');
364
      else
365
        cnFindEnd = NULL;
366
367
      if (cnFindEnd != NULL && cnFindEnd > cnFindStart)
368
        {
369
          len = cnFindEnd - cnFindStart;
370
          keyCn = dmalloc (len + 1, MDL);
371
        }
372
      else
373
        {
374
          len = 0;
375
          keyCn = NULL;
376
        }
377
378
      if (keyCn != NULL)
379
        {
380
          strncpy (keyCn, cnFindStart, len);
381
          keyCn[len] = '\0';
382
383
          strncat (cfile->inbuf, "key ", LDAP_BUFFER_SIZE);
384
          strncat (cfile->inbuf, keyCn, LDAP_BUFFER_SIZE);
385
          strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE);
386
387
          dfree (keyCn, MDL);
388
        }
389
390
      ldap_value_free (tempstr);
391
     }
392
393
  item->close_brace = 1;
394
}
395
396
397
static void
398
add_to_config_stack (LDAPMessage * res, LDAPMessage * ent)
399
{
400
  struct ldap_config_stack *ns;
401
402
  ns = dmalloc (sizeof (*ns), MDL);
403
  ns->res = res;
404
  ns->ldent = ent;
405
  ns->close_brace = 0;
406
  ns->processed = 0;
407
  ns->next = ldap_stack;
408
  ldap_stack = ns;
409
}
410
411
412
static void
413
ldap_stop()
414
{
415
  struct sigaction old, new;
416
417
  if (ld == NULL)
418
    return;
419
420
  /*
421
   ** ldap_unbind after a LDAP_SERVER_DOWN result
422
   ** causes a SIGPIPE and dhcpd gets terminated,
423
   ** since it doesn't handle it...
424
   */
425
426
  new.sa_flags   = 0;
427
  new.sa_handler = SIG_IGN;
428
  sigemptyset (&new.sa_mask);
429
  sigaction (SIGPIPE, &new, &old);
430
431
  ldap_unbind (ld);
432
  ld = NULL;
433
434
  sigaction (SIGPIPE, &old, &new);
435
}
436
437
438
static char *
439
_do_lookup_dhcp_string_option (struct option_state *options, int option_name)
440
{
441
  struct option_cache *oc;
442
  struct data_string db;
443
  char *ret;
444
445
  memset (&db, 0, sizeof (db));
446
  oc = lookup_option (&server_universe, options, option_name);
447
  if (oc &&
448
      evaluate_option_cache (&db, (struct packet*) NULL,
449
                             (struct lease *) NULL,
450
                             (struct client_state *) NULL, options,
451
                             (struct option_state *) NULL,
452
                             &global_scope, oc, MDL) &&
453
      db.data != NULL && *db.data != '\0')
454
455
    {
456
      ret = dmalloc (db.len + 1, MDL);
457
      if (ret == NULL)
458
        log_fatal ("no memory for ldap username");
459
460
      memcpy (ret, db.data, db.len);
461
      ret[db.len] = 0;
462
      data_string_forget (&db, MDL);
463
    }
464
  else
465
    ret = NULL;
466
467
  return (ret);
468
}
469
470
471
static int
472
_do_lookup_dhcp_int_option (struct option_state *options, int option_name)
473
{
474
  struct option_cache *oc;
475
  struct data_string db;
476
  int ret;
477
478
  memset (&db, 0, sizeof (db));
479
  oc = lookup_option (&server_universe, options, option_name);
480
  if (oc &&
481
      evaluate_option_cache (&db, (struct packet*) NULL,
482
                             (struct lease *) NULL,
483
                             (struct client_state *) NULL, options,
484
                             (struct option_state *) NULL,
485
                             &global_scope, oc, MDL) &&
486
      db.data != NULL && *db.data != '\0')
487
    {
488
      ret = strtol (db.data, NULL, 10);
489
      data_string_forget (&db, MDL);
490
    }
491
  else
492
    ret = 0;
493
494
  return (ret);
495
}
496
497
498
static int
499
_do_lookup_dhcp_enum_option (struct option_state *options, int option_name)
500
{
501
  struct option_cache *oc;
502
  struct data_string db;
503
  int ret;
504
505
  memset (&db, 0, sizeof (db));
506
  oc = lookup_option (&server_universe, options, option_name);
507
  if (oc &&
508
      evaluate_option_cache (&db, (struct packet*) NULL,
509
                             (struct lease *) NULL,
510
                             (struct client_state *) NULL, options,
511
                             (struct option_state *) NULL,
512
                             &global_scope, oc, MDL) &&
513
      db.data != NULL && *db.data != '\0')
514
    {
515
      if (db.len == 1) 
516
        ret = db.data [0];
517
      else
518
        log_fatal ("invalid option name %d", option_name);
519
520
      data_string_forget (&db, MDL);
521
    }
522
  else
523
    ret = 0;
524
525
  return (ret);
526
}
527
528
529
static void
530
ldap_start (void)
531
{
532
  struct option_state *options;
533
  int ret, version;
534
535
  if (ld != NULL)
536
    return;
537
538
  if (ldap_server == NULL)
539
    {
540
      options = NULL;
541
      option_state_allocate (&options, MDL);
542
543
      execute_statements_in_scope ((struct binding_value **) NULL,
544
                 (struct packet *) NULL, (struct lease *) NULL,
545
                 (struct client_state *) NULL, (struct option_state *) NULL,
546
                 options, &global_scope, root_group, (struct group *) NULL);
547
548
      ldap_server = _do_lookup_dhcp_string_option (options, SV_LDAP_SERVER);
549
      ldap_server_cn = _do_lookup_dhcp_string_option (options,
550
                                                      SV_LDAP_SERVER_CN);
551
      ldap_port = _do_lookup_dhcp_int_option (options, SV_LDAP_PORT);
552
      ldap_base_dn = _do_lookup_dhcp_string_option (options, SV_LDAP_BASE_DN);
553
      ldap_method = _do_lookup_dhcp_enum_option (options, SV_LDAP_METHOD);
554
      ldap_debug_file = _do_lookup_dhcp_string_option (options,
555
                                                       SV_LDAP_DEBUG_FILE);
556
557
#if defined (LDAP_CASA_AUTH)
558
      if (!load_uname_pwd_from_miCASA(ldap_username,ldap_password))
559
        {
560
#if defined (DEBUG_LDAP)
561
          log_info ("Authentication credential taken from file");
562
#endif
563
#endif
564
565
      ldap_username = _do_lookup_dhcp_string_option (options, SV_LDAP_USERNAME);
566
      ldap_password = _do_lookup_dhcp_string_option (options, SV_LDAP_PASSWORD);
567
568
#if defined (LDAP_CASA_AUTH)
569
      }
570
#endif
571
572
      option_state_dereference (&options, MDL);
573
    }
574
575
  if (ldap_server == NULL || ldap_base_dn == NULL)
576
    {
577
      log_info ("Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file");
578
      ldap_method = LDAP_METHOD_STATIC;
579
      return;
580
    }
581
582
  if (ldap_debug_file != NULL && ldap_debug_fd == -1)
583
    {
584
      if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY,
585
                                 S_IRUSR | S_IWUSR)) < 0)
586
        log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file,
587
                   strerror (errno));
588
    }
589
590
#if defined (DEBUG_LDAP)
591
  log_info ("Connecting to LDAP server %s:%d", ldap_server, ldap_port);
592
#endif
593
594
  if ((ld = ldap_init (ldap_server, ldap_port)) == NULL)
595
    {
596
      log_error ("Cannot init ldap session to %s", ldap_server);
597
      return;
598
    }
599
600
  version = LDAP_VERSION3;
601
  if ((ret = ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &version)) != LDAP_OPT_SUCCESS)
602
    {
603
      log_error ("Cannot set LDAP version to %d: %s", version,
604
                 ldap_err2string (ret));
605
    }
606
607
#if defined (USE_SSL)
608
  if ((ret = ldap_start_tls_s (ld, NULL, NULL)) != LDAP_SUCCESS)
609
    log_error ("Warning: Cannot start TLS session to %s: %s",
610
               ldap_server, ldap_err2string (ret));
611
  else
612
    log_info ("TLS session successfully started to %s", ldap_server);
613
#endif
614
615
  if (ldap_username != NULL && *ldap_username != '\0')
616
    {
617
      if ((ret = ldap_simple_bind_s (ld, ldap_username,
618
                                     ldap_password)) != LDAP_SUCCESS)
619
        {
620
          log_error ("Error: Cannot login into ldap server %s: %s", ldap_server,
621
                     ldap_err2string (ret));
622
          ldap_stop();
623
          return;
624
        }
625
    }
626
627
#if defined (DEBUG_LDAP)
628
  log_info ("Successfully logged into LDAP server %s", ldap_server);
629
#endif
630
}
631
632
633
static void
634
parse_external_dns (LDAPMessage * ent)
635
{
636
  char *search[] = {"dhcpOptionsDN", "dhcpSharedNetworkDN", "dhcpSubnetDN",
637
                    "dhcpGroupDN", "dhcpHostDN", "dhcpClassesDN",
638
                    "dhcpPoolDN", NULL};
639
  LDAPMessage * newres, * newent;
640
  struct ldap_config_stack *ns;
641
  char **tempstr;
642
  int i, j, ret;
643
#if defined (DEBUG_LDAP)
644
  char *dn;
645
646
  dn = ldap_get_dn (ld, ent);
647
  if (dn != NULL)
648
    {
649
      log_info ("Parsing external DNs for '%s'", dn);
650
      ldap_memfree (dn);
651
    }
652
#endif
653
654
  if (ld == NULL)
655
    ldap_start ();
656
  if (ld == NULL)
657
    return;
658
659
  for (i=0; search[i] != NULL; i++)
660
    {
661
      if ((tempstr = ldap_get_values (ld, ent, search[i])) == NULL)
662
        continue;
663
664
      for (j=0; tempstr[j] != NULL; j++)
665
        {
666
          if (*tempstr[j] == '\0')
667
            continue;
668
669
          if ((ret = ldap_search_s (ld, tempstr[j], LDAP_SCOPE_BASE, 
670
                                    "objectClass=*", NULL, 0, 
671
                                    &newres)) != LDAP_SUCCESS)
672
            {
673
              ldap_value_free (tempstr);
674
              ldap_stop();
675
              return;
676
            }
677
    
678
#if defined (DEBUG_LDAP)
679
          log_info ("Adding contents of subtree '%s' to config stack from '%s' reference", tempstr[j], search[i]);
680
#endif
681
          for (newent = ldap_first_entry (ld, newres);
682
               newent != NULL;
683
               newent = ldap_next_entry (ld, newent))
684
            {
685
#if defined (DEBUG_LDAP)
686
              dn = ldap_get_dn (ld, newent);
687
              if (dn != NULL)
688
                {
689
                  log_info ("Adding LDAP result set starting with '%s' to config stack", dn);
690
                  ldap_memfree (dn);
691
                }
692
#endif
693
694
              add_to_config_stack (newres, newent);
695
              /* don't free newres here */
696
            }
697
        }
698
699
      ldap_value_free (tempstr);
700
    }
701
}
702
703
704
static void
705
free_stack_entry (struct ldap_config_stack *item)
706
{
707
  struct ldap_config_stack *look_ahead_pointer = item;
708
  int may_free_msg = 1;
709
710
  while (look_ahead_pointer->next != NULL)
711
    {
712
      look_ahead_pointer = look_ahead_pointer->next;
713
      if (look_ahead_pointer->res == item->res)
714
        {
715
          may_free_msg = 0;
716
          break;
717
        }
718
    }
719
720
  if (may_free_msg) 
721
    ldap_msgfree (item->res);
722
723
  dfree (item, MDL);
724
}
725
726
727
static void
728
next_ldap_entry (struct parse *cfile)
729
{
730
  struct ldap_config_stack *temp_stack;
731
732
  if (ldap_stack != NULL && ldap_stack->close_brace)
733
    {
734
      strncat (cfile->inbuf, "}\n", LDAP_BUFFER_SIZE);
735
      ldap_stack->close_brace = 0;
736
    }
737
738
  while (ldap_stack != NULL && 
739
         (ldap_stack->ldent == NULL ||
740
          (ldap_stack->ldent = ldap_next_entry (ld, ldap_stack->ldent)) == NULL))
741
    {
742
      if (ldap_stack->close_brace)
743
        {
744
          strncat (cfile->inbuf, "}\n", LDAP_BUFFER_SIZE);
745
          ldap_stack->close_brace = 0;
746
        }
747
748
      temp_stack = ldap_stack;
749
      ldap_stack = ldap_stack->next;
750
      free_stack_entry (temp_stack);
751
    }
752
753
  if (ldap_stack != NULL && ldap_stack->close_brace)
754
    {
755
      strncat (cfile->inbuf, "}\n", LDAP_BUFFER_SIZE);
756
      ldap_stack->close_brace = 0;
757
    }
758
}
759
760
761
static char
762
check_statement_end (const char *statement)
763
{
764
  char *ptr;
765
766
  if (statement == NULL || *statement == '\0')
767
    return ('\0');
768
769
  /*
770
  ** check if it ends with "}", e.g.:
771
  **   "zone my.domain. { ... }"
772
  ** optionally followed by spaces
773
  */
774
  ptr = strrchr (statement, '}');
775
  if (ptr != NULL)
776
    {
777
      /* skip following white-spaces */
778
      for (++ptr; isspace ((int)*ptr); ptr++);
779
780
      /* check if we reached the end */
781
      if (*ptr == '\0')
782
        return ('}'); /* yes, block end */
783
      else
784
        return (*ptr);
785
    }
786
787
  /*
788
  ** this should not happen, but...
789
  ** check if it ends with ";", e.g.:
790
  **   "authoritative;"
791
  ** optionally followed by spaces
792
  */
793
  ptr = strrchr (statement, ';');
794
  if (ptr != NULL)
795
    {
796
      /* skip following white-spaces */
797
      for (++ptr; isspace ((int)*ptr); ptr++);
798
799
      /* check if we reached the end */
800
      if (*ptr == '\0')
801
        return (';'); /* ends with a ; */
802
      else
803
        return (*ptr);
804
    }
805
806
  return ('\0');
807
}
808
809
810
static isc_result_t
811
ldap_parse_entry_options (LDAPMessage *ent, char *buffer, size_t size,
812
                          int *lease_limit)
813
{
814
  char **tempstr;
815
  int i;
816
817
  if (ent == NULL || buffer == NULL || size == 0)
818
    return (ISC_R_FAILURE);
819
820
  if ((tempstr = ldap_get_values (ld, ent, "dhcpStatements")) != NULL)
821
    {
822
      for (i=0; tempstr[i] != NULL; i++)
823
        {
824
          if (lease_limit != NULL &&
825
              strncasecmp ("lease limit ", tempstr[i], 12) == 0)
826
            {
827
              *lease_limit = (int) strtol ((tempstr[i]) + 12, NULL, 10);
828
              continue;
829
            }
830
831
          strncat (buffer, tempstr[i], size);
832
833
          switch((int) check_statement_end (tempstr[i]))
834
            {
835
              case '}':
836
              case ';':
837
                strncat (buffer, "\n", size);
838
                break;
839
              default:
840
                strncat (buffer, ";\n", size);
841
                break;
842
            }
843
        }
844
      ldap_value_free (tempstr);
845
    }
846
847
  if ((tempstr = ldap_get_values (ld, ent, "dhcpOption")) != NULL)
848
    {
849
      for (i=0; tempstr[i] != NULL; i++)
850
        {
851
          strncat (buffer, "option ", size);
852
          strncat (buffer, tempstr[i], size);
853
          switch ((int) check_statement_end (tempstr[i]))
854
            {
855
              case ';':
856
                strncat (buffer, "\n", size);
857
                break;
858
              default:
859
                strncat (buffer, ";\n", size);
860
                break;
861
            }
862
        }
863
      ldap_value_free (tempstr);
864
    }
865
866
  return (ISC_R_SUCCESS);
867
}
868
869
870
static void
871
ldap_generate_config_string (struct parse *cfile)
872
{
873
  char **objectClass, *dn;
874
  struct ldap_config_stack *entry;
875
  LDAPMessage * ent, * res;
876
  int i, j, ignore, found;
877
  int ret;
878
879
  if (ld == NULL)
880
    ldap_start ();
881
  if (ld == NULL)
882
    return;
883
884
  entry = ldap_stack;
885
  if ((objectClass = ldap_get_values (ld, entry->ldent, 
886
                                      "objectClass")) == NULL)
887
    return;
888
    
889
  ignore = 0;
890
  found = 1;
891
  for (i=0; objectClass[i] != NULL; i++)
892
    {
893
      if (strcasecmp (objectClass[i], "dhcpSharedNetwork") == 0)
894
        ldap_parse_shared_network (entry, cfile);
895
      else if (strcasecmp (objectClass[i], "dhcpClass") == 0)
896
        ldap_parse_class (entry, cfile);
897
      else if (strcasecmp (objectClass[i], "dhcpSubnet") == 0)
898
        ldap_parse_subnet (entry, cfile);
899
      else if (strcasecmp (objectClass[i], "dhcpPool") == 0)
900
        ldap_parse_pool (entry, cfile);
901
      else if (strcasecmp (objectClass[i], "dhcpGroup") == 0)
902
        ldap_parse_group (entry, cfile);
903
      else if (strcasecmp (objectClass[i], "dhcpTSigKey") == 0)
904
        ldap_parse_key (entry, cfile);
905
      else if (strcasecmp (objectClass[i], "dhcpDnsZone") == 0)
906
        ldap_parse_zone (entry, cfile);
907
      else if (strcasecmp (objectClass[i], "dhcpHost") == 0)
908
        {
909
          if (ldap_method == LDAP_METHOD_STATIC)
910
            ldap_parse_host (entry, cfile);
911
          else
912
            {
913
              ignore = 1;
914
              break;
915
            }
916
        }
917
      else if (strcasecmp (objectClass[i], "dhcpSubClass") == 0)
918
        {
919
          if (ldap_method == LDAP_METHOD_STATIC)
920
            ldap_parse_subclass (entry, cfile);
921
          else
922
            {
923
              ignore = 1;
924
              break;
925
            }
926
        }
927
      else
928
        found = 0;
929
930
      if (found && cfile->inbuf[0] == '\0')
931
        {
932
          ignore = 1;
933
          break;
934
        }
935
    }
936
937
  ldap_value_free (objectClass);
938
939
  if (ignore)
940
    {
941
      next_ldap_entry (cfile);
942
      return;
943
    }
944
945
  ldap_parse_entry_options(entry->ldent, cfile->inbuf,
946
                           LDAP_BUFFER_SIZE-1, NULL);
947
948
  dn = ldap_get_dn (ld, entry->ldent);
949
950
#if defined(DEBUG_LDAP)
951
  if (dn != NULL)
952
    log_info ("Found LDAP entry '%s'", dn);
953
#endif
954
955
  if (dn == NULL ||
956
      (ret = ldap_search_s (ld, dn, LDAP_SCOPE_ONELEVEL, "objectClass=*", 
957
                            NULL, 0, &res)) != LDAP_SUCCESS)
958
    {
959
      if (dn)
960
        ldap_memfree (dn);
961
962
      ldap_stop();
963
      return;
964
    }
965
966
  ldap_memfree (dn);
967
968
  if ((ent = ldap_first_entry (ld, res)) != NULL)
969
    {
970
      add_to_config_stack (res, ent);
971
      parse_external_dns (entry->ldent);
972
    }
973
  else
974
    {
975
      ldap_msgfree (res);
976
      parse_external_dns (entry->ldent);
977
      next_ldap_entry (cfile);
978
    }
979
}
980
981
982
static void
983
ldap_close_debug_fd()
984
{
985
  if (ldap_debug_fd != -1)
986
    {
987
      close (ldap_debug_fd);
988
      ldap_debug_fd = -1;
989
    }
990
}
991
992
993
static void
994
ldap_write_debug (const void *buff, size_t size)
995
{
996
  if (ldap_debug_fd != -1)
997
    {
998
      if (write (ldap_debug_fd, buff, size) < 0)
999
        {
1000
          log_error ("Error writing to LDAP debug file %s: %s."
1001
                     " Disabling log file.", ldap_debug_file,
1002
                     strerror (errno));
1003
          ldap_close_debug_fd();
1004
        }
1005
    }
1006
}
1007
1008
static int
1009
ldap_read_function (struct parse *cfile)
1010
{
1011
  cfile->inbuf[0] = '\0';
1012
  cfile->buflen = 0;
1013
 
1014
  if (ldap_stack == NULL && *cfile->inbuf == '\0')
1015
    return (EOF);
1016
1017
  if (ldap_stack != NULL && *cfile->inbuf == '\0')
1018
    ldap_generate_config_string (cfile);
1019
1020
  cfile->buflen = strlen (cfile->inbuf);
1021
  if (cfile->buflen > 0)
1022
    ldap_write_debug (cfile->inbuf, cfile->buflen);
1023
1024
#if defined (DEBUG_LDAP)
1025
  log_info ("Sending config line '%s'", cfile->inbuf);
1026
#endif
1027
1028
  cfile->buflen = strlen (cfile->inbuf);
1029
  cfile->bufix = 1;
1030
1031
  return (cfile->inbuf[0]);
1032
}
1033
1034
1035
static char *
1036
ldap_get_host_name (LDAPMessage * ent)
1037
{
1038
  char **name, *ret;
1039
1040
  ret = NULL;
1041
  if ((name = ldap_get_values (ld, ent, "cn")) == NULL || name[0] == NULL)
1042
    {
1043
      if (name != NULL)
1044
        ldap_value_free (name);
1045
1046
#if defined (DEBUG_LDAP)
1047
      ret = ldap_get_dn (ld, ent);
1048
      if (ret != NULL)
1049
        {
1050
          log_info ("Cannot get cn attribute for LDAP entry %s", ret);
1051
          ldap_memfree(ret);
1052
        }
1053
#endif
1054
      return (NULL);
1055
    }
1056
1057
  ret = dmalloc (strlen (name[0]) + 1, MDL);
1058
  strcpy (ret, name[0]);
1059
  ldap_value_free (name);
1060
1061
  return (ret);
1062
}
1063
1064
1065
static int
1066
getfqhostname(char *fqhost, size_t size)
1067
{
1068
#if defined(MAXHOSTNAMELEN)
1069
  char   hname[MAXHOSTNAMELEN];
1070
#else
1071
  char   hname[65];
1072
#endif
1073
  struct hostent *hp;
1074
1075
  if(NULL == fqhost || 1 >= size)
1076
    return -1;
1077
1078
  memset(hname, 0, sizeof(hname));
1079
  if( gethostname(hname, sizeof(hname)-1))
1080
    return -1;
1081
1082
  if(NULL == (hp = gethostbyname(hname)))
1083
    return -1;
1084
1085
  strncpy(fqhost, hp->h_name, size-1);
1086
  fqhost[size-1] = '\0';
1087
  return 0;
1088
}
1089
1090
1091
isc_result_t
1092
ldap_read_config (void)
1093
{
1094
  LDAPMessage * ldres, * hostres, * ent, * hostent;
1095
  char hfilter[1024], sfilter[1024], fqdn[257];
1096
  char *buffer, **tempstr = NULL, *hostdn;
1097
  ldap_dn_node *curr = NULL;
1098
  struct parse *cfile;
1099
  struct utsname unme;
1100
  isc_result_t res;
1101
  size_t length;
1102
  int ret, cnt;
1103
1104
  if (ld == NULL)
1105
    ldap_start ();
1106
  if (ld == NULL)
1107
    return (ldap_server == NULL ? ISC_R_SUCCESS : ISC_R_FAILURE);
1108
 
1109
  buffer = dmalloc (LDAP_BUFFER_SIZE+1, MDL);
1110
  if (buffer == NULL)
1111
    return (ISC_R_FAILURE);
1112
1113
  cfile = (struct parse *) NULL;
1114
  res = new_parse (&cfile, -1, buffer, LDAP_BUFFER_SIZE, "LDAP", 0);
1115
  if (res != ISC_R_SUCCESS)
1116
    return (res);
1117
 
1118
  uname (&unme);
1119
  if (ldap_server_cn != NULL)
1120
    {
1121
     snprintf (hfilter, sizeof (hfilter),
1122
                "(&(objectClass=dhcpServer)(cn=%s))", ldap_server_cn);
1123
    }
1124
  else
1125
  {
1126
  if(0 == getfqhostname(fqdn, sizeof(fqdn)))
1127
    {
1128
      snprintf (hfilter, sizeof (hfilter),
1129
                "(&(objectClass=dhcpServer)(|(cn=%s)(cn=%s)))", 
1130
                unme.nodename, fqdn);
1131
    }
1132
  else
1133
    {
1134
      snprintf (hfilter, sizeof (hfilter),
1135
                "(&(objectClass=dhcpServer)(cn=%s))", unme.nodename);
1136
    }
1137
1138
  }
1139
  hostres = NULL;
1140
  if ((ret = ldap_search_s (ld, ldap_base_dn, LDAP_SCOPE_SUBTREE,
1141
                            hfilter, NULL, 0, &hostres)) != LDAP_SUCCESS)
1142
    {
1143
      log_error ("Cannot find host LDAP entry %s %s",
1144
		 ((ldap_server_cn == NULL)?(unme.nodename):(ldap_server_cn)), hfilter);
1145
      if(NULL != hostres)
1146
        ldap_msgfree (hostres);
1147
      ldap_stop();
1148
      return (ISC_R_FAILURE);
1149
    }
1150
1151
  if ((hostent = ldap_first_entry (ld, hostres)) == NULL)
1152
    {
1153
      log_error ("Error: Cannot find LDAP entry matching %s", hfilter);
1154
      ldap_msgfree (hostres);
1155
      ldap_stop();
1156
      return (ISC_R_FAILURE);
1157
    }
1158
1159
  hostdn = ldap_get_dn (ld, hostent);
1160
#if defined(DEBUG_LDAP)
1161
  if (hostdn != NULL)
1162
    log_info ("Found dhcpServer LDAP entry '%s'", hostdn);
1163
#endif
1164
1165
  if (hostdn == NULL ||
1166
      (tempstr = ldap_get_values (ld, hostent, "dhcpServiceDN")) == NULL ||
1167
      tempstr[0] == NULL)
1168
    {
1169
      log_error ("Error: Cannot find LDAP entry matching %s", hfilter);
1170
1171
      if (tempstr != NULL)
1172
        ldap_value_free (tempstr);
1173
1174
      if (hostdn)
1175
        ldap_memfree (hostdn);
1176
      ldap_msgfree (hostres);
1177
      ldap_stop();
1178
      return (ISC_R_FAILURE);
1179
    }
1180
1181
#if defined(DEBUG_LDAP)
1182
  log_info ("LDAP: Parsing dhcpServer options '%s' ...", hostdn);
1183
#endif
1184
1185
  cfile->inbuf[0] = '\0';
1186
  ldap_parse_entry_options(hostent, cfile->inbuf, LDAP_BUFFER_SIZE, NULL);
1187
  cfile->buflen = strlen (cfile->inbuf);
1188
  if(cfile->buflen > 0)
1189
    {
1190
      ldap_write_debug (cfile->inbuf, cfile->buflen);
1191
1192
      res = conf_file_subparse (cfile, root_group, ROOT_GROUP);
1193
      if (res != ISC_R_SUCCESS)
1194
        {
1195
          log_error ("LDAP: cannot parse dhcpServer entry '%s'", hostdn);
1196
          ldap_memfree (hostdn);
1197
          ldap_stop();
1198
          return res;
1199
        }
1200
      cfile->inbuf[0] = '\0';
1201
    }
1202
  ldap_msgfree (hostres);
1203
1204
  /*
1205
  ** attach ldap (tree) read function now
1206
  */
1207
  cfile->bufix = cfile->buflen = 0;
1208
  cfile->read_function = ldap_read_function;
1209
1210
  res = ISC_R_SUCCESS;
1211
  for (cnt=0; tempstr[cnt] != NULL; cnt++)
1212
    {
1213
      snprintf(sfilter, sizeof(sfilter), "(&(objectClass=dhcpService)"
1214
                        "(|(dhcpPrimaryDN=%s)(dhcpSecondaryDN=%s)))",
1215
                        hostdn, hostdn);
1216
      ldres = NULL;
1217
      if ((ret = ldap_search_s (ld, tempstr[cnt], LDAP_SCOPE_BASE,
1218
                                sfilter, NULL, 0, &ldres)) != LDAP_SUCCESS)
1219
        {
1220
          log_error ("Error searching for dhcpServiceDN '%s': %s. Please update the LDAP entry '%s'",
1221
                     tempstr[cnt], ldap_err2string (ret), hostdn);
1222
          if(NULL != ldres)
1223
            ldap_msgfree(ldres);
1224
          res = ISC_R_FAILURE;
1225
          break;
1226
        }
1227
1228
      if ((ent = ldap_first_entry (ld, ldres)) == NULL)
1229
        {
1230
          log_error ("Error: Cannot find dhcpService DN '%s' with primary or secondary server reference. Please update the LDAP server entry '%s'",
1231
                     tempstr[cnt], hostdn);
1232
1233
          ldap_msgfree(ldres);
1234
          res = ISC_R_FAILURE;
1235
          break;
1236
        }
1237
1238
      /*
1239
      ** FIXME: how to free the remembered dn's on exit?
1240
      **        This should be OK if dmalloc registers the
1241
      **        memory it allocated and frees it on exit..
1242
      */
1243
1244
      curr = dmalloc (sizeof (*curr), MDL);
1245
      if (curr != NULL)
1246
        {
1247
          length = strlen (tempstr[cnt]);
1248
          curr->dn = dmalloc (length + 1, MDL);
1249
          if (curr->dn == NULL)
1250
            {
1251
              dfree (curr, MDL);
1252
              curr = NULL;
1253
            }
1254
          else
1255
            strcpy (curr->dn, tempstr[cnt]);
1256
        }
1257
1258
      if (curr != NULL)
1259
        {
1260
          curr->refs++;
1261
1262
          /* append to service-dn list */
1263
          if (ldap_service_dn_tail != NULL)
1264
            ldap_service_dn_tail->next = curr;
1265
          else
1266
            ldap_service_dn_head = curr;
1267
1268
          ldap_service_dn_tail = curr;
1269
        }
1270
      else
1271
        log_fatal ("no memory to remember ldap service dn");
1272
1273
#if defined (DEBUG_LDAP)
1274
      log_info ("LDAP: Parsing dhcpService DN '%s' ...", tempstr[cnt]);
1275
#endif
1276
      add_to_config_stack (ldres, ent);
1277
      res = conf_file_subparse (cfile, root_group, ROOT_GROUP);
1278
      if (res != ISC_R_SUCCESS)
1279
        {
1280
          log_error ("LDAP: cannot parse dhcpService entry '%s'", tempstr[cnt]);
1281
          break;
1282
        }
1283
    }
1284
1285
  end_parse (&cfile);
1286
  ldap_close_debug_fd();
1287
1288
  ldap_memfree (hostdn);
1289
  ldap_value_free (tempstr);
1290
1291
  if (res != ISC_R_SUCCESS)
1292
    {
1293
      struct ldap_config_stack *temp_stack;
1294
1295
      while ((curr = ldap_service_dn_head) != NULL)
1296
        {
1297
          ldap_service_dn_head = curr->next;
1298
          dfree (curr->dn, MDL);
1299
          dfree (curr, MDL);
1300
        }
1301
1302
      ldap_service_dn_tail = NULL;
1303
1304
      while ((temp_stack = ldap_stack) != NULL)
1305
        {
1306
          ldap_stack = temp_stack->next;
1307
          free_stack_entry (temp_stack);
1308
        }
1309
1310
      ldap_stop();
1311
    }
1312
1313
  /* Unbind from ldap immediately after reading config in static mode. */
1314
  if (ldap_method == LDAP_METHOD_STATIC)
1315
    ldap_stop();
1316
1317
  return (res);
1318
}
1319
1320
1321
/* This function will parse the dhcpOption and dhcpStatements field in the LDAP
1322
   entry if it exists. Right now, type will be either HOST_DECL or CLASS_DECL.
1323
   If we are parsing a HOST_DECL, this always returns 0. If we are parsing a 
1324
   CLASS_DECL, this will return what the current lease limit is in LDAP. If
1325
   there is no lease limit specified, we return 0 */
1326
1327
static int
1328
ldap_parse_options (LDAPMessage * ent, struct group *group,
1329
                         int type, struct host_decl *host,
1330
                         struct class **class)
1331
{
1332
  int i, declaration, lease_limit;
1333
  char option_buffer[8192];
1334
  enum dhcp_token token;
1335
  struct parse *cfile;
1336
  isc_result_t res;
1337
  const char *val;
1338
1339
  lease_limit = 0;
1340
  *option_buffer = '\0';
1341
 
1342
 /* This block of code will try to find the parent of the host, and
1343
    if it is a group object, fetch the options and apply to the host. */
1344
  if (type == HOST_DECL) 
1345
    {
1346
      char *hostdn, *basedn, *temp1, *temp2, filter[1024];
1347
      LDAPMessage *groupdn, *entry;
1348
      int ret;
1349
1350
      hostdn = ldap_get_dn (ld, ent);
1351
      if( hostdn != NULL)
1352
        {
1353
          basedn = NULL;
1354
1355
          temp1 = strchr (hostdn, '=');
1356
          if (temp1 != NULL)
1357
            temp1 = strchr (++temp1, '=');
1358
          if (temp1 != NULL)
1359
            temp2 = strchr (++temp1, ',');
1360
          else
1361
            temp2 = NULL;
1362
1363
          if (temp2 != NULL)
1364
            {
1365
              snprintf (filter, sizeof(filter),
1366
                        "(&(cn=%.*s)(objectClass=dhcpGroup))",
1367
                        (int)(temp2 - temp1), temp1);
1368
1369
              basedn = strchr (temp1, ',');
1370
              if (basedn != NULL)
1371
                ++basedn;
1372
            }
1373
1374
          if (basedn != NULL && *basedn != '\0')
1375
            {
1376
              ret = ldap_search_s (ld, basedn, LDAP_SCOPE_SUBTREE,
1377
                                   filter, NULL, 0, &groupdn);
1378
              if (ret == LDAP_SUCCESS)
1379
                {
1380
                  if ((entry = ldap_first_entry (ld, groupdn)) != NULL)
1381
                    {
1382
                      res = ldap_parse_entry_options (entry, option_buffer,
1383
                                                      sizeof(option_buffer) - 1,
1384
                                                      &lease_limit);
1385
                      if (res != ISC_R_SUCCESS)
1386
                        {
1387
                          /* reset option buffer discarding any results */
1388
                          *option_buffer = '\0';
1389
                          lease_limit = 0;
1390
                        }
1391
                    }
1392
                  ldap_msgfree( groupdn);
1393
                }
1394
            }
1395
          ldap_memfree( hostdn);
1396
        }
1397
    }
1398
1399
  res = ldap_parse_entry_options (ent, option_buffer, sizeof(option_buffer) - 1,
1400
                                  &lease_limit);
1401
  if (res != ISC_R_SUCCESS)
1402
    return (lease_limit);
1403
1404
  option_buffer[sizeof(option_buffer) - 1] = '\0';
1405
  if (*option_buffer == '\0')
1406
    return (lease_limit);
1407
1408
  cfile = (struct parse *) NULL;
1409
  res = new_parse (&cfile, -1, option_buffer, strlen (option_buffer), 
1410
                   type == HOST_DECL ? "LDAP-HOST" : "LDAP-SUBCLASS", 0);
1411
  if (res != ISC_R_SUCCESS)
1412
    return (lease_limit);
1413
1414
#if defined (DEBUG_LDAP)
1415
  log_info ("Sending the following options: '%s'", option_buffer);
1416
#endif
1417
1418
  declaration = 0;
1419
  do
1420
    {
1421
      token = peek_token (&val, NULL, cfile);
1422
      if (token == END_OF_FILE)
1423
        break;
1424
       declaration = parse_statement (cfile, group, type, host, declaration);
1425
    } while (1);
1426
1427
  end_parse (&cfile);
1428
1429
  return (lease_limit);
1430
}
1431
1432
1433
1434
int
1435
find_haddr_in_ldap (struct host_decl **hp, int htype, unsigned hlen,
1436
                    const unsigned char *haddr, const char *file, int line)
1437
{
1438
  char buf[128], *type_str, **tempstr, *addr_str;
1439
  LDAPMessage * res, *ent;
1440
  struct host_decl * host;
1441
  isc_result_t status;
1442
  ldap_dn_node *curr;
1443
  int ret;
1444
1445
  if (ldap_method == LDAP_METHOD_STATIC)
1446
    return (0);
1447
1448
  if (ld == NULL)
1449
    ldap_start ();
1450
  if (ld == NULL)
1451
    return (0);
1452
1453
  switch (htype)
1454
    {
1455
      case HTYPE_ETHER:
1456
        type_str = "ethernet";
1457
        break;
1458
      case HTYPE_IEEE802:
1459
        type_str = "token-ring";
1460
        break;
1461
      case HTYPE_FDDI:
1462
        type_str = "fddi";
1463
        break;
1464
      default:
1465
        log_info ("Ignoring unknown type %d", htype);
1466
        return (0);
1467
    }
1468
1469
  /*
1470
  ** FIXME: It is not guaranteed, that the dhcpHWAddress attribute
1471
  **        contains _exactly_ "type addr" with one space between!
1472
  */
1473
  snprintf (buf, sizeof (buf),
1474
            "(&(objectClass=dhcpHost)(dhcpHWAddress=%s %s))",
1475
           type_str, print_hw_addr (htype, hlen, haddr));
1476
1477
  res = ent = NULL;
1478
  for (curr = ldap_service_dn_head;
1479
       curr != NULL && *curr->dn != '\0';
1480
       curr = curr->next)
1481
    {
1482
#if defined (DEBUG_LDAP)
1483
      log_info ("Searching for %s in LDAP tree %s", buf, curr->dn);
1484
#endif
1485
      ret = ldap_search_s (ld, curr->dn, LDAP_SCOPE_SUBTREE,
1486
                           buf, NULL, 0, &res);
1487
1488
      if(ret == LDAP_SERVER_DOWN)
1489
        {
1490
          log_info ("LDAP server was down, trying to reconnect...");
1491
1492
          ldap_stop();
1493
          ldap_start();
1494
          if(ld == NULL)
1495
            {
1496
              log_info ("LDAP reconnect failed - try again later...");
1497
              return (0);
1498
            }
1499
1500
          ret = ldap_search_s (ld, curr->dn, LDAP_SCOPE_SUBTREE,
1501
                               buf, NULL, 0, &res);
1502
        }
1503
1504
      if (ret == LDAP_SUCCESS)
1505
        {
1506
          if( (ent = ldap_first_entry (ld, res)) != NULL)
1507
            break; /* search OK and have entry */
1508
1509
#if defined (DEBUG_LDAP)
1510
          log_info ("No host entry for %s in LDAP tree %s",
1511
                    buf, curr->dn);
1512
#endif
1513
          if(res)
1514
            {
1515
              ldap_msgfree (res);
1516
              res = NULL;
1517
            }
1518
        }
1519
      else
1520
        {
1521
          if(res)
1522
            {
1523
              ldap_msgfree (res);
1524
              res = NULL;
1525
            }
1526
1527
          if (ret != LDAP_NO_SUCH_OBJECT && ret != LDAP_SUCCESS)
1528
            {
1529
              log_error ("Cannot search for %s in LDAP tree %s: %s", buf, 
1530
                         curr->dn, ldap_err2string (ret));
1531
              ldap_stop();
1532
              return (0);
1533
            }
1534
#if defined (DEBUG_LDAP)
1535
          else
1536
            {
1537
              log_info ("ldap_search_s returned %s when searching for %s in %s",
1538
                        ldap_err2string (ret), buf, curr->dn);
1539
            }
1540
#endif
1541
        }
1542
    }
1543
1544
  if (res && ent)
1545
    {
1546
#if defined (DEBUG_LDAP)
1547
      char *dn = ldap_get_dn (ld, ent);
1548
      if (dn != NULL)
1549
        {
1550
          log_info ("Found dhcpHWAddress LDAP entry %s", dn);
1551
          ldap_memfree(dn);
1552
        }
1553
#endif
1554
1555
      host = (struct host_decl *)0;
1556
      status = host_allocate (&host, MDL);
1557
      if (status != ISC_R_SUCCESS)
1558
        {
1559
          log_fatal ("can't allocate host decl struct: %s", 
1560
                     isc_result_totext (status)); 
1561
          ldap_msgfree (res);
1562
          return (0);
1563
        }
1564
1565
      host->name = ldap_get_host_name (ent);
1566
      if (host->name == NULL)
1567
        {
1568
          host_dereference (&host, MDL);
1569
          ldap_msgfree (res);
1570
          return (0);
1571
        }
1572
1573
      if (!clone_group (&host->group, root_group, MDL))
1574
        {
1575
          log_fatal ("can't clone group for host %s", host->name);
1576
          host_dereference (&host, MDL);
1577
          ldap_msgfree (res);
1578
          return (0);
1579
        }
1580
1581
      ldap_parse_options (ent, host->group, HOST_DECL, host, NULL);
1582
1583
      *hp = host;
1584
      ldap_msgfree (res);
1585
      return (1);
1586
    }
1587
1588
1589
  if(res) ldap_msgfree (res);
1590
  return (0);
1591
}
1592
1593
1594
int
1595
find_subclass_in_ldap (struct class *class, struct class **newclass, 
1596
                       struct data_string *data)
1597
{
1598
  LDAPMessage * res, * ent;
1599
  int i, ret, lease_limit;
1600
  isc_result_t status;
1601
  ldap_dn_node *curr;
1602
  char buf[1024];
1603
1604
  if (ldap_method == LDAP_METHOD_STATIC)
1605
    return (0);
1606
1607
  if (ld == NULL)
1608
    ldap_start ();
1609
  if (ld == NULL)
1610
    return (0);
1611
1612
  snprintf (buf, sizeof (buf),
1613
            "(&(objectClass=dhcpSubClass)(cn=%s)(dhcpClassData=%s))",
1614
            print_hex_1 (data->len, data->data, 60),
1615
            print_hex_2 (strlen (class->name), class->name, 60));
1616
#if defined (DEBUG_LDAP)
1617
  log_info ("Searching LDAP for %s", buf);
1618
#endif
1619
1620
  res = ent = NULL;
1621
  for (curr = ldap_service_dn_head;
1622
       curr != NULL && *curr->dn != '\0';
1623
       curr = curr->next)
1624
    {
1625
#if defined (DEBUG_LDAP)
1626
      log_info ("Searching for %s in LDAP tree %s", buf, curr->dn);
1627
#endif
1628
      ret = ldap_search_s (ld, curr->dn, LDAP_SCOPE_SUBTREE,
1629
                           buf, NULL, 0, &res);
1630
1631
      if(ret == LDAP_SERVER_DOWN)
1632
        {
1633
          log_info ("LDAP server was down, trying to reconnect...");
1634
1635
          ldap_stop();
1636
          ldap_start();
1637
1638
          if(ld == NULL)
1639
            {
1640
              log_info ("LDAP reconnect failed - try again later...");
1641
              return (0);
1642
            }
1643
1644
          ret = ldap_search_s (ld, curr->dn, LDAP_SCOPE_SUBTREE,
1645
                               buf, NULL, 0, &res);
1646
        }
1647
1648
      if (ret == LDAP_SUCCESS)
1649
        {
1650
          if( (ent = ldap_first_entry (ld, res)) != NULL)
1651
            break; /* search OK and have entry */
1652
1653
#if defined (DEBUG_LDAP)
1654
          log_info ("No subclass entry for %s in LDAP tree %s",
1655
                    buf, curr->dn);
1656
#endif
1657
          if(res)
1658
            {
1659
              ldap_msgfree (res);
1660
              res = NULL;
1661
            }
1662
        }
1663
      else
1664
        {
1665
          if(res)
1666
            {
1667
              ldap_msgfree (res);
1668
              res = NULL;
1669
            }
1670
1671
          if (ret != LDAP_NO_SUCH_OBJECT && ret != LDAP_SUCCESS)
1672
            {
1673
              log_error ("Cannot search for %s in LDAP tree %s: %s", buf, 
1674
                         curr->dn, ldap_err2string (ret));
1675
              ldap_stop();
1676
              return (0);
1677
            }
1678
#if defined (DEBUG_LDAP)
1679
          else
1680
            {
1681
              log_info ("ldap_search_s returned %s when searching for %s in %s",
1682
                        ldap_err2string (ret), buf, curr->dn);
1683
            }
1684
#endif
1685
        }
1686
    }
1687
1688
  if (res && ent)
1689
    {
1690
#if defined (DEBUG_LDAP)
1691
      char *dn = ldap_get_dn (ld, ent);
1692
      if (dn != NULL)
1693
        {
1694
          log_info ("Found subclass LDAP entry %s", dn);
1695
          ldap_memfree(dn);
1696
        }
1697
#endif
1698
1699
      status = class_allocate (newclass, MDL);
1700
      if (status != ISC_R_SUCCESS)
1701
        {
1702
          log_error ("Cannot allocate memory for a new class");
1703
          ldap_msgfree (res);
1704
          return (0);
1705
        }
1706
1707
      group_reference (&(*newclass)->group, class->group, MDL);
1708
      class_reference (&(*newclass)->superclass, class, MDL);
1709
      lease_limit = ldap_parse_options (ent, (*newclass)->group, 
1710
                                        CLASS_DECL, NULL, newclass);
1711
      if (lease_limit == 0)
1712
        (*newclass)->lease_limit = class->lease_limit; 
1713
      else
1714
        class->lease_limit = lease_limit;
1715
1716
      if ((*newclass)->lease_limit) 
1717
        {
1718
          (*newclass)->billed_leases = 
1719
              dmalloc ((*newclass)->lease_limit * sizeof (struct lease *), MDL);
1720
          if (!(*newclass)->billed_leases) 
1721
            {
1722
              log_error ("no memory for billing");
1723
              class_dereference (newclass, MDL);
1724
              ldap_msgfree (res);
1725
              return (0);
1726
            }
1727
          memset ((*newclass)->billed_leases, 0, 
1728
                ((*newclass)->lease_limit * sizeof (*newclass)->billed_leases));
1729
        }
1730
1731
      data_string_copy (&(*newclass)->hash_string, data, MDL);
1732
1733
      ldap_msgfree (res);
1734
      return (1);
1735
    }
1736
1737
  if(res) ldap_msgfree (res);
1738
  return (0);
1739
}
1740
1741
#endif
(-)dhcp-3.0.5/server/ldap_casa.c (+138 lines)
Line 0 Link Here
1
/* ldap_casa.c
2
   
3
   CASA routines for DHCPD... */
4
5
/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
6
 * Copyright (c) 1995-2003 Internet Software Consortium.
7
 * Copyright (c) 2006 Novell, Inc.
8
9
 * All rights reserved.
10
 * Redistribution and use in source and binary forms, with or without 
11
 * modification, are permitted provided that the following conditions are met: 
12
 * 1.Redistributions of source code must retain the above copyright notice, 
13
 *   this list of conditions and the following disclaimer. 
14
 * 2.Redistributions in binary form must reproduce the above copyright notice, 
15
 *   this list of conditions and the following disclaimer in the documentation 
16
 *   and/or other materials provided with the distribution. 
17
 * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors 
18
 *   may be used to endorse or promote products derived from this software 
19
 *   without specific prior written permission. 
20
21
 * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS 
22
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
24
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE 
25
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
26
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
27
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
28
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
29
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
30
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
31
 * POSSIBILITY OF SUCH DAMAGE.
32
33
 * This file was written by S Kalyanasundaram <skalyanasundaram@novell.com>
34
 */
35
36
#if defined(LDAP_CASA_AUTH)
37
#include "ldap_casa.h"
38
#include "dhcpd.h"
39
40
int
41
load_casa (void)
42
{
43
       if( !(casaIDK = dlopen(MICASA_LIB,RTLD_LAZY)))
44
       	  return 0;
45
       p_miCASAGetCredential = (CASA_GetCredential_T) dlsym(casaIDK, "miCASAGetCredential");
46
       p_miCASASetCredential = (CASA_SetCredential_T) dlsym(casaIDK, "miCASASetCredential");
47
       p_miCASARemoveCredential = (CASA_RemoveCredential_T) dlsym(casaIDK, "miCASARemoveCredential");
48
49
       if((p_miCASAGetCredential == NULL) ||
50
         (p_miCASASetCredential == NULL) ||
51
         (p_miCASARemoveCredential == NULL))
52
       {
53
          if(casaIDK)
54
            dlclose(casaIDK);
55
          casaIDK = NULL;
56
          p_miCASAGetCredential = NULL;
57
          p_miCASASetCredential = NULL;
58
          p_miCASARemoveCredential = NULL;
59
          return 0;
60
       }
61
       else
62
          return 1;
63
}
64
65
static void
66
release_casa(void)
67
{
68
   if(casaIDK)
69
   {
70
      dlclose(casaIDK);
71
      casaIDK = NULL;
72
   }
73
74
   p_miCASAGetCredential = NULL;
75
   p_miCASASetCredential = NULL;
76
   p_miCASARemoveCredential = NULL;
77
78
}
79
80
int
81
load_uname_pwd_from_miCASA (char **ldap_username, char **ldap_password)
82
 {
83
   int                     result = 0;
84
   int32_t                 credentialtype = SSCS_CRED_TYPE_SERVER_F;
85
   SSCS_BASIC_CREDENTIAL   credential = {0};
86
   SSCS_SECRET_ID_T        applicationSecretId = {0};
87
   char                    *tempVar = NULL;
88
89
   const char applicationName[10] = "dhcp-ldap";
90
91
   if ( load_casa() )
92
   {
93
      memset(&credential, 0, sizeof(SSCS_BASIC_CREDENTIAL));
94
      memset(&applicationSecretId, 0, sizeof(SSCS_SECRET_ID_T));
95
96
      applicationSecretId.len = strlen(applicationName) + 1;
97
      memcpy (applicationSecretId.id, applicationName, applicationSecretId.len);
98
99
      credential.unFlags = USERNAME_TYPE_CN_F;
100
101
      result = p_miCASAGetCredential (0,
102
                 &applicationSecretId,NULL,&credentialtype,
103
                 &credential,NULL);
104
105
      if(credential.unLen)
106
      {
107
         tempVar = dmalloc (credential.unLen + 1, MDL);
108
         memcpy(tempVar , credential.username, credential.unLen);
109
         if (!tempVar)
110
             log_fatal ("no memory for ldap_username");
111
         *ldap_username = tempVar;
112
113
         tempVar = dmalloc (credential.pwordLen + 1, MDL);
114
         memcpy(tempVar, credential.password, credential.pwordLen);
115
         if (!tempVar)
116
             log_fatal ("no memory for ldap_password");
117
         *ldap_password = tempVar;
118
119
#if defined (DEBUG_LDAP)
120
         log_info ("Authentication credential taken from CASA");
121
#endif
122
123
         release_casa();
124
         return 1;
125
126
        }
127
        else
128
        {
129
            release_casa();
130
            return 0;
131
        }
132
      }
133
      else
134
          return 0; //casa libraries not loaded
135
 }
136
137
#endif /* LDAP_CASA_AUTH */
138
(-)dhcp-3.0.5/server/mdb.c (+6 lines)
Lines 375-380 Link Here
375
{
375
{
376
	struct host_decl *foo;
376
	struct host_decl *foo;
377
	struct hardware h;
377
	struct hardware h;
378
	int ret;
379
380
#if defined(LDAP_CONFIGURATION)
381
	if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line)))
382
		return ret;
383
#endif
378
384
379
	h.hlen = hlen + 1;
385
	h.hlen = hlen + 1;
380
	h.hbuf [0] = htype;
386
	h.hbuf [0] = htype;
(-)dhcp-3.0.5/server/stables.c (+25 lines)
Lines 483-488 Link Here
483
	{ "log-facility", "Nsyslog-facilities.",	&server_universe, 44 },
483
	{ "log-facility", "Nsyslog-facilities.",	&server_universe, 44 },
484
	{ "do-forward-updates", "f",			&server_universe, 45 },
484
	{ "do-forward-updates", "f",			&server_universe, 45 },
485
	{ "ping-timeout", "T",				&server_universe, 46 },
485
	{ "ping-timeout", "T",				&server_universe, 46 },
486
#if defined(LDAP_CONFIGURATION)
487
	{ "ldap-server", "t",				&server_universe, 47 },
488
	{ "ldap-port", "d",				&server_universe, 48 },
489
	{ "ldap-username", "t",				&server_universe, 49 },
490
	{ "ldap-password", "t",				&server_universe, 50 },
491
	{ "ldap-base-dn", "t",				&server_universe, 51 },
492
	{ "ldap-method", "Nldap-methods.",		&server_universe, 52 },
493
	{ "ldap-debug-file", "t",			&server_universe, 53 },
494
	{ "ldap-server-cn", "t",     			&server_universe, 54 },
495
#else
486
	{ "unknown-47", "X",				&server_universe, 47 },
496
	{ "unknown-47", "X",				&server_universe, 47 },
487
	{ "unknown-48", "X",				&server_universe, 48 },
497
	{ "unknown-48", "X",				&server_universe, 48 },
488
	{ "unknown-49", "X",				&server_universe, 49 },
498
	{ "unknown-49", "X",				&server_universe, 49 },
Lines 491-496 Link Here
491
	{ "unknown-52", "X",				&server_universe, 52 },
501
	{ "unknown-52", "X",				&server_universe, 52 },
492
	{ "unknown-53", "X",				&server_universe, 53 },
502
	{ "unknown-53", "X",				&server_universe, 53 },
493
	{ "unknown-54", "X",				&server_universe, 54 },
503
	{ "unknown-54", "X",				&server_universe, 54 },
504
#endif
494
	{ "unknown-55", "X",				&server_universe, 55 },
505
	{ "unknown-55", "X",				&server_universe, 55 },
495
	{ "unknown-56", "X",				&server_universe, 56 },
506
	{ "unknown-56", "X",				&server_universe, 56 },
496
	{ "unknown-57", "X",				&server_universe, 57 },
507
	{ "unknown-57", "X",				&server_universe, 57 },
Lines 694-699 Link Here
694
	{ "option-end", "e",				&server_universe, 255 },
705
	{ "option-end", "e",				&server_universe, 255 },
695
};
706
};
696
707
708
#if defined(LDAP_CONFIGURATION)
709
struct enumeration_value ldap_values [] = {
710
	{ "static", LDAP_METHOD_STATIC },
711
	{ "dynamic", LDAP_METHOD_DYNAMIC },
712
	{ (char *) 0, 0 }
713
};
714
715
struct enumeration ldap_methods = {
716
	(struct enumeration *)0,
717
	"ldap-methods",
718
	ldap_values
719
};
720
#endif
721
697
struct enumeration_value ddns_styles_values [] = {
722
struct enumeration_value ddns_styles_values [] = {
698
	{ "none", 0 },
723
	{ "none", 0 },
699
	{ "ad-hoc", 1 },
724
	{ "ad-hoc", 1 },
(-)dhcp-3.0.5/site.conf (+2 lines)
Lines 1-2 Link Here
1
# Put local site configuration stuff here to override the default
1
# Put local site configuration stuff here to override the default
2
# settings in Makefile.conf
2
# settings in Makefile.conf
3
#COPTS = -DDEBUG_LDAP -DLDAP_CASA_AUTH -DDEBUG_CLASS_MATCHING -Wall -O -Wno-unused
4
LIBS=-lssl -lcrypto -lldap -llber

Return to bug 160979