> From [EMAIL PROTECTED] Thu Nov  2 21:59:10 2000
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: LPRng: segfault, semantics changes?
> From: Mike Whitson <[EMAIL PROTECTED]>
> Date: 02 Nov 2000 23:40:04 -0500
>
> Okay, so it's been a while since I last touched LPRng.  But one of my
> former co-workers at MIT asked me to come help figure out why the
> later version of LPRng they'd imported wouldn't work in the same
> environment as the one I'd last set up.
>
> After a hair-tearing evening or three, we're still hard-pressed to
> figure out whether the fault lies in semantic changes of the tokens in
> lpd.perms or the segfault caused when reading the "AUTHFROM" lpd.perms
> tag.

As far as I can tell,  there have been no semantic changes... or even
code changes...  ARAHHGGGHHH!  AARRRHAGGGH!!!  Sigh...

Release LPRng 3.7.1 - Sun Nov  5 11:56:40 PST 2000

 In LPRng/common/linelist.c,  many missing checks for null pointers.  
   (Found in a core dump supplied by: Mike Whitson <[EMAIL PROTECTED]>)

See the patch at the end...

>
> With our 3.6.1-based servers, we use lpd.perms files such as the
> following:
>
> ------------------------------------------------------------------------
> # Allow anybody to connect, get status, list queue, or print (once a
> # job is spooled)
> ACCEPT SERVICE=X,S,Q,P
> ACCEPT LPC=status,lpq,printcap
>
> # Only trust certain host keys to forward jobs/commands
> REJECT AUTH=FWD PRINTER=</var/spool/printer/queues.secure NOT 
>AUTHFROM=</var/spool/printer/hostkeys.allow
> REJECT AUTH=FWD AUTHJOB NOT AUTHFROM=</var/spool/printer/hostkeys.allow
>
> # Allow root to control and remove jobs
> ACCEPT SERVICE=C,R SERVER REMOTEUSER=root
>
> # Allow admins to control and remove jobs
> ACCEPT SERVICE=C,R AUTH=USER AUTHUSER=</var/spool/printer/lpcaccess.top
>
> # Printer-specific LPC ACLs
> ACCEPT SERVICE=C,R PRINTER=money,money2 AUTH=USER 
>AUTHUSER=</var/spool/printer/money/lpcaccess
> ACCEPT SERVICE=C,R PRINTER=sipb,meadow2 AUTH=USER 
>AUTHUSER=</var/spool/printer/sipb/lpcaccess
> ACCEPT SERVICE=C,R PRINTER=sipb,sipb2 AUTH=USER 
>AUTHUSER=</var/spool/printer/sipb/lpcaccess
> ACCEPT SERVICE=C,R PRINTER=vln,vln2 AUTH=USER 
>AUTHUSER=</var/spool/printer/vln/lpcaccess
> ACCEPT SERVICE=C,R PRINTER=dagger,dagger2 AUTH=USER 
>AUTHUSER=</var/spool/printer/dagger/lpcaccess
>
> # Reject jobs from unauthorized users to restricted queues
> REJECT SERVICE=R PRINTER=rinter,rinter2 NOT 
>USER=</var/spool/printer/rinter/restrict.list
> REJECT SERVICE=R PRINTER=dagger,dagger2 NOT 
>AUTHUSER=</var/spool/printer/dagger/restrict.list
>
> # Accept authenticated jobs to all other printers
> ACCEPT SERVICE=R AUTH=USER,FWD
> # Allow authenticated users to lprm their jobs
> ACCEPT SERVICE=M AUTH=USER,FWD AUTHJOB AUTHSAMEUSER
>
> # Reject unauthentic print/lprm requests to authenticated queues
> REJECT SERVICE=R,M PRINTER=</var/spool/printer/queues.secure
>
> # Reject unauthentic print requests from off MITnet
> REJECT SERVICE=R NOT REMOTEIP=</var/spool/printer/masks.allow
>
> # Accept unauthentic print requests if same user and on MITnet
> ACCEPT SERVICE=M NOT AUTHJOB SAMEUSER REMOTEIP=</var/spool/printer/masks.allow
>
> # Reject any other lpc, or lprm. Accept all else
> REJECT SERVICE=C,M
> DEFAULT ACCEPT
> ------------------------------------------------------------------------
>
> After much coaxing, we discovered that the reason people could not
> lprm their own jobs was that the connection-handling lpd was receiving
> a SIGSEGV and exiting.  This problem exists in 3.6.13 (our newer
> snapshot), and still exists in current code.  Here's a stack trace,
> from an LPRng 3.6.26 lpd (code unmodified from ftp.astart.com):
>
> ------------------------------------------------------------------------
> (gdb) where
> #0  0x78690 in Find_first_key (l=0x0, key=0x127068 "_", sep=0x126fb8 " \t=#@", 
>     m=0xffbee8c0) at ./common/linelist.c:790

OOOPSSS!

Apply the following patch:


*** common/linelist.c   2000/11/05 20:13:56     5.37
--- common/linelist.c   2000/11/05 21:43:35
***************
*** 8,14 ****
   ***************************************************************************/
  
   static char *const _id =
! "$Id: linelist.c,v 5.37 2000/11/05 20:13:56 papowell Exp $";
  
  #include "lp.h"
  #include "errorcodes.h"
--- 8,14 ----
   ***************************************************************************/
  
   static char *const _id =
! "$Id: linelist.c,v 5.37 2000/11/05 20:13:56 papowell Exp papowell $";
  
  #include "lp.h"
  #include "errorcodes.h"
***************
*** 870,879 ****
  const char *Find_value( struct line_list *l, const char *key, const char *sep )
  {
        const char *s = "0";
!       int mid, cmp;
  
        DEBUG5("Find_value: key '%s', sep '%s'", key, sep );
!       cmp = Find_first_key( l, key, sep, &mid );
        DEBUG5("Find_value: key '%s', cmp %d, mid %d", key, cmp, mid );
        if( cmp==0 ){
                if( sep ){
--- 870,879 ----
  const char *Find_value( struct line_list *l, const char *key, const char *sep )
  {
        const char *s = "0";
!       int mid, cmp = -1;
  
        DEBUG5("Find_value: key '%s', sep '%s'", key, sep );
!       if( l ) cmp = Find_first_key( l, key, sep, &mid );
        DEBUG5("Find_value: key '%s', cmp %d, mid %d", key, cmp, mid );
        if( cmp==0 ){
                if( sep ){
***************
*** 895,901 ****
  {
        char *s = 0;
        int i;
!       for( i = 0; i < l->count; ++i ){
                if( (s = l->list[i])[0] == letter ){
                        if( mid ) *mid = i;
                        DEBUG4( "Find_first_letter: letter '%c', at [%d]=value '%s'", 
letter, i, s );
--- 895,901 ----
  {
        char *s = 0;
        int i;
!       if(l)for( i = 0; i < l->count; ++i ){
                if( (s = l->list[i])[0] == letter ){
                        if( mid ) *mid = i;
                        DEBUG4( "Find_first_letter: letter '%c', at [%d]=value '%s'", 
letter, i, s );
***************
*** 919,927 ****
  const char *Find_exists_value( struct line_list *l, const char *key, const char *sep 
)
  {
        const char *s = 0;
!       int mid, cmp = -2;
  
!       cmp = Find_first_key( l, key, sep, &mid );
        if( cmp==0 ){
                if( sep ){
                        s = Fix_val( safestrpbrk(l->list[mid], sep ) );
--- 919,927 ----
  const char *Find_exists_value( struct line_list *l, const char *key, const char *sep 
)
  {
        const char *s = 0;
!       int mid, cmp = -1;
  
!       if( l ) cmp = Find_first_key( l, key, sep, &mid );
        if( cmp==0 ){
                if( sep ){
                        s = Fix_val( safestrpbrk(l->list[mid], sep ) );
***************
*** 947,955 ****
  char *Find_str_value( struct line_list *l, const char *key, const char *sep )
  {
        char *s = 0;
!       int mid, cmp;
  
!       cmp = Find_first_key( l, key, sep, &mid );
        if( cmp==0 ){
                /*
                 *  value: NULL, "", "@", "=xx", "#xx".
--- 947,955 ----
  char *Find_str_value( struct line_list *l, const char *key, const char *sep )
  {
        char *s = 0;
!       int mid, cmp = -1;
  
!       if( l ) cmp = Find_first_key( l, key, sep, &mid );
        if( cmp==0 ){
                /*
                 *  value: NULL, "", "@", "=xx", "#xx".
***************
*** 984,992 ****
  char *Find_casekey_str_value( struct line_list *l, const char *key, const char *sep )
  {
        char *s = 0;
!       int mid, cmp;
  
!       cmp = Find_first_casekey( l, key, sep, &mid );
        if( cmp==0 ){
                /*
                 *  value: NULL, "", "@", "=xx", "#xx".
--- 984,992 ----
  char *Find_casekey_str_value( struct line_list *l, const char *key, const char *sep )
  {
        char *s = 0;
!       int mid, cmp = -1;
  
!       if( l ) cmp = Find_first_casekey( l, key, sep, &mid );
        if( cmp==0 ){
                /*
                 *  value: NULL, "", "@", "=xx", "#xx".
***************
*** 1187,1193 ****
        char *e;
        int n = 0;
  
!       if( (s = Find_value( l, key, sep )) ){
                e = 0;
                n = strtol(s,&e,0);
                if( !e || *e ) n = 0;
--- 1187,1193 ----
        char *e;
        int n = 0;
  
!       if( l && (s = Find_value( l, key, sep )) ){
                e = 0;
                n = strtol(s,&e,0);
                if( !e || *e ) n = 0;
***************
*** 1213,1219 ****
        char *e;
        int n = 0;
  
!       if( (s = Find_value( l, key, sep )) ){
                e = 0;
                n = strtol(s,&e,10);
                if( !e || *e ){
--- 1213,1219 ----
        char *e;
        int n = 0;
  
!       if( l && (s = Find_value( l, key, sep )) ){
                e = 0;
                n = strtol(s,&e,10);
                if( !e || *e ){
***************
*** 1228,1234 ****
   
  
  /*
!  * char *Find_decimal_value( struct line_list *l, char *key, char *sep )
   *  Search the list for a corresponding key value
   *          value
   *   key    1
--- 1228,1234 ----
   
  
  /*
!  * double Find_double_value( struct line_list *l, char *key, char *sep )
   *  Search the list for a corresponding key value
   *          value
   *   key    1
***************
*** 1243,1249 ****
        char *e;
        double n = 0;
  
!       if( (s = Find_value( l, key, sep )) ){
                e = 0;
                n = strtod(s,&e);
        }
--- 1243,1249 ----
        char *e;
        double n = 0;
  
!       if( l && (s = Find_value( l, key, sep )) ){
                e = 0;
                n = strtod(s,&e);
        }

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