Don't use UT_NAMESIZE here to determine the maximum username length.
This commit is contained in:
parent
893d013cf6
commit
f195f6269e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200982
@ -49,7 +49,6 @@ static const char rcsid[] =
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <utmp.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <paths.h>
|
||||
#else
|
||||
@ -63,12 +62,6 @@ static const char rcsid[] =
|
||||
#include <security/openpam.h>
|
||||
#endif
|
||||
|
||||
#if (MAXLOGNAME-1) > UT_NAMESIZE
|
||||
#define LOGNAMESIZE UT_NAMESIZE
|
||||
#else
|
||||
#define LOGNAMESIZE (MAXLOGNAME-1)
|
||||
#endif
|
||||
|
||||
/* Local headers */
|
||||
|
||||
#include "gloadavg.h"
|
||||
@ -130,7 +123,7 @@ run_file(const char *filename, uid_t uid, gid_t gid)
|
||||
pid_t pid;
|
||||
int fd_out, fd_in;
|
||||
int queue;
|
||||
char mailbuf[LOGNAMESIZE + 1], fmt[49];
|
||||
char mailbuf[MAXLOGNAME], fmt[49];
|
||||
char *mailname = NULL;
|
||||
FILE *stream;
|
||||
int send_mail = 0;
|
||||
@ -231,7 +224,7 @@ run_file(const char *filename, uid_t uid, gid_t gid)
|
||||
|
||||
snprintf(fmt, sizeof(fmt),
|
||||
"#!/bin/sh\n# atrun uid=%%ld gid=%%ld\n# mail %%%ds %%d",
|
||||
LOGNAMESIZE);
|
||||
MAXLOGNAME - 1);
|
||||
|
||||
if (fscanf(stream, fmt, &nuid, &ngid, mailbuf, &send_mail) != 4)
|
||||
perrx("File %s is in wrong format - aborting", filename);
|
||||
|
Loading…
Reference in New Issue
Block a user