Mercurial > pidgin
comparison src/ntlm.c @ 11829:4669e7461968
[gaim-migrate @ 14120]
Regular comment changes. I'm sorry to force a big recompilation. It had to be done at some point, though, and I've tried to do this all in one day.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 26 Oct 2005 00:34:26 +0000 |
parents | 03cd74ca2562 |
children | 31a3a9af1494 |
comparison
equal
deleted
inserted
replaced
11828:5c50be815a4e | 11829:4669e7461968 |
---|---|
29 #include "ntlm.h" | 29 #include "ntlm.h" |
30 #include "cipher.h" | 30 #include "cipher.h" |
31 #include <string.h> | 31 #include <string.h> |
32 | 32 |
33 struct type1_message { | 33 struct type1_message { |
34 guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' */ | 34 guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' */ |
35 guint8 type; /* 0x01 */ | 35 guint8 type; /* 0x01 */ |
36 guint8 zero1[3]; | 36 guint8 zero1[3]; |
37 short flags; /* 0xb203 */ | 37 short flags; /* 0xb203 */ |
38 guint8 zero2[2]; | 38 guint8 zero2[2]; |
39 | 39 |
40 short dom_len1; /* domain string length */ | 40 short dom_len1; /* domain string length */ |
41 short dom_len2; /* domain string length */ | 41 short dom_len2; /* domain string length */ |
42 short dom_off; /* domain string offset */ | 42 short dom_off; /* domain string offset */ |
43 guint8 zero3[2]; | 43 guint8 zero3[2]; |
44 | 44 |
45 short host_len1; /* host string length */ | 45 short host_len1; /* host string length */ |
46 short host_len2; /* host string length */ | 46 short host_len2; /* host string length */ |
47 short host_off; /* host string offset (always 0x20) */ | 47 short host_off; /* host string offset (always 0x20) */ |
48 guint8 zero4[2]; | 48 guint8 zero4[2]; |
49 | 49 |
50 /* guint8 host[*]; // host string (ASCII) | 50 #if 0 |
51 guint8 dom[*]; // domain string (ASCII) */ | 51 guint8 host[*]; /* host string (ASCII) */ |
52 guint8 dom[*]; /* domain string (ASCII) */ | |
53 #endif | |
52 }; | 54 }; |
53 | 55 |
54 struct type2_message { | 56 struct type2_message { |
55 guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0'*/ | 57 guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0'*/ |
56 guint8 type; /* 0x02 */ | 58 guint8 type; /* 0x02 */ |
57 guint8 zero1[7]; | 59 guint8 zero1[7]; |
58 short msg_len; /* 0x28 */ | 60 short msg_len; /* 0x28 */ |
59 guint8 zero2[2]; | 61 guint8 zero2[2]; |
60 short flags; /* 0x8201 */ | 62 short flags; /* 0x8201 */ |
61 guint8 zero3[2]; | 63 guint8 zero3[2]; |
62 | 64 |
63 guint8 nonce[8]; /* nonce */ | 65 guint8 nonce[8]; /* nonce */ |
64 guint8 zero[8]; | 66 guint8 zero[8]; |
65 }; | 67 }; |
66 | 68 |
67 struct type3_message { | 69 struct type3_message { |
68 guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0'*/ | 70 guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0'*/ |
69 guint8 type; /* 0x03 */ | 71 guint8 type; /* 0x03 */ |
70 guint8 zero1[3]; | 72 guint8 zero1[3]; |
71 | 73 |
72 short lm_resp_len1; /* LanManager response length (always 0x18)*/ | 74 short lm_resp_len1; /* LanManager response length (always 0x18)*/ |
73 short lm_resp_len2; /* LanManager response length (always 0x18)*/ | 75 short lm_resp_len2; /* LanManager response length (always 0x18)*/ |
74 short lm_resp_off; /* LanManager response offset */ | 76 short lm_resp_off; /* LanManager response offset */ |
75 guint8 zero2[2]; | 77 guint8 zero2[2]; |
76 | 78 |
77 short nt_resp_len1; /* NT response length (always 0x18) */ | 79 short nt_resp_len1; /* NT response length (always 0x18) */ |
78 short nt_resp_len2; /* NT response length (always 0x18) */ | 80 short nt_resp_len2; /* NT response length (always 0x18) */ |
79 short nt_resp_off; /* NT response offset */ | 81 short nt_resp_off; /* NT response offset */ |
80 guint8 zero3[2]; | 82 guint8 zero3[2]; |
81 | 83 |
82 short dom_len1; /* domain string length */ | 84 short dom_len1; /* domain string length */ |
83 short dom_len2; /* domain string length */ | 85 short dom_len2; /* domain string length */ |
84 short dom_off; /* domain string offset (always 0x40) */ | 86 short dom_off; /* domain string offset (always 0x40) */ |
85 guint8 zero4[2]; | 87 guint8 zero4[2]; |
86 | 88 |
87 short user_len1; /* username string length */ | 89 short user_len1; /* username string length */ |
88 short user_len2; /* username string length */ | 90 short user_len2; /* username string length */ |
89 short user_off; /* username string offset */ | 91 short user_off; /* username string offset */ |
90 guint8 zero5[2]; | 92 guint8 zero5[2]; |
91 | 93 |
92 short host_len1; /* host string length */ | 94 short host_len1; /* host string length */ |
93 short host_len2; /* host string length */ | 95 short host_len2; /* host string length */ |
94 short host_off; /* host string offset */ | 96 short host_off; /* host string offset */ |
95 guint8 zero6[6]; | 97 guint8 zero6[6]; |
96 | 98 |
97 short msg_len; /* message length */ | 99 short msg_len; /* message length */ |
98 guint8 zero7[2]; | 100 guint8 zero7[2]; |
99 | 101 |
100 short flags; /* 0x8201 */ | 102 short flags; /* 0x8201 */ |
101 guint8 zero8[2]; | 103 guint8 zero8[2]; |
102 | 104 |
103 /* guint8 dom[*]; // domain string (unicode UTF-16LE) | 105 #if 0 |
104 guint8 user[*]; // username string (unicode UTF-16LE) | 106 guint8 dom[*]; /* domain string (unicode UTF-16LE) */ |
105 guint8 host[*]; // host string (unicode UTF-16LE) | 107 guint8 user[*]; /* username string (unicode UTF-16LE) */ |
106 guint8 lm_resp[*]; // LanManager response | 108 guint8 host[*]; /* host string (unicode UTF-16LE) */ |
107 guint8 nt_resp[*]; // NT response*/ | 109 guint8 lm_resp[*]; /* LanManager response */ |
110 guint8 nt_resp[*]; /* NT response */ | |
111 #endif | |
108 }; | 112 }; |
109 | 113 |
110 gchar *gaim_ntlm_gen_type1(gchar *hostname, gchar *domain) { | 114 gchar *gaim_ntlm_gen_type1(gchar *hostname, gchar *domain) { |
111 char *msg = g_malloc0(sizeof(struct type1_message) + strlen(hostname) + strlen(domain)); | 115 char *msg = g_malloc0(sizeof(struct type1_message) + strlen(hostname) + strlen(domain)); |
112 struct type1_message *tmsg = (struct type1_message*)msg; | 116 struct type1_message *tmsg = (struct type1_message*)msg; |