diff options
author | Jeremy Allison <jra@samba.org> | 2011-03-30 13:08:31 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-03-30 23:59:37 +0200 |
commit | c109a70531de72eef30a695248b91704bd0c7c24 (patch) | |
tree | 29182afa1ae334e8aee0e71e59aa1a0e5de65f6a /source3/web | |
parent | 9ede19fdccaf09303012208129a093197403ef2c (diff) | |
download | samba-c109a70531de72eef30a695248b91704bd0c7c24.tar.gz samba-c109a70531de72eef30a695248b91704bd0c7c24.tar.bz2 samba-c109a70531de72eef30a695248b91704bd0c7c24.zip |
Fix convert_string() to take a *converted_size arg. and return a bool.
Makes these interfaces much harder to misuse and easier to ensure error
checking.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Mar 30 23:59:37 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/web')
-rw-r--r-- | source3/web/cgi.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/web/cgi.c b/source3/web/cgi.c index 94590a28de..fa2304016e 100644 --- a/source3/web/cgi.c +++ b/source3/web/cgi.c @@ -345,6 +345,7 @@ static bool cgi_handle_authorization(char *line) struct passwd *pass = NULL; const char *rhost; char addr[INET6_ADDRSTRLEN]; + size_t size = 0; if (!strnequal(line,"Basic ", 6)) { goto err; @@ -361,13 +362,17 @@ static bool cgi_handle_authorization(char *line) } *p = 0; - convert_string(CH_UTF8, CH_UNIX, + if (!convert_string(CH_UTF8, CH_UNIX, line, -1, - user, sizeof(user)); + user, sizeof(user), &size)) { + goto err; + } - convert_string(CH_UTF8, CH_UNIX, + if (!convert_string(CH_UTF8, CH_UNIX, p+1, -1, - user_pass, sizeof(user_pass)); + user_pass, sizeof(user_pass), &size)) { + goto err; + } /* * Try and get the user from the UNIX password file. |