Cannot add a zone in brand new setup (2.2.1)



  • Tried to add a zone in captive portal and see this in the Logs…

    Mar 22 17:03:29 php-fpm[25111]: /services_captiveportal_zones_edit.php: XML error: XML_ERR_NAME_REQUIRED at line 515 in /conf/config.xml
    Mar 22 17:03:29 php-fpm[25111]: /services_captiveportal_zones_edit.php: pfSense is restoring the configuration /cf/conf/backup/config-1427064860.xml

    Filled out both fields… Am I missing something obvious?

    Brand new install, just assigned some NICs, enabled DHCP, declared some aliases... nothing else.

    Thx

    Peter


  • Banned

    Sounds like you forgot to configure zone name? Though I don't see how you managed that, seems impossible to skip.



  • http://pfsense/services_captiveportal_zones_edit.php - I can not get past the first form without entering a zone name (descriptions seems/is optional).
    What are you using as a zone name ? Some 'illegal' (XML) characters ?



  • Name is a mandatory field… if you leave it blank you get

    The following input errors were detected:

    The field Zone name is required.

    when you click on continue...

    So I filled it out (as I did with the description field)... BUT you got me thinking...

    I originally used a name starting with a number 3PartyZone... so I tried CPzone and guess what... problem solved.

    After 2 more tests it is obvious that the name of a CP zone cannot start with a number.
    I am not a XML specialist at all, but would find it very odd that you cannot start a name with a number.

    Not sure if this a minor bug or a a (un)documented feature ...
    The help line under the field says Zone name. Can only contain letters, digits, and underscores (_).
    Would be nice if it stated "and has to begin with a letter."

    Thx to get my brain going

    Peter



  • @peterlinuxgeek:

    I originally used a name starting with a number 3PartyZone… so I tried CPzone and guess what... problem solved.

    After 2 more tests it is obvious that the name of a CP zone cannot start with a number.

    I confirm.

    I created a new captive portal zone, named "3Zone".
    This was the result (see image).

    pfSense doesn't like captive portal zone names that start with a number …...
    This might be a feature or a bug .... I don't know, but I can't see why this should be a XML limitation.

    edit: this is the zone-name limitation: /usr/local/www/services_captiveportal_zones_edit.php - line 65
    Is says :

    	if (preg_match('/[^A-Za-z0-9_]/', $_POST['zone'])) {
    		$input_errors[] = gettext("The zone name can only contain letters, digits, and underscores (_).");
    

    It might be a good idea to force the first character to a letter - non a number, by modifying the preg_match as follows :
    '/[^A-Za-z][A-Za-z0-9_]/'



  • Banned

    Someone file a bug, needs input validation in the GUI.



  • Yep, it looks like current validation isn't strong enough :  http://www.w3.org/TR/xml11/#sec-common-syn 
    The first char (also called NameStartChar ) has limitations :

    ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]


Log in to reply