Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.
Remove requirement for "sys/types.h" include for functions from manpage.
POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.
Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.
PR: standards/142255
MFC after: 2 weeks
about a queue from a remote host. That remote host may use \r, \r\n,
or \n\r as the line-ending character. In some cases the remote host
will write a single line of information without *any* EOL sequence.
Translate all the non-unix EOL's to the standard newline, and make
sure the final line includes a terminating newline. Logic is also
added to translate all unprintable characters to '?', but that is
#if-ed out for now.
PR: bin/104731
MFC after: 3 weeks
system callers of getgroups(), getgrouplist(), and setgroups() to
allocate buffers dynamically. Specifically, allocate a buffer of size
sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow).
This (or similar gymnastics) is required for the code to actually follow
the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime
and where getgroups may return {NGROUPS_MAX}+1 results on systems like
FreeBSD which include the primary group.
In id(1), don't pointlessly add the primary group to the list of all
groups, it is always the first result from getgroups(). In principle
the old code was more portable, but this was only done in one of the two
places where getgroups() was called to the overall effect was pointless.
Document the actual POSIX requirements in the getgroups(2) and
setgroups(2) manpages. We do not yet support a dynamic NGROUPS, but we
may in the future.
MFC after: 2 weeks
so that the checking will wind up with the correct mode-bits in
the case where the initial open() of that lock file will create it.
Due to this bug, the first job ever sent to a queue could leave
that queue in a "printing is disabled" state.
PR: 93469
Submitted by: Michael Szklarski of kco.com.pl
MFC after: 1 week
properly initialized, that happens when lpc is called from a tty.
Without this change, it's possible to get SIGSEGV simply doing:
echo "..:" | lpc
Reported by: Wojciech A. Koszek <dunstan at freebsd czest pl>
PR: 77462 (patch rewritten by myself)
MFC After: 1 week
for calculating the job number for a job based on the control-file name.
We might receive cf-files named by other implementations of lpr, where
the job number shown by lpq would not match the job number that other
commands expected for the same name.
This also uses a newer algorithm for determining a job number, to avoid
problems caused when a control-file is named using an IP address, instead
of the hostname.
This also moved the declaration if isowner() from lp.h to rmjob.c. When I
went to change the parameters, I noticed that rmjob.c was the only source
file which uses it.
MFC after: 2 weeks
control-file for each print job. This is partially because the previous
checks still let through some characters which would cause trouble for
other applications which try to process the resulting userid -- such as
accounting programs.
But the main reason is to handle the case where some remote host sends a
print job where the given userid is an uppercase-version of the real userid.
For that case, lpd will now check for uppercase letters in the userid. If
there are any, it will check to see if the given userid (with the uppercase
letters) is a valid one. If it is *not* valid, then lpd will change the
userid to all-lowercase right when the job is received.
MFC after: 2 weeks
the file will be created with the right access, if the call to open()
does create it. Also fix the other call to umask() to turn off
"write others", just as a matter of general safety.
PR: 74418
MFC after: 4 days
sure the data file has been completely transfered before starting to
print it. This is needed because some implementations of lpr will send
the control-file for a print job before sending the matching data-files,
and that can cause problems if the receiving host is a busy print-server.
MFC after: 2 weeks
character 1 byte past the end of cmdline[] when libedit is being used for
input, and avoid writing a null pointer 1 element past the end of margv[].
Reviewed by: gad
when reading/writing spool files. I intend to do a more elaborate
version, but I want to get this much in before 4.9-release. As written,
this results in no change to the object code.
Submitted by: John-Mark Gurney
Reviewed by: /sbin/md5
MFC after: 4 days
format of 'sccsid' lines so they consistently match style(9).
A minor Makefile change is needed so lptest.c can find lp.cdefs.h.
Reviewed by: discussed with bde and obrien
MFC after: 15 days
format of 'sccsid' lines so they consistently match style(9)
Also the 'sccsid' line is formatted to match style(9), and
a 'From:' is removed so the sccsid returns to what it was back
in the days of '-r CSRG' (1996).
Reviewed by: discussed with bde and obrien
MFC after: 15 days
programs, minor Makefile changes are needed to find lp.cdefs.h.
For lpf.c, the 'sccsid' line is formatted to match style(9), and
a 'From:' is removed so the sccsid returns to what it was back
in the days of '-r CSRG' (1994).
Reviewed by: discussed with bde and obrien
MFC after: 15 days
format of 'sccsid' lines so they consistently match style(9)
guidelines. Note that this means you will have to add '-a' to
the 'strings' command when searching for rcs ids, eg:
strings -a /usr/sbin/lpc | grep '$FreeBSD'
Reviewed by: discussed on cvs-src & with bde and obrien
MFC after: 15 days
'#ifdef lint/#endif' around the lines should not have been removed.
Also add blank lines where one (per file) was missing.
Reviewed by: First part noticed by bde, blank lines noticed by me
MFC after: 15 days
get from '-r CSRG', instead of having that sccsid as a comment.
(this is the sccsid from 1996 -- there have been many changes to
printcap.c since then!)
MFC after: 15 days
format of 'sccsid' lines so they consistently match style(9)
guidelines. Inspired by recent update to lpd.c by charnier.
Reviewed by: discussed on cvs-src & with bde and obrien
MFC after: 15 days
source to use __FBSDID() for setting rcsids. Also fix the format
of 'sccsid' lines to consistently match style(9) guidelines.
Reviewed by: discussed with bde and obrien
MFC after: 15 days
somewhat easier to build this lpr on other operating systems.
This simply includes <sys/cdefs.h> when that is appropriate,
and then checks for any cdefs-ish macros that lpr uses, and
defines them if they don't already exist. This is only a start
at making freebsd's lpr less of a hassle to port. It is mainly
added so all of lpr can be changed to use the __FBSDID() macro,
without making it *more* of a hassle to build on other OS's.
Reviewed by: discussed with bde and obrien
MFC after: 15 days