History log of /freebsd-10-stable/usr.sbin/lpr/common_source/matchjobs.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 220586 12-Apr-2011 gad

- Fix the code that matches userids in match_jobspec(). It needs to check
the username-for-accounting field (P), not the username-for-headerpage (L).
These are usually the same value, except that control files do not have
the username-for-headerpage field if the user has requested no header page.
- Also rename the cji_username field to cji_headruser, to make it clear that
the value should only be used for the header page. (aka banner page)

MFC after: 3 weeks


# 139464 30-Dec-2004 gad

Fix so all parts of lpd, lpc, lpq, and lprm will use the same algorithm
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


# 117541 14-Jul-2003 gad

Take advantage of the common_source/lp.cdefs.h file to change lpr
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


# 101677 11-Aug-2002 schweikh

Fix typos; each file has at least one s/seperat/separat/
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.

Suggested by: bde
MFC after: 3 days


# 100204 16-Jul-2002 gad

The new implementation of 'lpc topq' is intended to be upwardly compatible
with the previous implementation. One noticeable difference is the order
in which messages are printed. In the previous implementation, the
command "lpc topq lp 1 20 300" might print:

lp:
moved cfA300some.host.org
moved cfA020some.host.org
moved cfA001some.host.org

while in the new implementation you'll see:

lp:
moved cfA001some.host.org
moved cfA020some.host.org
moved cfA300some.host.org

The final order of jobs in the queue is exactly the same, it's just
that the jobs are now moved in the same order they were specified,
instead of being moved (and thus listed) in the reverse order.

The new implementation also supports more options for how to select
which jobs should be moved. The previous topq allowed the user to
select jobs based on a job number, or based on a userid:
topq lp 17
topq lp drosehn

The new one also allows for a range of job numbers, or a hostname
(matching jobs that were sent from that hostname). To specify a
hostname, you must prefix it with an '@'-sign:
topq lp 17
topq lp 15-25
topq lp drosehn
topq lp @some.host.com

or a combination of those things:
topq lp drosehn:17
topq lp 15-25:drosehn
topq lp 15-25@some.host.edu
topq lp gad:15-25@some.host.edu

Futhermore, in the new implementation the user can also use
filename-style pattern-matching on the userid or hostname fields:
topq lp dros[ie]hn
topq lp @samba*
topq lp gad@*freebsd.org

(although the user should probably include those in quotes when they
are specifying the topq command as part of the 'lpc' command, just
to make sure the pattern-matching characters are not expanded by
whatever shell they are typing the command into)

The operator can still specify several of these job-specifiers in a
single command:
topq lp 17 22 27 drosihn:23 gad@*freebsd.org 97

If a job is matched by multiple job-specifiers on a single command,
then its final position in the queue is based on the first job-specifer
which matched it.

The previous implementation also recognized a jobnumber followed by
a hostname (with no separator), or a hostname:jobnumber, although
neither of these options were documented. Eg:
topq lp 42some.host.org
topq lp some.host.org:42

The new version allows the first one, and will also recognize the
second one *iff* the hostname includes a period (otherwise it is
assumed to be a userid followed by a job number). Both remain
undocumented, and are only provided in case there were some users
who did know about those options, and are used to typing them in.

The new implementation also fixes a few subtle security issues in
the old one (mainly just making sure all error-messages are printed
while the process is "not-priv"), avoids integer-overflow issues on
bad user input, and prints out more descriptive messages in a number
of circumstances.

The new bottomq command accepts all the same arguments as topq, but
moves the selected jobs to the bottom of the queue instead of the top.


# 100203 16-Jul-2002 gad

Changes which rewrite 'lpc topq', and which add 'lpc bottomq'. These
reflect much valuable feedback from wollman. More details on the new
'lpc topq' are in the log message for revision 1.2 of lpc/movejobs.c.

The previous implementation of 'lpc topq' is available as 'lpc xtopq',
in case there are any problems noticed in the new implementation. If
there are no problems with this version, a later update will remove the
'lpc xtopq' command.

Reviewed by: freebsd-print@bostonradio.org
MFC after: 6 days