warning on possible truncation
[freeradius.git] / src / main / tls_listen.c
1 /*
2  * tls.c
3  *
4  * Version:     $Id$
5  *
6  *   This program is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation; either version 2 of the License, or
9  *   (at your option) any later version.
10  *
11  *   This program is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU General Public License for more details.
15  *
16  *   You should have received a copy of the GNU General Public License
17  *   along with this program; if not, write to the Free Software
18  *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  * Copyright 2001  hereUare Communications, Inc. <raghud@hereuare.com>
21  * Copyright 2003  Alan DeKok <aland@freeradius.org>
22  * Copyright 2006  The FreeRADIUS server project
23  */
24
25 RCSID("$Id$")
26 USES_APPLE_DEPRECATED_API       /* OpenSSL API has been deprecated by Apple */
27
28 #include <freeradius-devel/radiusd.h>
29 #include <freeradius-devel/process.h>
30 #include <freeradius-devel/rad_assert.h>
31
32 #ifdef HAVE_SYS_STAT_H
33 #include <sys/stat.h>
34 #endif
35
36 #ifdef WITH_TLS
37 #ifdef HAVE_OPENSSL_RAND_H
38 #include <openssl/rand.h>
39 #endif
40
41 #ifdef HAVE_OPENSSL_OCSP_H
42 #include <openssl/ocsp.h>
43 #endif
44
45 #ifdef HAVE_PTHREAD_H
46 #define PTHREAD_MUTEX_LOCK pthread_mutex_lock
47 #define PTHREAD_MUTEX_UNLOCK pthread_mutex_unlock
48 #else
49 #define PTHREAD_MUTEX_LOCK(_x)
50 #define PTHREAD_MUTEX_UNLOCK(_x)
51 #endif
52
53 static void dump_hex(char const *msg, uint8_t const *data, size_t data_len)
54 {
55         size_t i;
56
57         if (rad_debug_lvl < 3) return;
58
59         printf("%s %d\n", msg, (int) data_len);
60         if (data_len > 256) data_len = 256;
61
62         for (i = 0; i < data_len; i++) {
63                 if ((i & 0x0f) == 0x00) printf ("%02x: ", (unsigned int) i);
64                 printf("%02x ", data[i]);
65                 if ((i & 0x0f) == 0x0f) printf ("\n");
66         }
67         printf("\n");
68         fflush(stdout);
69 }
70
71 static void tls_socket_close(rad_listen_t *listener)
72 {
73         listen_socket_t *sock = listener->data;
74
75         SSL_shutdown(sock->ssn->ssl);
76
77         listener->status = RAD_LISTEN_STATUS_EOL;
78         listener->tls = NULL; /* parent owns this! */
79
80         /*
81          *      Tell the event handler that an FD has disappeared.
82          */
83         DEBUG("Client has closed connection");
84         radius_update_listener(listener);
85
86         /*
87          *      Do NOT free the listener here.  It's in use by
88          *      a request, and will need to hang around until
89          *      all of the requests are done.
90          *
91          *      It is instead free'd in remove_from_request_hash()
92          */
93 }
94
95 static int CC_HINT(nonnull) tls_socket_write(rad_listen_t *listener, REQUEST *request)
96 {
97         uint8_t *p;
98         ssize_t rcode;
99         listen_socket_t *sock = listener->data;
100
101         p = sock->ssn->dirty_out.data;
102
103         while (p < (sock->ssn->dirty_out.data + sock->ssn->dirty_out.used)) {
104                 RDEBUG3("Writing to socket %d", request->packet->sockfd);
105                 rcode = write(request->packet->sockfd, p,
106                               (sock->ssn->dirty_out.data + sock->ssn->dirty_out.used) - p);
107                 if (rcode <= 0) {
108                         RDEBUG("Error writing to TLS socket: %s", fr_syserror(errno));
109
110                         tls_socket_close(listener);
111                         return 0;
112                 }
113                 p += rcode;
114         }
115
116         sock->ssn->dirty_out.used = 0;
117
118         return 1;
119 }
120
121
122 static int tls_socket_recv(rad_listen_t *listener)
123 {
124         bool doing_init = false;
125         ssize_t rcode;
126         RADIUS_PACKET *packet;
127         REQUEST *request;
128         listen_socket_t *sock = listener->data;
129         fr_tls_status_t status;
130         RADCLIENT *client = sock->client;
131
132         if (!sock->packet) {
133                 sock->packet = rad_alloc(sock, false);
134                 if (!sock->packet) return 0;
135
136                 sock->packet->sockfd = listener->fd;
137                 sock->packet->src_ipaddr = sock->other_ipaddr;
138                 sock->packet->src_port = sock->other_port;
139                 sock->packet->dst_ipaddr = sock->my_ipaddr;
140                 sock->packet->dst_port = sock->my_port;
141
142                 if (sock->request) sock->request->packet = talloc_steal(sock->request, sock->packet);
143         }
144
145         /*
146          *      Allocate a REQUEST for debugging, and initialize the TLS session.
147          */
148         if (!sock->request) {
149                 sock->request = request = request_alloc(sock);
150                 if (!sock->request) {
151                         ERROR("Out of memory");
152                         return 0;
153                 }
154
155                 rad_assert(request->packet == NULL);
156                 rad_assert(sock->packet != NULL);
157                 request->packet = talloc_steal(request, sock->packet);
158
159                 request->component = "<core>";
160                 request->component = "<tls-connect>";
161
162                 request->reply = rad_alloc(request, false);
163                 if (!request->reply) return 0;
164
165                 rad_assert(sock->ssn == NULL);
166
167                 sock->ssn = tls_new_session(sock, listener->tls, sock->request,
168                                             listener->tls->require_client_cert);
169                 if (!sock->ssn) {
170                         TALLOC_FREE(sock->request);
171                         sock->packet = NULL;
172                         return 0;
173                 }
174
175                 SSL_set_ex_data(sock->ssn->ssl, FR_TLS_EX_INDEX_REQUEST, (void *)request);
176                 SSL_set_ex_data(sock->ssn->ssl, fr_tls_ex_index_certs, (void *) &sock->certs);
177                 SSL_set_ex_data(sock->ssn->ssl, FR_TLS_EX_INDEX_TALLOC, sock->parent);
178
179                 doing_init = true;
180         }
181
182         rad_assert(sock->request != NULL);
183         rad_assert(sock->request->packet != NULL);
184         rad_assert(sock->packet != NULL);
185         rad_assert(sock->ssn != NULL);
186
187         request = sock->request;
188
189         RDEBUG3("Reading from socket %d", request->packet->sockfd);
190         PTHREAD_MUTEX_LOCK(&sock->mutex);
191         rcode = read(request->packet->sockfd,
192                      sock->ssn->dirty_in.data,
193                      sizeof(sock->ssn->dirty_in.data));
194         if ((rcode < 0) && (errno == ECONNRESET)) {
195         do_close:
196                 DEBUG("Closing TLS socket from client port %u", sock->other_port);
197                 tls_socket_close(listener);
198                 PTHREAD_MUTEX_UNLOCK(&sock->mutex);
199                 return 0;
200         }
201
202         if (rcode < 0) {
203                 RDEBUG("Error reading TLS socket: %s", fr_syserror(errno));
204                 goto do_close;
205         }
206
207         /*
208          *      Normal socket close.
209          */
210         if (rcode == 0) goto do_close;
211
212         sock->ssn->dirty_in.used = rcode;
213
214         dump_hex("READ FROM SSL", sock->ssn->dirty_in.data, sock->ssn->dirty_in.used);
215
216         /*
217          *      Catch attempts to use non-SSL.
218          */
219         if (doing_init && (sock->ssn->dirty_in.data[0] != handshake)) {
220                 RDEBUG("Non-TLS data sent to TLS socket: closing");
221                 goto do_close;
222         }
223
224         /*
225          *      If we need to do more initialization, do that here.
226          */
227         if (!SSL_is_init_finished(sock->ssn->ssl)) {
228                 if (!tls_handshake_recv(request, sock->ssn)) {
229                         RDEBUG("FAILED in TLS handshake receive");
230                         goto do_close;
231                 }
232
233                 /*
234                  *      More ACK data to send.  Do so.
235                  */
236                 if (sock->ssn->dirty_out.used > 0) {
237                         tls_socket_write(listener, request);
238                         PTHREAD_MUTEX_UNLOCK(&sock->mutex);
239                         return 0;
240                 }
241
242                 /*
243                  *      FIXME: Run the request through a virtual
244                  *      server in order to see if we like the
245                  *      certificate presented by the client.
246                  */
247         }
248
249         /*
250          *      Try to get application data.
251          */
252         status = tls_application_data(sock->ssn, request);
253         RDEBUG("Application data status %d", status);
254
255         if (status == FR_TLS_MORE_FRAGMENTS) {
256                 PTHREAD_MUTEX_UNLOCK(&sock->mutex);
257                 return 0;
258         }
259
260         if (sock->ssn->clean_out.used == 0) {
261                 PTHREAD_MUTEX_UNLOCK(&sock->mutex);
262                 return 0;
263         }
264
265         /*
266          *      We now have a bunch of application data.
267          */
268         dump_hex("TUNNELED DATA > ", sock->ssn->clean_out.data, sock->ssn->clean_out.used);
269
270         /*
271          *      If the packet is a complete RADIUS packet, return it to
272          *      the caller.  Otherwise...
273          */
274         if ((sock->ssn->clean_out.used < 20) ||
275             (((sock->ssn->clean_out.data[2] << 8) | sock->ssn->clean_out.data[3]) != (int) sock->ssn->clean_out.used)) {
276                 RDEBUG("Received bad packet: Length %zd contents %d",
277                        sock->ssn->clean_out.used,
278                        (sock->ssn->clean_out.data[2] << 8) | sock->ssn->clean_out.data[3]);
279                 goto do_close;
280         }
281
282         packet = sock->packet;
283         packet->data = talloc_array(packet, uint8_t, sock->ssn->clean_out.used);
284         packet->data_len = sock->ssn->clean_out.used;
285         sock->ssn->record_minus(&sock->ssn->clean_out, packet->data, packet->data_len);
286         packet->vps = NULL;
287         PTHREAD_MUTEX_UNLOCK(&sock->mutex);
288
289         if (!rad_packet_ok(packet, 0, NULL)) {
290                 if (DEBUG_ENABLED) ERROR("Receive - %s", fr_strerror());
291                 DEBUG("Closing TLS socket from client");
292                 PTHREAD_MUTEX_LOCK(&sock->mutex);
293                 tls_socket_close(listener);
294                 PTHREAD_MUTEX_UNLOCK(&sock->mutex);
295                 return 0;       /* do_close unlocks the mutex */
296         }
297
298         /*
299          *      Copied from src/lib/radius.c, rad_recv();
300          */
301         if (fr_debug_lvl) {
302                 char host_ipaddr[128];
303
304                 if (is_radius_code(packet->code)) {
305                         RDEBUG("tls_recv: %s packet from host %s port %d, id=%d, length=%d",
306                                fr_packet_codes[packet->code],
307                                inet_ntop(packet->src_ipaddr.af,
308                                          &packet->src_ipaddr.ipaddr,
309                                          host_ipaddr, sizeof(host_ipaddr)),
310                                packet->src_port,
311                                packet->id, (int) packet->data_len);
312                 } else {
313                         RDEBUG("tls_recv: Packet from host %s port %d code=%d, id=%d, length=%d",
314                                inet_ntop(packet->src_ipaddr.af,
315                                          &packet->src_ipaddr.ipaddr,
316                                          host_ipaddr, sizeof(host_ipaddr)),
317                                packet->src_port,
318                                packet->code,
319                                packet->id, (int) packet->data_len);
320                 }
321         }
322
323         FR_STATS_INC(auth, total_requests);
324
325         return 1;
326 }
327
328
329 int dual_tls_recv(rad_listen_t *listener)
330 {
331         RADIUS_PACKET *packet;
332         RAD_REQUEST_FUNP fun = NULL;
333         listen_socket_t *sock = listener->data;
334         RADCLIENT       *client = sock->client;
335
336         if (listener->status != RAD_LISTEN_STATUS_KNOWN) return 0;
337
338         if (!tls_socket_recv(listener)) {
339                 return 0;
340         }
341
342         rad_assert(sock->packet != NULL);
343         rad_assert(sock->ssn != NULL);
344         rad_assert(client != NULL);
345
346         packet = talloc_steal(NULL, sock->packet);
347         sock->packet = NULL;
348
349         /*
350          *      Some sanity checks, based on the packet code.
351          *
352          *      "auth+acct" are marked as "auth", with the "dual" flag
353          *      set.
354          */
355         switch (packet->code) {
356         case PW_CODE_ACCESS_REQUEST:
357                 if (listener->type != RAD_LISTEN_AUTH) goto bad_packet;
358                 FR_STATS_INC(auth, total_requests);
359                 fun = rad_authenticate;
360                 break;
361
362 #ifdef WITH_ACCOUNTING
363         case PW_CODE_ACCOUNTING_REQUEST:
364                 if (listener->type != RAD_LISTEN_ACCT) {
365                         /*
366                          *      Allow auth + dual.  Disallow
367                          *      everything else.
368                          */
369                         if (!((listener->type == RAD_LISTEN_AUTH) &&
370                               (listener->dual))) {
371                                     goto bad_packet;
372                         }
373                 }
374                 FR_STATS_INC(acct, total_requests);
375                 fun = rad_accounting;
376                 break;
377 #endif
378
379         case PW_CODE_STATUS_SERVER:
380                 if (!main_config.status_server) {
381                         FR_STATS_INC(auth, total_unknown_types);
382                         WARN("Ignoring Status-Server request due to security configuration");
383                         rad_free(&packet);
384                         return 0;
385                 }
386                 fun = rad_status_server;
387                 break;
388
389         default:
390         bad_packet:
391                 FR_STATS_INC(auth, total_unknown_types);
392
393                 DEBUG("Invalid packet code %d sent from client %s port %d : IGNORED",
394                       packet->code, client->shortname, packet->src_port);
395                 rad_free(&packet);
396                 return 0;
397         } /* switch over packet types */
398
399         if (!request_receive(NULL, listener, packet, client, fun)) {
400                 FR_STATS_INC(auth, total_packets_dropped);
401                 rad_free(&packet);
402                 return 0;
403         }
404
405         return 1;
406 }
407
408
409 /*
410  *      Send a response packet
411  */
412 int dual_tls_send(rad_listen_t *listener, REQUEST *request)
413 {
414         listen_socket_t *sock = listener->data;
415
416         VERIFY_REQUEST(request);
417
418         rad_assert(request->listener == listener);
419         rad_assert(listener->send == dual_tls_send);
420
421         if (listener->status != RAD_LISTEN_STATUS_KNOWN) return 0;
422
423         /*
424          *      Accounting reject's are silently dropped.
425          *
426          *      We do it here to avoid polluting the rest of the
427          *      code with this knowledge
428          */
429         if (request->reply->code == 0) return 0;
430
431         /*
432          *      Pack the VPs
433          */
434         if (rad_encode(request->reply, request->packet,
435                        request->client->secret) < 0) {
436                 RERROR("Failed encoding packet: %s", fr_strerror());
437                 return 0;
438         }
439
440         if (request->reply->data_len > (MAX_PACKET_LEN - 100)) {
441                 RWARN("Packet is large, and possibly truncated - %zd vs max %zd",
442                       request->reply->data_len, MAX_PACKET_LEN);
443         }
444
445         /*
446          *      Sign the packet.
447          */
448         if (rad_sign(request->reply, request->packet,
449                        request->client->secret) < 0) {
450                 RERROR("Failed signing packet: %s", fr_strerror());
451                 return 0;
452         }
453
454         PTHREAD_MUTEX_LOCK(&sock->mutex);
455
456         /*
457          *      Write the packet to the SSL buffers.
458          */
459         sock->ssn->record_plus(&sock->ssn->clean_in,
460                                request->reply->data, request->reply->data_len);
461
462         dump_hex("TUNNELED DATA < ", sock->ssn->clean_in.data, sock->ssn->clean_in.used);
463
464         /*
465          *      Do SSL magic to get encrypted data.
466          */
467         tls_handshake_send(request, sock->ssn);
468
469         /*
470          *      And finally write the data to the socket.
471          */
472         if (sock->ssn->dirty_out.used > 0) {
473                 dump_hex("WRITE TO SSL", sock->ssn->dirty_out.data, sock->ssn->dirty_out.used);
474
475                 tls_socket_write(listener, request);
476         }
477         PTHREAD_MUTEX_UNLOCK(&sock->mutex);
478
479         return 0;
480 }
481
482
483 #ifdef WITH_PROXY
484 /*
485  *      Read from the SSL socket.  Safe with either blocking or
486  *      non-blocking IO.  This level of complexity is probably not
487  *      necessary, as each packet gets put into one SSL application
488  *      record.  When SSL has a full record, we should be able to read
489  *      the entire packet via one SSL_read().
490  *
491  *      When SSL has a partial record, SSL_read() will return
492  *      WANT_READ or WANT_WRITE, and zero application data.
493  *
494  *      Called with the mutex held.
495  */
496 static ssize_t proxy_tls_read(rad_listen_t *listener)
497 {
498         int rcode;
499         size_t length;
500         uint8_t *data;
501         listen_socket_t *sock = listener->data;
502
503         /*
504          *      Get the maximum size of data to receive.
505          */
506         if (!sock->data) sock->data = talloc_array(sock, uint8_t,
507                                                    sock->ssn->mtu);
508
509         data = sock->data;
510
511         if (sock->partial < 4) {
512                 rcode = SSL_read(sock->ssn->ssl, data + sock->partial,
513                                  4 - sock->partial);
514                 if (rcode <= 0) {
515                         int err = SSL_get_error(sock->ssn->ssl, rcode);
516                         switch (err) {
517                         case SSL_ERROR_WANT_READ:
518                         case SSL_ERROR_WANT_WRITE:
519                                 return 0; /* do some more work later */
520
521                         case SSL_ERROR_ZERO_RETURN:
522                                 /* remote end sent close_notify, send one back */
523                                 SSL_shutdown(sock->ssn->ssl);
524
525                         case SSL_ERROR_SYSCALL:
526                         do_close:
527                                 return -1;
528
529                         default:
530                                 while ((err = ERR_get_error())) {
531                                         DEBUG("proxy recv says %s",
532                                               ERR_error_string(err, NULL));
533                                 }
534
535                                 goto do_close;
536                         }
537                 }
538
539                 sock->partial = rcode;
540         } /* try reading the packet header */
541
542         if (sock->partial < 4) return 0; /* read more data */
543
544         length = (data[2] << 8) | data[3];
545
546         /*
547          *      Do these checks only once, when we read the header.
548          */
549         if (sock->partial == 4) {
550                 DEBUG3("Proxy received header saying we have a packet of %u bytes",
551                        (unsigned int) length);
552
553                 /*
554                  *      FIXME: allocate a RADIUS_PACKET, and set
555                  *      "data" to be as large as necessary.
556                  */
557                 if (length > sock->ssn->mtu) {
558                         INFO("Received packet will be too large! Set \"fragment_size = %u\"",
559                              (data[2] << 8) | data[3]);
560                         goto do_close;
561                 }
562         }
563
564         /*
565          *      Try to read some more.
566          */
567         if (sock->partial < length) {
568                 rcode = SSL_read(sock->ssn->ssl, data + sock->partial,
569                                  length - sock->partial);
570                 if (rcode <= 0) {
571                         switch (SSL_get_error(sock->ssn->ssl, rcode)) {
572                         case SSL_ERROR_WANT_READ:
573                         case SSL_ERROR_WANT_WRITE:
574                                 return 0;
575
576                         case SSL_ERROR_ZERO_RETURN:
577                                 /* remote end sent close_notify, send one back */
578                                 SSL_shutdown(sock->ssn->ssl);
579                                 goto do_close;
580                         default:
581                                 goto do_close;
582                         }
583                 }
584
585                 sock->partial += rcode;
586         }
587
588         /*
589          *      If we're not done, say so.
590          *
591          *      Otherwise, reset the partially read data flag, and say
592          *      we have a packet.
593          */
594         if (sock->partial < length) {
595                 return 0;
596         }
597
598         sock->partial = 0;      /* we've now read the packet */
599         return length;
600 }
601
602
603 int proxy_tls_recv(rad_listen_t *listener)
604 {
605         listen_socket_t *sock = listener->data;
606         char buffer[256];
607         RADIUS_PACKET *packet;
608         uint8_t *data;
609         ssize_t data_len;
610
611         if (listener->status != RAD_LISTEN_STATUS_KNOWN) return 0;
612
613         DEBUG3("Proxy SSL socket has data to read");
614         PTHREAD_MUTEX_LOCK(&sock->mutex);
615         data_len = proxy_tls_read(listener);
616         PTHREAD_MUTEX_UNLOCK(&sock->mutex);
617
618         if (data_len < 0) {
619                 DEBUG("Closing TLS socket to home server");
620                 PTHREAD_MUTEX_LOCK(&sock->mutex);
621                 tls_socket_close(listener);
622                 PTHREAD_MUTEX_UNLOCK(&sock->mutex);
623                 return 0;
624         }
625
626         if (data_len == 0) return 0; /* not done yet */
627
628         data = sock->data;
629
630         packet = rad_alloc(sock, false);
631         packet->sockfd = listener->fd;
632         packet->src_ipaddr = sock->other_ipaddr;
633         packet->src_port = sock->other_port;
634         packet->dst_ipaddr = sock->my_ipaddr;
635         packet->dst_port = sock->my_port;
636         packet->code = data[0];
637         packet->id = data[1];
638         packet->data_len = data_len;
639         packet->data = talloc_array(packet, uint8_t, packet->data_len);
640         memcpy(packet->data, data, packet->data_len);
641         memcpy(packet->vector, packet->data + 4, 16);
642
643         /*
644          *      FIXME: Client MIB updates?
645          */
646         switch (packet->code) {
647         case PW_CODE_ACCESS_ACCEPT:
648         case PW_CODE_ACCESS_CHALLENGE:
649         case PW_CODE_ACCESS_REJECT:
650                 break;
651
652 #ifdef WITH_ACCOUNTING
653         case PW_CODE_ACCOUNTING_RESPONSE:
654                 break;
655 #endif
656
657         default:
658                 /*
659                  *      FIXME: Update MIB for packet types?
660                  */
661                 ERROR("Invalid packet code %d sent to a proxy port "
662                        "from home server %s port %d - ID %d : IGNORED",
663                        packet->code,
664                        ip_ntoh(&packet->src_ipaddr, buffer, sizeof(buffer)),
665                        packet->src_port, packet->id);
666                 rad_free(&packet);
667                 return 0;
668         }
669
670         if (!request_proxy_reply(packet)) {
671                 rad_free(&packet);
672                 return 0;
673         }
674
675         return 1;
676 }
677
678
679 int proxy_tls_send(rad_listen_t *listener, REQUEST *request)
680 {
681         int rcode;
682         listen_socket_t *sock = listener->data;
683
684         VERIFY_REQUEST(request);
685
686         if ((listener->status != RAD_LISTEN_STATUS_INIT) &&
687             (listener->status != RAD_LISTEN_STATUS_KNOWN)) return 0;
688
689         /*
690          *      Normal proxying calls us with the data already
691          *      encoded.  The "ping home server" code does not.  So,
692          *      if there's no packet, encode it here.
693          */
694         if (!request->proxy->data) {
695                 request->proxy_listener->encode(request->proxy_listener,
696                                                 request);
697         }
698
699         DEBUG3("Proxy is writing %u bytes to SSL",
700                (unsigned int) request->proxy->data_len);
701         PTHREAD_MUTEX_LOCK(&sock->mutex);
702         rcode = SSL_write(sock->ssn->ssl, request->proxy->data,
703                           request->proxy->data_len);
704         if (rcode < 0) {
705                 int err;
706
707                 err = ERR_get_error();
708                 switch (err) {
709                 case SSL_ERROR_NONE:
710                 case SSL_ERROR_WANT_READ:
711                 case SSL_ERROR_WANT_WRITE:
712                         break;  /* let someone else retry */
713
714                 default:
715                         DEBUG("proxy SSL_write says %s",
716                               ERR_error_string(err, NULL));
717                         DEBUG("Closing TLS socket to home server");
718                         tls_socket_close(listener);
719                         PTHREAD_MUTEX_UNLOCK(&sock->mutex);
720                         return 0;
721                 }
722         }
723         PTHREAD_MUTEX_UNLOCK(&sock->mutex);
724
725         return 1;
726 }
727 #endif  /* WITH_PROXY */
728
729 #endif  /* WITH_TLS */