bug in params.c

Christopher R. Hertel crh at nts.umn.edu
Mon Oct 16 15:53:26 GMT 2000

The problem, then, is that mygetc() is returning a negative value.

The ASCII character set is in the range 0..127.  (Note that the A in ASCII
stands for "American".)  Many years ago, several companies decided to
extend the character set to include "International" characters.  There's a
lot of history there, but the upshot is that the "upper" range (128..255)
is used for these characters, and IBM's set is now considered "standard", 
though it is not part of ASCII.

The u-umlaut character has a value of 252.  If the character value is 
taken as a *signed* byte, then this would appear as a negative value.  
Somehow, this is what is happening.

The proper fix, I believe, is to ensure that the characters are being
viewed as unsigned characters, and that these are being properly converted
to signed ints.  You need a signed int because the EOF value is generally
given as -1.

I'll see what I can do with the code in mygetc().

Chris -)-----

[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> Hi all out there,
> I've found a nasty bug in params.c:
> Function EatComment consists of the following line:
>    for( c = mygetc( InFile ); ('\n'!=c) && (EOF!=c) && (c>0); c = mygetc( InFile ) )
>                                                                       ^^^^^^^^^^^
> the (c>0) comparison fails for German umlauts, therefore EatComment returns
> and the rest of the services file cannot be parsed anymore. In my case the
> umlaut was in a comment in the [global] section so no services were available
> at all. I fixed it by omitting the (c>0) comparison:
>    for( c = mygetc( InFile ); ('\n'!=c) && (EOF!=c) ; c = mygetc( InFile ) )
> Greetings, Osama
> ---
> Fachhochschule f_r Technik Esslingen
> Au_enstelle Goeppingen

Christopher R. Hertel -)-----                   University of Minnesota
crh at nts.umn.edu              Networking and Telecommunications Services

    Ideals are like stars; you will not succeed in touching them
    with your hands...you choose them as your guides, and following
    them you will reach your destiny.  --Carl Schultz

More information about the samba-technical mailing list