home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.265 < prev    next >
Encoding:
Internet Message Format  |  2004-02-16  |  3.7 KB

  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.           if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL)
  54.           {
  55.           arg += len;
  56. ***************
  57. *** 6950,6970 ****
  58.   {
  59.       int        opt_idx;
  60.       char_u    *varp;
  61.   
  62.       opt_idx = findoption(name);
  63.       if (opt_idx == -1)
  64.       EMSG2(_("E355: Unknown option: %s"), name);
  65. -     else if (options[opt_idx].flags & P_STRING)
  66. -     set_string_option(opt_idx, string, opt_flags);
  67.       else
  68.       {
  69. !     varp = get_varp(&options[opt_idx]);
  70. !     if (varp != NULL)    /* hidden option is not changed */
  71.       {
  72. !         if (options[opt_idx].flags & P_NUM)
  73. !         (void)set_num_option(opt_idx, varp, number, NULL, opt_flags);
  74. !         else
  75. !         (void)set_bool_option(opt_idx, varp, (int)number, opt_flags);
  76.       }
  77.       }
  78.   }
  79. --- 7007,7038 ----
  80.   {
  81.       int        opt_idx;
  82.       char_u    *varp;
  83. +     int        flags;
  84.   
  85.       opt_idx = findoption(name);
  86.       if (opt_idx == -1)
  87.       EMSG2(_("E355: Unknown option: %s"), name);
  88.       else
  89.       {
  90. !     flags = options[opt_idx].flags;
  91. ! #ifdef HAVE_SANDBOX
  92. !     /* Disallow changing some options in the sandbox */
  93. !     if (sandbox > 0 && (flags & P_SECURE))
  94. !         EMSG(_(e_sandbox));
  95. !     else
  96. ! #endif
  97. !       if (flags & P_STRING)
  98. !         set_string_option(opt_idx, string, opt_flags);
  99. !     else
  100.       {
  101. !         varp = get_varp(&options[opt_idx]);
  102. !         if (varp != NULL)    /* hidden option is not changed */
  103. !         {
  104. !         if (flags & P_NUM)
  105. !             (void)set_num_option(opt_idx, varp, number, NULL, opt_flags);
  106. !         else
  107. !             (void)set_bool_option(opt_idx, varp, (int)number, opt_flags);
  108. !         }
  109.       }
  110.       }
  111.   }
  112. *** ../vim-6.2.264/src/version.c    Tue Feb 17 20:22:36 2004
  113. --- src/version.c    Tue Feb 17 20:38:04 2004
  114. ***************
  115. *** 639,640 ****
  116. --- 639,642 ----
  117.   {   /* Add new patch number below this line */
  118. + /**/
  119. +     265,
  120.   /**/
  121.  
  122. -- 
  123. In Joseph Heller's novel "Catch-22", the main character tries to get out of a
  124. war by proving he is crazy.  But the mere fact he wants to get out of the war
  125. only shows he isn't crazy -- creating the original "Catch-22".
  126.  
  127.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  128. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  129. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  130.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  131.