out[ i+1 ] = *data;
} else {
#endif
- out[ i ] = hexdig[ ( *data & 0xf0 ) >> 4 ];
- out[ i+1 ] = hexdig[ *data & 0x0f ];
+ out[ i ] = hexdig[ ( *data & 0xf0U ) >> 4 ];
+ out[ i+1 ] = hexdig[ *data & 0x0fU ];
#ifndef LDAP_HEX
}
#endif
}
(*ber_pvt_log_print)( "*** end dump ***\n" );
-}
\ No newline at end of file
+}
*len = netlen = 0;
if ( ber_read( ber, (char *) &lc, 1 ) != 1 )
return( LBER_DEFAULT );
- if ( lc & 0x80 ) {
- noctets = (lc & 0x7f);
+ if ( lc & 0x80U ) {
+ noctets = (lc & 0x7fU);
if ( (unsigned) noctets > sizeof(unsigned long) )
return( LBER_DEFAULT );
diff = sizeof(unsigned long) - noctets;
case 'v': /* sequence of strings */
sss = va_arg( ap, char *** );
if ( *sss ) {
- for (j = 0; (*sss)[j]; j++)
+ for (j = 0; (*sss)[j]; j++) {
free( (*sss)[j] );
+ (*sss)[j] = NULL;
+ }
free( *sss );
*sss = NULL;
}
ber_calc_taglen( unsigned long tag )
{
int i;
- long mask;
+ unsigned long mask;
/* find the first non-all-zero byte in the tag */
for ( i = sizeof(long) - 1; i > 0; i-- ) {
- mask = (0xffL << (i * 8));
+ mask = (0xffUL << (i * 8));
/* not all zero */
if ( tag & mask )
break;
* with bit 8 0.
*/
- if ( len <= 0x7F )
+ if ( len <= 0x7FUL )
return( 1 );
/*
* length of the length, followed by the length itself.
*/
- if ( len <= 0xFF )
+ if ( len <= 0xffUL )
return( 2 );
- if ( len <= 0xFFFFL )
+ if ( len <= 0xffffUL )
return( 3 );
- if ( len <= 0xFFFFFFL )
+ if ( len <= 0xffffffUL )
return( 4 );
return( 5 );
{
int i;
char lenlen;
- long mask;
+ unsigned long mask;
unsigned long netlen;
assert( ber != NULL );
/* find the first non-all-zero byte */
for ( i = sizeof(long) - 1; i > 0; i-- ) {
- mask = (0xffL << (i * 8));
+ mask = (0xffUL << (i * 8));
/* not all zero */
if ( len & mask )
break;
lenlen = (unsigned char) ++i;
if ( lenlen > 4 )
return( -1 );
- lenlen |= 0x80;
+ lenlen |= 0x80UL;
/* write the length of the length */
if ( ber_write( ber, &lenlen, 1, nosos ) != 1 )
* high bit is clear - look for first non-all-zero byte
*/
for ( i = sizeof(long) - 1; i > 0; i-- ) {
- mask = (0xffL << (i * 8));
+ mask = (0xffUL << (i * 8));
if ( sign ) {
/* not all ones */
* we now have the "leading byte". if the high bit on this
* byte matches the sign bit, we need to "back up" a byte.
*/
- mask = (num & (0x80L << (i * 8)));
+ mask = (num & (0x80UL << (i * 8)));
if ( (mask && !sign) || (sign && !mask) )
i++;
ber_put_boolean( BerElement *ber, int boolval, unsigned long tag )
{
int taglen;
- unsigned char trueval = 0xff;
- unsigned char falseval = 0x00;
+ unsigned char trueval = 0xffU;
+ unsigned char falseval = 0x00U;
assert( ber != NULL );
{
unsigned long len, netlen;
int taglen, lenlen;
- unsigned char ltag = 0x80 + FOUR_BYTE_LEN - 1;
+ unsigned char ltag = 0x80U + FOUR_BYTE_LEN - 1;
Seqorset *next;
Seqorset **sos = &ber->ber_sos;
len = (*sos)->sos_clen;
netlen = AC_HTONL( len );
- if ( sizeof(long) > 4 && len > 0xFFFFFFFFL )
+ if ( sizeof(long) > 4 && len > 0xffffffffUL )
return( -1 );
if ( ber->ber_options & LBER_USE_DER ) {
if ( ber->ber_options & LBER_USE_DER ) {
ltag = (lenlen == 1)
? (unsigned char) len
- : 0x80 + (lenlen - 1);
+ : 0x80UL + (lenlen - 1);
}
/* one byte of length length */
#ifndef notdef
num = 7;
- if ( ber_printf( ber, "{ti}", 0x1f44, num ) == -1 ) {
+ if ( ber_printf( ber, "{ti}", 0x1f44U, num ) == -1 ) {
fprintf( stderr, "ber_printf returns -1" );
exit( 1 );
}
unsigned char c;
if (ber_pvt_sb_read( sb, (char *) &c, 1)<=0)
return LBER_DEFAULT;
- if (c & 0x80) {
- int len = c & 0x7f;
+ if (c & 0x80U) {
+ int len = c & 0x7fU;
if ( (len==0) || ((unsigned) len>sizeof( ber->ber_len ) ) ) {
errno = ERANGE;
return LBER_DEFAULT;
} else {
rc = ber_scanf( &ber, "{ia}", &along, &ld->ld_error );
}
+
if ( rc == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
} else {
/*
* in controls.c
*/
-LDAPControl *ldap_control_dup LDAP_P(( const LDAPControl *ctrl ));
-LDAPControl **ldap_controls_dup LDAP_P(( const LDAPControl **ctrls ));
+LDAPControl *ldap_control_dup LDAP_P((
+ const LDAPControl *ctrl ));
+
+LDAPControl **ldap_controls_dup LDAP_P((
+ const LDAPControl **ctrls ));
int ldap_int_get_controls LDAP_P((
BerElement *be,
- LDAPControl ***cp));
+ LDAPControl ***ctrlsp));
int ldap_int_put_controls LDAP_P((
LDAP *ld,
ber_pvt_sb_set_io( sb, &ber_pvt_sb_io_tcp, NULL );
if ( krbinstancep != NULL ) {
+ char *c;
#ifdef HAVE_KERBEROS
if (( *krbinstancep = ldap_host_connected_to( sb )) != NULL &&
- ( p = strchr( *krbinstancep, '.' )) != NULL ) {
- *p = '\0';
+ ( c = strchr( *krbinstancep, '.' )) != NULL ) {
+ *c = '\0';
}
#else /* HAVE_KERBEROS */
krbinstancep = NULL;
ber_clear( ber, 1 ); /* gack! */
return( -2 ); /* continue looking */
}
- Debug( LDAP_DEBUG_TRACE, "got %s msgid %ld, original id %d\n",
- ( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" : "result", id,
- lr->lr_origid );
+ Debug( LDAP_DEBUG_TRACE, "ldap_read: %s msgid %ld, original id %d\n",
+ ( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" :
+ ( tag == LDAP_RES_SEARCH_REFERENCE ) ? "reference" : "result",
+ id, lr->lr_origid );
id = lr->lr_origid;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
if ( ld->ld_error != NULL && *ld->ld_error != '\0' )
fprintf( stderr, "Additional info: %s\n", ld->ld_error );
- if ( NAME_ERROR( ld->ld_errno ) && ld->ld_matched != NULL )
+ if ( LDAP_NAME_ERROR( ld->ld_errno ) && ld->ld_matched != NULL )
fprintf( stderr, "Matched DN: %s\n", ld->ld_matched );
*/
}