diff options
author | pjung <none@none> | 2007-08-23 00:53:10 -0700 |
---|---|---|
committer | pjung <none@none> | 2007-08-23 00:53:10 -0700 |
commit | db11989eba94cf47ce5bf1b5d90354fa5855a69f (patch) | |
tree | d37e06abf5e1af8efd2e95dd80549a71d0f9baca /usr/src | |
parent | 8ab8f548d223ad7d80cafed28de7777e52ac6ed9 (diff) | |
download | illumos-joyent-db11989eba94cf47ce5bf1b5d90354fa5855a69f.tar.gz |
6437648 svc.configd will dump core if svc_nonpersist.db fails the integrity check
6571620 svccfg repository command should fail if the given file doesn't exist
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/svc/configd/backend.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/svc/svccfg/svccfg.y | 24 | ||||
-rw-r--r-- | usr/src/cmd/svc/svccfg/svccfg_libscf.c | 17 |
3 files changed, 35 insertions, 8 deletions
diff --git a/usr/src/cmd/svc/configd/backend.c b/usr/src/cmd/svc/configd/backend.c index 62fc26ebc0..50bb3052c5 100644 --- a/usr/src/cmd/svc/configd/backend.c +++ b/usr/src/cmd/svc/configd/backend.c @@ -1274,7 +1274,7 @@ integrity_fail: "%s\n", db_file, fname); else configd_critical( - "%s: integrity check failed: %s\n", + "%s: integrity check failed.\n", db_file); } else { (void) fprintf(stderr, diff --git a/usr/src/cmd/svc/svccfg/svccfg.y b/usr/src/cmd/svc/svccfg/svccfg.y index fccd14fed3..c5b5cede9c 100644 --- a/usr/src/cmd/svc/svccfg/svccfg.y +++ b/usr/src/cmd/svc/svccfg/svccfg.y @@ -18,8 +18,9 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -188,11 +189,26 @@ extract_cmd: SCC_EXTRACT terminator { lscf_profile_extract(NULL); } } | SCC_EXTRACT error terminator { synerr(SCC_EXTRACT); return(0); } -repository_cmd : SCC_REPOSITORY SCV_WORD terminator +repository_cmd: SCC_REPOSITORY SCV_WORD terminator { - lscf_set_repository($2); + if (strcmp($2, "-f") == 0) { + synerr(SCC_REPOSITORY); + return(0); + } + lscf_set_repository($2, 0); free($2); } + | SCC_REPOSITORY SCV_WORD SCV_WORD terminator + { + if (strcmp($2, "-f") == 0) { + lscf_set_repository($3, 1); + free($2); + free($3); + } else { + synerr(SCC_REPOSITORY); + return(0); + } + } | SCC_REPOSITORY error terminator { synerr(SCC_REPOSITORY); return(0); } inventory_cmd : SCC_INVENTORY SCV_WORD terminator diff --git a/usr/src/cmd/svc/svccfg/svccfg_libscf.c b/usr/src/cmd/svc/svccfg/svccfg_libscf.c index 41c3d69f5d..ca53a21a95 100644 --- a/usr/src/cmd/svc/svccfg/svccfg_libscf.c +++ b/usr/src/cmd/svc/svccfg/svccfg_libscf.c @@ -796,14 +796,25 @@ repository_teardown(void) } void -lscf_set_repository(const char *repfile) +lscf_set_repository(const char *repfile, int force) { repository_teardown(); - if (est->sc_repo_filename != NULL) + if (est->sc_repo_filename != NULL) { free((void *)est->sc_repo_filename); + est->sc_repo_filename = NULL; + } - est->sc_repo_filename = safe_strdup(repfile); + if ((force == 0) && (access(repfile, R_OK) != 0)) { + /* + * Repository file does not exist + * or has no read permission. + */ + warn(gettext("Cannot access \"%s\": %s\n"), + repfile, strerror(errno)); + } else { + est->sc_repo_filename = safe_strdup(repfile); + } lscf_prep_hndl(); } |