1 Index: squid3/helpers/basic_auth/winbind/wb_basic_auth.c
2 diff -c squid3/helpers/basic_auth/winbind/wb_basic_auth.c:1.6 squid3/helpers/basic_auth/winbind/wb_basic_auth.c:1.7
3 *** squid3/helpers/basic_auth/winbind/wb_basic_auth.c:1.6 Tue Feb 11 07:34:31 2003
4 --- squid3/helpers/basic_auth/winbind/wb_basic_auth.c Fri Sep 12 04:13:22 2003
12 NSS_STATUS winbindd_request(int req_type,
13 struct winbindd_request *request,
20 ! void manage_request(void)
22 char buf[BUFFER_SIZE+1];
24 char *c, *user, *pass;
26 ! if (fgets(buf, BUFFER_SIZE, stdin) == NULL) {
27 ! warn("fgets() failed! dying..... errno=%d (%s)\n", errno,
29 ! exit(1); /* BIIG buffer */
32 c=memchr(buf,'\n',BUFFER_SIZE);
41 warn("Oversized message\n");
47 debug("Got '%s' from squid (length: %d).\n",buf,length);
52 ! int manage_request(void)
54 char buf[BUFFER_SIZE+1];
56 char *c, *user, *pass;
58 ! if (fgets(buf, BUFFER_SIZE, stdin) == NULL)
61 c=memchr(buf,'\n',BUFFER_SIZE);
66 warn("Oversized message\n");
67 + fgets(buf, BUFFER_SIZE, stdin);
72 debug("Got '%s' from squid (length: %d).\n",buf,length);
76 warn("Invalid Request\n");
84 warn("Invalid Request\n");
93 warn("Password not found. Denying access\n");
101 warn("Password not found. Denying access\n");
110 rfc1738_unescape(pass);
112 do_authenticate(user,pass);
121 + struct winbindd_request request;
122 + struct winbindd_response response;
124 + r = winbindd_request(WINBINDD_INTERFACE_VERSION, &request, &response);
125 + if (r != NSS_STATUS_SUCCESS)
127 + } while (r != NSS_STATUS_SUCCESS && retry);
128 + if (r != NSS_STATUS_SUCCESS) {
129 + warn("Can't contact winbindd. Dying\n");
132 + if (response.data.interface_version != WINBIND_INTERFACE_VERSION) {
133 + warn("Winbind protocol mismatch. Align squid and samba. Dying\n");
141 setbuf(stdout, NULL);
142 setbuf(stderr, NULL);
150 setbuf(stdout, NULL);
151 setbuf(stderr, NULL);
155 ! while(manage_request()) {
156 ! /* everything is done within manage_request */
160 Index: squid3/helpers/external_acl/winbind_group/wb_check_group.c
161 diff -c squid3/helpers/external_acl/winbind_group/wb_check_group.c:1.11 squid3/helpers/external_acl/winbind_group/wb_check_group.c:1.12
162 *** squid3/helpers/external_acl/winbind_group/wb_check_group.c:1.11 Sun May 11 07:01:34 2003
163 --- squid3/helpers/external_acl/winbind_group/wb_check_group.c Fri Sep 12 04:13:23 2003
175 + struct winbindd_request request;
176 + struct winbindd_response response;
178 + r = winbindd_request(WINBINDD_INTERFACE_VERSION, &request, &response);
179 + if (r != NSS_STATUS_SUCCESS)
181 + } while (r != NSS_STATUS_SUCCESS && retry);
182 + if (r != NSS_STATUS_SUCCESS) {
183 + warn("Can't contact winbindd. Dying\n");
186 + if (response.data.interface_version != WINBIND_INTERFACE_VERSION) {
187 + warn("Winbind protocol mismatch. Align squid and samba. Dying\n");
193 main (int argc, char *argv[])
198 if (use_case_insensitive_compare)
199 debug("Warning: running in case insensitive mode !!!\n");
204 while (fgets (buf, BUFSIZE, stdin))
206 Index: squid3/helpers/ntlm_auth/winbind/wb_ntlm_auth.c
207 diff -c squid3/helpers/ntlm_auth/winbind/wb_ntlm_auth.c:1.8 squid3/helpers/ntlm_auth/winbind/wb_ntlm_auth.c:1.9
208 *** squid3/helpers/ntlm_auth/winbind/wb_ntlm_auth.c:1.8 Tue Aug 5 15:40:02 2003
209 --- squid3/helpers/ntlm_auth/winbind/wb_ntlm_auth.c Fri Sep 12 04:13:25 2003
212 return; /* useless */
216 manage_request(char *target_domain)
218 char buf[BUFFER_SIZE + 1];
220 return; /* useless */
224 manage_request(char *target_domain)
226 char buf[BUFFER_SIZE + 1];
232 ! if (fgets(buf, BUFFER_SIZE, stdin) == NULL) {
233 ! warn("fgets() failed! dying..... errno=%d (%s)\n", errno,
235 ! exit(1); /* BIIG buffer */
238 c = memchr(buf, '\n', BUFFER_SIZE);
241 helperfail("illegal request received");
242 warn("Illegal request received: '%s'\n", buf);
251 ! if (fgets(buf, BUFFER_SIZE, stdin) == NULL)
254 c = memchr(buf, '\n', BUFFER_SIZE);
257 helperfail("illegal request received");
258 warn("Illegal request received: '%s'\n", buf);
265 if (memcmp(buf, "YR", 2) == 0) { /* refresh-request */
266 sendchallenge(ntlm_make_challenge(target_domain, NULL,
267 build_challenge(), CHALLENGE_LEN));
270 if (strncmp(buf, "KK ", 3) != 0) { /* not an auth-request */
271 helperfail("illegal request received");
272 warn("Illegal request received: '%s'\n", buf);
275 /* At this point I'm sure it's a KK */
276 decoded = base64_decode(buf + 3);
277 if (!decoded) { /* decoding failure, return error */
278 authfail("-", "-", "Auth-format error, base64-decoding error");
281 fast_header = (struct _ntlmhdr *) decoded;
283 /* sanity-check: it IS a NTLMSSP packet, isn't it? */
284 if (memcmp(fast_header->signature, "NTLMSSP", 8) != 0) {
285 authfail("-", "-", "Broken NTLM packet, missing NTLMSSP signature");
288 /* Understand what we got */
289 switch le32toh(fast_header->type) {
291 authfail("-", "-", "Received neg-request while expecting auth packet");
294 authfail("-", "-", "Received challenge. Refusing to abide");
296 case NTLM_AUTHENTICATE:
297 do_authenticate((ntlm_authenticate *) decoded,
298 (strlen(buf) - 3) * 3 / 4);
301 helperfail("Unknown authentication packet type");
310 if (memcmp(buf, "YR", 2) == 0) { /* refresh-request */
311 sendchallenge(ntlm_make_challenge(target_domain, NULL,
312 build_challenge(), CHALLENGE_LEN));
315 if (strncmp(buf, "KK ", 3) != 0) { /* not an auth-request */
316 helperfail("illegal request received");
317 warn("Illegal request received: '%s'\n", buf);
320 /* At this point I'm sure it's a KK */
321 decoded = base64_decode(buf + 3);
322 if (!decoded) { /* decoding failure, return error */
323 authfail("-", "-", "Auth-format error, base64-decoding error");
326 fast_header = (struct _ntlmhdr *) decoded;
328 /* sanity-check: it IS a NTLMSSP packet, isn't it? */
329 if (memcmp(fast_header->signature, "NTLMSSP", 8) != 0) {
330 authfail("-", "-", "Broken NTLM packet, missing NTLMSSP signature");
333 /* Understand what we got */
334 switch le32toh(fast_header->type) {
336 authfail("-", "-", "Received neg-request while expecting auth packet");
339 authfail("-", "-", "Received challenge. Refusing to abide");
341 case NTLM_AUTHENTICATE:
342 do_authenticate((ntlm_authenticate *) decoded,
343 (strlen(buf) - 3) * 3 / 4);
346 helperfail("Unknown authentication packet type");
359 struct winbindd_request request;
360 struct winbindd_response response;
361 ! r = winbindd_request(WINBINDD_INTERFACE_VERSION, &request, &response);
362 if (r != NSS_STATUS_SUCCESS) {
363 warn("Can't contact winbindd. Dying\n");
370 struct winbindd_request request;
371 struct winbindd_response response;
373 ! r = winbindd_request(WINBINDD_INTERFACE_VERSION, &request, &response);
374 ! if (r != NSS_STATUS_SUCCESS)
376 ! } while (r != NSS_STATUS_SUCCESS && retry);
377 if (r != NSS_STATUS_SUCCESS) {
378 warn("Can't contact winbindd. Dying\n");
382 setbuf(stdout, NULL);
383 setbuf(stderr, NULL);
386 ! manage_request(target_domain);
391 setbuf(stdout, NULL);
392 setbuf(stderr, NULL);
394 ! while (manage_request(target_domain)) {
395 ! /* everything is done within manage_request */