No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / lib / krb5 / verify_krb5_conf.c
blob22be98ad453cf71637313160105f5fda9b2332ee
1 /*
2 * Copyright (c) 1999 - 2005 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute 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.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE 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
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #include "krb5_locl.h"
35 #include <getarg.h>
36 #include <parse_bytes.h>
37 #include <err.h>
38 __RCSID("$Heimdal: verify_krb5_conf.c 22233 2007-12-08 21:43:37Z lha $"
39 "$NetBSD$");
41 /* verify krb5.conf */
43 static int dumpconfig_flag = 0;
44 static int version_flag = 0;
45 static int help_flag = 0;
46 static int warn_mit_syntax_flag = 0;
48 static struct getargs args[] = {
49 {"dumpconfig", 0, arg_flag, &dumpconfig_flag,
50 "show the parsed config files", NULL },
51 {"warn-mit-syntax", 0, arg_flag, &warn_mit_syntax_flag,
52 "show the parsed config files", NULL },
53 {"version", 0, arg_flag, &version_flag,
54 "print version", NULL },
55 {"help", 0, arg_flag, &help_flag,
56 NULL, NULL }
59 static void
60 usage (int ret)
62 arg_printusage (args,
63 sizeof(args)/sizeof(*args),
64 NULL,
65 "[config-file]");
66 exit (ret);
69 static int
70 check_bytes(krb5_context context, const char *path, char *data)
72 if(parse_bytes(data, NULL) == -1) {
73 krb5_warnx(context, "%s: failed to parse \"%s\" as size", path, data);
74 return 1;
76 return 0;
79 static int
80 check_time(krb5_context context, const char *path, char *data)
82 if(parse_time(data, NULL) == -1) {
83 krb5_warnx(context, "%s: failed to parse \"%s\" as time", path, data);
84 return 1;
86 return 0;
89 static int
90 check_numeric(krb5_context context, const char *path, char *data)
92 long int v;
93 char *end;
94 v = strtol(data, &end, 0);
95 if(*end != '\0') {
96 krb5_warnx(context, "%s: failed to parse \"%s\" as a number",
97 path, data);
98 return 1;
100 return 0;
103 static int
104 check_boolean(krb5_context context, const char *path, char *data)
106 long int v;
107 char *end;
108 if(strcasecmp(data, "yes") == 0 ||
109 strcasecmp(data, "true") == 0 ||
110 strcasecmp(data, "no") == 0 ||
111 strcasecmp(data, "false") == 0)
112 return 0;
113 v = strtol(data, &end, 0);
114 if(*end != '\0') {
115 krb5_warnx(context, "%s: failed to parse \"%s\" as a boolean",
116 path, data);
117 return 1;
119 if(v != 0 && v != 1)
120 krb5_warnx(context, "%s: numeric value \"%s\" is treated as \"true\"",
121 path, data);
122 return 0;
125 static int
126 check_524(krb5_context context, const char *path, char *data)
128 if(strcasecmp(data, "yes") == 0 ||
129 strcasecmp(data, "no") == 0 ||
130 strcasecmp(data, "2b") == 0 ||
131 strcasecmp(data, "local") == 0)
132 return 0;
134 krb5_warnx(context, "%s: didn't contain a valid option `%s'",
135 path, data);
136 return 1;
139 static int
140 check_host(krb5_context context, const char *path, char *data)
142 int ret;
143 char hostname[128];
144 const char *p = data;
145 struct addrinfo hints;
146 char service[32];
147 int defport;
148 struct addrinfo *ai;
150 hints.ai_flags = 0;
151 hints.ai_family = PF_UNSPEC;
152 hints.ai_socktype = 0;
153 hints.ai_protocol = 0;
155 hints.ai_addrlen = 0;
156 hints.ai_canonname = NULL;
157 hints.ai_addr = NULL;
158 hints.ai_next = NULL;
160 /* XXX data could be a list of hosts that this code can't handle */
161 /* XXX copied from krbhst.c */
162 if(strncmp(p, "http://", 7) == 0){
163 p += 7;
164 hints.ai_socktype = SOCK_STREAM;
165 strlcpy(service, "http", sizeof(service));
166 defport = 80;
167 } else if(strncmp(p, "http/", 5) == 0) {
168 p += 5;
169 hints.ai_socktype = SOCK_STREAM;
170 strlcpy(service, "http", sizeof(service));
171 defport = 80;
172 }else if(strncmp(p, "tcp/", 4) == 0){
173 p += 4;
174 hints.ai_socktype = SOCK_STREAM;
175 strlcpy(service, "kerberos", sizeof(service));
176 defport = 88;
177 } else if(strncmp(p, "udp/", 4) == 0) {
178 p += 4;
179 hints.ai_socktype = SOCK_DGRAM;
180 strlcpy(service, "kerberos", sizeof(service));
181 defport = 88;
182 } else {
183 hints.ai_socktype = SOCK_DGRAM;
184 strlcpy(service, "kerberos", sizeof(service));
185 defport = 88;
187 if(strsep_copy(&p, ":", hostname, sizeof(hostname)) < 0) {
188 return 1;
190 hostname[strcspn(hostname, "/")] = '\0';
191 if(p != NULL) {
192 char *end;
193 int tmp = strtol(p, &end, 0);
194 if(end == p) {
195 krb5_warnx(context, "%s: failed to parse port number in %s",
196 path, data);
197 return 1;
199 defport = tmp;
200 snprintf(service, sizeof(service), "%u", defport);
202 ret = getaddrinfo(hostname, service, &hints, &ai);
203 if(ret == EAI_SERVICE && !isdigit((unsigned char)service[0])) {
204 snprintf(service, sizeof(service), "%u", defport);
205 ret = getaddrinfo(hostname, service, &hints, &ai);
207 if(ret != 0) {
208 krb5_warnx(context, "%s: %s (%s)", path, gai_strerror(ret), hostname);
209 return 1;
211 return 0;
214 static int
215 mit_entry(krb5_context context, const char *path, char *data)
217 if (warn_mit_syntax_flag)
218 krb5_warnx(context, "%s is only used by MIT Kerberos", path);
219 return 0;
222 struct s2i {
223 const char *s;
224 int val;
227 #define L(X) { #X, LOG_ ## X }
229 static struct s2i syslogvals[] = {
230 /* severity */
231 L(EMERG),
232 L(ALERT),
233 L(CRIT),
234 L(ERR),
235 L(WARNING),
236 L(NOTICE),
237 L(INFO),
238 L(DEBUG),
239 /* facility */
240 L(AUTH),
241 #ifdef LOG_AUTHPRIV
242 L(AUTHPRIV),
243 #endif
244 #ifdef LOG_CRON
245 L(CRON),
246 #endif
247 L(DAEMON),
248 #ifdef LOG_FTP
249 L(FTP),
250 #endif
251 L(KERN),
252 L(LPR),
253 L(MAIL),
254 #ifdef LOG_NEWS
255 L(NEWS),
256 #endif
257 L(SYSLOG),
258 L(USER),
259 #ifdef LOG_UUCP
260 L(UUCP),
261 #endif
262 L(LOCAL0),
263 L(LOCAL1),
264 L(LOCAL2),
265 L(LOCAL3),
266 L(LOCAL4),
267 L(LOCAL5),
268 L(LOCAL6),
269 L(LOCAL7),
270 { NULL, -1 }
273 static int
274 find_value(const char *s, struct s2i *table)
276 while(table->s && strcasecmp(table->s, s))
277 table++;
278 return table->val;
281 static int
282 check_log(krb5_context context, const char *path, char *data)
284 /* XXX sync with log.c */
285 int min = 0, max = -1, n;
286 char c;
287 const char *p = data;
289 n = sscanf(p, "%d%c%d/", &min, &c, &max);
290 if(n == 2){
291 if(c == '/') {
292 if(min < 0){
293 max = -min;
294 min = 0;
295 }else{
296 max = min;
300 if(n){
301 p = strchr(p, '/');
302 if(p == NULL) {
303 krb5_warnx(context, "%s: failed to parse \"%s\"", path, data);
304 return 1;
306 p++;
308 if(strcmp(p, "STDERR") == 0 ||
309 strcmp(p, "CONSOLE") == 0 ||
310 (strncmp(p, "FILE", 4) == 0 && (p[4] == ':' || p[4] == '=')) ||
311 (strncmp(p, "DEVICE", 6) == 0 && p[6] == '='))
312 return 0;
313 if(strncmp(p, "SYSLOG", 6) == 0){
314 int ret = 0;
315 char severity[128] = "";
316 char facility[128] = "";
317 p += 6;
318 if(*p != '\0')
319 p++;
320 if(strsep_copy(&p, ":", severity, sizeof(severity)) != -1)
321 strsep_copy(&p, ":", facility, sizeof(facility));
322 if(*severity == '\0')
323 strlcpy(severity, "ERR", sizeof(severity));
324 if(*facility == '\0')
325 strlcpy(facility, "AUTH", sizeof(facility));
326 if(find_value(severity, syslogvals) == -1) {
327 krb5_warnx(context, "%s: unknown syslog facility \"%s\"",
328 path, facility);
329 ret++;
331 if(find_value(severity, syslogvals) == -1) {
332 krb5_warnx(context, "%s: unknown syslog severity \"%s\"",
333 path, severity);
334 ret++;
336 return ret;
337 }else{
338 krb5_warnx(context, "%s: unknown log type: \"%s\"", path, data);
339 return 1;
343 typedef int (*check_func_t)(krb5_context, const char*, char*);
344 struct entry {
345 const char *name;
346 int type;
347 void *check_data;
350 struct entry all_strings[] = {
351 { "", krb5_config_string, NULL },
352 { NULL }
355 struct entry all_boolean[] = {
356 { "", krb5_config_string, check_boolean },
357 { NULL }
361 struct entry v4_name_convert_entries[] = {
362 { "host", krb5_config_list, all_strings },
363 { "plain", krb5_config_list, all_strings },
364 { NULL }
367 struct entry libdefaults_entries[] = {
368 { "accept_null_addresses", krb5_config_string, check_boolean },
369 { "capath", krb5_config_list, all_strings },
370 { "check_pac", krb5_config_string, check_boolean },
371 { "clockskew", krb5_config_string, check_time },
372 { "date_format", krb5_config_string, NULL },
373 { "default_cc_name", krb5_config_string, NULL },
374 { "default_etypes", krb5_config_string, NULL },
375 { "default_etypes_des", krb5_config_string, NULL },
376 { "default_keytab_modify_name", krb5_config_string, NULL },
377 { "default_keytab_name", krb5_config_string, NULL },
378 { "default_realm", krb5_config_string, NULL },
379 { "dns_canonize_hostname", krb5_config_string, check_boolean },
380 { "dns_proxy", krb5_config_string, NULL },
381 { "dns_lookup_kdc", krb5_config_string, check_boolean },
382 { "dns_lookup_realm", krb5_config_string, check_boolean },
383 { "dns_lookup_realm_labels", krb5_config_string, NULL },
384 { "egd_socket", krb5_config_string, NULL },
385 { "encrypt", krb5_config_string, check_boolean },
386 { "extra_addresses", krb5_config_string, NULL },
387 { "fcache_version", krb5_config_string, check_numeric },
388 { "fcc-mit-ticketflags", krb5_config_string, check_boolean },
389 { "forward", krb5_config_string, check_boolean },
390 { "forwardable", krb5_config_string, check_boolean },
391 { "http_proxy", krb5_config_string, check_host /* XXX */ },
392 { "ignore_addresses", krb5_config_string, NULL },
393 { "kdc_timeout", krb5_config_string, check_time },
394 { "kdc_timesync", krb5_config_string, check_boolean },
395 { "log_utc", krb5_config_string, check_boolean },
396 { "maxretries", krb5_config_string, check_numeric },
397 { "scan_interfaces", krb5_config_string, check_boolean },
398 { "srv_lookup", krb5_config_string, check_boolean },
399 { "srv_try_txt", krb5_config_string, check_boolean },
400 { "ticket_lifetime", krb5_config_string, check_time },
401 { "time_format", krb5_config_string, NULL },
402 { "transited_realms_reject", krb5_config_string, NULL },
403 { "no-addresses", krb5_config_string, check_boolean },
404 { "v4_instance_resolve", krb5_config_string, check_boolean },
405 { "v4_name_convert", krb5_config_list, v4_name_convert_entries },
406 { "verify_ap_req_nofail", krb5_config_string, check_boolean },
407 { "max_retries", krb5_config_string, check_time },
408 { "renew_lifetime", krb5_config_string, check_time },
409 { "proxiable", krb5_config_string, check_boolean },
410 { "warn_pwexpire", krb5_config_string, check_time },
411 /* MIT stuff */
412 { "permitted_enctypes", krb5_config_string, mit_entry },
413 { "default_tgs_enctypes", krb5_config_string, mit_entry },
414 { "default_tkt_enctypes", krb5_config_string, mit_entry },
415 { NULL }
418 struct entry appdefaults_entries[] = {
419 { "afslog", krb5_config_string, check_boolean },
420 { "afs-use-524", krb5_config_string, check_524 },
421 { "encrypt", krb5_config_string, check_boolean },
422 { "forward", krb5_config_string, check_boolean },
423 { "forwardable", krb5_config_string, check_boolean },
424 { "proxiable", krb5_config_string, check_boolean },
425 { "ticket_lifetime", krb5_config_string, check_time },
426 { "renew_lifetime", krb5_config_string, check_time },
427 { "no-addresses", krb5_config_string, check_boolean },
428 { "krb4_get_tickets", krb5_config_string, check_boolean },
429 { "pkinit_anchors", krb5_config_string, NULL },
430 { "pkinit_win2k", krb5_config_string, NULL },
431 { "pkinit_win2k_require_binding", krb5_config_string, NULL },
432 { "pkinit_require_eku", krb5_config_string, NULL },
433 { "pkinit_require_krbtgt_otherName", krb5_config_string, NULL },
434 { "pkinit_require_hostname_match", krb5_config_string, NULL },
435 #if 0
436 { "anonymous", krb5_config_string, check_boolean },
437 #endif
438 { "", krb5_config_list, appdefaults_entries },
439 { NULL }
442 struct entry realms_entries[] = {
443 { "forwardable", krb5_config_string, check_boolean },
444 { "proxiable", krb5_config_string, check_boolean },
445 { "ticket_lifetime", krb5_config_string, check_time },
446 { "renew_lifetime", krb5_config_string, check_time },
447 { "warn_pwexpire", krb5_config_string, check_time },
448 { "kdc", krb5_config_string, check_host },
449 { "admin_server", krb5_config_string, check_host },
450 { "kpasswd_server", krb5_config_string, check_host },
451 { "krb524_server", krb5_config_string, check_host },
452 { "v4_name_convert", krb5_config_list, v4_name_convert_entries },
453 { "v4_instance_convert", krb5_config_list, all_strings },
454 { "v4_domains", krb5_config_string, NULL },
455 { "default_domain", krb5_config_string, NULL },
456 { "win2k_pkinit", krb5_config_string, NULL },
457 /* MIT stuff */
458 { "admin_keytab", krb5_config_string, mit_entry },
459 { "acl_file", krb5_config_string, mit_entry },
460 { "dict_file", krb5_config_string, mit_entry },
461 { "kadmind_port", krb5_config_string, mit_entry },
462 { "kpasswd_port", krb5_config_string, mit_entry },
463 { "master_key_name", krb5_config_string, mit_entry },
464 { "master_key_type", krb5_config_string, mit_entry },
465 { "key_stash_file", krb5_config_string, mit_entry },
466 { "max_life", krb5_config_string, mit_entry },
467 { "max_renewable_life", krb5_config_string, mit_entry },
468 { "default_principal_expiration", krb5_config_string, mit_entry },
469 { "default_principal_flags", krb5_config_string, mit_entry },
470 { "supported_enctypes", krb5_config_string, mit_entry },
471 { "database_name", krb5_config_string, mit_entry },
472 { NULL }
475 struct entry realms_foobar[] = {
476 { "", krb5_config_list, realms_entries },
477 { NULL }
481 struct entry kdc_database_entries[] = {
482 { "realm", krb5_config_string, NULL },
483 { "dbname", krb5_config_string, NULL },
484 { "mkey_file", krb5_config_string, NULL },
485 { "acl_file", krb5_config_string, NULL },
486 { "log_file", krb5_config_string, NULL },
487 { NULL }
490 struct entry kdc_entries[] = {
491 { "database", krb5_config_list, kdc_database_entries },
492 { "key-file", krb5_config_string, NULL },
493 { "logging", krb5_config_string, check_log },
494 { "max-request", krb5_config_string, check_bytes },
495 { "require-preauth", krb5_config_string, check_boolean },
496 { "ports", krb5_config_string, NULL },
497 { "addresses", krb5_config_string, NULL },
498 { "enable-kerberos4", krb5_config_string, check_boolean },
499 { "enable-524", krb5_config_string, check_boolean },
500 { "enable-http", krb5_config_string, check_boolean },
501 { "check-ticket-addresses", krb5_config_string, check_boolean },
502 { "allow-null-ticket-addresses", krb5_config_string, check_boolean },
503 { "allow-anonymous", krb5_config_string, check_boolean },
504 { "v4_realm", krb5_config_string, NULL },
505 { "enable-kaserver", krb5_config_string, check_boolean },
506 { "encode_as_rep_as_tgs_rep", krb5_config_string, check_boolean },
507 { "kdc_warn_pwexpire", krb5_config_string, check_time },
508 { "use_2b", krb5_config_list, NULL },
509 { "enable-pkinit", krb5_config_string, check_boolean },
510 { "pkinit_identity", krb5_config_string, NULL },
511 { "pkinit_anchors", krb5_config_string, NULL },
512 { "pkinit_pool", krb5_config_string, NULL },
513 { "pkinit_revoke", krb5_config_string, NULL },
514 { "pkinit_kdc_ocsp", krb5_config_string, NULL },
515 { "pkinit_principal_in_certificate", krb5_config_string, NULL },
516 { "pkinit_dh_min_bits", krb5_config_string, NULL },
517 { "pkinit_allow_proxy_certificate", krb5_config_string, NULL },
518 { "hdb-ldap-create-base", krb5_config_string, NULL },
519 { "v4-realm", krb5_config_string, NULL },
520 { NULL }
523 struct entry kadmin_entries[] = {
524 { "password_lifetime", krb5_config_string, check_time },
525 { "default_keys", krb5_config_string, NULL },
526 { "use_v4_salt", krb5_config_string, NULL },
527 { "require-preauth", krb5_config_string, check_boolean },
528 { NULL }
530 struct entry log_strings[] = {
531 { "", krb5_config_string, check_log },
532 { NULL }
536 /* MIT stuff */
537 struct entry kdcdefaults_entries[] = {
538 { "kdc_ports", krb5_config_string, mit_entry },
539 { "v4_mode", krb5_config_string, mit_entry },
540 { NULL }
543 struct entry capaths_entries[] = {
544 { "", krb5_config_list, all_strings },
545 { NULL }
548 struct entry password_quality_entries[] = {
549 { "policies", krb5_config_string, NULL },
550 { "external_program", krb5_config_string, NULL },
551 { "min_classes", krb5_config_string, check_numeric },
552 { "min_length", krb5_config_string, check_numeric },
553 { "", krb5_config_list, all_strings },
554 { NULL }
557 struct entry toplevel_sections[] = {
558 { "libdefaults" , krb5_config_list, libdefaults_entries },
559 { "realms", krb5_config_list, realms_foobar },
560 { "domain_realm", krb5_config_list, all_strings },
561 { "logging", krb5_config_list, log_strings },
562 { "kdc", krb5_config_list, kdc_entries },
563 { "kadmin", krb5_config_list, kadmin_entries },
564 { "appdefaults", krb5_config_list, appdefaults_entries },
565 { "gssapi", krb5_config_list, NULL },
566 { "capaths", krb5_config_list, capaths_entries },
567 { "password_quality", krb5_config_list, password_quality_entries },
568 /* MIT stuff */
569 { "kdcdefaults", krb5_config_list, kdcdefaults_entries },
570 { NULL }
574 static int
575 check_section(krb5_context context, const char *path, krb5_config_section *cf,
576 struct entry *entries)
578 int error = 0;
579 krb5_config_section *p;
580 struct entry *e;
582 char *local;
584 for(p = cf; p != NULL; p = p->next) {
585 asprintf(&local, "%s/%s", path, p->name);
586 for(e = entries; e->name != NULL; e++) {
587 if(*e->name == '\0' || strcmp(e->name, p->name) == 0) {
588 if(e->type != p->type) {
589 krb5_warnx(context, "%s: unknown or wrong type", local);
590 error |= 1;
591 } else if(p->type == krb5_config_string && e->check_data != NULL) {
592 error |= (*(check_func_t)e->check_data)(context, local, p->u.string);
593 } else if(p->type == krb5_config_list && e->check_data != NULL) {
594 error |= check_section(context, local, p->u.list, e->check_data);
596 break;
599 if(e->name == NULL) {
600 krb5_warnx(context, "%s: unknown entry", local);
601 error |= 1;
603 free(local);
605 return error;
609 static void
610 dumpconfig(int level, krb5_config_section *top)
612 krb5_config_section *x;
613 for(x = top; x; x = x->next) {
614 switch(x->type) {
615 case krb5_config_list:
616 if(level == 0) {
617 printf("[%s]\n", x->name);
618 } else {
619 printf("%*s%s = {\n", 4 * level, " ", x->name);
621 dumpconfig(level + 1, x->u.list);
622 if(level > 0)
623 printf("%*s}\n", 4 * level, " ");
624 break;
625 case krb5_config_string:
626 printf("%*s%s = %s\n", 4 * level, " ", x->name, x->u.string);
627 break;
633 main(int argc, char **argv)
635 krb5_context context;
636 krb5_error_code ret;
637 krb5_config_section *tmp_cf;
638 int optidx = 0;
640 setprogname (argv[0]);
642 ret = krb5_init_context(&context);
643 if (ret == KRB5_CONFIG_BADFORMAT)
644 errx (1, "krb5_init_context failed to parse configuration file");
645 else if (ret)
646 errx (1, "krb5_init_context failed with %d", ret);
648 if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optidx))
649 usage(1);
651 if (help_flag)
652 usage (0);
654 if(version_flag){
655 print_version(NULL);
656 exit(0);
659 argc -= optidx;
660 argv += optidx;
662 tmp_cf = NULL;
663 if(argc == 0)
664 krb5_get_default_config_files(&argv);
666 while(*argv) {
667 ret = krb5_config_parse_file_multi(context, *argv, &tmp_cf);
668 if (ret != 0)
669 krb5_warn (context, ret, "krb5_config_parse_file");
670 argv++;
673 if(dumpconfig_flag)
674 dumpconfig(0, tmp_cf);
676 return check_section(context, "", tmp_cf, toplevel_sections);