<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Heimdalntlmlibrary: test_ntlm.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<p>
<a href="http://www.h5l.org/"><img src="http://www.h5l.org/keyhole-heimdal.png" alt="keyhole logo"/></a>
</p>
<!-- end of header marker -->
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>test_ntlm.c</h1>Example how to use the NTLM primitives.<p>
<div class="fragment"><pre class="fragment"><span class="comment">/*</span>
<span class="comment"> * Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan</span>
<span class="comment"> * (Royal Institute of Technology, Stockholm, Sweden).</span>
<span class="comment"> * All rights reserved.</span>
<span class="comment"> *</span>
<span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<span class="comment"> * modification, are permitted provided that the following conditions</span>
<span class="comment"> * are met:</span>
<span class="comment"> *</span>
<span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
<span class="comment"> *</span>
<span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<span class="comment"> *</span>
<span class="comment"> * 3. Neither the name of KTH nor the names of its contributors may be</span>
<span class="comment"> * used to endorse or promote products derived from this software without</span>
<span class="comment"> * specific prior written permission.</span>
<span class="comment"> *</span>
<span class="comment"> * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY</span>
<span class="comment"> * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span>
<span class="comment"> * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE</span>
<span class="comment"> * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span>
<span class="comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span>
<span class="comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR</span>
<span class="comment"> * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,</span>
<span class="comment"> * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR</span>
<span class="comment"> * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF</span>
<span class="comment"> * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<span class="comment"> */</span>
<span class="preprocessor">#include "config.h"</span>
<span class="preprocessor">#include <stdio.h></span>
<span class="preprocessor">#include <err.h></span>
<span class="preprocessor">#include <roken.h></span>
<span class="preprocessor">#include <getarg.h></span>
<span class="preprocessor">#include <krb5-types.h></span> <span class="comment">/* or <inttypes.h> */</span>
<span class="preprocessor">#include <heimntlm.h></span>
<span class="keyword">static</span> <span class="keywordtype">int</span>
test_parse(<span class="keywordtype">void</span>)
{
<span class="keyword">const</span> <span class="keywordtype">char</span> *user = <span class="stringliteral">"foo"</span>,
*domain = <span class="stringliteral">"mydomain"</span>,
*password = <span class="stringliteral">"digestpassword"</span>,
*target = <span class="stringliteral">"DOMAIN"</span>;
<span class="keyword">struct </span><a name="_a0"></a><a class="code" href="structntlm__type1.html">ntlm_type1</a> type1;
<span class="keyword">struct </span><a name="_a1"></a><a class="code" href="structntlm__type2.html">ntlm_type2</a> type2;
<span class="keyword">struct </span><a name="_a2"></a><a class="code" href="structntlm__type3.html">ntlm_type3</a> type3;
<span class="keyword">struct </span><a name="_a3"></a><a class="code" href="structntlm__buf.html">ntlm_buf</a> data;
<span class="keywordtype">int</span> ret, flags;
memset(&type1, 0, <span class="keyword">sizeof</span>(type1));
type1.<a name="a4"></a><a class="code" href="structntlm__type1.html#e2f4bbf968f7dde8f1cd2a71396a06fb">flags</a> = NTLM_NEG_UNICODE|NTLM_NEG_TARGET|NTLM_NEG_NTLM;
type1.<a name="a5"></a><a class="code" href="structntlm__type1.html#7d99f4da91742cd5bd94f1af1713c075">domain</a> = rk_UNCONST(domain);
type1.<a name="a6"></a><a class="code" href="structntlm__type1.html#63e2c0e1d31b93802670e677b89ae7e8">hostname</a> = NULL;
type1.<a name="a7"></a><a class="code" href="structntlm__type1.html#3f0a2c98b021a211c030b09b37d35fa3">os</a>[0] = 0;
type1.<a class="code" href="structntlm__type1.html#3f0a2c98b021a211c030b09b37d35fa3">os</a>[1] = 0;
ret = <a name="a8"></a><a class="code" href="group__ntlm__core.html#g0107727234287ac61a8801b0faff9dff">heim_ntlm_encode_type1</a>(&type1, &data);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_encode_type1"</span>);
memset(&type1, 0, <span class="keyword">sizeof</span>(type1));
ret = heim_ntlm_decode_type1(&data, &type1);
free(data.<a name="a9"></a><a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_encode_type1"</span>);
<a name="a10"></a><a class="code" href="group__ntlm__core.html#g76fa6caf3f539e24008e31613f5eb663">heim_ntlm_free_type1</a>(&type1);
<span class="comment">/*</span>
<span class="comment"> *</span>
<span class="comment"> */</span>
memset(&type2, 0, <span class="keyword">sizeof</span>(type2));
flags = NTLM_NEG_UNICODE | NTLM_NEG_NTLM | NTLM_TARGET_DOMAIN;
type2.<a name="a11"></a><a class="code" href="structntlm__type2.html#7f52e5d5e1e31e369d88d1cfb738a9ff">flags</a> = flags;
memset(type2.<a name="a12"></a><a class="code" href="structntlm__type2.html#12c5c7a960c60bbd54dbf49527856bab">challenge</a>, 0x7f, <span class="keyword">sizeof</span>(type2.<a class="code" href="structntlm__type2.html#12c5c7a960c60bbd54dbf49527856bab">challenge</a>));
type2.<a name="a13"></a><a class="code" href="structntlm__type2.html#7ed7a5246d77d4358e6fa459c6263a10">targetname</a> = rk_UNCONST(target);
type2.<a name="a14"></a><a class="code" href="structntlm__type2.html#d468bf3c5f042a893f3d118a9cb50a34">targetinfo</a>.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a> = NULL;
type2.<a class="code" href="structntlm__type2.html#d468bf3c5f042a893f3d118a9cb50a34">targetinfo</a>.<a name="a15"></a><a class="code" href="structntlm__buf.html#1ca1856fd5b4ac0197320d7723c73bd0">length</a> = 0;
ret = <a name="a16"></a><a class="code" href="group__ntlm__core.html#g2860c6f6d497255eb433adc8cacc49dd">heim_ntlm_encode_type2</a>(&type2, &data);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_encode_type2"</span>);
memset(&type2, 0, <span class="keyword">sizeof</span>(type2));
ret = heim_ntlm_decode_type2(&data, &type2);
free(data.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_decode_type2"</span>);
<a name="a17"></a><a class="code" href="group__ntlm__core.html#g8fde84c86f1c7c9f730f7fb4acedcb43">heim_ntlm_free_type2</a>(&type2);
<span class="comment">/*</span>
<span class="comment"> *</span>
<span class="comment"> */</span>
memset(&type3, 0, <span class="keyword">sizeof</span>(type3));
type3.<a name="a18"></a><a class="code" href="structntlm__type3.html#65347e68a22b66fc65c299f2cda2cf2d">flags</a> = flags;
type3.<a name="a19"></a><a class="code" href="structntlm__type3.html#c6e99229102b238c4aad9b93fabe95b7">username</a> = rk_UNCONST(user);
type3.<a name="a20"></a><a class="code" href="structntlm__type3.html#89d7688f04cb1362ffa5a81759d28716">targetname</a> = rk_UNCONST(target);
type3.<a name="a21"></a><a class="code" href="structntlm__type3.html#ffbe974b5c93e47e2c8bf6f5a767c82d">ws</a> = rk_UNCONST(<span class="stringliteral">"workstation"</span>);
{
<span class="keyword">struct </span><a class="code" href="structntlm__buf.html">ntlm_buf</a> key;
<a name="a22"></a><a class="code" href="group__ntlm__core.html#g254ee0a4d5a2594833e36697ad575d7e">heim_ntlm_nt_key</a>(password, &key);
<a name="a23"></a><a class="code" href="group__ntlm__core.html#ge3b634802ef94233a175291abd2ea14d">heim_ntlm_calculate_ntlm1</a>(key.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>, key.<a class="code" href="structntlm__buf.html#1ca1856fd5b4ac0197320d7723c73bd0">length</a>,
type2.<a class="code" href="structntlm__type2.html#12c5c7a960c60bbd54dbf49527856bab">challenge</a>,
&type3.<a name="a24"></a><a class="code" href="structntlm__type3.html#7b496ad8682fbd4a5fe06c32da7621c7">ntlm</a>);
free(key.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>);
}
ret = <a name="a25"></a><a class="code" href="group__ntlm__core.html#g9cf026be6e602c22d62aa9e47e85c7c2">heim_ntlm_encode_type3</a>(&type3, &data);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_encode_type3"</span>);
free(type3.<a class="code" href="structntlm__type3.html#7b496ad8682fbd4a5fe06c32da7621c7">ntlm</a>.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>);
memset(&type3, 0, <span class="keyword">sizeof</span>(type3));
ret = heim_ntlm_decode_type3(&data, 1, &type3);
free(data.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_decode_type3"</span>);
<span class="keywordflow">if</span> (strcmp(<span class="stringliteral">"workstation"</span>, type3.<a class="code" href="structntlm__type3.html#ffbe974b5c93e47e2c8bf6f5a767c82d">ws</a>) != 0)
errx(1, <span class="stringliteral">"type3 ws wrong"</span>);
<span class="keywordflow">if</span> (strcmp(target, type3.<a class="code" href="structntlm__type3.html#89d7688f04cb1362ffa5a81759d28716">targetname</a>) != 0)
errx(1, <span class="stringliteral">"type3 targetname wrong"</span>);
<span class="keywordflow">if</span> (strcmp(user, type3.<a class="code" href="structntlm__type3.html#c6e99229102b238c4aad9b93fabe95b7">username</a>) != 0)
errx(1, <span class="stringliteral">"type3 username wrong"</span>);
<a name="a26"></a><a class="code" href="group__ntlm__core.html#gc4e6d01e5247b8540d41ccbbf1031319">heim_ntlm_free_type3</a>(&type3);
<span class="comment">/*</span>
<span class="comment"> * NTLMv2</span>
<span class="comment"> */</span>
memset(&type2, 0, <span class="keyword">sizeof</span>(type2));
flags = NTLM_NEG_UNICODE | NTLM_NEG_NTLM | NTLM_TARGET_DOMAIN;
type2.<a class="code" href="structntlm__type2.html#7f52e5d5e1e31e369d88d1cfb738a9ff">flags</a> = flags;
memset(type2.<a class="code" href="structntlm__type2.html#12c5c7a960c60bbd54dbf49527856bab">challenge</a>, 0x7f, <span class="keyword">sizeof</span>(type2.<a class="code" href="structntlm__type2.html#12c5c7a960c60bbd54dbf49527856bab">challenge</a>));
type2.<a class="code" href="structntlm__type2.html#7ed7a5246d77d4358e6fa459c6263a10">targetname</a> = rk_UNCONST(target);
type2.<a class="code" href="structntlm__type2.html#d468bf3c5f042a893f3d118a9cb50a34">targetinfo</a>.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a> = <span class="stringliteral">"\x00\x00"</span>;
type2.<a class="code" href="structntlm__type2.html#d468bf3c5f042a893f3d118a9cb50a34">targetinfo</a>.<a class="code" href="structntlm__buf.html#1ca1856fd5b4ac0197320d7723c73bd0">length</a> = 2;
ret = <a class="code" href="group__ntlm__core.html#g2860c6f6d497255eb433adc8cacc49dd">heim_ntlm_encode_type2</a>(&type2, &data);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_encode_type2"</span>);
memset(&type2, 0, <span class="keyword">sizeof</span>(type2));
ret = heim_ntlm_decode_type2(&data, &type2);
free(data.<a class="code" href="structntlm__buf.html#0cb7caf04f8f80326491b45edcdd2687">data</a>);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_decode_type2"</span>);
<a class="code" href="group__ntlm__core.html#g8fde84c86f1c7c9f730f7fb4acedcb43">heim_ntlm_free_type2</a>(&type2);
<span class="keywordflow">return</span> 0;
}
<span class="keyword">static</span> <span class="keywordtype">int</span>
test_keys(<span class="keywordtype">void</span>)
{
<span class="keyword">const</span> <span class="keywordtype">char</span>
*username = <span class="stringliteral">"test"</span>,
*password = <span class="stringliteral">"test1234"</span>,
*target = <span class="stringliteral">"TESTNT"</span>;
<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>
serverchallenge[8] = <span class="stringliteral">"\x67\x7f\x1c\x55\x7a\x5e\xe9\x6c"</span>;
<span class="keyword">struct </span><a class="code" href="structntlm__buf.html">ntlm_buf</a> infotarget, infotarget2, answer, key;
<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ntlmv2[16], ntlmv2_1[16];
<span class="keywordtype">int</span> ret;
infotarget.length = 70;
infotarget.data =
<span class="stringliteral">"\x02\x00\x0c\x00\x54\x00\x45\x00\x53\x00\x54\x00\x4e\x00\x54\x00"</span>
<span class="stringliteral">"\x01\x00\x0c\x00\x4d\x00\x45\x00\x4d\x00\x42\x00\x45\x00\x52\x00"</span>
<span class="stringliteral">"\x03\x00\x1e\x00\x6d\x00\x65\x00\x6d\x00\x62\x00\x65\x00\x72\x00"</span>
<span class="stringliteral">"\x2e\x00\x74\x00\x65\x00\x73\x00\x74\x00\x2e\x00\x63\x00\x6f"</span>
<span class="stringliteral">"\x00\x6d\x00"</span>
<span class="stringliteral">"\x00\x00\x00\x00"</span>;
answer.length = 0;
answer.data = NULL;
<a class="code" href="group__ntlm__core.html#g254ee0a4d5a2594833e36697ad575d7e">heim_ntlm_nt_key</a>(password, &key);
ret = <a name="a27"></a><a class="code" href="group__ntlm__core.html#ga8f07fb71a0d5f095cde3fb9fb40d10c">heim_ntlm_calculate_ntlm2</a>(key.data,
key.length,
username,
target,
serverchallenge,
&infotarget,
ntlmv2,
&answer);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_calculate_ntlm2"</span>);
ret = <a name="a28"></a><a class="code" href="group__ntlm__core.html#g3b3d6a5187cab6bfe656afa7a8273ca6">heim_ntlm_verify_ntlm2</a>(key.data,
key.length,
username,
target,
0,
serverchallenge,
&answer,
&infotarget2,
ntlmv2_1);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_verify_ntlm2"</span>);
<span class="keywordflow">if</span> (memcmp(ntlmv2, ntlmv2_1, <span class="keyword">sizeof</span>(ntlmv2)) != 0)
errx(1, <span class="stringliteral">"ntlm master key not same"</span>);
<span class="keywordflow">if</span> (infotarget.length > infotarget2.length)
errx(1, <span class="stringliteral">"infotarget length"</span>);
<span class="keywordflow">if</span> (memcmp(infotarget.data, infotarget2.data, infotarget.length) != 0)
errx(1, <span class="stringliteral">"infotarget not the same"</span>);
free(key.data);
free(answer.data);
free(infotarget2.data);
<span class="keywordflow">return</span> 0;
}
<span class="keyword">static</span> <span class="keywordtype">int</span>
test_ntlm2_session_resp(<span class="keywordtype">void</span>)
{
<span class="keywordtype">int</span> ret;
<span class="keyword">struct </span><a class="code" href="structntlm__buf.html">ntlm_buf</a> lm, ntlm;
<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> lm_resp[24] =
<span class="stringliteral">"\xff\xff\xff\x00\x11\x22\x33\x44"</span>
<span class="stringliteral">"\x00\x00\x00\x00\x00\x00\x00\x00"</span>
<span class="stringliteral">"\x00\x00\x00\x00\x00\x00\x00\x00"</span>;
<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ntlm2_sess_resp[24] =
<span class="stringliteral">"\x10\xd5\x50\x83\x2d\x12\xb2\xcc"</span>
<span class="stringliteral">"\xb7\x9d\x5a\xd1\xf4\xee\xd3\xdf"</span>
<span class="stringliteral">"\x82\xac\xa4\xc3\x68\x1d\xd4\x55"</span>;
<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> client_nonce[8] =
<span class="stringliteral">"\xff\xff\xff\x00\x11\x22\x33\x44"</span>;
<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> server_challenge[8] =
<span class="stringliteral">"\x01\x23\x45\x67\x89\xab\xcd\xef"</span>;
<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ntlm_hash[16] =
<span class="stringliteral">"\xcd\x06\xca\x7c\x7e\x10\xc9\x9b"</span>
<span class="stringliteral">"\x1d\x33\xb7\x48\x5a\x2e\xd8\x08"</span>;
ret = heim_ntlm_calculate_ntlm2_sess(client_nonce,
server_challenge,
ntlm_hash,
&lm,
&ntlm);
<span class="keywordflow">if</span> (ret)
errx(1, <span class="stringliteral">"heim_ntlm_calculate_ntlm2_sess_resp"</span>);
<span class="keywordflow">if</span> (lm.length != 24 || memcmp(lm.data, lm_resp, 24) != 0)
errx(1, <span class="stringliteral">"lm_resp wrong"</span>);
<span class="keywordflow">if</span> (ntlm.length != 24 || memcmp(ntlm.data, ntlm2_sess_resp, 24) != 0)
errx(1, <span class="stringliteral">"ntlm2_sess_resp wrong"</span>);
free(lm.data);
free(ntlm.data);
<span class="keywordflow">return</span> 0;
}
<span class="keyword">static</span> <span class="keywordtype">int</span>
test_targetinfo(<span class="keywordtype">void</span>)
{
<span class="keyword">struct </span>ntlm_targetinfo ti;
<span class="keyword">struct </span><a class="code" href="structntlm__buf.html">ntlm_buf</a> buf;
<span class="keyword">const</span> <span class="keywordtype">char</span> *dnsservername = <span class="stringliteral">"dnsservername"</span>;
<span class="keywordtype">int</span> ret;
memset(&ti, 0, <span class="keyword">sizeof</span>(ti));
ti.dnsservername = rk_UNCONST(dnsservername);
ti.avflags = 1;
ret = <a name="a29"></a><a class="code" href="group__ntlm__core.html#g2881747fad2ac2979a28d3bd050b0fa8">heim_ntlm_encode_targetinfo</a>(&ti, 1, &buf);
<span class="keywordflow">if</span> (ret)
<span class="keywordflow">return</span> ret;
memset(&ti, 0, <span class="keyword">sizeof</span>(ti));
ret = <a name="a30"></a><a class="code" href="group__ntlm__core.html#gf1d4de2faec8b1c1070a55fd2e6e630f">heim_ntlm_decode_targetinfo</a>(&buf, 1, &ti);
<span class="keywordflow">if</span> (ret)
<span class="keywordflow">return</span> ret;
<span class="keywordflow">if</span> (ti.dnsservername == NULL ||
strcmp(ti.dnsservername, dnsservername) != 0)
errx(1, <span class="stringliteral">"ti.dnshostname != %s"</span>, dnsservername);
<span class="keywordflow">if</span> (ti.avflags != 1)
errx(1, <span class="stringliteral">"ti.avflags != 1"</span>);
<a name="a31"></a><a class="code" href="group__ntlm__core.html#g704ec8c5dba05ef57186d242ff165565">heim_ntlm_free_targetinfo</a>(&ti);
<span class="keywordflow">return</span> 0;
}
<span class="keyword">static</span> <span class="keywordtype">int</span> verbose_flag = 0;
<span class="keyword">static</span> <span class="keywordtype">int</span> version_flag = 0;
<span class="keyword">static</span> <span class="keywordtype">int</span> help_flag = 0;
<span class="keyword">static</span> <span class="keyword">struct </span>getargs args[] = {
{<span class="stringliteral">"verbose"</span>, 0, arg_flag, &verbose_flag, <span class="stringliteral">"verbose printing"</span>, NULL },
{<span class="stringliteral">"version"</span>, 0, arg_flag, &version_flag, <span class="stringliteral">"print version"</span>, NULL },
{<span class="stringliteral">"help"</span>, 0, arg_flag, &help_flag, NULL, NULL }
};
<span class="keyword">static</span> <span class="keywordtype">void</span>
usage (<span class="keywordtype">int</span> ret)
{
arg_printusage (args, <span class="keyword">sizeof</span>(args)/<span class="keyword">sizeof</span>(*args),
NULL, <span class="stringliteral">""</span>);
exit (ret);
}
<span class="keywordtype">int</span>
main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
<span class="keywordtype">int</span> ret = 0, optind = 0;
setprogname(argv[0]);
<span class="keywordflow">if</span>(getarg(args, <span class="keyword">sizeof</span>(args) / <span class="keyword">sizeof</span>(args[0]), argc, argv, &optind))
usage(1);
<span class="keywordflow">if</span> (help_flag)
usage (0);
<span class="keywordflow">if</span>(version_flag){
print_version(NULL);
exit(0);
}
argc -= optind;
argv += optind;
<span class="keywordflow">if</span> (verbose_flag)
printf(<span class="stringliteral">"test_parse\n"</span>);
ret += test_parse();
<span class="keywordflow">if</span> (verbose_flag)
printf(<span class="stringliteral">"test_keys\n"</span>);
ret += test_keys();
<span class="keywordflow">if</span> (verbose_flag)
printf(<span class="stringliteral">"test_ntlm2_session_resp\n"</span>);
ret += test_ntlm2_session_resp();
<span class="keywordflow">if</span> (verbose_flag)
printf(<span class="stringliteral">"test_targetinfo\n"</span>);
ret += test_targetinfo();
<span class="keywordflow">return</span> ret;
}
</pre></div> </div>
<hr size="1"><address style="text-align: right;"><small>
Generated on Wed Jan 11 14:07:50 2012 for Heimdalntlmlibrary by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>