> From [EMAIL PROTECTED] Mon Mar 18 10:38:26 2002
> Date: Mon, 18 Mar 2002 18:45:15 +0100
> From: Bertrand Decouty <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: LPRng: trouble with "oh=" content
>
> Hello.
>
> I am testing LPRng 3.8.8 under Solaris 2.7 (I already use LPRng 3.5.2) and i
> encounter a big trouble with "oh=" content.
> The printcap works fine if "oh" includes the primary name of the server
> machine, but NOT if it contains an alias!
>
> This worked fine with LPRng 3.5.2.
>
> here is an example:
> >>
> % ypmatch imp-mableu5 hosts
> 131.254.60.59   las-vegas.irisa.fr las-vegas imp-mableu5
>
> % lpc printcap mableu5
> Printer: mAbleu5@las-vegas
> mAbleu5|copieur Xerox 220/230 (client) - NOSTATUT|Copieur Xerox DC220/230
> A-bleu (serveur)
>  :cm=Photocopieur XEROX 220/230 salle imprimante A031
>  :lf=/var/spool/mAbleu5/mAbleu5_log
>  :[EMAIL PROTECTED]
>  :lpd_bounce
>  :oh=las-vegas
>  :ps=status
>  :sd=/var/spool/mAbleu5
>  :server
> >>
>
> "oh=las-vegas" -> OK
> "oh=imp-mableu5" -> Not OK

I looked at the code and realized why I changed it.  It is a matter
of overhead/cost of implementation.

The 'oh' functionality works by the following method:

a)  look up the IP address/cannonical host name of the
    host.  This will return a list of names/IP addresses
    for this host.

    Note a)  This list usually is in FQDN format
    Note b)  This list usually does NOT have aliases
      if your DNS is not set up to map aliases.

b)  For each entry in the 'oh' list, run
      Match_ipaddr_value( name, IP_INFORMATION_FOR_HOST );
    Stop when you find a match

c)  The Match_ipaddr_value first determines
     if the 'name' is an IP Address/Netmask or
     a 'string'.  If it is an IP address, it checks
    the list if IP addresses for this host.  If it
    is a 'string' then it treats it like a 'glob match'
    and matches this against the FQDN and other aliases
    in the IP_INFORMATION_FOR_HOST data structure.

Now you might ask why I do it this way.  The answer is
simple:

  If I had to do a DNS lookup on the host name to get the IP address
  and other information,  I would be doing a very large number of
  them,  each time I needed to check/get information.  This would
  cause the LPD server to initiate a very large number of DNS lookups.
  On systems where there was not a caching DNS in operation, this
  had disastrous effects.

Now lets see if we can special case this,  just for you.

The code in LPRng/src/common/linelist.c where the "oh"
is handled has a loop:


                        for( i = start_oh; !ok && i <= end_oh; ++i ){
                                DEBUG4("Build_pc_names: [%d] '%s'", i, opts.list[i] );
                                if( (t = safestrchr( opts.list[i], '=' )) ){
                                        Split(&oh,t+1,File_sep,0,0,0,1,0,0);
                                        ok = !Match_ipaddr_value(&oh, hostname);

                      ^^^^^^^^^^^^^^^^^^^^^
                                        DEBUG4("Build_pc_names: check host '%s', ok 
%d",
                                                t+1, ok );
                                        Free_line_list(&oh);
                                }
                        }


Now we could add after this loop the following,  which would do what
you want:

                        for( i = start_oh; !ok && i <= end_oh; ++i ){
                                DEBUG4("Build_pc_names: trying a name lookup [%d] 
'%s'", i, opts.list[i] );
                                if( (t = safestrchr( opts.list[i], '=' )) ){
                                        int j;
                                        Split(&oh,t+1,File_sep,0,0,0,1,0,0);
                                        for( j = 0; !ok && j < oh.count; ++j ){
                                                char *s = oh.list[j];
                                                char *fq;
                                                DEBUG4("Build_pc_names: DNS lookup 
host '%s'", s );
                                                fq = Find_fqdn( &LookupHost_IP, s );
                        ^^^^^ evil DNS lookup
                                                if( fq ){
                                                        ok = !Same_host( 
&LookupHost_IP, hostname );
                                                }
                                        }
                                        Free_line_list(&oh);
                                }
                        }

So,  I guess the answer is 'no'.

However,  I have shown you how to do this.  I cannot recommend or
suggest that you do it, as it will have, possibly, disastrous
performance effects on systems where you have a large number of
'oh' entries.

Sorry about that.

Patrick


Patrick Powell                 Astart Technologies,
[EMAIL PROTECTED]            9475 Chesapeake Drive, Suite D,
Network and System             San Diego, CA 92123
  Consulting                   858-874-6543 FAX 858-279-8424 
LPRng - Print Spooler (http://www.lprng.com)

-----------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------

Reply via email to