diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-01-18 09:32:00 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2021-01-18 09:32:00 -0500 | 
| commit | 46e6f9f2ad21296c643686622419ce4122730aa7 (patch) | |
| tree | d57e7146f3bc237537a8e90353d729782d93381b /lib/northbound_cli.c | |
| parent | f6e07e1bdf6c5d4dfbc4f8b5e9a42efe71c67243 (diff) | |
lib: Correctly set temp file permissions
Set the temp file permissions to limit who can read
the file.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/northbound_cli.c')
| -rw-r--r-- | lib/northbound_cli.c | 6 | 
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 7048df99fb..853f643472 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -693,6 +693,12 @@ static int nb_write_config(struct nb_config *config, enum nb_cfg_format format,  			  __func__, safe_strerror(errno));  		return -1;  	} +	if (fchmod(fd, CONFIGFILE_MASK) != 0) { +		flog_warn(EC_LIB_SYSTEM_CALL, +			  "%s: fchmod() failed: %s(%d):", __func__, +			  safe_strerror(errno), errno); +		return -1; +	}  	/* Make vty for configuration file. */  	file_vty = vty_new();  | 
