Print this page
11894 zonecfg export should quote strings

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zonecfg/zonecfg.c
          +++ new/usr/src/cmd/zonecfg/zonecfg.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  25   25   * Copyright 2014 Gary Mills
       26 + * Copyright 2019 Joyent, Inc.
  26   27   */
  27   28  
  28   29  /*
  29   30   * zonecfg is a lex/yacc based command interpreter used to manage zone
  30   31   * configurations.  The lexer (see zonecfg_lex.l) builds up tokens, which
  31   32   * the grammar (see zonecfg_grammar.y) builds up into commands, some of
  32   33   * which takes resources and/or properties as arguments.  See the block
  33   34   * comments near the end of zonecfg_grammar.y for how the data structures
  34   35   * which keep track of these resources and properties are built up.
  35   36   *
↓ open down ↓ 1784 lines elided ↑ open up ↑
1820 1821  }
1821 1822  
1822 1823  static void
1823 1824  export_prop(FILE *of, int prop_num, char *prop_id)
1824 1825  {
1825 1826          char *quote_str;
1826 1827  
1827 1828          if (strlen(prop_id) == 0)
1828 1829                  return;
1829 1830          quote_str = quoteit(prop_id);
1830      -        (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET),
     1831 +        (void) fprintf(of, "%s %s=\"%s\"\n", cmd_to_str(CMD_SET),
1831 1832              pt_to_str(prop_num), quote_str);
1832 1833          free(quote_str);
1833 1834  }
1834 1835  
1835 1836  void
1836 1837  export_func(cmd_t *cmd)
1837 1838  {
1838 1839          struct zone_nwiftab nwiftab;
1839 1840          struct zone_fstab fstab;
1840 1841          struct zone_devtab devtab;
↓ open down ↓ 5780 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX