]> git.sur5r.net Git - openldap/blob - libraries/libldap/os-ip.c
ca167f4966dd267321e30c3e59eca5dc884840f9
[openldap] / libraries / libldap / os-ip.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 /*  Portions
7  *  Copyright (c) 1995 Regents of the University of Michigan.
8  *  All rights reserved.
9  *
10  *  os-ip.c -- platform-specific TCP & UDP related code
11  */
12
13 #include "portable.h"
14
15 #include <stdio.h>
16
17 #include <ac/stdlib.h>
18
19 #include <ac/errno.h>
20 #include <ac/socket.h>
21 #include <ac/string.h>
22 #include <ac/time.h>
23 #include <ac/unistd.h>
24
25 #ifdef HAVE_IO_H
26 #include <io.h>
27 #endif /* HAVE_IO_H */
28
29 #include "ldap-int.h"
30
31 int ldap_int_tblsize = 0;
32
33 #if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
34 #  ifdef LDAP_PF_INET6
35 int ldap_int_inet4or6 = AF_UNSPEC;
36 #  else
37 int ldap_int_inet4or6 = AF_INET;
38 #  endif
39 #endif
40
41 /*
42  * nonblock connect code
43  * written by Lars Uffmann, <lars.uffmann@mediaway.net>.
44  *
45  * Copyright 1999, Lars Uffmann, All rights reserved.
46  * This software is not subject to any license of my employer
47  * mediaWays GmbH.
48  *
49  * OpenLDAP COPYING RESTRICTIONS APPLY, see COPYRIGHT file
50  *
51  * Read about the rationale in ldap_connect_timeout: 
52  * ftp://koobera.math.uic.edu/www/docs/connect.html.
53  */
54
55 #define osip_debug(ld,fmt,arg1,arg2,arg3) \
56 do { \
57         ldap_log_printf(NULL, LDAP_DEBUG_TRACE, fmt, arg1, arg2, arg3); \
58 } while(0)
59
60 static void
61 ldap_pvt_set_errno(int err)
62 {
63         errno = err;
64 }
65
66 int
67 ldap_int_timeval_dup( struct timeval **dest, const struct timeval *src )
68 {
69         struct timeval *new;
70
71         assert( dest != NULL );
72
73         if (src == NULL) {
74                 *dest = NULL;
75                 return 0;
76         }
77
78         new = (struct timeval *) LDAP_MALLOC(sizeof(struct timeval));
79
80         if( new == NULL ) {
81                 *dest = NULL;
82                 return 1;
83         }
84
85         AC_MEMCPY( (char *) new, (const char *) src, sizeof(struct timeval));
86
87         *dest = new;
88         return 0;
89 }
90
91 static int
92 ldap_pvt_ndelay_on(LDAP *ld, int fd)
93 {
94         osip_debug(ld, "ldap_ndelay_on: %d\n",fd,0,0);
95         return ber_pvt_socket_set_nonblock( fd, 1 );
96 }
97    
98 static int
99 ldap_pvt_ndelay_off(LDAP *ld, int fd)
100 {
101         osip_debug(ld, "ldap_ndelay_off: %d\n",fd,0,0);
102         return ber_pvt_socket_set_nonblock( fd, 0 );
103 }
104
105 static ber_socket_t
106 ldap_int_socket(LDAP *ld, int family, int type )
107 {
108         ber_socket_t s = socket(family, type, 0);
109         osip_debug(ld, "ldap_new_socket: %d\n",s,0,0);
110         return ( s );
111 }
112
113 static int
114 ldap_pvt_close_socket(LDAP *ld, int s)
115 {
116         osip_debug(ld, "ldap_close_socket: %d\n",s,0,0);
117         return tcp_close(s);
118 }
119
120 static int
121 ldap_int_prepare_socket(LDAP *ld, int s, int proto )
122 {
123         osip_debug(ld, "ldap_prepare_socket: %d\n", s,0,0);
124
125 #ifdef TCP_NODELAY
126         if( proto == LDAP_PROTO_TCP ) {
127                 int dummy = 1;
128                 if ( setsockopt( s, IPPROTO_TCP, TCP_NODELAY,
129                         (char*) &dummy, sizeof(dummy) ) == AC_SOCKET_ERROR )
130                 {
131                         osip_debug(ld, "ldap_prepare_socket: "
132                                 "setsockopt(%d, TCP_NODELAY) failed (ignored).\n",
133                                 s, 0, 0);
134                 }
135         }
136 #endif
137
138         return 0;
139 }
140
141 #ifndef HAVE_WINSOCK
142
143 #undef TRACE
144 #define TRACE do { \
145         osip_debug(ld, \
146                 "ldap_is_socket_ready: error on socket %d: errno: %d (%s)\n", \
147                 s, \
148                 errno, \
149                 sock_errstr(errno) ); \
150 } while( 0 )
151
152 /*
153  * check the socket for errors after select returned.
154  */
155 static int
156 ldap_pvt_is_socket_ready(LDAP *ld, int s)
157 {
158         osip_debug(ld, "ldap_is_sock_ready: %d\n",s,0,0);
159
160 #if defined( notyet ) /* && defined( SO_ERROR ) */
161 {
162         int so_errno;
163         socklen_t dummy = sizeof(so_errno);
164         if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy )
165                 == AC_SOCKET_ERROR )
166         {
167                 return -1;
168         }
169         if ( so_errno ) {
170                 ldap_pvt_set_errno(so_errno);
171                 TRACE;
172                 return -1;
173         }
174         return 0;
175 }
176 #else
177 {
178         /* error slippery */
179         struct sockaddr_in sin;
180         char ch;
181         socklen_t dummy = sizeof(sin);
182         if ( getpeername( s, (struct sockaddr *) &sin, &dummy )
183                 == AC_SOCKET_ERROR )
184         {
185                 /* XXX: needs to be replace with ber_stream_read() */
186                 read(s, &ch, 1);
187                 TRACE;
188                 return -1;
189         }
190         return 0;
191 }
192 #endif
193         return -1;
194 }
195 #undef TRACE
196
197 #endif /* HAVE_WINSOCK */
198
199 static int
200 ldap_pvt_connect(LDAP *ld, ber_socket_t s,
201         struct sockaddr *sin, socklen_t addrlen,
202         int async)
203 {
204         int rc;
205         struct timeval  tv, *opt_tv=NULL;
206         fd_set          wfds, *z=NULL;
207 #ifdef HAVE_WINSOCK
208         fd_set          efds;
209 #endif
210
211 #ifdef LDAP_CONNECTIONLESS
212         /* We could do a connect() but that would interfere with
213          * attempts to poll a broadcast address
214          */
215         if (LDAP_IS_UDP(ld)) {
216                 if (ld->ld_options.ldo_peer)
217                         ldap_memfree(ld->ld_options.ldo_peer);
218                 ld->ld_options.ldo_peer=ldap_memalloc(sizeof(struct sockaddr));
219                 AC_MEMCPY(ld->ld_options.ldo_peer,sin,sizeof(struct sockaddr));
220                 return ( 0 );
221         }
222 #endif
223         if ( (opt_tv = ld->ld_options.ldo_tm_net) != NULL ) {
224                 tv.tv_usec = opt_tv->tv_usec;
225                 tv.tv_sec = opt_tv->tv_sec;
226         }
227
228         osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
229                         s, opt_tv ? tv.tv_sec : -1L, async);
230
231         if ( ldap_pvt_ndelay_on(ld, s) == -1 )
232                 return ( -1 );
233
234         if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) {
235                 if ( ldap_pvt_ndelay_off(ld, s) == -1 )
236                         return ( -1 );
237                 return ( 0 );
238         }
239
240 #ifdef HAVE_WINSOCK
241         ldap_pvt_set_errno( WSAGetLastError() );
242 #endif
243
244         if ( errno != EINPROGRESS && errno != EWOULDBLOCK ) {
245                 return ( -1 );
246         }
247         
248 #ifdef notyet
249         if ( async ) return ( -2 );
250 #endif
251
252         FD_ZERO(&wfds);
253         FD_SET(s, &wfds );
254
255 #ifdef HAVE_WINSOCK
256         FD_ZERO(&efds);
257         FD_SET(s, &efds );
258 #endif
259
260         do {
261                 rc = select(ldap_int_tblsize, z, &wfds,
262 #ifdef HAVE_WINSOCK
263                         &efds,
264 #else
265                         z,
266 #endif
267                         opt_tv ? &tv : NULL);
268         } while( rc == AC_SOCKET_ERROR && errno == EINTR &&
269                 LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART ));
270
271         if( rc == AC_SOCKET_ERROR ) return rc;
272
273 #ifdef HAVE_WINSOCK
274         /* This means the connection failed */
275         if ( FD_ISSET(s, &efds) ) {
276             int so_errno;
277             int dummy = sizeof(so_errno);
278             if ( getsockopt( s, SOL_SOCKET, SO_ERROR,
279                         (char *) &so_errno, &dummy ) == AC_SOCKET_ERROR || !so_errno )
280             {
281                 /* impossible */
282                 so_errno = WSAGetLastError();
283             }
284             ldap_pvt_set_errno(so_errno);
285             osip_debug(ld, "ldap_pvt_connect: error on socket %d: "
286                        "errno: %d (%s)\n", s, errno, sock_errstr(errno));
287             return -1;
288         }
289 #endif
290         if ( FD_ISSET(s, &wfds) ) {
291 #ifndef HAVE_WINSOCK
292                 if ( ldap_pvt_is_socket_ready(ld, s) == -1 )
293                         return ( -1 );
294 #endif
295                 if ( ldap_pvt_ndelay_off(ld, s) == -1 )
296                         return ( -1 );
297                 return ( 0 );
298         }
299         osip_debug(ld, "ldap_connect_timeout: timed out\n",0,0,0);
300         ldap_pvt_set_errno( ETIMEDOUT );
301         return ( -1 );
302 }
303
304 #ifndef HAVE_INET_ATON
305 int
306 ldap_pvt_inet_aton( const char *host, struct in_addr *in)
307 {
308         unsigned long u = inet_addr( host );
309         if ( u != 0xffffffff || u != (unsigned long) -1 ) {
310                 in->s_addr = u;
311                 return 1;
312         }
313         return 0;
314 }
315 #endif
316
317
318 int
319 ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
320         int proto,
321         const char *host,
322         unsigned long address, int port, int async )
323 {
324         struct sockaddr_in      sin;
325         ber_socket_t            s = AC_SOCKET_INVALID;
326         int                     rc, i, use_hp = 0;
327         struct hostent          *hp = NULL;
328         char                    *ha_buf=NULL, *p, *q;
329         int                     socktype;
330
331         
332         switch(proto) {
333         case LDAP_PROTO_TCP: socktype = SOCK_STREAM;
334                 osip_debug(ld, "ldap_connect_to_host: TCP %s:%d\n",host,port,0);
335                 break;
336         case LDAP_PROTO_UDP: socktype = SOCK_DGRAM;
337                 osip_debug(ld, "ldap_connect_to_host: TCP %s:%d\n",host,port,0);
338                 break;
339
340         default:
341                 osip_debug(ld, "ldap_connect_to_host: unknown proto: %d\n",
342                         proto, 0, 0);
343                 return -1;
344         }
345
346         if (host != NULL) {
347 #if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
348                 char serv[7];
349                 int err;
350                 struct addrinfo hints, *res, *sai;
351
352                 memset( &hints, '\0', sizeof(hints) );
353                 hints.ai_family = ldap_int_inet4or6;
354                 hints.ai_socktype = socktype;
355
356                 snprintf(serv, sizeof serv, "%d", port );
357                 if ( ( err = getaddrinfo(host, serv, &hints, &res) ) ) {
358                         osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
359                                 AC_GAI_STRERROR(err), 0, 0);
360                         return -1;
361                 }
362                 rc = -1;
363
364                 for( sai=res; sai != NULL; sai=sai->ai_next) {
365                         if( sai->ai_addr == NULL ) {
366                                 osip_debug(ld, "ldap_connect_to_host: getaddrinfo "
367                                         "ai_addr is NULL?\n", 0, 0, 0);
368                                 continue;
369                         }
370
371                         /* we assume AF_x and PF_x are equal for all x */
372                         s = ldap_int_socket( ld, sai->ai_family, socktype );
373                         if ( s == AC_SOCKET_INVALID ) {
374                                 continue;
375                         }
376
377                         if ( ldap_int_prepare_socket(ld, s, proto ) == -1 ) {
378                                 ldap_pvt_close_socket(ld, s);
379                                 break;
380                         }
381
382                         switch (sai->ai_family) {
383 #ifdef LDAP_PF_INET6
384                         case AF_INET6: {
385                                 char addr[INET6_ADDRSTRLEN];
386                                 inet_ntop( AF_INET6,
387                                         &((struct sockaddr_in6 *)sai->ai_addr)->sin6_addr,
388                                         addr, sizeof addr);
389                                 osip_debug(ld, "ldap_connect_to_host: Trying %s %s\n", 
390                                         addr, serv, 0);
391                         } break;
392 #endif
393                         case AF_INET: {
394                                 char addr[INET_ADDRSTRLEN];
395                                 inet_ntop( AF_INET,
396                                         &((struct sockaddr_in *)sai->ai_addr)->sin_addr,
397                                         addr, sizeof addr);
398                                 osip_debug(ld, "ldap_connect_to_host: Trying %s:%s\n", 
399                                         addr, serv, 0);
400                         } break;
401                         }
402
403                         rc = ldap_pvt_connect(ld, s, sai->ai_addr, sai->ai_addrlen, async);
404                         if ( (rc == 0) || (rc == -2) ) {
405                                 ber_sockbuf_ctrl( sb, LBER_SB_OPT_SET_FD, &s );
406                                 break;
407                         }
408                         ldap_pvt_close_socket(ld, s);
409                 }
410                 freeaddrinfo(res);
411                 return rc;
412
413 #else
414                 struct in_addr in;
415                 if (! inet_aton( host, &in) ) {
416                         int local_h_errno;
417                         struct hostent he_buf;
418                         rc = ldap_pvt_gethostbyname_a(host, &he_buf, &ha_buf,
419                                         &hp, &local_h_errno);
420
421                         if ( (rc < 0) || (hp == NULL) ) {
422 #ifdef HAVE_WINSOCK
423                                 ldap_pvt_set_errno( WSAGetLastError() );
424 #else
425                                 /* not exactly right, but... */
426                                 ldap_pvt_set_errno( EHOSTUNREACH );
427 #endif
428                                 if (ha_buf) LDAP_FREE(ha_buf);
429                                 return -1;
430                         }
431                         use_hp = 1;
432                 }
433                 address = in.s_addr;
434 #endif
435         }
436
437         rc = s = -1;
438         for ( i = 0; !use_hp || (hp->h_addr_list[i] != 0); ++i, rc = -1 ) {
439                 s = ldap_int_socket( ld, PF_INET, socktype );
440                 if ( s == AC_SOCKET_INVALID ) {
441                         /* use_hp ? continue : break; */
442                         break;
443                 }
444            
445                 if ( ldap_int_prepare_socket( ld, s, proto ) == -1 ) {
446                         ldap_pvt_close_socket(ld, s);
447                         break;
448                 }
449
450                 (void)memset((char *)&sin, '\0', sizeof(struct sockaddr_in));
451                 sin.sin_family = AF_INET;
452                 sin.sin_port = htons((short) port);
453                 p = (char *)&sin.sin_addr;
454                 q = use_hp ? (char *)hp->h_addr_list[i] : (char *)&address;
455                 AC_MEMCPY(p, q, sizeof(sin.sin_addr) );
456
457                 osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", 
458                         inet_ntoa(sin.sin_addr),port,0);
459
460                 rc = ldap_pvt_connect(ld, s,
461                         (struct sockaddr *)&sin, sizeof(struct sockaddr_in),
462                         async);
463    
464                 if ( (rc == 0) || (rc == -2) ) {
465                         ber_sockbuf_ctrl( sb, LBER_SB_OPT_SET_FD, &s );
466                         break;
467                 }
468
469                 ldap_pvt_close_socket(ld, s);
470
471                 if (!use_hp)
472                         break;
473         }
474         if (ha_buf) LDAP_FREE(ha_buf);
475         return rc;
476 }
477
478 #if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND ) || \
479         defined( HAVE_CYRUS_SASL )
480 char *
481 ldap_host_connected_to( Sockbuf *sb )
482 {
483         struct hostent  *hp;
484         socklen_t               len;
485 #ifdef LDAP_PF_INET6
486         struct sockaddr_storage sabuf;
487 #else
488         struct sockaddr sabuf;
489 #endif
490         struct sockaddr *sa = (struct sockaddr *) &sabuf;
491         char                    *addr;
492         char                    *host;
493
494         /* buffers for gethostbyaddr_r */
495         struct hostent  he_buf;
496         int                             local_h_errno;
497         char                    *ha_buf=NULL;
498         ber_socket_t    sd;
499
500         (void)memset( (char *)sa, '\0', sizeof sabuf );
501         len = sizeof sabuf;
502
503         ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
504         if ( getpeername( sd, sa, &len ) == -1 ) {
505                 return( NULL );
506         }
507
508         /*
509          * do a reverse lookup on the addr to get the official hostname.
510          * this is necessary for kerberos to work right, since the official
511          * hostname is used as the kerberos instance.
512          */
513
514         switch (sa->sa_family) {
515 #ifdef LDAP_PF_LOCAL
516         case AF_LOCAL:
517                 return LDAP_STRDUP( ldap_int_hostname );
518 #endif
519 #ifdef LDAP_PF_INET6
520         case AF_INET6:
521                 addr = (char *) &((struct sockaddr_in6 *)sa)->sin6_addr;
522                 len = sizeof( struct in6_addr );
523                 break;
524 #endif
525         case AF_INET:
526                 addr = (char *) &((struct sockaddr_in *)sa)->sin_addr;
527                 len = sizeof( struct in_addr );
528
529                 {
530                         struct sockaddr_in localhost;
531                         localhost.sin_addr.s_addr = htonl( INADDR_ANY );
532
533                         if( memcmp ( &localhost.sin_addr,
534                                 &((struct sockaddr_in *)sa)->sin_addr,
535                                 sizeof(localhost.sin_addr) ) == 0 )
536                         {
537                                 return LDAP_STRDUP( ldap_int_hostname );
538                         }
539
540 #ifdef INADDR_LOOPBACK
541                         localhost.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
542
543                         if( memcmp ( &localhost.sin_addr,
544                                 &((struct sockaddr_in *)sa)->sin_addr,
545                                 sizeof(localhost.sin_addr) ) == 0 )
546                         {
547                                 return LDAP_STRDUP( ldap_int_hostname );
548                         }
549 #endif
550                 }
551                 break;
552
553         default:
554                 return( NULL );
555                 break;
556         }
557
558         host = NULL;
559         if ((ldap_pvt_gethostbyaddr_a( addr, len, sa->sa_family,
560                 &he_buf, &ha_buf, &hp, &local_h_errno ) == 0 ) &&
561                 (hp != NULL) && ( hp->h_name != NULL ) )
562         {
563                 host = LDAP_STRDUP( hp->h_name );   
564         }
565
566         LDAP_FREE( ha_buf );
567         return host;
568 }
569 #endif
570
571
572 /* for UNIX */
573 struct selectinfo {
574         fd_set  si_readfds;
575         fd_set  si_writefds;
576         fd_set  si_use_readfds;
577         fd_set  si_use_writefds;
578 };
579
580
581 void
582 ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
583 {
584         struct selectinfo       *sip;
585         ber_socket_t            sd;
586
587         sip = (struct selectinfo *)ld->ld_selectinfo;
588         
589         ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
590         if ( !FD_ISSET( sd, &sip->si_writefds )) {
591                 FD_SET( sd, &sip->si_writefds );
592         }
593 }
594
595
596 void
597 ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
598 {
599         struct selectinfo       *sip;
600         ber_socket_t            sd;
601
602         sip = (struct selectinfo *)ld->ld_selectinfo;
603
604         ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
605         if ( !FD_ISSET( sd, &sip->si_readfds )) {
606                 FD_SET( sd, &sip->si_readfds );
607         }
608 }
609
610
611 void
612 ldap_mark_select_clear( LDAP *ld, Sockbuf *sb )
613 {
614         struct selectinfo       *sip;
615         ber_socket_t            sd;
616
617         sip = (struct selectinfo *)ld->ld_selectinfo;
618
619         ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
620         FD_CLR( sd, &sip->si_writefds );
621         FD_CLR( sd, &sip->si_readfds );
622 }
623
624
625 int
626 ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
627 {
628         struct selectinfo       *sip;
629         ber_socket_t            sd;
630
631         sip = (struct selectinfo *)ld->ld_selectinfo;
632
633         ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
634         return( FD_ISSET( sd, &sip->si_use_writefds ));
635 }
636
637
638 int
639 ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
640 {
641         struct selectinfo       *sip;
642         ber_socket_t            sd;
643
644         sip = (struct selectinfo *)ld->ld_selectinfo;
645
646         ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
647         return( FD_ISSET( sd, &sip->si_use_readfds ));
648 }
649
650
651 void *
652 ldap_new_select_info( void )
653 {
654         struct selectinfo       *sip;
655
656         if (( sip = (struct selectinfo *)LDAP_CALLOC( 1,
657             sizeof( struct selectinfo ))) != NULL ) {
658                 FD_ZERO( &sip->si_readfds );
659                 FD_ZERO( &sip->si_writefds );
660         }
661
662         return( (void *)sip );
663 }
664
665
666 void
667 ldap_free_select_info( void *sip )
668 {
669         LDAP_FREE( sip );
670 }
671
672
673 void
674 ldap_int_ip_init( void )
675 {
676         int tblsize;
677 #if defined( HAVE_SYSCONF )
678         tblsize = sysconf( _SC_OPEN_MAX );
679 #elif defined( HAVE_GETDTABLESIZE )
680         tblsize = getdtablesize();
681 #else
682         tblsize = FD_SETSIZE;
683 #endif /* !USE_SYSCONF */
684
685 #ifdef FD_SETSIZE
686         if( tblsize > FD_SETSIZE )
687                 tblsize = FD_SETSIZE;
688 #endif  /* FD_SETSIZE*/
689         ldap_int_tblsize = tblsize;
690 }
691
692
693 int
694 ldap_int_select( LDAP *ld, struct timeval *timeout )
695 {
696         struct selectinfo       *sip;
697
698 #ifdef NEW_LOGGING
699         LDAP_LOG ( CONNECTION, ENTRY, "ldap_int_select\n", 0, 0, 0 );
700 #else
701         Debug( LDAP_DEBUG_TRACE, "ldap_int_select\n", 0, 0, 0 );
702 #endif
703
704         if ( ldap_int_tblsize == 0 )
705                 ldap_int_ip_init();
706
707         sip = (struct selectinfo *)ld->ld_selectinfo;
708         sip->si_use_readfds = sip->si_readfds;
709         sip->si_use_writefds = sip->si_writefds;
710         
711         return( select( ldap_int_tblsize,
712                         &sip->si_use_readfds, &sip->si_use_writefds,
713                         NULL, timeout ));
714 }