home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!wupost!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!rutgers!modus!gear!cadlab!albani
- From: albani@cadlab.sublink.org (Lanfranco Albani)
- Newsgroups: comp.unix.admin
- Subject: Re: allowing users root access to specific commands
- Message-ID: <1992Jul29.094031.6915@cadlab.sublink.org>
- Date: 29 Jul 92 09:40:31 GMT
- References: <1992Jul24.130911.6009@dragon.acadiau.ca> <Brwt1v.2pL@acsu.buffalo.edu> <BrzE3L.A1q@watdragon.waterloo.edu>
- Organization: CAD.LAB S.p.A., Bologna, Italia
- Lines: 69
-
- jmsellen@watdragon.waterloo.edu writes:
-
- :hinkle@cs.Buffalo.EDU (Steven J. Hinkle) writes:
- :| We use a program called 'sudo'. It is available via anonymous ftp from
- :|boulder.colorado.edu in /pub/sa-book/sudo
- :|
-
- We are trying to use the version found in the Unix System
- Administration Handbook by Nemeth, Snyder, Seebass.
-
- We found a couple of bugs.
-
- First, in the function errexit() there is a duplicated fragment:
-
- if((fd = popen(cmd, "w")) == NULL)
- {
- return;
- }
-
- the first occurrence has the buffer cmd uninitialized, and is
- useless.
-
- Second, in the function checkdoer() there is a nasty bug:
- the following fragment succeds for every occurrence of all* !!!
-
- if(strncmp(cp0,"all",3) == 0)
-
- we change it to:
-
- if(strcmp(cp0,"all\n") == 0)
-
- :The mailmsg() routine has
- : char cmd[80];
- : (void) sprintf(cmd,
- : "/usr/ucb/mail -s \"*SECURITY* %s@%s tried to execute %s\" %s ",
- : user,hostname,*argv,ALERTMAIL);
- :If I'm counting correctly, there are 27 bytes available to hold user, hostname,
- :the command attempted, the ALERTMAIL userid, and the trailing '\0'. And
- :hostname is declared as MAXHOSTNAMELEN long. What happens when
- :sprintf overflows?
-
- We change the mail routines to use /bin/mail (have it on all our
- unix boxes), but /bin/mail doesn't support the -s "Subject" syntax,
- so another modify to the sources, and this solve the problem you
- checked, as follow:
-
- (void) sprintf(cmd,"/bin/mail %s",ALERTMAIL);
- if((fd = popen(cmd, "w")) == NULL)
- {
- return;
- }
- fprintf(fd,"Subject: *SECURITY* %s@%s -> %s\n",
- user, hostname, *argv);
- fprintf(fd, "%s@%s ha tentato di eseguire\n\n",
- user, hostname);
- while(argc--)
- {
- (void) fputs(*argv++, fd);
- (void) fputc(' ', fd);
- }
- (void) fputs("\n\nGiusto per farlo sapere.", fd);
-
- Bye, Lanfranco
-
- --
- Lanfranco Albani - CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia
- Email: (work:) albani@cadlab.sublink.org, (home:) bob@allan.sublink.org
- Phone: (work:) ++39 (51) 6130360, (home:) ++39 (51) 727372;
- Fax: ++39 (51) 6130294 (work only), Fidonet: 2:332/407.1138 (home only).
-