diff options
Diffstat (limited to 'contrib/sendmail/smrsh')
-rw-r--r-- | contrib/sendmail/smrsh/smrsh.8 | 11 | ||||
-rw-r--r-- | contrib/sendmail/smrsh/smrsh.c | 10 |
2 files changed, 14 insertions, 7 deletions
diff --git a/contrib/sendmail/smrsh/smrsh.8 b/contrib/sendmail/smrsh/smrsh.8 index 3b07664..b15a16c 100644 --- a/contrib/sendmail/smrsh/smrsh.8 +++ b/contrib/sendmail/smrsh/smrsh.8 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: smrsh.8,v 8.16.2.1 2003/07/08 01:33:03 gshapiro Exp $ +.\" $Id: smrsh.8,v 8.16.2.2 2003/10/07 18:05:37 ca Exp $ .\" -.TH SMRSH 8 "$Date: 2003/07/08 01:33:03 $" +.TH SMRSH 8 "$Date: 2003/10/07 18:05:37 $" .SH NAME smrsh \- restricted shell for sendmail .SH SYNOPSIS @@ -88,6 +88,11 @@ and/or \-DSMRSH_CMDDIR=\e"\fIdir\fP\e" to change the default program directory (defaults to ``/usr/adm/sm.bin''). .SH FILES -/usr/adm/sm.bin \- directory for restricted programs +/usr/adm/sm.bin \- default directory for restricted programs on most OSs +.PP +/var/adm/sm.bin \- directory for restricted programs on HP UX and Solaris +.PP +/usr/libexec/sm.bin \- directory for restricted programs on FreeBSD (>= 3.3) + .SH SEE ALSO sendmail(8) diff --git a/contrib/sendmail/smrsh/smrsh.c b/contrib/sendmail/smrsh/smrsh.c index 9a9bc21..bfcfcbe 100644 --- a/contrib/sendmail/smrsh/smrsh.c +++ b/contrib/sendmail/smrsh/smrsh.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.58.2.2 2002/09/24 21:40:05 ca Exp $") +SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.58.2.5 2003/12/15 17:09:39 ca Exp $") /* ** SMRSH -- sendmail restricted shell @@ -118,8 +118,9 @@ addcmd(s, cmd, len) if (s == NULL || *s == '\0') return; + /* enough space for s (len) and CMDDIR + "/" and '\0'? */ if (sizeof newcmdbuf - strlen(newcmdbuf) <= - len + (cmd ? (strlen(CMDDIR) + 1) : 0)) + len + 1 + (cmd ? (strlen(CMDDIR) + 1) : 0)) { (void)sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s: command too long: %s\n", prg, par); @@ -130,7 +131,7 @@ addcmd(s, cmd, len) } if (cmd) (void) sm_strlcat2(newcmdbuf, CMDDIR, "/", sizeof newcmdbuf); - (void) sm_strlcat(newcmdbuf, s, sizeof newcmdbuf); + (void) strncat(newcmdbuf, s, len); } int @@ -423,7 +424,8 @@ main(argc, argv) #ifdef DEBUG (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%s\n", newcmdbuf); #endif /* DEBUG */ - (void) execle("/bin/sh", "/bin/sh", "-c", newcmdbuf, NULL, newenv); + (void) execle("/bin/sh", "/bin/sh", "-c", newcmdbuf, + (char *)NULL, newenv); save_errno = errno; #ifndef DEBUG syslog(LOG_CRIT, "Cannot exec /bin/sh: %s", sm_errstring(errno)); |