Mike Gerdts wrote:
> On Mon, May 12, 2008 at 3:20 PM, Terry Smith <[EMAIL PROTECTED]> wrote:
>> Hi I seem to have found a small problem with zoneadm
>>
>> I have configured a zone called "2" in this case.
> 
> Interesting.  Zones shouldn't be able to be named that.
> 
> 
>>From <sys/zone.h>:
> 
> /*
>  * Extended Regular expression (see regex(5)) which matches all valid zone
>  * names.
>  */
> #define ZONENAME_REGEXP         "[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}"

Hi,

Actually, this allows zone names to start with either
[a-z], [A-Z] or [0-9]

followed by 0 to 62 of any of [-_.a-zA-Z0-9]

So from this it would seem that "2" is a valid, but perhaps unexpected zone 
name.

HTH,

Warren

> That is, a zone name is required to start with a letter.  It looks
> like code to prevent it has existed in Nevada since Septemer 2005
> (PSARC 2005/485).
> 
> libzonecfg.c:
> 
>     795 int
>     796 zonecfg_validate_zonename(const char *zone)
>     797 {
>     798       int i;
>     799
>     800       if (strcmp(zone, GLOBAL_ZONENAME) == 0)
>     801               return (Z_BOGUS_ZONE_NAME);
>     802
>     803       if (strlen(zone) >= ZONENAME_MAX)
>     804               return (Z_BOGUS_ZONE_NAME);
>     805
>     806       if (!((zone[0] >= 'a' && zone[0] <= 'z') ||
>     807           (zone[0] >= 'A' && zone[0] <= 'Z') ||
>     808           (zone[0] >= '0' && zone[0] <= '9')))
>     809               return (Z_BOGUS_ZONE_NAME);
>     810
>     811       for (i = 1; zone[i] != '\0'; i++) {
>     812               if (!((zone[i] >= 'a' && zone[i] <= 'z') ||
>     813                   (zone[i] >= 'A' && zone[i] <= 'Z') ||
>     814                   (zone[i] >= '0' && zone[i] <= '9') ||
>     815                   (zone[i] == '-') || (zone[i] == '_') || (zone[i] == 
> '.')))
>     816                       return (Z_BOGUS_ZONE_NAME);
>     817       }
>     818
>     819       return (Z_OK);
>     820 }
> 
> 
>> When I try and install the zone named "2" it seems to pick up the zone
>> with the instance ID of 2 instead and gives me an error saying install
>> operation is invalid for running zones.
> 
> The source and man page seem to be out of sync in the argument for the
> -z option:
> 
> zoneadm(1M) man page from snv_87:
> 
> SYNOPSIS
>      zoneadm -z zonename [-u uuid-match] subcommand
>          [subcommand_options]
> 
>      zoneadm [-R root] [-z zonename] [-u uuid-match] list
>          [list_options]
> 
>      zoneadm [-R root] -z zonename [-u uuid-match] mark incomplete
> . . .
> 
>      -z zonename
> 
>          String identifier for a zone.
> 
> 
> zone_get_id in libzonecfg.c:
> 
>    5248       /* first try looking for active zone by id */
>    5249       errno = 0;
>    5250       zoneid = (zoneid_t)strtol(str, &cp, 0);
>    5251       if (errno == 0 && cp != str && *cp == '\0' &&
>    5252           getzonenamebyid(zoneid, NULL, 0) != -1) {
>    5253               *zip = zoneid;
>    5254               return (0);
>    5255       }
>    5256
>    5257       /* then look for active zone by name */
>    5258       if ((zoneid = getzoneidbyname(str)) != -1) {
>    5259               *zip = zoneid;
>    5260               return (0);
>    5261       }
> 
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to