List,
Here is a correction to one of the patches. I used File_sep without
realizing it contained "," as separator, needed to enumerate several IP
address in a row. By using ";" instead of File_sep you can now use
semicolon as separator for usernames and comma as separator for IP
addresses. I see this use of ";" in lpd_status.c as well, but I don't know
why Patrick did not document why he used it there instead of File_sep, as
it is clear to me know why but I missed it at first. force_lpq_status
takes a special value syntax not seen elsewhere and my
force_controlfile_username uses the same syntax. Maybe one should define
a new constant in include/linelist.h to handle this case, or rethink which
characters are allowed to be separators. File_sep and Value_sep could
possible be reduced, but this of course causes bad backward compatiblity
problems with people's old configs if they rely on using for example tabs
as separators.
Also section 7.7.4 in LPRng-HOWTO says
force_lpq_status=s=pc*.eng.com,130.192.12.0/24,l=sun*.eng.com
This should be (notice the semicolon instead of comma):
force_lpq_status=s=pc*.eng.com,130.192.12.0/24;l=sun*.eng.com
------
Example use of force_controlfile_username:
force_controlfile_username=foobar=10.0.0.1,10.0.0.2;fiefum=10.2.0.0/24
New patch to common/getqueue.c:
--- LPRng-3.8.21/src/common/getqueue.c.orig Wed Apr 16 01:37:42 2003
+++ LPRng-3.8.21/src/common/getqueue.c Wed Jun 18 21:37:58 2003
@@ -2104,11 +2104,53 @@
int status = 0, fd, i;
struct stat statb;
+ struct line_list l, listv;
+ char *s, *t;
+ Init_line_list(&l);
+ Init_line_list(&listv);
+
if(DEBUGL3) Dump_job( "Create_control: before fixing", job );
/* deal with authentication */
Make_identifier( job );
+
+ /*
+ * if we get a request from these hosts, change host name in control
+ * file (possibly faked if from untrusted host) to FQDN of remote host
+ */
+ if( Force_controlfile_originate_hostname_DYN ){
+ Free_line_list(&l);
+
Split(&l,Force_controlfile_originate_hostname_DYN,File_sep,0,0,0,0,0,0);
+ if( Match_ipaddr_value( &l, &RemoteHost_IP ) == 0 ){
+ DEBUG1("Create_control: remotehost '%s'", FQDNRemote_FQDN );
+ Set_str_value(&job->info,FROMHOST,FQDNRemote_FQDN);
+ fromhost = Find_str_value(&job->info,FROMHOST,Value_sep);
+ }
+ Free_line_list(&l);
+ }
+
+ /*
+ * if we get a request from these hosts, change user name in control
+ * file (possibly faked if from untrusted host) to specified
+ */
+ if( Force_controlfile_username_DYN ){
+ Free_line_list(&listv);
+ Split(&listv,Force_controlfile_username_DYN,";",0,0,0,0,0,0);
+ for(i = 0; i < listv.count; ++i ){
+ s = listv.list[i];
+ if( (t = safestrpbrk(s,Value_sep)) ) *t++ = 0;
+ Free_line_list(&l);
+ Split(&l,t,Value_sep,0,0,0,0,0,0);
+ if( Match_ipaddr_value( &l, &RemoteHost_IP ) == 0 ){
+ DEBUG1("Create_control: username '%s'", s );
+ Set_str_value(&job->info,LOGNAME,s);
+ break;
+ }
+ }
+ Free_line_list(&l);
+ Free_line_list(&listv);
+ }
if( !(fromhost = Find_str_value(&job->info,FROMHOST,Value_sep)) ||
Is_clean_name(fromhost) ){
Set_str_value(&job->info,FROMHOST,FQDNRemote_FQDN);
-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body. For the impatient,
to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED]
with: | example:
subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED]
If you have major problems, send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------