home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / admin / 4395 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  2.5 KB

  1. Path: sparky!uunet!usc!wupost!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!rutgers!modus!gear!cadlab!albani
  2. From: albani@cadlab.sublink.org (Lanfranco Albani)
  3. Newsgroups: comp.unix.admin
  4. Subject: Re: allowing users root access to specific commands
  5. Message-ID: <1992Jul29.094031.6915@cadlab.sublink.org>
  6. Date: 29 Jul 92 09:40:31 GMT
  7. References: <1992Jul24.130911.6009@dragon.acadiau.ca> <Brwt1v.2pL@acsu.buffalo.edu> <BrzE3L.A1q@watdragon.waterloo.edu>
  8. Organization: CAD.LAB S.p.A., Bologna, Italia
  9. Lines: 69
  10.  
  11. jmsellen@watdragon.waterloo.edu writes:
  12.  
  13. :hinkle@cs.Buffalo.EDU (Steven J. Hinkle) writes:
  14. :|   We use a program called 'sudo'.  It is available via anonymous ftp from 
  15. :|boulder.colorado.edu in /pub/sa-book/sudo
  16. :|
  17.  
  18. We are trying to use the version found in the Unix System
  19. Administration Handbook by Nemeth, Snyder, Seebass.
  20.  
  21. We found a couple of bugs.
  22.  
  23. First, in the function errexit() there is a duplicated fragment:
  24.  
  25.     if((fd = popen(cmd, "w")) == NULL)
  26.     {
  27.         return;
  28.     }
  29.  
  30. the first occurrence has the buffer cmd uninitialized, and is
  31. useless.
  32.  
  33. Second, in the function checkdoer() there is a nasty bug:
  34. the following fragment succeds for every occurrence of all* !!!
  35.  
  36.     if(strncmp(cp0,"all",3) == 0)
  37.  
  38. we change it to:
  39.  
  40.     if(strcmp(cp0,"all\n") == 0)
  41.  
  42. :The mailmsg() routine has
  43. :    char cmd[80];
  44. :    (void) sprintf(cmd,
  45. :        "/usr/ucb/mail -s \"*SECURITY* %s@%s tried to execute %s\" %s ",
  46. :        user,hostname,*argv,ALERTMAIL);
  47. :If I'm counting correctly, there are 27 bytes available to hold user, hostname,
  48. :the command attempted, the ALERTMAIL userid, and the trailing '\0'.  And
  49. :hostname is declared as MAXHOSTNAMELEN long.  What happens when
  50. :sprintf overflows?
  51.  
  52. We change the mail routines to use /bin/mail (have it on all our
  53. unix boxes), but /bin/mail doesn't support the -s "Subject" syntax,
  54. so another modify to the sources, and this solve the problem you
  55. checked, as follow:
  56.  
  57.     (void) sprintf(cmd,"/bin/mail %s",ALERTMAIL);
  58.     if((fd = popen(cmd, "w")) == NULL)
  59.     {
  60.         return;
  61.     }
  62.     fprintf(fd,"Subject: *SECURITY* %s@%s -> %s\n",
  63.             user, hostname, *argv);
  64.     fprintf(fd, "%s@%s ha tentato di eseguire\n\n",
  65.             user, hostname);
  66.     while(argc--)
  67.     {
  68.         (void) fputs(*argv++, fd);
  69.         (void) fputc(' ', fd);
  70.     }
  71.     (void) fputs("\n\nGiusto per farlo sapere.", fd);
  72.  
  73. Bye, Lanfranco
  74.  
  75. -- 
  76. Lanfranco Albani - CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia
  77. Email: (work:) albani@cadlab.sublink.org, (home:) bob@allan.sublink.org
  78. Phone: (work:) ++39 (51) 6130360, (home:) ++39 (51) 727372; 
  79. Fax: ++39 (51) 6130294 (work only), Fidonet: 2:332/407.1138 (home only).
  80.