Beispiel #1
0
    def _aa_domain_search(self):
        """
        The domain-search option specifies a 'search list' of Domain Names to
        be used by the client to locate not-fully-qualified domain names. The
        difference between this option and historic use of the domain-name
        option for the same ends is that this option is encoded in RFC1035
        compressed labels on the wire. For example:

            option domain-search "example.com", "sales.example.com";
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        value = self.value.strip(';')
        value = value.strip(' ')
        for name in value.split(','):
            # Bug here. Ex: "asf, "'asdf"'
            name = name.strip(' ')
            if not name:
                raise ValidationError("Each name needs to be a non empty "
                                      "domain name surrounded by \"\"")

            if name[0] != '"' and name[len(name) - 1] != '"':
                raise ValidationError("Each name needs to be a non empty "
                                      "domain name surrounded by \"\"")
            validate_name(name.strip('"'))
    def _aa_domain_name(self):
        """
        option domain-name text;

            The 'text' should be a space seperated domain names. I.E.:
            phx.mozilla.com phx1.mozilla.com This option specifies the domain
            name that client should use when resolving hostnames via the Domain
            Name System.
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        value = self._get_value()
        for name in value.split(" "):
            validate_name(name)
        self.value = value
Beispiel #3
0
    def _aa_host_name(self):
        """
        option host-name text;

            This option specifies the name of the client. The name may or may
            not be qualified with the local domain name (it is preferable to
            use the domain-name option to specify the domain name). See RFC
            1035 for character set restrictions. This option is only honored by
            dhclient-script(8) if the hostname for the client machine is not
            set.
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        if not (self.value.startswith('"') and self.value.endswith('"')):
            self.value = '"' + self.value + '"'
        validate_name(self.value.strip('"'))
Beispiel #4
0
    def _aa_host_name(self):
        """
        option host-name text;

            This option specifies the name of the client. The name may or may
            not be qualified with the local domain name (it is preferable to
            use the domain-name option to specify the domain name). See RFC
            1035 for character set restrictions. This option is only honored by
            dhclient-script(8) if the hostname for the client machine is not
            set.
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        if not (self.value.startswith('"') and self.value.endswith('"')):
            self.value = '"' + self.value + '"'
        validate_name(self.value.strip('"'))
Beispiel #5
0
    def _aa_domain_name(self):
        """
        option domain-name text;

            The 'text' should be a space seperated domain names. I.E.:
            phx.mozilla.com phx1.mozilla.com This option specifies the domain
            name that client should use when resolving hostnames via the Domain
            Name System.
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        if (len(self.value) < 2 or not (
                self.value.startswith('"') and self.value.endswith('"'))):
            raise ValidationError(
                "Make sure the domain(s) name have \" \" around them"
            )
        for name in self.value.strip('"').split(' '):
            validate_name(name)