summaryrefslogtreecommitdiff
path: root/usr/src/lib/libscf/common/midlevel.c
diff options
context:
space:
mode:
authorwesolows <none@none>2007-09-13 10:10:42 -0700
committerwesolows <none@none>2007-09-13 10:10:42 -0700
commit3eae19d9cf3390cf5b75e10c9c1945fd36ad856a (patch)
tree2e7dc09a2b8d857b406d077178dc53207a1d6e15 /usr/src/lib/libscf/common/midlevel.c
parentdb30663e794986128c960dc83ff43ca474b68a23 (diff)
downloadillumos-joyent-3eae19d9cf3390cf5b75e10c9c1945fd36ad856a.tar.gz
PSARC 2007/177 SMF read-protected property storage
PSARC 2007/519 svccfg(1M) restore 6537749 SMF should support read-protection of data 6538452 svccfg delete leaks memory on syntax error with options 6546699 svccfg archive should be able to be reimported 6559692 svccfg fails to import a manifest with an empty <property> 6597168 startd is setting $SMF_METHOD incorrectly 6597173 allocation failure can induce crash in scf_handle_decode_fmri() 6597183 allocation failure can induce crash in scf_simple_app_props_free() 6597190 scf_simple_app_props_get() can return with unset error code 6598922 rc_node_modify_permission_check() calls perm_granted() with rn_lock held
Diffstat (limited to 'usr/src/lib/libscf/common/midlevel.c')
-rw-r--r--usr/src/lib/libscf/common/midlevel.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/src/lib/libscf/common/midlevel.c b/usr/src/lib/libscf/common/midlevel.c
index ec642baaa3..7a45f6a34b 100644
--- a/usr/src/lib/libscf/common/midlevel.c
+++ b/usr/src/lib/libscf/common/midlevel.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -303,7 +304,9 @@ fill_prop(scf_property_t *prop, const char *pgname, const char *propname,
}
if (iterret == -1) {
- if (scf_error() != SCF_ERROR_CONNECTION_BROKEN)
+ int err = scf_error();
+ if (err != SCF_ERROR_CONNECTION_BROKEN &&
+ err != SCF_ERROR_PERMISSION_DENIED)
(void) scf_set_error(SCF_ERROR_INTERNAL);
goto error1;
}
@@ -1804,7 +1807,12 @@ scf_simple_app_props_get(scf_handle_t *hin, const char *inst_fmri)
return (NULL);
}
} else {
- sys_fmri = strdup(inst_fmri);
+ if ((sys_fmri = strdup(inst_fmri)) == NULL) {
+ if (local_h)
+ scf_handle_destroy(h);
+ (void) scf_set_error(SCF_ERROR_NO_MEMORY);
+ return (NULL);
+ }
}
if ((namelen = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH)) == -1) {
@@ -1856,6 +1864,9 @@ scf_simple_app_props_get(scf_handle_t *hin, const char *inst_fmri)
(void) scf_set_error(SCF_ERROR_NO_MEMORY);
goto error1;
}
+ nextpg->pg_name = NULL;
+ nextpg->pg_next = NULL;
+ nextpg->pg_proplist = NULL;
thispg->pg_next = nextpg;
thispg = nextpg;
} else {
@@ -1874,8 +1885,6 @@ scf_simple_app_props_get(scf_handle_t *hin, const char *inst_fmri)
goto error1;
}
- nextpg->pg_next = NULL;
- nextpg->pg_proplist = NULL;
thisprop = NULL;
scf_iter_reset(propiter);
@@ -2005,6 +2014,7 @@ scf_simple_app_props_get(scf_handle_t *hin, const char *inst_fmri)
thisprop = NULL;
if ((nextpg->pg_name = strdup(pgname)) == NULL) {
+ (void) scf_set_error(SCF_ERROR_NO_MEMORY);
free(nextpg);
goto error1;
}