Is this configuration usable?
| 237 | |
| 238 | // Is this configuration usable? |
| 239 | bool |
| 240 | valid() const |
| 241 | { |
| 242 | /* Check mandatory parameters first */ |
| 243 | if (versions::gcpv1 == _version && (!_token || !(_token_len > 0))) { |
| 244 | Dbg(dbg_ctl, "version = %s; keyid = %s", versionString(), _keyid); |
| 245 | TSWarning("[%s] missing mandatory configs for version: %s %s", PLUGIN_NAME, versionString(), _conf_fname); |
| 246 | return false; |
| 247 | } else if ((versions::awsv2 == _version || versions::awsv4 == _version) && |
| 248 | (!_secret || !(_secret_len > 0) || !_keyid || !(_keyid_len > 0))) { |
| 249 | Dbg(dbg_ctl, "version = %s; keyid = %s; secret = %s", versionString(), _keyid, _secret); |
| 250 | TSWarning("[%s] missing mandatory configs for version: %s %s", PLUGIN_NAME, versionString(), _conf_fname); |
| 251 | return false; |
| 252 | } |
| 253 | |
| 254 | /* Optional parameters, issue warning if v2 parameters are used with v4 and vice-versa (wrong parameters are ignored anyways) */ |
| 255 | if (versions::awsv2 == _version) { |
| 256 | if (_v4includeHeaders_modified && !_v4includeHeaders.empty()) { |
| 257 | Dbg(dbg_ctl, "headers are not being signed with AWS auth v2, included headers parameter ignored"); |
| 258 | } |
| 259 | if (_v4excludeHeaders_modified && !_v4excludeHeaders.empty()) { |
| 260 | Dbg(dbg_ctl, "headers are not being signed with AWS auth v2, excluded headers parameter ignored"); |
| 261 | } |
| 262 | if (_region_map_modified && !_region_map.empty()) { |
| 263 | Dbg(dbg_ctl, "region map is not used with AWS auth v2, parameter ignored"); |
| 264 | } |
| 265 | if (nullptr != _token || _token_len > 0) { |
| 266 | Dbg(dbg_ctl, "session token support with AWS auth v2 is not implemented, parameter ignored"); |
| 267 | } |
| 268 | } else { |
| 269 | /* awsv4 == _version || gcpv1 == _version */ |
| 270 | // NOTE: virtual host not used with AWS auth v4, parameter ignored |
| 271 | } |
| 272 | return true; |
| 273 | } |
| 274 | |
| 275 | // Used to copy relevant configurations that can be configured in a config file. Note: we intentionally |
| 276 | // don't override/use the assignment operator, since we only copy things IF they have been modified. |
no test coverage detected