diff options
author | Samba Release Account <samba-bugs@samba.org> | 1997-02-02 18:12:36 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1997-02-02 18:12:36 +0000 |
commit | 98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97 (patch) | |
tree | 8b58f68487342ad1b688be2cbf205fe3e13cfeea /source3/lib | |
parent | 2831c627740c80d4ea1187058b249e1d5b5e5c58 (diff) | |
download | samba-98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97.tar.gz samba-98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97.tar.bz2 samba-98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97.zip |
util.c: StrCaseCmp and StrnCaseCmp terminated incorrectly, giving false
answers when a string was partially identical. this issue is still
outstanding, and needs to be investigated further.
loadparm.c: added lp_logon_path() parameter.
ipc.c: in NetUserGetInfo, lp_logon_path() can be returned instead of always
specifying \\SAMBA_SERVER\HOMES (which may not necessarily exist).
it is now possible to specify lp_logon_path() as \\ARBITRARY_SERVER\%U,
just like NT server can. the default is \\SAMBA_SERVER\HOMES, just like
it used to be.
lkcl
(This used to be commit d5b6ad7cb87d6b1a9342f027ac4f57ffdb54b4f3)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 318ac3fc61..dbf8a377bb 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -796,25 +796,32 @@ char *attrib_string(int mode) /******************************************************************* case insensitive string compararison ********************************************************************/ -int StrCaseCmp(char *s, char *t) +int StrCaseCmp(char const *s, char const *t) { - for (; tolower(*s) == tolower(*t); ++s, ++t) - if (!*s) return 0; + /* compare until we run out of string, either t or s, or find a difference */ + while (*s && *t && tolower(*s) == tolower(*t)) + { + s++; t++; + } - return tolower(*s) - tolower(*t); + return(tolower(*s) - tolower(*t)); } /******************************************************************* case insensitive string compararison, length limited ********************************************************************/ -int StrnCaseCmp(char *s, char *t, int n) +int StrnCaseCmp(char const *s, char const *t, int n) { - while (n-- && *s && *t) { - if (tolower(*s) != tolower(*t)) return(tolower(*s) - tolower(*t)); + /* compare until we run out of string, either t or s, or chars */ + while (n-- && *s && *t && tolower(*s) == tolower(*t)) + { s++; t++; } + + /* not run out of chars - strings are different lengths */ if (n) return(tolower(*s) - tolower(*t)); + /* identical up to where we run out of chars, and strings are same length */ return(0); } |