mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 11:39:34 -05:00
Add UL to LBER tags.
This commit is contained in:
parent
150e105f41
commit
6ee995f528
10 changed files with 42 additions and 34 deletions
|
|
@ -141,8 +141,8 @@ ber_bprint(
|
|||
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
|
||||
|
|
@ -249,4 +249,4 @@ ber_sos_dump(
|
|||
}
|
||||
|
||||
(*ber_pvt_log_print)( "*** end dump ***\n" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,8 +104,8 @@ ber_skip_tag( BerElement *ber, unsigned long *len )
|
|||
*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;
|
||||
|
|
@ -694,8 +694,10 @@ va_dcl
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ static int
|
|||
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;
|
||||
|
|
@ -77,7 +77,7 @@ ber_calc_lenlen( unsigned long len )
|
|||
* with bit 8 0.
|
||||
*/
|
||||
|
||||
if ( len <= 0x7F )
|
||||
if ( len <= 0x7FUL )
|
||||
return( 1 );
|
||||
|
||||
/*
|
||||
|
|
@ -85,11 +85,11 @@ ber_calc_lenlen( unsigned long len )
|
|||
* 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 );
|
||||
|
|
@ -100,7 +100,7 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos )
|
|||
{
|
||||
int i;
|
||||
char lenlen;
|
||||
long mask;
|
||||
unsigned long mask;
|
||||
unsigned long netlen;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
|
@ -123,7 +123,7 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos )
|
|||
|
||||
/* 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;
|
||||
|
|
@ -131,7 +131,7 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos )
|
|||
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 )
|
||||
|
|
@ -162,7 +162,7 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag )
|
|||
* 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 */
|
||||
|
|
@ -179,7 +179,7 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag )
|
|||
* 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++;
|
||||
|
||||
|
|
@ -355,8 +355,8 @@ int
|
|||
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 );
|
||||
|
||||
|
|
@ -431,7 +431,7 @@ ber_put_seqorset( BerElement *ber )
|
|||
{
|
||||
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;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ ber_put_seqorset( BerElement *ber )
|
|||
|
||||
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 ) {
|
||||
|
|
@ -502,7 +502,7 @@ ber_put_seqorset( BerElement *ber )
|
|||
if ( ber->ber_options & LBER_USE_DER ) {
|
||||
ltag = (lenlen == 1)
|
||||
? (unsigned char) len
|
||||
: 0x80 + (lenlen - 1);
|
||||
: 0x80UL + (lenlen - 1);
|
||||
}
|
||||
|
||||
/* one byte of length length */
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ main( int argc, char **argv )
|
|||
|
||||
#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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -480,8 +480,8 @@ get_lenbyte:
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
|
|||
} else {
|
||||
rc = ber_scanf( &ber, "{ia}", &along, &ld->ld_error );
|
||||
}
|
||||
|
||||
if ( rc == LBER_ERROR ) {
|
||||
ld->ld_errno = LDAP_DECODING_ERROR;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -274,12 +274,15 @@ int ldap_check_cache LDAP_P(( LDAP *ld, unsigned long msgtype, BerElement *reque
|
|||
/*
|
||||
* 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,
|
||||
|
|
|
|||
|
|
@ -261,10 +261,11 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, const char *host, int defport,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -327,9 +327,10 @@ try_read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
|
|||
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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -906,7 +906,7 @@ print_ldap_result( LDAP *ld, LDAPMessage *lm, char *s )
|
|||
/*
|
||||
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 );
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue