]>
Commit | Line | Data |
---|---|---|
00326db2 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.265 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.265 | |
11 | Problem: Although ":set" is not allowed in the sandbox, ":let &opt = val" | |
12 | works. | |
13 | Solution: Do allow changing options in the sandbox, but not the ones that | |
14 | can't be changed from a modeline. | |
15 | Files: src/ex_cmds.h, src/option.c | |
16 | ||
17 | ||
18 | *** ../vim-6.2.264/src/ex_cmds.h Tue Feb 10 19:35:15 2004 | |
19 | --- src/ex_cmds.h Mon Feb 16 17:06:54 2004 | |
20 | *************** | |
21 | *** 687,693 **** | |
22 | EX(CMD_scscope, "scscope", do_scscope, | |
23 | EXTRA|NOTRLCOM|SBOXOK), | |
24 | EX(CMD_set, "set", ex_set, | |
25 | ! TRLBAR|EXTRA|CMDWIN), | |
26 | EX(CMD_setfiletype, "setfiletype", ex_setfiletype, | |
27 | TRLBAR|EXTRA|NEEDARG|CMDWIN), | |
28 | EX(CMD_setglobal, "setglobal", ex_set, | |
29 | --- 687,693 ---- | |
30 | EX(CMD_scscope, "scscope", do_scscope, | |
31 | EXTRA|NOTRLCOM|SBOXOK), | |
32 | EX(CMD_set, "set", ex_set, | |
33 | ! TRLBAR|EXTRA|CMDWIN|SBOXOK), | |
34 | EX(CMD_setfiletype, "setfiletype", ex_setfiletype, | |
35 | TRLBAR|EXTRA|NEEDARG|CMDWIN), | |
36 | EX(CMD_setglobal, "setglobal", ex_set, | |
37 | *** ../vim-6.2.264/src/option.c Wed Feb 4 21:42:30 2004 | |
38 | --- src/option.c Tue Feb 17 11:17:55 2004 | |
39 | *************** | |
40 | *** 3393,3398 **** | |
41 | --- 3425,3439 ---- | |
42 | goto skip; | |
43 | } | |
44 | ||
45 | + #ifdef HAVE_SANDBOX | |
46 | + /* Disallow changing some options in the sandbox */ | |
47 | + if (sandbox > 0 && (flags & P_SECURE)) | |
48 | + { | |
49 | + errmsg = (char_u *)_(e_sandbox); | |
50 | + goto skip; | |
51 | + } | |
52 | + #endif | |
53 | + | |
54 | if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) | |
55 | { | |
56 | arg += len; | |
57 | *************** | |
58 | *** 6950,6970 **** | |
59 | { | |
60 | int opt_idx; | |
61 | char_u *varp; | |
62 | ||
63 | opt_idx = findoption(name); | |
64 | if (opt_idx == -1) | |
65 | EMSG2(_("E355: Unknown option: %s"), name); | |
66 | - else if (options[opt_idx].flags & P_STRING) | |
67 | - set_string_option(opt_idx, string, opt_flags); | |
68 | else | |
69 | { | |
70 | ! varp = get_varp(&options[opt_idx]); | |
71 | ! if (varp != NULL) /* hidden option is not changed */ | |
72 | { | |
73 | ! if (options[opt_idx].flags & P_NUM) | |
74 | ! (void)set_num_option(opt_idx, varp, number, NULL, opt_flags); | |
75 | ! else | |
76 | ! (void)set_bool_option(opt_idx, varp, (int)number, opt_flags); | |
77 | } | |
78 | } | |
79 | } | |
80 | --- 7007,7038 ---- | |
81 | { | |
82 | int opt_idx; | |
83 | char_u *varp; | |
84 | + int flags; | |
85 | ||
86 | opt_idx = findoption(name); | |
87 | if (opt_idx == -1) | |
88 | EMSG2(_("E355: Unknown option: %s"), name); | |
89 | else | |
90 | { | |
91 | ! flags = options[opt_idx].flags; | |
92 | ! #ifdef HAVE_SANDBOX | |
93 | ! /* Disallow changing some options in the sandbox */ | |
94 | ! if (sandbox > 0 && (flags & P_SECURE)) | |
95 | ! EMSG(_(e_sandbox)); | |
96 | ! else | |
97 | ! #endif | |
98 | ! if (flags & P_STRING) | |
99 | ! set_string_option(opt_idx, string, opt_flags); | |
100 | ! else | |
101 | { | |
102 | ! varp = get_varp(&options[opt_idx]); | |
103 | ! if (varp != NULL) /* hidden option is not changed */ | |
104 | ! { | |
105 | ! if (flags & P_NUM) | |
106 | ! (void)set_num_option(opt_idx, varp, number, NULL, opt_flags); | |
107 | ! else | |
108 | ! (void)set_bool_option(opt_idx, varp, (int)number, opt_flags); | |
109 | ! } | |
110 | } | |
111 | } | |
112 | } | |
113 | *** ../vim-6.2.264/src/version.c Tue Feb 17 20:22:36 2004 | |
114 | --- src/version.c Tue Feb 17 20:38:04 2004 | |
115 | *************** | |
116 | *** 639,640 **** | |
117 | --- 639,642 ---- | |
118 | { /* Add new patch number below this line */ | |
119 | + /**/ | |
120 | + 265, | |
121 | /**/ | |
122 | ||
123 | -- | |
124 | In Joseph Heller's novel "Catch-22", the main character tries to get out of a | |
125 | war by proving he is crazy. But the mere fact he wants to get out of the war | |
126 | only shows he isn't crazy -- creating the original "Catch-22". | |
127 | ||
128 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
129 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
130 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
131 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |