diff options
author | gad <gad@FreeBSD.org> | 2011-04-13 00:36:19 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2011-04-13 00:36:19 +0000 |
commit | cbc50fc3398a22818f0dd68583fa2dab7fd90151 (patch) | |
tree | 3e323d503104f1da3d7c3a7686551ba93a0b4b4b | |
parent | 34372be22a50d86b73a2a5a327c270caf9a4e306 (diff) | |
download | FreeBSD-src-cbc50fc3398a22818f0dd68583fa2dab7fd90151.zip FreeBSD-src-cbc50fc3398a22818f0dd68583fa2dab7fd90151.tar.gz |
- 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
-rw-r--r-- | usr.sbin/lpr/common_source/ctlinfo.c | 12 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/ctlinfo.h | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/matchjobs.c | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/usr.sbin/lpr/common_source/ctlinfo.c b/usr.sbin/lpr/common_source/ctlinfo.c index 20a153f..c23e419 100644 --- a/usr.sbin/lpr/common_source/ctlinfo.c +++ b/usr.sbin/lpr/common_source/ctlinfo.c @@ -1,6 +1,6 @@ /* * ------+---------+---------+---------+---------+---------+---------+---------* - * Copyright (c) 2001 - Garance Alistair Drosehn <gad@FreeBSD.org>. + * Copyright (c) 2001,2011 - Garance Alistair Drosehn <gad@FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -248,7 +248,7 @@ ctl_freeinf(struct cjobinfo *cjinf) /* [cpriv->pub.cji_fname is part of cpriv-malloced area] */ FREESTR(cpriv->pub.cji_jobname); FREESTR(cpriv->pub.cji_mailto); - FREESTR(cpriv->pub.cji_username); + FREESTR(cpriv->pub.cji_headruser); if (cpriv->cji_fstream != NULL) { fclose(cpriv->cji_fstream); @@ -343,7 +343,7 @@ ctl_readcf(const char *ptrname, const char *cfname) cpriv->pub.cji_jobname = strdup(lbuff); break; case 'L': - cpriv->pub.cji_username = strdup(lbuff); + cpriv->pub.cji_headruser = strdup(lbuff); break; case 'M': /* @@ -586,8 +586,8 @@ ctl_renametf(const char *ptrname, const char *tfname) fprintf(newcf, "C%s\n", cjinf->cji_class); if (cjinf->cji_jobname != NULL) fprintf(newcf, "J%s\n", cjinf->cji_jobname); - if (cjinf->cji_username != NULL) - fprintf(newcf, "L%s\n", cjinf->cji_username); + if (cjinf->cji_headruser != NULL) + fprintf(newcf, "L%s\n", cjinf->cji_headruser); /* * This should probably add more sanity checks on mailto value. @@ -832,7 +832,7 @@ ctl_dumpcji(FILE *dbg_stream, const char *heading, struct cjobinfo *cjinf) PRINTSTR("cf-fname", cpriv->pub.cji_fname); PRINTSTR("jobname.J", cpriv->pub.cji_jobname); PRINTSTR("mailto.M", cpriv->pub.cji_mailto); - PRINTSTR("hdruser.L", cpriv->pub.cji_username); + PRINTSTR("headruser.L", cpriv->pub.cji_headruser); ctl_dbgline++; fprintf(dbg_stream, "%4d] %12s = ", ctl_dbgline, "*cjprivate"); diff --git a/usr.sbin/lpr/common_source/ctlinfo.h b/usr.sbin/lpr/common_source/ctlinfo.h index 95fe572..49bf532 100644 --- a/usr.sbin/lpr/common_source/ctlinfo.h +++ b/usr.sbin/lpr/common_source/ctlinfo.h @@ -1,6 +1,6 @@ /* * ------+---------+---------+---------+---------+---------+---------+---------* - * Copyright (c) 2001 - Garance Alistair Drosehn <gad@FreeBSD.org>. + * Copyright (c) 2001,2011 - Garance Alistair Drosehn <gad@FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,7 +59,7 @@ struct cjobinfo { char *cji_fname; /* filename of the control file */ char *cji_jobname; /* job-name (for banner) */ char *cji_mailto; /* userid to send email to (or null) */ - char *cji_username; /* "literal" user-name (for banner) or + char *cji_headruser; /* "literal" user-name (for banner) or * NULL if no banner-page is wanted */ struct cjprivate *cji_priv; }; diff --git a/usr.sbin/lpr/common_source/matchjobs.c b/usr.sbin/lpr/common_source/matchjobs.c index de572f8..c7dd165 100644 --- a/usr.sbin/lpr/common_source/matchjobs.c +++ b/usr.sbin/lpr/common_source/matchjobs.c @@ -1,6 +1,6 @@ /* * ------+---------+---------+---------+---------+---------+---------+---------* - * Copyright (c) 2002 - Garance Alistair Drosehn <gad@FreeBSD.org>. + * Copyright (c) 2002,2011 - Garance Alistair Drosehn <gad@FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -453,7 +453,7 @@ match_jobspec(struct jobqueue *jq, struct jobspec *jspec) cfinf = ctl_readcf("fakeq", jq->job_cfname); if (cfinf == NULL) goto nomatch; - if (fnmatch(jspec->wanteduser, cfinf->cji_username, 0) != 0) + if (fnmatch(jspec->wanteduser, cfinf->cji_acctuser, 0) != 0) goto nomatch; } @@ -467,7 +467,7 @@ match_jobspec(struct jobqueue *jq, struct jobspec *jspec) * pattern), then the caller's "doentry()" routine might * want to know the userid of this job that matched. */ - jspec->matcheduser = strdup(cfinf->cji_username); + jspec->matcheduser = strdup(cfinf->cji_acctuser); } #if DEBUG_SCANJS printf("\t [ job matched! ]\n"); |