check return value

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24146 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-12-11 05:07:35 +00:00
parent e2f40cd57f
commit 12edcfbf3b

View File

@@ -1041,15 +1041,18 @@ heim_ntlm_build_ntlm1_master(void *key, size_t len,
* @param target the name of the target, assumed to be in UTF8.
* @param ntlmv2 the ntlmv2 session key
*
* @return 0 on success, or an error code on failure.
*
* @ingroup ntlm_core
*/
void
int
heim_ntlm_ntlmv2_key(const void *key, size_t len,
const char *username,
const char *target,
unsigned char ntlmv2[16])
{
int ret;
unsigned int hmaclen;
HMAC_CTX c;
@@ -1058,17 +1061,23 @@ heim_ntlm_ntlmv2_key(const void *key, size_t len,
{
struct ntlm_buf buf;
/* uppercase username and turn it into ucs2-le */
ascii2ucs2le(username, 1, &buf);
ret = ascii2ucs2le(username, 1, &buf);
if (ret)
goto out;
HMAC_Update(&c, buf.data, buf.length);
free(buf.data);
/* uppercase target and turn into ucs2-le */
ascii2ucs2le(target, 1, &buf);
ret = ascii2ucs2le(target, 1, &buf);
if (ret)
goto out;
HMAC_Update(&c, buf.data, buf.length);
free(buf.data);
}
HMAC_Final(&c, ntlmv2, &hmaclen);
out:
HMAC_CTX_cleanup(&c);
return ret;
}
/*