mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 01:52:39 +03:00
[settings] Explicitly separate the concept of a completed fetched setting
The fetch_setting() family of functions may currently modify the definition of the specified setting (e.g. to add missing type information). Clean up this interface by requiring callers to provide an explicit buffer to contain the completed definition of the fetched setting, if required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -121,7 +121,7 @@ static struct interface_descriptor validator_job_desc =
|
||||
*/
|
||||
|
||||
/** Cross-signed certificate source setting */
|
||||
struct setting crosscert_setting __setting ( SETTING_CRYPTO ) = {
|
||||
const struct setting crosscert_setting __setting ( SETTING_CRYPTO ) = {
|
||||
.name = "crosscert",
|
||||
.description = "Cross-signed certificate source",
|
||||
.tag = DHCP_EB_CROSS_CERT,
|
||||
@@ -232,14 +232,7 @@ static int validator_start_download ( struct validator *validator,
|
||||
int rc;
|
||||
|
||||
/* Determine cross-signed certificate source */
|
||||
len = fetch_string_setting_copy ( NULL, &crosscert_setting,
|
||||
&crosscert_copy );
|
||||
if ( len < 0 ) {
|
||||
rc = len;
|
||||
DBGC ( validator, "VALIDATOR %p could not fetch crosscert "
|
||||
"setting: %s\n", validator, strerror ( rc ) );
|
||||
goto err_fetch_crosscert;
|
||||
}
|
||||
fetch_string_setting_copy ( NULL, &crosscert_setting, &crosscert_copy );
|
||||
crosscert = ( crosscert_copy ? crosscert_copy : crosscert_default );
|
||||
|
||||
/* Allocate URI string */
|
||||
@@ -279,7 +272,6 @@ static int validator_start_download ( struct validator *validator,
|
||||
free ( uri_string );
|
||||
err_alloc_uri_string:
|
||||
free ( crosscert_copy );
|
||||
err_fetch_crosscert:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user