title: Freeradius authentification against active directory using MS_CHAP
body: <p>I'm trying to create an authentification using Freeradius 3 with the MS_CHAP authentification protocol. I set up my active directory. It works:</p>
  
  <pre><code>$ ntlm_auth --request-nt-key --username=admin --password=Qwerty01 --domain=DOMAIN.LOCAL
  NT_STATUS_OK: The operation completed successfully. (0x0)
  </code></pre>
  
  <p>However, I can't authenticate using radtest:</p>
  
  <pre><code>$ radtest -t mschap admin Qwerty01 localhost 0 testing123
  Sent Access-Request Id 232 from 0.0.0.0:51847 to 127.0.0.1:1812 length 131
      User-Name = "admin"
      MS-CHAP-Password = "Qwerty01"
      NAS-IP-Address = 127.0.0.1
      NAS-Port = 0
      Message-Authenticator = 0x00
      Cleartext-Password = "Qwerty01"
      MS-CHAP-Challenge = 0x044d30abb8866f26
      MS-CHAP-Response = 0x0001000000000000000000000000000000000000000000000000803c721e5b12ff86836a1873e1c0f62d18e2c054b83c940f
  Received Access-Reject Id 232 from 127.0.0.1:1812 to 127.0.0.1:51847 length 61
      MS-CHAP-Error = "\000E=691 R=1 C=f25227a7f4150df5 V=2"
  (0) -: Expected Access-Accept got Access-Reject
  </code></pre>
  
  <p>Here is my freeradius logs:</p>
  
  <pre><code>...
  (1)   authenticate {
  (1) mschap: Client is using MS-CHAPv1 with NT-Password
  (1) mschap: Executing: /bin/ntlm_auth --request-nt-key --allow-mschapv2 --username=%{mschap:User-Name:-None} --domain=%{%{mschap:NT-Domain}:-DOMAIN.LOCAL} --challenge=%{mschap:Challenge:-00} --nt-response=%{mschap:NT-Response:-00}:
  (1) mschap: EXPAND --username=%{mschap:User-Name:-None}
  (1) mschap:    --&gt; --username=admin
  (1) mschap: ERROR: No NT-Domain was found in the User-Name
  (1) mschap: EXPAND --domain=%{%{mschap:NT-Domain}:-DOMAIN.LOCAL}
  (1) mschap:    --&gt; --domain=DOMAIN.LOCAL
  (1) mschap: mschap1: 04
  (1) mschap: EXPAND --challenge=%{mschap:Challenge:-00}
  (1) mschap:    --&gt; --challenge=044d30abb8866f26
  (1) mschap: EXPAND --nt-response=%{mschap:NT-Response:-00}
  (1) mschap:    --&gt; --nt-response=803c721e5b12ff86836a1873e1c0f62d18e2c054b83c940f
  (1) mschap: ERROR: Program returned code (1) and output 'Reading winbind reply failed! (0xc0000001)'
  (1) mschap: ERROR: Reading winbind reply failed! (0xc0000001)
  (1) mschap: Authentication failed
  ...
  </code></pre>