mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Use sysconf(_SC_ARG_MAX) instead of NCARGS.
This commit is contained in:
parent
fd757c50f6
commit
13b68b3267
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143907
@ -132,7 +132,8 @@ main(int argc, char *argv[])
|
||||
static void
|
||||
doit(struct sockaddr *fromp)
|
||||
{
|
||||
char cmdbuf[NCARGS+1], *cp;
|
||||
char *cmdbuf, *cp;
|
||||
int maxcmdlen;
|
||||
char user[16], pass[16];
|
||||
struct passwd *pwd;
|
||||
int fd, r, sd;
|
||||
@ -142,6 +143,10 @@ doit(struct sockaddr *fromp)
|
||||
char buf[BUFSIZ], sig;
|
||||
int one = 1;
|
||||
|
||||
maxcmdlen = (int)sysconf(_SC_ARG_MAX);
|
||||
if (maxcmdlen <= 0 || (cmdbuf = malloc(maxcmdlen)) == NULL)
|
||||
exit(1);
|
||||
|
||||
(void) signal(SIGINT, SIG_DFL);
|
||||
(void) signal(SIGQUIT, SIG_DFL);
|
||||
(void) signal(SIGTERM, SIG_DFL);
|
||||
@ -182,7 +187,7 @@ doit(struct sockaddr *fromp)
|
||||
}
|
||||
getstr(user, sizeof(user), "username");
|
||||
getstr(pass, sizeof(pass), "password");
|
||||
getstr(cmdbuf, sizeof(cmdbuf), "command");
|
||||
getstr(cmdbuf, maxcmdlen, "command");
|
||||
(void) alarm(0);
|
||||
|
||||
if ((pwd = getpwnam(user)) == NULL || (pwd->pw_uid = 0 && no_uid_0) ||
|
||||
|
@ -195,12 +195,17 @@ doit(struct sockaddr *fromp)
|
||||
int one = 1;
|
||||
const char *cp, *errorstr;
|
||||
char sig, buf[BUFSIZ];
|
||||
char cmdbuf[NCARGS+1], luser[16], ruser[16];
|
||||
char *cmdbuf, luser[16], ruser[16];
|
||||
char rhost[2 * MAXHOSTNAMELEN + 1];
|
||||
char numericname[INET6_ADDRSTRLEN];
|
||||
int af, srcport;
|
||||
int maxcmdlen;
|
||||
login_cap_t *lc;
|
||||
|
||||
maxcmdlen = (int)sysconf(_SC_ARG_MAX);
|
||||
if (maxcmdlen <= 0 || (cmdbuf = malloc(maxcmdlen)) == NULL)
|
||||
exit(1);
|
||||
|
||||
(void) signal(SIGINT, SIG_DFL);
|
||||
(void) signal(SIGQUIT, SIG_DFL);
|
||||
(void) signal(SIGTERM, SIG_DFL);
|
||||
@ -301,7 +306,7 @@ doit(struct sockaddr *fromp)
|
||||
(void) alarm(60);
|
||||
getstr(ruser, sizeof(ruser), "ruser");
|
||||
getstr(luser, sizeof(luser), "luser");
|
||||
getstr(cmdbuf, sizeof(cmdbuf), "command");
|
||||
getstr(cmdbuf, maxcmdlen, "command");
|
||||
(void) alarm(0);
|
||||
|
||||
pam_err = pam_start("rsh", luser, &pamc, &pamh);
|
||||
|
Loading…
Reference in New Issue
Block a user