Diff for /libraries/libldap/sasl.c between versions 1.64.2.8 and 1.74

version 1.64.2.8, 2010/04/13 20:22:59 version 1.74, 2009/10/26 17:49:42
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/libraries/libldap/sasl.c,v 1.64.2.7 2009/10/31 00:11:22 quanah Exp $ */  /* $OpenLDAP: pkg/ldap/libraries/libldap/sasl.c,v 1.73 2009/01/21 23:40:21 kurt Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
  * Copyright 1998-2010 The OpenLDAP Foundation.   * Copyright 1998-2009 The OpenLDAP Foundation.
  * All rights reserved.   * All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
Line 679  sb_sasl_generic_write( Sockbuf_IO_Desc * Line 679  sb_sasl_generic_write( Sockbuf_IO_Desc *
 {  {
         struct sb_sasl_generic_data     *p;          struct sb_sasl_generic_data     *p;
         int                             ret;          int                             ret;
         ber_len_t                       len2;          ber_len_t                       len2, sent;
   
         assert( sbiod != NULL );          assert( sbiod != NULL );
         assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );          assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
   
         p = (struct sb_sasl_generic_data *)sbiod->sbiod_pvt;          p = (struct sb_sasl_generic_data *)sbiod->sbiod_pvt;
   
         /* Is there anything left in the buffer? */          /* Are there anything left in the buffer? */
         if ( p->buf_out.buf_ptr != p->buf_out.buf_end ) {          if ( p->buf_out.buf_ptr != p->buf_out.buf_end ) {
                 ret = ber_pvt_sb_do_write( sbiod, &p->buf_out );                  ret = ber_pvt_sb_do_write( sbiod, &p->buf_out );
                 if ( ret < 0 ) return ret;                  if ( ret < 0 ) return ret;
Line 698  sb_sasl_generic_write( Sockbuf_IO_Desc * Line 698  sb_sasl_generic_write( Sockbuf_IO_Desc *
                 }                  }
         }          }
   
         len2 = p->max_send - 100;       /* For safety margin */          /* If we're just retrying a partial write, ignore
         len2 = len > len2 ? len2 : len;           * the first byte of this request since we fudged it
            * below on the previous call.
         /* If we're just retrying a partial write, tell the  
          * caller it's done. Let them call again if there's  
          * still more left to write.  
          */           */
         if ( p->flags & LDAP_PVT_SASL_PARTIAL_WRITE ) {          if ( p->flags & LDAP_PVT_SASL_PARTIAL_WRITE ) {
                 p->flags ^= LDAP_PVT_SASL_PARTIAL_WRITE;                  p->flags ^= LDAP_PVT_SASL_PARTIAL_WRITE;
                 return len2;                  len--;
                   if ( !len )
                           return 1;
                   buf = (char *)buf + 1;
         }          }
   
         /* now encode the next packet. */          /* now encode the next packet. */
         p->ops->reset_buf( p, &p->buf_out );          p->ops->reset_buf( p, &p->buf_out );
   
           len2 = p->max_send - 100;       /* For safety margin */
           len2 = len > len2 ? len2 : len;
   
         ret = p->ops->encode( p, buf, len2, &p->buf_out );          ret = p->ops->encode( p, buf, len2, &p->buf_out );
   
         if ( ret != 0 ) {          if ( ret != 0 ) {
Line 722  sb_sasl_generic_write( Sockbuf_IO_Desc * Line 725  sb_sasl_generic_write( Sockbuf_IO_Desc *
                 return -1;                  return -1;
         }          }
   
         ret = ber_pvt_sb_do_write( sbiod, &p->buf_out );          sent = ber_pvt_sb_do_write( sbiod, &p->buf_out );
   
         if ( ret < 0 ) {          if ( sent < 0 ) {
                 /* error? */                  /* error? */
                 int err = sock_errno();                  len2 = sent;
                 /* caller can retry this */          } else if ( sent != p->buf_out.buf_end ) {
                 if ( err == EAGAIN || err == EWOULDBLOCK || err == EINTR )                  /* partial write? */
                         p->flags |= LDAP_PVT_SASL_PARTIAL_WRITE;                  len2--;
                 return ret;  
         } else if ( p->buf_out.buf_ptr != p->buf_out.buf_end ) {  
                 /* partial write? pretend nothing got written */  
                 len2 = 0;  
                 p->flags |= LDAP_PVT_SASL_PARTIAL_WRITE;                  p->flags |= LDAP_PVT_SASL_PARTIAL_WRITE;
         }          }
   

Removed from v.1.64.2.8  
changed lines
  Added in v.1.74


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org