- 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
This commit is contained in:
Garance A Drosehn 2011-04-13 00:36:19 +00:00
parent 5e8eb3cd4e
commit ad1f7851dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=220586
3 changed files with 11 additions and 11 deletions

View File

@ -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");

View File

@ -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;
};

View File

@ -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");