diff options
-rw-r--r-- | usr/src/cmd/tsol/tnctl/tnctl.c | 14 | ||||
-rw-r--r-- | usr/src/lib/libtsnet/common/libtsnet.h | 6 | ||||
-rw-r--r-- | usr/src/lib/libtsnet/common/tsol_getrhent.c | 8 | ||||
-rw-r--r-- | usr/src/lib/libtsnet/common/tsol_gettpent.c | 8 |
4 files changed, 24 insertions, 12 deletions
diff --git a/usr/src/cmd/tsol/tnctl/tnctl.c b/usr/src/cmd/tsol/tnctl/tnctl.c index 56776d4688..7d8d3015ce 100644 --- a/usr/src/cmd/tsol/tnctl/tnctl.c +++ b/usr/src/cmd/tsol/tnctl/tnctl.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -171,6 +171,7 @@ translate_inet_addr(tsol_rhent_t *rhentp, int *alen, char abuf[], int abuflen) static void process_rhl(const char *file) { + boolean_t error = B_FALSE; boolean_t success = B_FALSE; tsol_rhent_t *rhentp = NULL; FILE *fp; @@ -186,7 +187,7 @@ process_rhl(const char *file) } tsol_setrhent(1); - while (rhentp = tsol_fgetrhent(fp)) { + while (rhentp = tsol_fgetrhent(fp, &error)) { /* First time through the loop, flush it all */ if (!success && flush_mode) (void) tnrh(TNDB_FLUSH, NULL); @@ -218,6 +219,9 @@ process_rhl(const char *file) } (void) fclose(fp); tsol_endrhent(); + + if (error) + exit(1); } /* @@ -461,6 +465,7 @@ static void process_tpl(const char *file) { FILE *fp; + boolean_t error = B_FALSE; boolean_t success = B_FALSE; tsol_tpent_t *tpentp; @@ -472,7 +477,7 @@ process_tpl(const char *file) } tsol_settpent(1); - while (tpentp = tsol_fgettpent(fp)) { + while (tpentp = tsol_fgettpent(fp, &error)) { /* First time through the loop, flush it all */ if (!success && flush_mode) (void) tnrhtp(TNDB_FLUSH, NULL); @@ -503,6 +508,9 @@ process_tpl(const char *file) } (void) fclose(fp); tsol_endtpent(); + + if (error) + exit(1); } static void diff --git a/usr/src/lib/libtsnet/common/libtsnet.h b/usr/src/lib/libtsnet/common/libtsnet.h index c1f9b695bd..1ab8f8448c 100644 --- a/usr/src/lib/libtsnet/common/libtsnet.h +++ b/usr/src/lib/libtsnet/common/libtsnet.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * All symbols and functions in this header file and library are private to Sun @@ -70,7 +70,7 @@ extern "C" { /* Template entry parsing */ extern tsol_tpent_t *tsol_gettpbyname(const char *); extern tsol_tpent_t *tsol_gettpent(void); -extern tsol_tpent_t *tsol_fgettpent(FILE *); +extern tsol_tpent_t *tsol_fgettpent(FILE *, boolean_t *); extern void tsol_freetpent(tsol_tpent_t *); extern void tsol_settpent(int); extern void tsol_endtpent(void); @@ -80,7 +80,7 @@ extern tsol_tpent_t *tpstr_to_ent(tsol_tpstr_t *, int *, char **); /* Remote host entry parsing */ extern tsol_rhent_t *tsol_getrhbyaddr(const void *, size_t, int); extern tsol_rhent_t *tsol_getrhent(void); -extern tsol_rhent_t *tsol_fgetrhent(FILE *); +extern tsol_rhent_t *tsol_fgetrhent(FILE *, boolean_t *); extern void tsol_freerhent(tsol_rhent_t *); extern void tsol_setrhent(int); extern void tsol_endrhent(void); diff --git a/usr/src/lib/libtsnet/common/tsol_getrhent.c b/usr/src/lib/libtsnet/common/tsol_getrhent.c index 24455f0960..8843cf7427 100644 --- a/usr/src/lib/libtsnet/common/tsol_getrhent.c +++ b/usr/src/lib/libtsnet/common/tsol_getrhent.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * From "tsol_getrhent.c 7.6 00/09/22 SMI; TSOL 2.x" @@ -128,7 +128,7 @@ tsol_getrhent(void) } tsol_rhent_t * -tsol_fgetrhent(FILE *f) +tsol_fgetrhent(FILE *f, boolean_t *error) { int err = 0; char *errstr = NULL; @@ -149,11 +149,13 @@ tsol_fgetrhent(FILE *f) * Loop until we find a non-blank, non-comment line, or * until EOF. No need to log blank lines, comments. */ - if (err != LTSNET_EMPTY) + if (err != LTSNET_EMPTY) { (void) fprintf(stderr, "%s: %.32s%s: %s\n", gettext("Error parsing tnrhdb file"), errstr, (strlen(errstr) > 32)? "...": "", (char *)tsol_strerror(err, errno)); + *error = B_TRUE; + } _nss_XbyY_fgets(f, &arg); rhstrp = (tsol_rhstr_t *)NSS_XbyY_FINI(&arg); if (rhstrp == NULL) /* EOF */ diff --git a/usr/src/lib/libtsnet/common/tsol_gettpent.c b/usr/src/lib/libtsnet/common/tsol_gettpent.c index ab20c85620..467bd8fccb 100644 --- a/usr/src/lib/libtsnet/common/tsol_gettpent.c +++ b/usr/src/lib/libtsnet/common/tsol_gettpent.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * From "tsol_gettpent.c 7.13 00/10/13 SMI; TSOL 2.x" @@ -122,7 +122,7 @@ tsol_gettpent(void) } tsol_tpent_t * -tsol_fgettpent(FILE *f) +tsol_fgettpent(FILE *f, boolean_t *error) { int err = 0; char *errstr = NULL; @@ -143,11 +143,13 @@ tsol_fgettpent(FILE *f) * Loop until we find a non-blank, non-comment line, or * until EOF. No need to log blank lines, comments. */ - if (err != LTSNET_EMPTY) + if (err != LTSNET_EMPTY) { (void) fprintf(stderr, "%s: %.32s%s: %s\n", gettext("Error parsing tnrhtp file"), errstr, (strlen(errstr) > 32)? "...": "", (char *)tsol_strerror(err, errno)); + *error = B_TRUE; + } _nss_XbyY_fgets(f, &arg); tpstrp = (tsol_tpstr_t *)NSS_XbyY_FINI(&arg); if (tpstrp == NULL) /* EOF */ |