diff --git a/CHANGES b/CHANGES index d34f48a614..b7bb8a6a28 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ OpenLDAP Change Log Changes included in OpenLDAP 1.2.1 CVS Tag: OPENLDAP_REL_ENG_1_2 Updated ctype and string generic headers. + Fix ctype 'unsigned char' bug Build environment Added pthread '-mt' check for Solaris 2.x. diff --git a/clients/fax500/main.c b/clients/fax500/main.c index 2c103c20a8..5c4429e40e 100644 --- a/clients/fax500/main.c +++ b/clients/fax500/main.c @@ -1138,7 +1138,7 @@ do_noemailorfax( FILE *fp, Error *err, int namelen, int errtype ) != NULL ) { for ( i = 0; vals[i]; i++ ) { last = strlen( vals[i] ) - 1; - if ( isdigit( vals[i][last] ) ) { + if ( isdigit((unsigned char) vals[i][last]) ) { rdn = strdup( vals[i] ); break; } @@ -1176,7 +1176,7 @@ do_noemailorfax( FILE *fp, Error *err, int namelen, int errtype ) for ( i = 0; vals[0][i] != '\0'; i++ ) { if ( vals[0][i] == '$' ) { fprintf( fp, "\n%*s ", namelen, " " ); - while ( isspace( vals[0][i+1] ) ) + while ( isspace((unsigned char) vals[0][i+1]) ) i++; } else { fprintf( fp, "%c", vals[0][i] ); @@ -1225,7 +1225,7 @@ do_ambiguous( FILE *fp, Error *err, int namelen ) if ( (vals = ldap_get_values( ld, e, "cn" )) != NULL ) { for ( i = 0; vals[i]; i++ ) { last = strlen( vals[i] ) - 1; - if ( isdigit( vals[i][last] ) ) { + if ( isdigit((unsigned char) vals[i][last]) ) { rdn = strdup( vals[i] ); break; } diff --git a/clients/fax500/rp500.c b/clients/fax500/rp500.c index abf4daad89..dafb4a4a20 100644 --- a/clients/fax500/rp500.c +++ b/clients/fax500/rp500.c @@ -191,7 +191,7 @@ main( int argc, char **argv ) cn = ldap_get_values( ld, e, "cn" ); for ( i = 0; cn[i] != NULL; i++ ) { last = strlen( cn[i] ) - 1; - if ( isdigit( cn[i][last] ) ) { + if ( isdigit((unsigned char) cn[i][last]) ) { rdn = strdup( cn[i] ); break; } diff --git a/clients/finger/main.c b/clients/finger/main.c index 0b3f6b2d84..ccc689852f 100644 --- a/clients/finger/main.c +++ b/clients/finger/main.c @@ -228,7 +228,7 @@ do_query( void ) p = buf; } - for ( ; *p && isspace( *p ); p++ ) + for ( ; *p && isspace( (unsigned char) *p ); p++ ) ; /* NULL */ do_search( ld, p ); @@ -370,7 +370,7 @@ do_search( LDAP *ld, char *buf ) cn = ldap_get_values( ld, e, "cn" ); for ( i = 0; cn[i] != NULL; i++ ) { last = strlen( cn[i] ) - 1; - if ( isdigit( cn[i][last] ) ) { + if (isdigit((unsigned char) cn[i][last])) { rdn = strdup( cn[i] ); break; } diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 60b35b913c..823589951e 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -376,7 +376,7 @@ do_queries( int s ) query = buf; /* strip off leading white space */ - while ( isspace( *query )) { + while ( isspace( (unsigned char) *query )) { ++query; --len; } diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 04ad52ea12..7eee0e696e 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -406,7 +406,7 @@ do_queries( int s ) query = buf; /* strip off leading white space */ - while ( isspace( *query )) { + while ( isspace( (unsigned char) *query )) { ++query; --len; } diff --git a/clients/mail500/main.c b/clients/mail500/main.c index aedd5594d3..f99747d5e8 100644 --- a/clients/mail500/main.c +++ b/clients/mail500/main.c @@ -1311,7 +1311,7 @@ do_noemail( FILE *fp, Error *err, int namelen ) != NULL ) { for ( i = 0; vals[i]; i++ ) { last = strlen( vals[i] ) - 1; - if ( isdigit( vals[i][last] ) ) { + if ( isdigit((unsigned char) vals[i][last]) ) { rdn = strdup( vals[i] ); break; } @@ -1349,7 +1349,7 @@ do_noemail( FILE *fp, Error *err, int namelen ) for ( i = 0; vals[0][i] != '\0'; i++ ) { if ( vals[0][i] == '$' ) { fprintf( fp, "\n%*s ", namelen, " " ); - while ( isspace( vals[0][i+1] ) ) + while ( isspace((unsigned char) vals[0][i+1]) ) i++; } else { fprintf( fp, "%c", vals[0][i] ); @@ -1398,7 +1398,7 @@ do_ambiguous( FILE *fp, Error *err, int namelen ) if ( (vals = ldap_get_values( ld, e, "cn" )) != NULL ) { for ( i = 0; vals[i]; i++ ) { last = strlen( vals[i] ) - 1; - if ( isdigit( vals[i][last] ) ) { + if (isdigit((unsigned char) vals[i][last])) { rdn = strdup( vals[i] ); break; } diff --git a/clients/rcpt500/main.c b/clients/rcpt500/main.c index 2ea4d740f2..449c1b8a5a 100644 --- a/clients/rcpt500/main.c +++ b/clients/rcpt500/main.c @@ -236,7 +236,7 @@ read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep ) { char *hdr; - for ( hdr = buf + offset; isspace( *hdr ); ++hdr ) { + for ( hdr = buf + offset; isspace( (unsigned char) *hdr ); ++hdr ) { ; } if (( hdr = strdup( hdr )) == NULL ) { @@ -249,7 +249,7 @@ read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep ) while ( 1 ) { *linep = fgets( buf, MAXSIZE, fp ); buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */ - if ( *linep == NULL || !isspace( **linep )) { + if ( *linep == NULL || !isspace( (unsigned char) **linep )) { break; } if (( hdr = realloc( hdr, strlen( hdr ) + @@ -355,16 +355,16 @@ find_command( char *text, char **argp ) p = text; for ( s = argbuf; *p != '\0'; ++p ) { - *s++ = TOLOWER( *p ); + *s++ = TOLOWER( (unsigned char) *p ); } *s = '\0'; for ( i = 0; cmds[ i ].cmd_text != NULL; ++i ) { if (( s = strstr( argbuf, cmds[ i ].cmd_text )) != NULL - && isspace( *(s + strlen( cmds[ i ].cmd_text )))) { + && isspace( (unsigned char) s[ strlen( cmds[ i ].cmd_text ) ] )) { strcpy( argbuf, text + (s - argbuf) + strlen( cmds[ i ].cmd_text )); *argp = argbuf; - while ( isspace( **argp )) { + while ( isspace( (unsigned char) **argp )) { ++(*argp); } return( i ); diff --git a/clients/rcpt500/query.c b/clients/rcpt500/query.c index 28605e9a25..5b38049c91 100644 --- a/clients/rcpt500/query.c +++ b/clients/rcpt500/query.c @@ -261,7 +261,7 @@ append_entry_list( char *reply, char *query, LDAP *ldp, LDAPMessage *ldmsgp ) if (( cn = ldap_get_values( ldp, e, "cn" )) != NULL ) { for ( i = 0; cn[i] != NULL; i++ ) { - if ( isdigit( *( cn[i] + strlen( cn[i] ) - 1 ))) { + if ( isdigit((unsigned char) cn[i][strlen( cn[i] ) - 1])) { rdn = strdup( cn[i] ); free_rdn = 1; break; @@ -325,7 +325,7 @@ remove_trailing_space( char *s ) { char *p = s + strlen( s ) - 1; - while ( isspace( *p ) && p > s ) { + while ( isspace( (unsigned char) *p ) && p > s ) { --p; } *(++p) = '\0'; diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 97543c3a0b..d63e887981 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -211,7 +211,7 @@ main( int argc, char **argv ) if ( !use_ldif && ( q = strchr( rbuf, '\n' )) != NULL ) { for ( p = rbuf; p < q; ++p ) { - if ( !isdigit( *p )) { + if ( !isdigit( (unsigned char) *p )) { break; } } @@ -452,20 +452,21 @@ process_ldapmod_rec( char *rbuf ) value = p; } - for ( attr = line; *attr != '\0' && isspace( *attr ); ++attr ) { + for ( attr = line; + *attr != '\0' && isspace( (unsigned char) *attr ); ++attr ) { ; /* skip attribute leading white space */ } - for ( q = p - 1; q > attr && isspace( *q ); --q ) { + for ( q = p - 1; q > attr && isspace( (unsigned char) *q ); --q ) { *q = '\0'; /* remove attribute trailing white space */ } if ( value != NULL ) { - while ( isspace( *value )) { + while ( isspace( (unsigned char) *value )) { ++value; /* skip value leading white space */ } for ( q = value + strlen( value ) - 1; q > value && - isspace( *q ); --q ) { + isspace( (unsigned char) *q ); --q ) { *q = '\0'; /* remove value trailing white space */ } if ( *value == '\0' ) { diff --git a/clients/ud/auth.c b/clients/ud/auth.c index 0461261f2b..3c6d81ff33 100644 --- a/clients/ud/auth.c +++ b/clients/ud/auth.c @@ -298,7 +298,7 @@ str2upper( char *s ) char *p; for ( p = s; *p != '\0'; ++p ) { - *p = TOUPPER( *p ); + *p = TOUPPER( (unsigned char) *p ); } } @@ -363,7 +363,7 @@ krbgetpass( char *user, char *inst, char *realm, char *pw, C_Block key ) #ifdef HAVE_AFS_KERBEROS strcpy( lcrealm, realm ); for ( p = lcrealm; *p != '\0'; ++p ) { - *p = TOLOWER( *p ); + *p = TOLOWER( (unsigned char) *p ); } ka_StringToKey( passwd, lcrealm, key ); diff --git a/clients/ud/edit.c b/clients/ud/edit.c index 891f2e7c87..8bdab14f9d 100644 --- a/clients/ud/edit.c +++ b/clients/ud/edit.c @@ -265,8 +265,8 @@ write_entry( void ) cp = line; if (*cp == '#') continue; - if (isspace(*cp)) { /* value */ - while (isspace(*cp)) + if (isspace((unsigned char)*cp)) { /* value */ + while (isspace((unsigned char)*cp)) cp++; values[number_of_values++] = strdup(cp); if ( number_of_values >= MAX_VALUES ) { @@ -276,7 +276,7 @@ write_entry( void ) continue; } /* attribute */ - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; /* * If the number of values is greater than zero, then we diff --git a/clients/ud/group.c b/clients/ud/group.c index 9e32739f24..b864eb9777 100644 --- a/clients/ud/group.c +++ b/clients/ud/group.c @@ -865,7 +865,7 @@ mod_addrDN( char *group, int offset ) register char *cp; if (strchr(s, '<') == NULL) { for (cp = s; *cp != '@'; cp++) - if (isspace(*cp)) + if (isspace((unsigned char)*cp)) *cp = '.'; } new_value = s; diff --git a/clients/ud/main.c b/clients/ud/main.c index 2178c5685c..9480c63b7d 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -195,19 +195,19 @@ do_commands( void ) putchar('\n'); continue; } - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; ap = cmd; if (memset(cmd, '\0', sizeof(cmd)) == NULL) fatal("memset"); - while (!isspace(*cp) && (*cp != '\0')) + while (!isspace((unsigned char)*cp) && (*cp != '\0')) *ap++ = *cp++; if (iscom("status")) status(); else if (iscom("stop") || iscom("quit")) break; else if (iscom("cb") || iscom("cd") || iscom("moveto")) { - while (isspace(*cp) && (*cp != '\0')) + while (isspace((unsigned char)*cp) && (*cp != '\0')) cp++; if (!strncasecmp(cp, "base", 4)) cp += 4; @@ -391,7 +391,7 @@ change_base( int type, char **base, char *s ) * * sequence now that 'cp' is pointing to the '='. */ - while(!isspace(*cp)) + while(!isspace((unsigned char)*cp)) cp--; cp++; /* @@ -582,7 +582,7 @@ initialize_client( void ) if (server != NULL) continue; cp = buffer + 6; - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; if ((*cp == '\0') || (*cp == '\n')) continue; @@ -592,7 +592,7 @@ initialize_client( void ) if (server != NULL) continue; cp = buffer + 4; - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; if ((*cp == '\0') || (*cp == '\n')) continue; @@ -600,7 +600,7 @@ initialize_client( void ) } else if (!strncasecmp(buffer, "base", 4)) { cp = buffer + 4; - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; if ((*cp == '\0') || (*cp == '\n')) continue; @@ -608,7 +608,7 @@ initialize_client( void ) } else if (!strncasecmp(buffer, "groupbase", 9)) { cp = buffer + 9; - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; if ((*cp == '\0') || (*cp == '\n')) continue; diff --git a/clients/ud/mod.c b/clients/ud/mod.c index b6efc6fc02..9ead3ba278 100644 --- a/clients/ud/mod.c +++ b/clients/ud/mod.c @@ -570,7 +570,7 @@ set_boolean( printf(" Please enter Y for yes, N for no, or RETURN to cancel: "); fflush(stdout); (void) fetch_buffer(response, sizeof(response), stdin); - for (s = response; isspace(*s); s++) + for (s = response; isspace((unsigned char)*s); s++) ; if ((*s == 'y') || (*s == 'Y')) { if (ldap_modify_s(ld, who, mods)) { @@ -635,7 +635,7 @@ set_updates( char *who, int dummy ) printf("\n Change this setting [no]? "); fflush(stdout); (void) fetch_buffer(response, sizeof(response), stdin); - for (s = response; isspace(*s); s++) + for (s = response; isspace((unsigned char)*s); s++) ; if ((*s == 'y') || (*s == 'Y')) { if (!strcmp(cp, "TRUE")) @@ -766,7 +766,7 @@ check_URL( char *url ) register char *cp; for (cp = url; *cp != '\n' && *cp != '\0'; cp++) { - if (isspace(*cp)) + if (isspace((unsigned char)*cp)) return(-1); /*NOTREACHED*/ } diff --git a/clients/ud/print.c b/clients/ud/print.c index ad62c50a4c..c369e5ee72 100644 --- a/clients/ud/print.c +++ b/clients/ud/print.c @@ -341,7 +341,7 @@ print_values( struct attribute A ) putchar('\n'); for (k = lead; k > 0; k--) putchar(' '); - while (isspace(*(cp + 1))) + while (isspace((unsigned char) cp[1])) cp++; } else @@ -512,14 +512,14 @@ print_one_URL( char *s, int label_lead, char *tag, int url_lead ) register int i; char c, *cp, *url; - for (cp = s; !isspace(*cp) && (*cp != '\0'); cp++) + for (cp = s; !isspace((unsigned char)*cp) && (*cp != '\0'); cp++) ; c = *cp; *cp = '\0'; url = strdup(s); *cp = c; if (*cp != '\0') { - for (cp++; isspace(*cp); cp++) + for (cp++; isspace((unsigned char)*cp); cp++) ; } else @@ -547,7 +547,7 @@ time2text( char *ldtimestr, int dateonly ) } for ( p = ldtimestr; p - ldtimestr < 12; ++p ) { - if ( !isdigit( *p )) { + if ( !isdigit( (unsigned char) *p )) { return( fmterr ); } } diff --git a/clients/ud/ud.h b/clients/ud/ud.h index ab893e3a25..a90765f6e8 100644 --- a/clients/ud/ud.h +++ b/clients/ud/ud.h @@ -28,7 +28,7 @@ * parsing names. */ #define MAX_NAME_COMPS 8 -#define isnamesepartor(x) (isspace(x)) +#define isnamesepartor(x) (isspace((unsigned char) (x))) #define isignorechar(x) (((x) == '.') || ((x) == '_')) /* diff --git a/clients/ud/util.c b/clients/ud/util.c index ae1072f29a..0ee2e60926 100644 --- a/clients/ud/util.c +++ b/clients/ud/util.c @@ -198,12 +198,13 @@ fetch_buffer( char *buffer, int length, FILE *where ) errno = 0; /* so fatal() doesn't bitch */ fatal("fgets"); } - for (i = strlen(buffer) - 1; i >= 0 && !isprint(buffer[i]); i--) + for (i = strlen(buffer) - 1; + i >= 0 && !isprint((unsigned char) buffer[i]); i--) buffer[i] = '\0'; p = buffer; while ( *p != '\0' ) { - if ( isprint( *p )) { + if ( isprint( (unsigned char) *p )) { ++p; } else { SAFEMEMCPY( p, p + 1, strlen( p + 1 ) + 1 ); @@ -289,10 +290,10 @@ format( char *str, int width, int lead ) /*NOTREACHED*/ } cp = s + width - lead; - while (!isspace(*cp) && (cp != s)) + while (!isspace((unsigned char)*cp) && (cp != s)) cp--; *cp = '\0'; - while (isspace(*s)) + while (isspace((unsigned char)*s)) s++; printf("%s%s\n", leader, s); s = cp + 1; @@ -368,7 +369,7 @@ format2( * back it up to the first space character. */ cp = s + width - first_indent - strlen(first_tag); - while (!isspace(*cp) && (cp != s)) + while (!isspace((unsigned char)*cp) && (cp != s)) cp--; /* @@ -386,7 +387,7 @@ format2( * as well. We should gobble up all of these since we don't want * unexpected leading blanks. */ - for (s = cp + 1; isspace(*s); s++) + for (s = cp + 1; isspace((unsigned char)*s); s++) ; /* now do all of the other lines */ @@ -399,7 +400,7 @@ format2( /*NOTREACHED*/ } cp = s + width - indent - strlen(tag); - while (!isspace(*cp) && (cp != s)) + while (!isspace((unsigned char)*cp) && (cp != s)) cp--; c = *cp; *cp = '\0'; @@ -496,10 +497,10 @@ isauniqname( char *s ) if ((i < 3) || (i > 8)) /* uniqnames are 3-8 chars */ return(FALSE); - if (!isalpha(*s)) /* uniqnames begin with a letter */ + if (!isalpha((unsigned char)*s)) /* uniqnames begin with a letter */ return(FALSE); for ( ; *s != '\0'; s++) /* uniqnames are alphanumeric */ - if (!isalnum(*s)) + if (!isalnum((unsigned char)*s)) return(FALSE); return(TRUE); } @@ -593,7 +594,7 @@ Free( void *ptr ) char * nextstr( char *s ) { - while (isspace(*s) && (*s != '\0')) + while (isspace((unsigned char) *s) && (*s != '\0')) s++; if (s == NULL) return(NULL); diff --git a/contrib/saucer/main.c b/contrib/saucer/main.c index b664c5a10f..3e21106953 100644 --- a/contrib/saucer/main.c +++ b/contrib/saucer/main.c @@ -532,7 +532,7 @@ int is_whitespace(register char *s) if (!s) return 1; - while (*s && isspace(*s)) + while (*s && isspace((unsigned char) *s)) ++s; return !*s; @@ -634,7 +634,7 @@ char *skip_to_whitespace(register char *s) if (!s) return s; - while (*s && !isspace(*s)) + while (*s && !isspace((unsigned char) *s)) ++s; return s; @@ -645,7 +645,7 @@ char *skip_whitespace(register char *s) if (!s) return s; - while (*s && isspace(*s)) + while (*s && isspace((unsigned char) *s)) ++s; return s; diff --git a/contrib/whois++/command.c b/contrib/whois++/command.c index 1b109ae65c..638442e897 100644 --- a/contrib/whois++/command.c +++ b/contrib/whois++/command.c @@ -88,7 +88,7 @@ getToken( char *token ) if ( log ) syslog( LOG_INFO, "Whois++ Query: %s", buffer ); } - while ( buffer[idx] != '\0' && isspace( buffer[idx] ) ) + while ( buffer[idx] != '\0' && isspace( (unsigned char) buffer[idx] ) ) idx++; token[0] = buffer[idx++]; token[1] = '\0'; @@ -154,7 +154,8 @@ getToken( char *token ) token[i++] = buffer[idx++]; else token[i++] = ch; - } while ( ch != '\0' && !isspace( ch ) && !isspecial( ch ) ); + } while ( ch != '\0' && + !isspace( (unsigned char) ch ) && !isspecial( ch ) ); token[--i] = '\0'; idx--; /**/ /* @@ -376,7 +377,7 @@ processTerm( } else { if ( ( s = strchr( buffer, ',' ) ) != NULL ) { *s++ = '\0'; - while ( *s && isspace( *s ) ) + while ( *s && isspace( (unsigned char) *s ) ) s++; sprintf( query, "(sn%s%s)", (soundex)?"~=":"=", buffer ); @@ -384,7 +385,7 @@ processTerm( /* let's just make sure there is no title */ if ( ( t = strrchr( s, ',' ) ) != NULL ) { *t++ = '\0'; - while ( *t && isspace( *t ) ) + while ( *t && isspace( (unsigned char) *t ) ) t++; sprintf( query, "(personalTitle%s%s)", (soundex)?"~=":"=", t ); diff --git a/contrib/whois++/output.c b/contrib/whois++/output.c index 6ebe649227..b793971e62 100644 --- a/contrib/whois++/output.c +++ b/contrib/whois++/output.c @@ -217,18 +217,18 @@ char *dn, *attributes[]; ufn = ldap_dn2ufn( dn ); if ( ( s = index( ufn, ',' ) ) != NULL ) { *s++ = '\0'; - while ( *s != '\0' && isspace( *s ) ) + while ( *s != '\0' && isspace( (unsigned char) *s ) ) s++; department = s; while ( s != NULL && *s != '\0' && !EQ( s, organisation ) ) if ( ( s = index( s, ',' ) ) != NULL ) { s++; - while ( *s != '\0' && isspace( *s ) ) + while ( *s && isspace( (unsigned char) *s ) ) s++; } if ( s != NULL ) if ( s != department ) { - while ( isspace( *--s ) ) + while ( isspace( (unsigned char) *--s ) ) ; *s = '\0'; } else diff --git a/contrib/whois++/util.c b/contrib/whois++/util.c index 5d7b8ebec4..3f9bdd668b 100644 --- a/contrib/whois++/util.c +++ b/contrib/whois++/util.c @@ -53,8 +53,8 @@ lowerCase( char *string ) char *s; for ( s = string; s != NULL && *s != '\0'; s++ ) - if ( isupper( *s ) ) - *s = tolower( *s ); + if ( isupper( (unsigned char) *s ) ) + *s = tolower( (unsigned char) *s ); return string; } diff --git a/libraries/libldap/dsparse.c b/libraries/libldap/dsparse.c index 13451a4de1..51403c40f2 100644 --- a/libraries/libldap/dsparse.c +++ b/libraries/libldap/dsparse.c @@ -157,7 +157,7 @@ next_token( char **sp ) p = *sp; - while ( isspace( *p )) { /* skip leading white space */ + while ( isspace( (unsigned char) *p )) { /* skip leading white space */ ++p; } @@ -172,7 +172,7 @@ next_token( char **sp ) t = tokstart = p; for ( ;; ) { - if ( *p == '\0' || ( isspace( *p ) && !in_quote )) { + if ( *p == '\0' || ( isspace( (unsigned char) *p ) && !in_quote )) { if ( *p != '\0' ) { ++p; } diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 2291a121db..b56eb6e56b 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -92,8 +92,8 @@ ldap_dn2ufn( char *dn ) char *rsave = r; *r-- = '\0'; - while ( !isspace( *r ) && *r != ';' - && *r != ',' && r > ufn ) + while ( !isspace( (unsigned char) *r ) + && *r != ';' && *r != ',' && r > ufn ) r--; r++; diff --git a/libraries/libldap/getdxbyname.c b/libraries/libldap/getdxbyname.c index f48a3269bb..bce6361027 100644 --- a/libraries/libldap/getdxbyname.c +++ b/libraries/libldap/getdxbyname.c @@ -133,12 +133,12 @@ decode_answer( unsigned char *answer, int len ) if ( *q >= 3 && strncasecmp( q + 1, "dx:", 3 ) == 0 ) { txt_len = *q - 3; r = q + 4; - while ( isspace( *r )) { + while ( isspace( (unsigned char) *r )) { ++r; --txt_len; } pref = 0; - while ( isdigit( *r )) { + while ( isdigit( (unsigned char) *r )) { pref *= 10; pref += ( *r - '0' ); ++r; @@ -147,7 +147,7 @@ decode_answer( unsigned char *answer, int len ) if ( dx_count < MAX_TO_SORT - 1 ) { dx_pref[ dx_count ] = pref; } - while ( isspace( *r )) { + while ( isspace( (unsigned char) *r )) { ++r; --txt_len; } diff --git a/libraries/libldap/getfilter.c b/libraries/libldap/getfilter.c index 4d201e89a9..6851a0c7c5 100644 --- a/libraries/libldap/getfilter.c +++ b/libraries/libldap/getfilter.c @@ -333,12 +333,12 @@ ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern, if ( *p == '%' ) { ++p; if ( *p == 'v' ) { - if ( isdigit( *(p+1))) { + if ( isdigit( (unsigned char) p[1] )) { ++p; wordnum = *p - '1'; if ( *(p+1) == '-' ) { ++p; - if ( isdigit( *(p+1))) { + if ( isdigit( (unsigned char) p[1] )) { ++p; endwordnum = *p - '1'; /* e.g., "%v2-4" */ if ( endwordnum > wordcount - 1 ) { diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index cc8588d712..b3a2e93c63 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -92,14 +92,15 @@ static void openldap_ldap_init_w_conf(const char *file) if(*start == '#') continue; /* trim leading white space */ - while((*start != '\0') && isspace(*start)) start++; + while((*start != '\0') && isspace((unsigned char) *start)) + start++; /* anything left? */ if(*start == '\0') continue; /* trim trailing white space */ end = &start[strlen(start)-1]; - while(isspace(*end)) end--; + while(isspace((unsigned char)*end)) end--; end[1] = '\0'; /* anything left? */ @@ -108,7 +109,7 @@ static void openldap_ldap_init_w_conf(const char *file) /* parse the command */ cmd=start; - while((*start != '\0') && !isspace(*start)) { + while((*start != '\0') && !isspace((unsigned char)*start)) { start++; } if(*start == '\0') { @@ -119,7 +120,7 @@ static void openldap_ldap_init_w_conf(const char *file) *start++ = '\0'; /* we must have some non-whitespace to skip */ - while(isspace(*start)) start++; + while(isspace((unsigned char)*start)) start++; opt = start; for(i=0; attrs[i].type != ATTR_NONE; i++) { diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 794831fc9a..bec117c85b 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -406,7 +406,7 @@ put_filter_list( BerElement *ber, char *str ) Debug( LDAP_DEBUG_TRACE, "put_filter_list \"%s\"\n", str, 0, 0 ); while ( *str ) { - while ( *str && isspace( *str ) ) + while ( *str && isspace( (unsigned char) *str ) ) str++; if ( *str == '\0' ) break; diff --git a/libraries/libldap/tmplout.c b/libraries/libldap/tmplout.c index fad65f766f..f40c343c52 100644 --- a/libraries/libldap/tmplout.c +++ b/libraries/libldap/tmplout.c @@ -254,7 +254,7 @@ do_entry2text( freevals = 1; } - *attr = TOUPPER( *attr ); + *attr = TOUPPER( (unsigned char) *attr ); err = do_vals2text( ld, buf, vals, attr, labelwidth, LDAP_SYN_CASEIGNORESTR, writeproc, writeparm, eol, @@ -303,14 +303,14 @@ do_entry2text( if ( show && LDAP_GET_SYN_TYPE( colp->ti_syntaxid ) == LDAP_SYN_TYPE_BOOLEAN && LDAP_IS_TMPLITEM_OPTION_SET( colp, LDAP_DITEM_OPT_HIDEIFFALSE ) && - TOUPPER( vals[ 0 ][ 0 ] ) != 'T' ) { + TOUPPER( (unsigned char) vals[ 0 ][ 0 ] ) != 'T' ) { show = 0; } if ( colp->ti_syntaxid == LDAP_SYN_SEARCHACTION ) { if (( opts & LDAP_DISP_OPT_DOSEARCHACTIONS ) != 0 ) { if ( colp->ti_attrname == NULL || ( show && - TOUPPER( vals[ 0 ][ 0 ] ) == 'T' )) { + TOUPPER( (unsigned char) vals[ 0 ][ 0 ] ) == 'T' )) { err = searchaction( ld, buf, base, entry, dn, colp, labelwidth, rdncount, writeproc, writeparm, eol, urlprefix ); @@ -674,7 +674,7 @@ do_vals2text( p = s = outval; while (( s = strchr( s, '$' )) != NULL ) { *s++ = '\0'; - while ( isspace( *s )) { + while ( isspace( (unsigned char) *s )) { ++s; } if ( html ) { @@ -690,7 +690,7 @@ do_vals2text( break; case LDAP_SYN_BOOLEAN: - outval = TOUPPER( outval[ 0 ] ) == 'T' ? "TRUE" : "FALSE"; + outval = TOUPPER((unsigned char) outval[0]) == 'T' ? "TRUE" : "FALSE"; ++writeoutval; break; @@ -703,13 +703,13 @@ do_vals2text( case LDAP_SYN_LABELEDURL: if ( !notascii && ( p = strchr( outval, '$' )) != NULL ) { *p++ = '\0'; - while ( isspace( *p )) { + while ( isspace( (unsigned char) *p )) { ++p; } s = outval; } else if ( !notascii && ( s = strchr( outval, ' ' )) != NULL ) { *s++ = '\0'; - while ( isspace( *s )) { + while ( isspace( (unsigned char) *s )) { ++s; } p = outval; @@ -883,7 +883,7 @@ time2text( char *ldtimestr, int dateonly ) return( fmterr ); } - for ( ndigits=0; isdigit(ldtimestr[ndigits]); ndigits++) { + for ( ndigits=0; isdigit((unsigned char) ldtimestr[ndigits]); ndigits++) { ; /* EMPTY */ } diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 9036d7d124..09aa3433fc 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -60,7 +60,7 @@ str_parse_line( int i, b64; /* skip any leading space */ - while ( isspace( *line ) ) { + while ( isspace( (unsigned char) *line ) ) { line++; } *type = line; @@ -73,7 +73,7 @@ str_parse_line( } /* trim any space between type and : */ - for ( p = s - 1; p > line && isspace( *p ); p-- ) { + for ( p = s - 1; p > line && isspace( (unsigned char) *p ); p-- ) { *p = '\0'; } *s++ = '\0'; @@ -89,7 +89,7 @@ str_parse_line( } /* skip space between : and value */ - while ( isspace( *s ) ) { + while ( isspace( (unsigned char) *s ) ) { s++; } @@ -171,8 +171,7 @@ str_parse_line( char * str_getline( char **next ) { - char *l; - char c; + char *l; if ( *next == NULL || **next == '\n' || **next == '\0' ) { return( NULL ); @@ -180,7 +179,7 @@ str_getline( char **next ) l = *next; while ( (*next = strchr( *next, '\n' )) != NULL ) { - c = *(*next + 1); + unsigned char c = *(*next + 1); if ( isspace( c ) && c != '\n' ) { **next = CONTINUED_LINE_MARKER; *(*next+1) = CONTINUED_LINE_MARKER; diff --git a/servers/ldapd/syntax.c b/servers/ldapd/syntax.c index 9b9ee0febc..609158a4c0 100644 --- a/servers/ldapd/syntax.c +++ b/servers/ldapd/syntax.c @@ -146,7 +146,7 @@ attr_key_rfc1779( if ( x == NULL ) { x = "?"; - } else if ( isdigit ( *x ) ) { + } else if ( isdigit ( (unsigned char) *x ) ) { sprintf ( key, "OID.%s", x ); return; } else if (strcasecmp(x,"commonName")==0) { @@ -787,7 +787,8 @@ static void de_t61( char *s, int t61mark ) { char *next = s; - int c, hex; + unsigned char c; + unsigned int hex; while ( *s ) { switch ( *s ) { diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index d0de1d1d43..d3cf307e35 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -243,7 +243,7 @@ parse_acl( /* normalize the domain */ for ( s = b->a_domainpat; *s; s++ ) { - *s = TOLOWER( *s ); + *s = TOLOWER( (unsigned char) *s ); } } else if ( strcasecmp( left, "addr" ) == 0 ) { regtest(fname, lineno, right); diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 0d696dc024..6467a13f05 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -40,7 +40,7 @@ attr_normalize( char *s ) char *save; for ( save = s; *s; s++ ) { - *s = TOLOWER( *s ); + *s = TOLOWER( (unsigned char) *s ); } return( save ); diff --git a/servers/slapd/config.c b/servers/slapd/config.c index b810460680..69fa445694 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -579,7 +579,7 @@ fp_getline( FILE *fp, int *lineno ) if ( (p = strchr( buf, '\n' )) != NULL ) { *p = '\0'; } - if ( ! isspace( buf[0] ) ) { + if ( ! isspace( (unsigned char) buf[0] ) ) { return( line ); } diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index d5a9410a6d..89af5ec78b 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -250,7 +250,7 @@ slapd_daemon( /* normalize the domain */ for ( s = client_name; *s; s++ ) { - *s = TOLOWER( *s ); + *s = TOLOWER( (unsigned char) *s ); } } else { diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 54e53bfc35..70863dc6d9 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -138,7 +138,7 @@ dn_normalize_case( char *dn ) /* normalize case */ for ( s = dn; *s; s++ ) { - *s = TOUPPER( *s ); + *s = TOUPPER( (unsigned char) *s ); } return( dn ); @@ -266,7 +266,7 @@ dn_upcase( char *dn ) /* normalize case */ for ( s = dn; *s; s++ ) { - *s = TOUPPER( *s ); + *s = TOUPPER( (unsigned char) *s ); } return( dn ); diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 7572686781..2399274e3d 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -49,7 +49,7 @@ str2entry( char *s ) /* check to see if there's an id included */ next = s; - if ( isdigit( *s ) ) { + if ( isdigit( (unsigned char) *s ) ) { id = atoi( s ); if ( (s = str_getline( &next )) == NULL ) { Debug( LDAP_DEBUG_TRACE, diff --git a/servers/slapd/phonetic.c b/servers/slapd/phonetic.c index 4c7f3537bf..27f3f91e54 100644 --- a/servers/slapd/phonetic.c +++ b/servers/slapd/phonetic.c @@ -97,11 +97,11 @@ phonetic( char *s ) } adjacent = '0'; - phoneme[0] = TOUPPER(*p); + phoneme[0] = TOUPPER((unsigned char)*p); phoneme[1] = '\0'; for ( i = 0; i < 99 && (! iswordbreak(*p)); p++ ) { - ch = TOUPPER (*p); + ch = TOUPPER ((unsigned char)*p); code = '0'; @@ -199,8 +199,8 @@ phonetic( char *Word ) for (n = ntrans + 4, n_end = ntrans + 35; !iswordbreak( *Word ) && n < n_end; Word++) { - if (isalpha(*Word)) - *n++ = TOUPPER(*Word); + if (isalpha((unsigned char)*Word)) + *n++ = TOUPPER((unsigned char)*Word); } Metaph = buf; *Metaph = '\0'; diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index e8fddf337b..139934834b 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -96,7 +96,7 @@ replog( tmp = entry2str( e, &len, 0 ); while ( (tmp = strchr( tmp, '\n' )) != NULL ) { tmp++; - if ( ! isspace( *tmp ) ) + if ( ! isspace( (unsigned char) *tmp ) ) break; } fprintf( fp, "%s", tmp ); diff --git a/servers/slapd/shell-backends/shellutil.c b/servers/slapd/shell-backends/shellutil.c index 59d43cb707..8fb7ddea44 100644 --- a/servers/slapd/shell-backends/shellutil.c +++ b/servers/slapd/shell-backends/shellutil.c @@ -198,7 +198,7 @@ parse_input( FILE *ifp, FILE *ofp, struct ldop *op ) while ( args != NULL ) { if (( p = strchr( args, ' ' )) != NULL ) { *p++ = '\0'; - while ( isspace( *p )) { + while ( isspace( (unsigned char) *p )) { ++p; } } @@ -233,7 +233,7 @@ find_input_tag( char **linep ) /* linep is set to start of args */ for ( i = 0; ips[ i ].ip_type != 0; ++i ) { if ( strncasecmp( *linep, ips[ i ].ip_tag, p - *linep ) == 0 ) { - while ( isspace( *(++p) )) { + while ( isspace( (unsigned char) *(++p) )) { ; } *linep = p; diff --git a/servers/slapd/str2filter.c b/servers/slapd/str2filter.c index 1ab28f1462..3fce185f77 100644 --- a/servers/slapd/str2filter.c +++ b/servers/slapd/str2filter.c @@ -101,7 +101,7 @@ str2list( char *str, unsigned long ftype ) fp = &f->f_list; while ( *str ) { - while ( *str && isspace( *str ) ) + while ( *str && isspace( (unsigned char) *str ) ) str++; if ( *str == '\0' ) break; diff --git a/servers/slapd/tools/chlog2replog.c b/servers/slapd/tools/chlog2replog.c index b9d171ba8e..4349779914 100644 --- a/servers/slapd/tools/chlog2replog.c +++ b/servers/slapd/tools/chlog2replog.c @@ -232,7 +232,8 @@ static void de_t61(char *s, int t61mark) { char *next = s; - int c, hex; + unsigned char c; + unsigned int hex; while ( *s ) { switch ( *s ) { @@ -533,7 +534,8 @@ main( int argc, char **argv ) /* See if we've got a line continuation to deal with */ nbuflen = strlen( nbuf ); if ( state == ST_CONCAT ) { - for ( p = nbuf; isspace( *p ); p++, nbuflen-- ); /* skip space */ + for ( p = nbuf; isspace( (unsigned char) *p ); p++, nbuflen-- ) + ; /* skip space */ buf = realloc( buf, buflen + nbuflen + 1 ); strcat( buf, p ); buflen += ( nbuflen ); diff --git a/servers/slapd/tools/edb2ldif.c b/servers/slapd/tools/edb2ldif.c index 9aad796369..bef4a0d8c7 100644 --- a/servers/slapd/tools/edb2ldif.c +++ b/servers/slapd/tools/edb2ldif.c @@ -761,7 +761,7 @@ read_edbmap( char *mapfile, struct edbmap **edbmapp ) } *filename++ = '\0'; - while ( isspace( *filename )) { /* strip leading whitespace */ + while ( isspace((unsigned char) *filename) ) { /* strip leading whitespace */ ++filename; } @@ -770,12 +770,12 @@ read_edbmap( char *mapfile, struct edbmap **edbmapp ) } p = filename + strlen( filename ) - 1; - while ( isspace( *p )) { /* strip trailing whitespace */ + while ( isspace((unsigned char) *p) ) { /* strip trailing whitespace */ *p-- = '\0'; } rdn = line; - while ( isspace( *rdn )) { /* strip leading whitespace */ + while ( isspace((unsigned char) *rdn)) { /* strip leading whitespace */ ++rdn; } @@ -784,7 +784,7 @@ read_edbmap( char *mapfile, struct edbmap **edbmapp ) } p = rdn + strlen( rdn ) - 1; - while ( isspace( *p )) { /* strip trailing whitespace */ + while ( isspace((unsigned char) *p)) { /* strip trailing whitespace */ *p-- = '\0'; } diff --git a/servers/slapd/tools/ldapsyntax.c b/servers/slapd/tools/ldapsyntax.c index 2495e4db22..2d916e254d 100644 --- a/servers/slapd/tools/ldapsyntax.c +++ b/servers/slapd/tools/ldapsyntax.c @@ -248,7 +248,8 @@ char *s; int t61mark; { char *next = s; - int c, hex; + unsigned char c; + unsigned int hex; while ( *s ) { switch ( *s ) { diff --git a/servers/slapd/tools/ldbmcat.c b/servers/slapd/tools/ldbmcat.c index f7e62c7d31..fb3cbdd137 100644 --- a/servers/slapd/tools/ldbmcat.c +++ b/servers/slapd/tools/ldbmcat.c @@ -66,7 +66,7 @@ main( int argc, char **argv ) if (( s = data.dptr ) != NULL ) { - if ( !printid && isdigit( *s )) { + if ( !printid && isdigit( (unsigned char) *s )) { if (( s = strchr( s, '\n' )) != NULL ) { ++s; } diff --git a/servers/slapd/tools/ldbmtest.c b/servers/slapd/tools/ldbmtest.c index afdd148ee0..c46a3c9e9f 100644 --- a/servers/slapd/tools/ldbmtest.c +++ b/servers/slapd/tools/ldbmtest.c @@ -432,7 +432,7 @@ get_idlist( FILE *fp, Datum *data ) printf( "%d IDs entered. Max number of ids? [%d] ", i, i ); if ( fgets( buf, sizeof(buf), fp ) != NULL && - isdigit( buf[0] ) ) { + isdigit( (unsigned char) buf[0] ) ) { nmax = atol( buf ); } } else { diff --git a/servers/slapd/tools/ldif2id2children.c b/servers/slapd/tools/ldif2id2children.c index da966c2a8f..1dab807cd1 100644 --- a/servers/slapd/tools/ldif2id2children.c +++ b/servers/slapd/tools/ldif2id2children.c @@ -152,7 +152,7 @@ main( int argc, char **argv ) } if ( line[0] == '\n' || stop && buf && *buf ) { if ( *buf != '\n' ) { - if (isdigit(*buf)) { + if (isdigit((unsigned char) *buf)) { id = atol(buf); } else { id++; diff --git a/servers/slapd/tools/ldif2id2entry.c b/servers/slapd/tools/ldif2id2entry.c index 96ed84ffe3..1ab1a2d681 100644 --- a/servers/slapd/tools/ldif2id2entry.c +++ b/servers/slapd/tools/ldif2id2entry.c @@ -134,7 +134,7 @@ main( int argc, char **argv ) len = strlen( line ); if ( buf == NULL || *buf == '\0' ) { - if (!isdigit(line[0])) { + if (!isdigit((unsigned char) line[0])) { sprintf( idbuf, "%d\n", id + 1 ); idlen = strlen( idbuf ); } else { diff --git a/servers/slapd/tools/ldif2index.c b/servers/slapd/tools/ldif2index.c index 2b39bca046..82ca056e90 100644 --- a/servers/slapd/tools/ldif2index.c +++ b/servers/slapd/tools/ldif2index.c @@ -137,7 +137,7 @@ main( int argc, char **argv ) } if ( line[0] == '\n' || stop && buf && *buf ) { if ( *buf != '\n' ) { - if (isdigit(*buf)) { + if (isdigit((unsigned char) *buf)) { id = atol(buf); } else { id++; diff --git a/servers/slapd/value.c b/servers/slapd/value.c index bb6b7e620b..d8f72c4cd8 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -98,7 +98,7 @@ value_normalize( if ( (syntax & SYNTAX_TEL) && (*s == ' ' || *s == '-') ) { continue; } - *d++ = TOUPPER( *s ); + *d++ = TOUPPER( (unsigned char) *s ); } *d = '\0'; }