View | Details | Raw Unified | Return to bug 223403
Collapse All | Expand All

(-)/usr/local/etc/rc.d/named (+49 lines)
Lines 168-179 Link Here
168
	done
168
	done
169
}
169
}
170
170
171
get_sessionkeyfile_from_conf()
172
{
173
        if [ -z "$1" -o -z "$2" ]; then
174
                err 3 "USAGE: get_sessionkeyfile_from_conf string file ($name)"
175
        fi
176
177
        local string file line
178
179
        string="$1" ; file="$2"
180
181
        if [ ! -s "$file" ]; then
182
                err 3 "get_sessionkeyfile_from_conf: $file does not exist ($name)"
183
        fi
184
185
        while read line; do
186
                case "$line" in
187
                *[#\;]*${string}*)      continue ;;
188
                *${string}*)            break ;;
189
                esac
190
        done < $file
191
192
        if [ -n "$line" ]; then
193
                line=${line#*/}
194
                _sessionkeyfile_from_conf="/${line%%[\"\;]*}"
195
        else
196
                return 1
197
        fi
198
}
199
171
# Make symlinks to the correct pid file
200
# Make symlinks to the correct pid file
172
#
201
#
173
make_symlinks()
202
make_symlinks()
174
{
203
{
175
	checkyesno named_symlink_enable &&
204
	checkyesno named_symlink_enable &&
176
	    ln -fs "${named_chrootdir}${pidfile}" ${pidfile}
205
	    ln -fs "${named_chrootdir}${pidfile}" ${pidfile}
206
	    ln -fs "${named_chrootdir}${sessionkeyfile}" ${sessionkeyfile}
177
}
207
}
178
208
179
named_poststart()
209
named_poststart()
Lines 204-209 Link Here
204
	fi
234
	fi
205
}
235
}
206
236
237
find_sessionkeyfile()
238
{
239
	if get_sessionkeyfile_from_conf session-keyfile ${named_conf}; then
240
		sessionkeyfile="${_sessionkeyfile_from_conf}"
241
	else
242
		sessionkeyfile="/var/run/named/session.key"
243
	fi
244
}
245
207
named_stop()
246
named_stop()
208
{
247
{
209
	find_pidfile
248
	find_pidfile
Lines 271-285 Link Here
271
named_prestart()
310
named_prestart()
272
{
311
{
273
	find_pidfile
312
	find_pidfile
313
	find_sessionkeyfile
274
314
275
	if [ -n "${named_pidfile}" ]; then
315
	if [ -n "${named_pidfile}" ]; then
276
		warn 'named_pidfile: now determined from the conf file'
316
		warn 'named_pidfile: now determined from the conf file'
277
	fi
317
	fi
278
318
319
	if [ -n "${named_sessionkeyfile}" ]; then
320
		warn 'named_sessionkeyfile: now determined from the conf file'
321
	fi
322
279
	piddir=`/usr/bin/dirname ${pidfile}`
323
	piddir=`/usr/bin/dirname ${pidfile}`
280
	if [ ! -d ${piddir} ]; then
324
	if [ ! -d ${piddir} ]; then
281
		install -d -o ${named_uid} -g ${named_uid} ${piddir}
325
		install -d -o ${named_uid} -g ${named_uid} ${piddir}
282
	fi
326
	fi
327
	
328
	sessionkeydir=`/usr/bin/dirname ${sessionkeyfile}`
329
	if [ ! -d ${sessionkeydir} ]; then
330
		install -d -o ${named_uid} -g ${named_uid} ${sessionkeydir}
331
	fi
283
332
284
	command_args="-u ${named_uid:=root} -c ${named_conf} ${command_args}"
333
	command_args="-u ${named_uid:=root} -c ${named_conf} ${command_args}"
285
334

Return to bug 223403