Kea: default_credentials.cc Source File

| Kea 3.2.0-git

default_credentials.cc
Go to the documentation of this file.
1// Copyright (C) 2024-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8#include <cc/default_credentials.h>
9
10namespace isc {
11namespace data {
12
13const std::unordered_set<std::string>
14 DefaultCredentials::DEFAULT_CREDENTIALS = {
15#ifndef IGNORE_KEA_DEFAULT_CREDENTIALS
16#ifndef ALLOW_KEATEST
17 "keatest",
18#endif
19 "1234", "*****"
20#endif
21#ifdef EXTRA_KEA_DEFAULT_CREDENTIALS
22 EXTRA_KEA_DEFAULT_CREDENTIALS
23#endif
24};
25
26void
27DefaultCredentials::check(const std::string& value) {
28 if (DEFAULT_CREDENTIALS.count(value)) {
29 isc_throw(DefaultCredential,
30 "illegal use of a default value as credential");
31 }
32}
33
34} // end of isc::dhcp namespace
35} // end of isc namespace
isc::data::DefaultCredential
Exception thrown on attempt to use a default credential.
Definition default_credentials.h:18
default_credentials.h
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition exceptions/exceptions.h:210
isc::data
Definition base_stamped_element.cc:12
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
isc::data::DefaultCredentials::DEFAULT_CREDENTIALS
static const std::unordered_set< std::string > DEFAULT_CREDENTIALS
Default credentials.
Definition default_credentials.h:27
isc::data::DefaultCredentials::check
static void check(const std::string &value)
Check if the value is a default credential.
Definition default_credentials.cc:27