Exemplo n.º 1
0
// start with "file://", end with null byte
func ensureByteArrayUriPathExistsFor8021x(errs sectionErrors, section, key string, bytePath []byte, limitedExts ...string) {
	path := byteArrayToStrPath(bytePath)
	if !utils.IsURI(path) {
		rememberError(errs, section, key, NM_KEY_ERROR_INVALID_VALUE)
		return
	}
	ensureFileExists(errs, section, key, toLocalPathFor8021x(path), limitedExts...)
}
Exemplo n.º 2
0
// convert uri to local path, etc "file:///the/path" -> "/the/path"
func toLocalPathFor8021x(path string) (uriPath string) {
	// the uri for 8021x cert files is specially, we just need remove
	// suffix "file://" from it
	if utils.IsURI(path) {
		uriPath = strings.TrimPrefix(path, "file://")
	} else {
		uriPath = path
	}
	return
}
Exemplo n.º 3
0
// convert local path to uri, etc "/the/path" -> "file:///the/path"
func toUriPathFor8021x(path string) (uriPath string) {
	// the uri for 8021x cert files is specially, we just need append
	// suffix "file://" for it
	if !utils.IsURI(path) {
		uriPath = "file://" + path
	} else {
		uriPath = path
	}
	return
}
Exemplo n.º 4
0
func checkSetting8021xPacFile(data connectionData, errs sectionErrors) {
	if !isSetting8021xPacFileExists(data) {
		return
	}
	value := getSetting8021xPacFile(data)
	if utils.IsURI(value) {
		rememberError(errs, section8021x, NM_SETTING_802_1X_PAC_FILE, NM_KEY_ERROR_INVALID_VALUE)
		return
	}
	ensureFileExists(errs, section8021x, NM_SETTING_802_1X_PAC_FILE, value, ".pac")
}