From 5ee926446579ba94fe5a2c125966b738b46ffc3b Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 2 May 2003 13:29:28 +0000 Subject: [PATCH] Fix assignment of * to unsigned * and vice versa. --- clients/tools/ldapcompare.c | 2 +- clients/tools/ldapsearch.c | 3 ++- libraries/liblber/decode.c | 2 +- libraries/liblber/encode.c | 8 ++++---- libraries/libldap/cyrus.c | 6 +++--- libraries/libldap/getdn.c | 6 +++--- libraries/libldap/tls.c | 6 +++--- libraries/libldap/utf-8.c | 10 +++++----- libraries/liblutil/entropy.c | 2 +- libraries/liblutil/passwd.c | 26 +++++++++++++------------- servers/slapd/entry.c | 6 +++--- 11 files changed, 39 insertions(+), 38 deletions(-) diff --git a/clients/tools/ldapcompare.c b/clients/tools/ldapcompare.c index b797c5fbac..da957436a5 100644 --- a/clients/tools/ldapcompare.c +++ b/clients/tools/ldapcompare.c @@ -150,7 +150,7 @@ main( int argc, char **argv ) /* it's base64 encoded. */ bvalue.bv_val = malloc( strlen( &sep[1] )); bvalue.bv_len = lutil_b64_pton( &sep[1], - bvalue.bv_val, strlen( &sep[1] )); + (unsigned char *) bvalue.bv_val, strlen( &sep[1] )); if (bvalue.bv_len == (ber_len_t)-1) { fprintf(stderr, _("base64 decode error\n")); diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index a362d2b453..daebef8ef5 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -1600,7 +1600,8 @@ static void print_ctrls( b64->bv_val = ber_memalloc( b64->bv_len + 1 ); b64->bv_len = lutil_b64_ntop( - ctrls[i]->ldctl_value.bv_val, ctrls[i]->ldctl_value.bv_len, + (unsigned char *) ctrls[i]->ldctl_value.bv_val, + ctrls[i]->ldctl_value.bv_len, b64->bv_val, b64->bv_len ); } diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index a502380e9d..ae0b963b03 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -128,7 +128,7 @@ ber_skip_tag( BerElement *ber, ber_len_t *len ) return LBER_DEFAULT; } - if( (unsigned) ber_read( ber, netlen, noctets ) != noctets ) { + if( (unsigned) ber_read( ber, (char *) netlen, noctets ) != noctets ) { return LBER_DEFAULT; } diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index c29f0b1132..5e2fecf69f 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -83,7 +83,7 @@ ber_put_tag( } rc = ber_write( ber, - &nettag[sizeof(ber_tag_t) - taglen], + (char *) &nettag[sizeof(ber_tag_t) - taglen], taglen, nosos ); return rc; @@ -165,7 +165,7 @@ ber_put_len( BerElement *ber, ber_len_t len, int nosos ) /* write the length itself */ rc = ber_write( ber, - &netlen[sizeof(ber_len_t)-i], + (char *) &netlen[sizeof(ber_len_t)-i], i, nosos ); return rc == i ? i+1 : -1; @@ -230,7 +230,7 @@ ber_put_int_or_enum( } rc = ber_write( ber, - &netnum[sizeof(ber_int_t) - i], + (char *) &netnum[sizeof(ber_int_t) - i], i, 0 ); /* length of tag + length + contents */ @@ -569,7 +569,7 @@ ber_put_seqorset( BerElement *ber ) /* the length itself */ rc = ber_write( ber, - &netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN-1)], + (char *) &netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN-1)], FOUR_BYTE_LEN-1, 1 ); if( rc != FOUR_BYTE_LEN - 1 ) { diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 62e305640b..7ad2b80e66 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -211,8 +211,8 @@ sb_sasl_drop_packet ( Sockbuf_Buf *sec_buf_in, unsigned max, int debuglevel ) sec_buf_in->buf_end, len ); if ( len >= 4 ) { - sec_buf_in->buf_end = sb_sasl_pkt_length( sec_buf_in->buf_base, - max, debuglevel); + sec_buf_in->buf_end = sb_sasl_pkt_length( + (unsigned char *) sec_buf_in->buf_base, max, debuglevel); } else { sec_buf_in->buf_end = 0; @@ -260,7 +260,7 @@ sb_sasl_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) } /* The new packet always starts at p->sec_buf_in.buf_base */ - ret = sb_sasl_pkt_length( p->sec_buf_in.buf_base, + ret = sb_sasl_pkt_length( (unsigned char *) p->sec_buf_in.buf_base, *p->sasl_maxbuf, sbiod->sbiod_sb->sb_debug ); /* Grow the packet buffer if neccessary */ diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 60ffe1aa2e..23bd41b640 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -29,7 +29,7 @@ /* parsing/printing routines */ static int str2strval( const char *str, ber_len_t stoplen, struct berval *val, - const char **next, unsigned flags, unsigned *retFlags, void *ctx ); + const char **next, unsigned flags, int *retFlags, void *ctx ); static int DCE2strval( const char *str, struct berval *val, const char **next, unsigned flags, void *ctx ); static int IA52strval( const char *str, struct berval *val, @@ -1439,7 +1439,7 @@ return_result:; * '\' + HEXPAIR(p) -> unhex(p) */ static int -str2strval( const char *str, ber_len_t stoplen, struct berval *val, const char **next, unsigned flags, unsigned *retFlags, void *ctx ) +str2strval( const char *str, ber_len_t stoplen, struct berval *val, const char **next, unsigned flags, int *retFlags, void *ctx ) { const char *p, *end, *startPos, *endPos = NULL; ber_len_t len, escapes; @@ -3459,7 +3459,7 @@ get_oid: newAVA->la_attr.bv_val = oidptr; } } } - Val.bv_val = str->data; + Val.bv_val = (char *) str->data; Val.bv_len = str->length; switch( str->type ) { case V_ASN1_UNIVERSALSTRING: diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index e355d25a6e..d7d62885e0 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -234,7 +234,7 @@ ldap_pvt_tls_init_def_ctx( void ) } SSL_CTX_set_session_id_context( tls_def_ctx, - "OpenLDAP", sizeof("OpenLDAP")-1 ); + (const unsigned char *) "OpenLDAP", sizeof("OpenLDAP")-1 ); if ( tls_opt_ciphersuite && !SSL_CTX_set_cipher_list( tls_def_ctx, ciphersuite ) ) @@ -1037,7 +1037,7 @@ ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in ) if (gn->type == GEN_DNS) { if (ntype != IS_DNS) continue; - sn = ASN1_STRING_data(gn->d.ia5); + sn = (char *) ASN1_STRING_data(gn->d.ia5); sl = ASN1_STRING_length(gn->d.ia5); /* Is this an exact match? */ @@ -1061,7 +1061,7 @@ ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in ) } else if (gn->type == GEN_IPADD) { if (ntype == IS_DNS) continue; - sn = ASN1_STRING_data(gn->d.ia5); + sn = (char *) ASN1_STRING_data(gn->d.ia5); sl = ASN1_STRING_length(gn->d.ia5); #ifdef LDAP_PF_INET6 diff --git a/libraries/libldap/utf-8.c b/libraries/libldap/utf-8.c index d6caf8c476..f97fe9efbb 100644 --- a/libraries/libldap/utf-8.c +++ b/libraries/libldap/utf-8.c @@ -135,7 +135,7 @@ int ldap_utf8_charlen2( const char * p ) /* conv UTF-8 to UCS-4, useful for comparisons */ ldap_ucs4_t ldap_x_utf8_to_ucs4( const char * p ) { - const unsigned char *c = p; + const unsigned char *c = (const unsigned char *) p; ldap_ucs4_t ch; int len, i; static unsigned char mask[] = { @@ -163,7 +163,7 @@ ldap_ucs4_t ldap_x_utf8_to_ucs4( const char * p ) int ldap_x_ucs4_to_utf8( ldap_ucs4_t c, char *buf ) { int len=0; - unsigned char* p = buf; + unsigned char* p = (unsigned char *) buf; /* not a valid Unicode character */ if ( c < 0 ) return 0; @@ -298,7 +298,7 @@ ldap_ucs_to_utf8s( struct berval *ucs, int csize, struct berval *utf8s ) char* ldap_utf8_next( const char * p ) { int i; - const unsigned char *u = p; + const unsigned char *u = (const unsigned char *) p; if( LDAP_UTF8_ISASCII(u) ) { return (char *) &p[1]; @@ -325,7 +325,7 @@ char* ldap_utf8_next( const char * p ) char* ldap_utf8_prev( const char * p ) { int i; - const unsigned char *u = p; + const unsigned char *u = (const unsigned char *) p; for( i=-1; i>-6 ; i-- ) { if ( ( u[i] & 0xc0 ) != 0x80 ) { @@ -349,7 +349,7 @@ char* ldap_utf8_prev( const char * p ) int ldap_utf8_copy( char* dst, const char *src ) { int i; - const unsigned char *u = src; + const unsigned char *u = (const unsigned char *) src; dst[0] = src[0]; diff --git a/libraries/liblutil/entropy.c b/libraries/liblutil/entropy.c index 6995cf4bc6..505f3b5a70 100644 --- a/libraries/liblutil/entropy.c +++ b/libraries/liblutil/entropy.c @@ -122,7 +122,7 @@ int lutil_entropy( unsigned char *buf, ber_len_t nbytes ) for( n = 0; n < nbytes; n += 16 ) { struct lutil_MD5Context ctx; - char digest[16]; + unsigned char digest[16]; /* poor resolution */ #ifdef HAVE_GETTIMEOFDAY diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 70009e0771..f3a727d150 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -343,7 +343,7 @@ struct berval * lutil_passwd_generate( ber_len_t len ) return NULL; } - if( lutil_entropy( pw->bv_val, pw->bv_len) < 0 ) { + if( lutil_entropy( (unsigned char *) pw->bv_val, pw->bv_len) < 0 ) { ber_bvfree( pw ); return NULL; } @@ -442,7 +442,7 @@ static struct berval * pw_string64( AC_MEMCPY(b64->bv_val, sc->bv_val, sc->bv_len); rc = lutil_b64_ntop( - string.bv_val, string.bv_len, + (unsigned char *) string.bv_val, string.bv_len, &b64->bv_val[sc->bv_len], b64len ); if( salt ) ber_memfree( string.bv_val ); @@ -1046,16 +1046,16 @@ static struct berval *hash_ssha1( { lutil_SHA1_CTX SHA1context; unsigned char SHA1digest[LUTIL_SHA1_BYTES]; - unsigned char saltdata[4]; + char saltdata[4]; struct berval digest; struct berval salt; - digest.bv_val = SHA1digest; + digest.bv_val = (char *) SHA1digest; digest.bv_len = sizeof(SHA1digest); salt.bv_val = saltdata; salt.bv_len = sizeof(saltdata); - if( lutil_entropy( salt.bv_val, salt.bv_len) < 0 ) { + if( lutil_entropy( (unsigned char *) salt.bv_val, salt.bv_len) < 0 ) { return NULL; } @@ -1077,7 +1077,7 @@ static struct berval *hash_sha1( lutil_SHA1_CTX SHA1context; unsigned char SHA1digest[LUTIL_SHA1_BYTES]; struct berval digest; - digest.bv_val = SHA1digest; + digest.bv_val = (char *) SHA1digest; digest.bv_len = sizeof(SHA1digest); lutil_SHA1Init( &SHA1context ); @@ -1096,16 +1096,16 @@ static struct berval *hash_smd5( { lutil_MD5_CTX MD5context; unsigned char MD5digest[LUTIL_MD5_BYTES]; - unsigned char saltdata[4]; + char saltdata[4]; struct berval digest; struct berval salt; - digest.bv_val = MD5digest; + digest.bv_val = (char *) MD5digest; digest.bv_len = sizeof(MD5digest); salt.bv_val = saltdata; salt.bv_len = sizeof(saltdata); - if( lutil_entropy( salt.bv_val, salt.bv_len) < 0 ) { + if( lutil_entropy( (unsigned char *) salt.bv_val, salt.bv_len) < 0 ) { return NULL; } @@ -1129,7 +1129,7 @@ static struct berval *hash_md5( struct berval digest; - digest.bv_val = MD5digest; + digest.bv_val = (char *) MD5digest; digest.bv_len = sizeof(MD5digest); lutil_MD5Init( &MD5context ); @@ -1298,11 +1298,11 @@ static struct berval *hash_crypt( /* copy the salt we made into entropy before snprintfing it back into the salt */ char entropy[sizeof(salt)]; - strcpy( entropy, salt ); - snprintf( salt, sizeof(entropy), salt_format, entropy ); + strcpy( entropy, (char *) salt ); + snprintf( (char *) salt, sizeof(entropy), salt_format, entropy ); } - hash.bv_val = crypt( passwd->bv_val, salt ); + hash.bv_val = crypt( passwd->bv_val, (char *) salt ); if( hash.bv_val == NULL ) return NULL; diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index f854f8b0da..289251c9e7 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -641,11 +641,11 @@ int entry_decode(struct berval *bv, Entry **e) i = entry_getlen(&ptr); x = ch_calloc(1, i); i = entry_getlen(&ptr); - x->e_name.bv_val = ptr; + x->e_name.bv_val = (char *) ptr; x->e_name.bv_len = i; ptr += i+1; i = entry_getlen(&ptr); - x->e_nname.bv_val = ptr; + x->e_nname.bv_val = (char *) ptr; x->e_nname.bv_len = i; ptr += i+1; #ifdef NEW_LOGGING @@ -667,7 +667,7 @@ int entry_decode(struct berval *bv, Entry **e) while ((i = entry_getlen(&ptr))) { struct berval bv; bv.bv_len = i; - bv.bv_val = ptr; + bv.bv_val = (char *) ptr; if (a) { a->a_next = (Attribute *)bptr; } -- 2.39.5