home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / gopher / 1071 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  1.7 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!wupost!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!fstop.csc.ti.com!choctaw!peterson
  2. From: peterson@choctaw.NoSubdomain.NoDomain (Bob Peterson)
  3. Newsgroups: alt.gopher
  4. Subject: Escaping shell metacharacters
  5. Message-ID: <1992Jul24.205632.17295@csc.ti.com>
  6. Date: 24 Jul 92 20:56:32 GMT
  7. Sender: usenet@csc.ti.com
  8. Reply-To: peterson@csc.ti.com
  9. Organization: Texas Instruments Computer Science Lab
  10. Lines: 28
  11. Nntp-Posting-Host: choctaw
  12.  
  13.  
  14.   Over the past few days I used Mike Macgirvin's
  15. (mtm@camis.Stanford.EDU) WHOIS/FINGER hack (alt.gopher article
  16. <mtm.711060422@CAMIS>) to implement in our Gopher 1.01 queries of the
  17. local Archie index.  In doing so I suddenly discovered my Archie query
  18. using the regular expression ^emacs caused _execution_ of emacs, rather
  19. than executing the archie shell script with an argument of ^emacs.  The
  20. shell (/bin/csh under SunOS 4.1.2) interpreted the caret as a
  21. metacharacter, terminated the line up to and including the caret, then
  22. executed emacs.
  23.  
  24.   In short, gopherd`s exec: processing needs to strip or escape
  25. characters with special meaning.  Failing to handle special characters
  26. opens a security hold, e.g., if instead of searching for files matching
  27. the regular expression "^emacs" I had searched for "^rm -rf *", well,
  28. you get the idea.
  29.  
  30.   The new code should probably go into gopherd/special.c just after
  31. line 64, "s[strlen(s)-1] = '\0';".  I've not yet debugged the necessary
  32. code.
  33.  
  34.     Bob
  35.  
  36. --
  37. Bob Peterson             Work: peterson@csc.ti.com              Expressway Site
  38. Texas Instruments        Home: peterson@zgnews.lonestar.org     North Building
  39. P.O. Box 655474, MS238   TIMSG: RWP  Landline: +1 214 995 6080  Aisle A4
  40. Dallas, Tx USA 75265                 FAX line: +1 214 995 0304  2-88V97
  41.