From owner-freebsd-audit Thu Jun 28 15:48:19 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl1x01.coxmail.com [206.157.231.23]) by hub.freebsd.org (Postfix) with ESMTP id 2223D37B401 for ; Thu, 28 Jun 2001 15:48:14 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010628224813.LHWZ1034.iatl0x01@enterprise.muriel.penguinpowered.com>; Thu, 28 Jun 2001 18:48:13 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010628184717:405=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: Date: Thu, 28 Jun 2001 18:47:17 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Garance A Drosihn Subject: RE: Initial ctlinfo, for checking incoming jobs to lpd Cc: freebsd-audit@freebsd.org, freebsd-print@bostonradio.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010628184717:405=_ Content-Type: text/plain; charset=us-ascii On 28-Jun-2001 Garance A Drosihn wrote: | The following patch would add a new source file to lpr/common_source, | called ctlinfo.c. While I have several plans for ctlinfo.c, this first | cut just replaces calls to link & unlink in lpd/recvjob.c with a call | to a new routine which does a whole bunch of work. I'm not too familiar with the code. It's looks pretty good altogether. Here's just a few little things I noticed: | + | +struct cjobinfo * style(9) bug, extra spaces before asterick | +ctl_readcf(const char *ptrname, const char *cfname) | +{ | + int id; | + char *lbuff; | + FILE *cfile; | + struct cjprivate *cpriv; | + size_t msize, sroom, sroom2; | + | + cfile = fopen(cfname, "r"); | + if (cfile == NULL) { | + syslog(LOG_ERR, "%s: ctl_readcf error open(%s): %s", | + ptrname, cfname, strerror(errno)); | + return NULL; | + } should be `return (NULL);' | + | + sroom = roundup(sizeof(struct cjprivate), 8); | + sroom2 = sroom + strlen(cfname) + 1; | + sroom2 = roundup(sroom2, 8); | + msize = sroom2 + CTI_LINEMAX; | + msize = roundup(msize, 8); | + cpriv = (struct cjprivate *)malloc(msize); | + if (cpriv == NULL) | + return NULL; | + memset(cpriv, 0, msize); | + | + cpriv->pub.cji_fname = (char *)(cpriv + sroom); | + strcpy(cpriv->pub.cji_fname, cfname); | + cpriv->cji_buff = (char *)(cpriv + sroom2); | + cpriv->cji_eobuff = (char *)(cpriv + msize - 1); | + | + cpriv->cji_fstream = cfile; | + | + /* | + * Copy job-attribute values from control file to the struct of | + * "public" information. In some cases, it is invalid for the | + * value to be a null-string, so that is ignored. | + */ | + while ((lbuff = ctl_getline(&(cpriv->pub)))) { should test against != NULL. [snip] | + /* | + * Some lpr implementations on PC's set a null-string for their | + * hostname. A MacOS 10 system which has not correctly setup | + * /etc/hostconfig will claim a hostname of 'localhost'. Anything | + * with blanks in it would be an invalid value for hostname. For | + * any of these invalid hostname values, replace the given value | + * with the name of the host that this job is coming from. | + */ | + nogood = 0; | + if (cjinf->cji_orighost == NULL) | + nogood = 1; | + else if (strcmp(cjinf->cji_orighost, ".na.") == NULL) | + nogood = 1; | + else if (strcmp(cjinf->cji_orighost, "localhost") == NULL) | + nogood = 1; strcmp() returns 0 for match [snip] | +++ common_source/lp.h 2001/06/28 00:22:01 | @@ -267,6 +267,7 @@ | char *pcaperr(int _error); | void prank(int _n); | void process(const struct printer *_pp, char *_file); | +void ctl_renametf(const char *_ptrname, const char *_tfname); This should line up. Later, Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010628184717:405=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7O7P0FokZQs3sv5kRAp1HAJ4hZek92fT5zdo+/sdeFRkPCSQLfwCgmGeQ 9GHuuyUMqoMDdmf8Y7HCAe8= =HU12 -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010628184717:405=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message