tsol_sgettpent.c revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * CDDL HEADER START
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * The contents of this file are subject to the terms of the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Common Development and Distribution License (the "License").
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * You may not use this file except in compliance with the License.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * See the License for the specific language governing permissions
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * and limitations under the License.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * When distributing Covered Code, include this CDDL HEADER in each
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * If applicable, add the following below this CDDL HEADER, with the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * fields enclosed by brackets "[]" replaced with your own identifying
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * information: Portions Copyright [yyyy] [name of copyright owner]
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * CDDL HEADER END
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Use is subject to license terms.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * From "tsol_tndb_parser.c 7.24 01/09/05 SMI; TSOL 2.x"
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * These functions parse entries in the "tnrhtp" (remote host template) file.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Each entry in this file has two fields, separated by a colon. The first
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * field is the template name. The second is a list of "key=value" attributes,
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * separated by semicolons.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * In order to help preserve sanity, we do not allow more than one unescaped
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * colon in a line, nor any unescaped '=' or ';' characters in the template
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * name. Such things are indicative of typing errors, not intentional
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * configuration.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#pragma ident "%Z%%M% %I% %E% SMI"
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk return (0);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (stobsl(min, &range->lower_bound, NO_CORRECTION, &err) == 0)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (stobsl(max, &range->upper_bound, NO_CORRECTION, &err) == 0)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (!bldominates(&range->upper_bound, &range->lower_bound))
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk return (0);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (stobsl(tokp, &labels[sc], NO_CORRECTION, &err) == 0)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk return (0);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * parse fields by host type -
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * add on to the following if statement for each new host type.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * default label
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * check label range
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * This is the old format. Use ADMIN_LOW to SL of the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * default label as the gw_sl_range.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * also label set, if present. (optional)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * label range
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk err = get_tn_sl_range(&tpentp->tp_sl_range_cipso, val, val2);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * also label set, if present. (optional)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /* CIPSO entries don't support default labels */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk return (0);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpktpstr_to_ent(tsol_tpstr_t *tpstrp, int *errp, char **errstrp)
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * The user can specify NULL pointers for these. Make sure that we
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * don't have to deal with checking for NULL everywhere by just
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * pointing to our own variables if the user gives NULL.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /* The default, unless we find a more specific error locus. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (template == NULL || *template == '#' || *template == '\n') {
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (attrs && *attrs != '\0' && *attrs != '#' && *attrs != '\n')
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (attrs && *attrs != '\0' && *attrs != '#' && *attrs != '\n')
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (strlcpy(tpentp->name, template, sizeof (tpentp->name)) >=
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk if (*errp == 0) {
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk (void) fprintf(stdout, "tpstr_to_ent: %s:%s\n", tpentp->name,
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#endif /* DEBUG */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk#endif /* DEBUG */