diff options
| author | Brian Bennett <brian.bennett@joyent.com> | 2019-10-29 17:16:05 -0700 |
|---|---|---|
| committer | Dan McDonald <danmcd@joyent.com> | 2019-12-17 10:23:37 -0500 |
| commit | c8236ea6ad6caec3ccd52d13b0345b7881f0c12c (patch) | |
| tree | 68c047b5af71c1c5377b388eb5ade9e618766b4f /usr/src | |
| parent | e58ba7f235f59e7b79c7d4ce4fb02b7adc47273e (diff) | |
| download | illumos-joyent-c8236ea6ad6caec3ccd52d13b0345b7881f0c12c.tar.gz | |
11894 zonecfg export should quote strings
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: Mike Gerdts <mike.gerdts@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/zonecfg/zonecfg.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr/src/cmd/zonecfg/zonecfg.c b/usr/src/cmd/zonecfg/zonecfg.c index 354591185b..d1aaec81db 100644 --- a/usr/src/cmd/zonecfg/zonecfg.c +++ b/usr/src/cmd/zonecfg/zonecfg.c @@ -23,6 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. * Copyright 2014 Gary Mills + * Copyright 2019 Joyent, Inc. */ /* @@ -1822,14 +1823,16 @@ quoteit(char *instr) static void export_prop(FILE *of, int prop_num, char *prop_id) { - char *quote_str; - if (strlen(prop_id) == 0) return; - quote_str = quoteit(prop_id); - (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET), - pt_to_str(prop_num), quote_str); - free(quote_str); + /* + * We're going to explicitly quote all strings on export. + * This should be fine since it seems that no amount of escaping + * will coerce zonecfg to properly parse a double quote as + * part of the string value. + */ + (void) fprintf(of, "%s %s=\"%s\"\n", cmd_to_str(CMD_SET), + pt_to_str(prop_num), prop_id); } void |
