Requests_SSL::verify_reference_name()

最后更新于:2021-11-26 04:05:54

Requests_SSL::verify_reference_name( string$reference)

Verify that a reference name is valid

参数

$reference

(string) (Required) Reference dNSName

响应

(boolean) Is the name valid?

源文件

文件: gc-includes/Requests/SSL.php

	public static function verify_reference_name($reference) {
		$parts = explode('.', $reference);

		// Check the first part of the name
		$first = array_shift($parts);

		if (strpos($first, '*') !== false) {
			// Check that the wildcard is the full part
			if ($first !== '*') {
				return false;
			}

			// Check that we have at least 3 components (including first)
			if (count($parts) < 2) {
				return false;
			}
		}

		// Check the remaining parts
		foreach ($parts as $part) {
			if (strpos($part, '*') !== false) {
				return false;
			}
		}

		// Nothing found, verified!
		return true;
	}