http_ntlm.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #ifndef __HTTP_NTLM_H
  2. #define __HTTP_NTLM_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * $Id: http_ntlm.h,v 1.6 2004/01/07 09:19:35 bagder Exp $
  24. ***************************************************************************/
  25. typedef enum {
  26. CURLNTLM_NONE, /* not a ntlm */
  27. CURLNTLM_BAD, /* an ntlm, but one we don't like */
  28. CURLNTLM_FIRST, /* the first 401-reply we got with NTLM */
  29. CURLNTLM_FINE, /* an ntlm we act on */
  30. CURLNTLM_LAST /* last entry in this enum, don't use */
  31. } CURLntlm;
  32. /* this is for ntlm header input */
  33. CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy, char *header);
  34. /* this is for creating ntlm header output */
  35. CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy, bool *ready);
  36. void Curl_ntlm_cleanup(struct SessionHandle *data);
  37. /* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */
  38. #define NTLMFLAG_NEGOTIATE_UNICODE (1<<0)
  39. /* Indicates that Unicode strings are supported for use in security buffer
  40. data. */
  41. #define NTLMFLAG_NEGOTIATE_OEM (1<<1)
  42. /* Indicates that OEM strings are supported for use in security buffer data. */
  43. #define NTLMFLAG_REQUEST_TARGET (1<<2)
  44. /* Requests that the server's authentication realm be included in the Type 2
  45. message. */
  46. /* unknown (1<<3) */
  47. #define NTLMFLAG_NEGOTIATE_SIGN (1<<4)
  48. /* Specifies that authenticated communication between the client and server
  49. should carry a digital signature (message integrity). */
  50. #define NTLMFLAG_NEGOTIATE_SEAL (1<<5)
  51. /* Specifies that authenticated communication between the client and server
  52. should be encrypted (message confidentiality). */
  53. #define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE (1<<6)
  54. /* unknown purpose */
  55. #define NTLMFLAG_NEGOTIATE_LM_KEY (1<<7)
  56. /* Indicates that the LAN Manager session key should be used for signing and
  57. sealing authenticated communications. */
  58. #define NTLMFLAG_NEGOTIATE_NETWARE (1<<8)
  59. /* unknown purpose */
  60. #define NTLMFLAG_NEGOTIATE_NTLM_KEY (1<<9)
  61. /* Indicates that NTLM authentication is being used. */
  62. /* unknown (1<<10) */
  63. /* unknown (1<<11) */
  64. #define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED (1<<12)
  65. /* Sent by the client in the Type 1 message to indicate that a desired
  66. authentication realm is included in the message. */
  67. #define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED (1<<13)
  68. /* Sent by the client in the Type 1 message to indicate that the client
  69. workstation's name is included in the message. */
  70. #define NTLMFLAG_NEGOTIATE_LOCAL_CALL (1<<14)
  71. /* Sent by the server to indicate that the server and client are on the same
  72. machine. Implies that the client may use a pre-established local security
  73. context rather than responding to the challenge. */
  74. #define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN (1<<15)
  75. /* Indicates that authenticated communication between the client and server
  76. should be signed with a "dummy" signature. */
  77. #define NTLMFLAG_TARGET_TYPE_DOMAIN (1<<16)
  78. /* Sent by the server in the Type 2 message to indicate that the target
  79. authentication realm is a domain. */
  80. #define NTLMFLAG_TARGET_TYPE_SERVER (1<<17)
  81. /* Sent by the server in the Type 2 message to indicate that the target
  82. authentication realm is a server. */
  83. #define NTLMFLAG_TARGET_TYPE_SHARE (1<<18)
  84. /* Sent by the server in the Type 2 message to indicate that the target
  85. authentication realm is a share. Presumably, this is for share-level
  86. authentication. Usage is unclear. */
  87. #define NTLMFLAG_NEGOTIATE_NTLM2_KEY (1<<19)
  88. /* Indicates that the NTLM2 signing and sealing scheme should be used for
  89. protecting authenticated communications. */
  90. #define NTLMFLAG_REQUEST_INIT_RESPONSE (1<<20)
  91. /* unknown purpose */
  92. #define NTLMFLAG_REQUEST_ACCEPT_RESPONSE (1<<21)
  93. /* unknown purpose */
  94. #define NTLMFLAG_REQUEST_NONNT_SESSION_KEY (1<<22)
  95. /* unknown purpose */
  96. #define NTLMFLAG_NEGOTIATE_TARGET_INFO (1<<23)
  97. /* Sent by the server in the Type 2 message to indicate that it is including a
  98. Target Information block in the message. */
  99. /* unknown (1<24) */
  100. /* unknown (1<25) */
  101. /* unknown (1<26) */
  102. /* unknown (1<27) */
  103. /* unknown (1<28) */
  104. #define NTLMFLAG_NEGOTIATE_128 (1<<29)
  105. /* Indicates that 128-bit encryption is supported. */
  106. #define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE (1<<30)
  107. /* unknown purpose */
  108. #define NTLMFLAG_NEGOTIATE_56 (1<<31)
  109. /* Indicates that 56-bit encryption is supported. */
  110. #endif