Changes in / [eda0270:75a4b85]
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
reda0270 r75a4b85 39 39 { 40 40 #ifdef IPV6 41 int use_ipv6 = 1; 42 struct sockaddr_in6 listen_addr6; 41 struct sockaddr_in6 listen_addr; 42 #else 43 struct sockaddr_in listen_addr; 43 44 #endif 44 struct sockaddr_in listen_addr;45 45 int i; 46 46 FILE *fp; … … 49 49 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 50 50 51 #ifdef IPV6 52 if( ( global.listen_socket = socket( AF_INET6, SOCK_STREAM, 0 ) ) == -1 ) 53 { 54 use_ipv6 = 0; 55 #endif 56 global.listen_socket = socket( AF_INET, SOCK_STREAM, 0 ); 57 #ifdef IPV6 58 } 59 #endif 51 global.listen_socket = socket( AF_INETx, SOCK_STREAM, 0 ); 60 52 if( global.listen_socket == -1 ) 61 53 { … … 69 61 70 62 #ifdef IPV6 71 listen_addr6.sin6_family = AF_INET6; 72 listen_addr6.sin6_port = htons( global.conf->port ); 73 if( ( i = inet_pton( AF_INET6, ipv6_wrap( global.conf->iface ), &listen_addr6.sin6_addr ) ) != 1 ) 74 { 75 /* Forget about IPv6 in this function. */ 76 use_ipv6 = 0; 77 #endif 78 listen_addr.sin_family = AF_INET; 79 listen_addr.sin_port = htons( global.conf->port ); 80 if( strcmp( global.conf->iface, "::" ) == 0 ) 81 i = inet_pton( AF_INET, "0.0.0.0", &listen_addr.sin_addr ); 82 else 83 i = inet_pton( AF_INET, global.conf->iface, &listen_addr.sin_addr ); 84 #ifdef IPV6 85 } 63 listen_addr.sin6_family = AF_INETx; 64 listen_addr.sin6_port = htons( global.conf->port ); 65 i = inet_pton( AF_INETx, ipv6_wrap( global.conf->iface ), &listen_addr.sin6_addr ); 66 #else 67 listen_addr.sin_family = AF_INETx; 68 listen_addr.sin_port = htons( global.conf->port ); 69 i = inet_pton( AF_INETx, global.conf->iface, &listen_addr.sin_addr ); 86 70 #endif 87 71 … … 92 76 } 93 77 94 #ifdef IPV6 95 if( !use_ipv6 || ( i = bind( global.listen_socket, (struct sockaddr *) &listen_addr6, sizeof( listen_addr6 ) ) ) == -1 ) 96 #endif 97 i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( listen_addr ) ); 78 i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( listen_addr ) ); 98 79 if( i == -1 ) 99 80 { -
irc.c
reda0270 r75a4b85 47 47 char buf[128]; 48 48 #ifdef IPV6 49 struct sockaddr_in6 sock6[1]; 50 unsigned int i6; 49 struct sockaddr_in6 sock[1]; 50 #else 51 struct sockaddr_in sock[1]; 51 52 #endif 52 struct sockaddr_in sock[1];53 53 54 54 irc = g_new0( irc_t, 1 ); … … 70 70 71 71 i = sizeof( *sock ); 72 #ifdef IPV673 i6 = sizeof( *sock6 );74 #endif75 72 76 73 if( global.conf->hostname ) 77 74 irc->myhost = g_strdup( global.conf->hostname ); 78 75 #ifdef IPV6 79 else if( getsockname( irc->fd, (struct sockaddr*) sock 6, &i6 ) == 0 && sock6->sin6_family == AF_INET6)80 { 81 if( ( peer = gethostbyaddr( (char*) &sock 6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6) ) )76 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx ) 77 { 78 if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) ) 82 79 irc->myhost = g_strdup( peer->h_name ); 83 else if( inet_ntop( AF_INET 6, &sock6->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )80 else if( inet_ntop( AF_INETx, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 84 81 irc->myhost = g_strdup( ipv6_unwrap( buf ) ); 85 82 } 83 #else 84 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx ) 85 { 86 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) ) 87 irc->myhost = g_strdup( peer->h_name ); 88 else if( inet_ntop( AF_INETx, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 89 irc->myhost = g_strdup( buf ); 90 } 86 91 #endif 87 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET )88 {89 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) )90 irc->myhost = g_strdup( peer->h_name );91 else if( inet_ntop( AF_INET, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )92 irc->myhost = g_strdup( buf );93 }94 92 95 93 i = sizeof( *sock ); 96 94 #ifdef IPV6 97 i6 = sizeof( *sock6 ); 98 if( getpeername( irc->fd, (struct sockaddr*) sock6, &i6 ) == 0 && sock6->sin6_family == AF_INET6 ) 99 { 100 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) ) 95 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx ) 96 { 97 if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) ) 101 98 irc->host = g_strdup( peer->h_name ); 102 else if( inet_ntop( AF_INET 6, &sock6->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )99 else if( inet_ntop( AF_INETx, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 103 100 irc->host = g_strdup( ipv6_unwrap( buf ) ); 104 101 } 105 else 102 #else 103 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx ) 104 { 105 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) ) 106 irc->host = g_strdup( peer->h_name ); 107 else if( inet_ntop( AF_INETx, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 108 irc->host = g_strdup( buf ); 109 } 106 110 #endif 107 if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET )108 {109 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) )110 irc->host = g_strdup( peer->h_name );111 else if( inet_ntop( AF_INET, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )112 irc->host = g_strdup( buf );113 }114 111 115 112 /* Rare, but possible. */ … … 624 621 char namelist[385] = ""; 625 622 struct conversation *c = NULL; 626 char *ops = set_getstr( irc, "ops" );627 623 628 624 /* RFCs say there is no error reply allowed on NAMES, so when the … … 641 637 if( u->gc && !u->away && set_getbool( &irc->set, "away_devoice" ) ) 642 638 strcat( namelist, "+" ); 643 else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ||644 ( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) )645 strcat( namelist, "@" );646 639 647 640 strcat( namelist, u->nick ); -
protocols/msn/msn.c
reda0270 r75a4b85 105 105 } 106 106 107 while( md->groupcount > 0 )108 g_free( md->grouplist[--md->groupcount] );109 107 g_free( md->grouplist ); 110 108 -
sock.h
reda0270 r75a4b85 1 1 #include <errno.h> 2 2 #include <fcntl.h> 3 4 /* To cut down on the ifdef stuff a little bit in other places */ 5 #ifdef IPV6 6 #define AF_INETx AF_INET6 7 #else 8 #define AF_INETx AF_INET 9 #endif 3 10 4 11 #ifndef _WIN32
Note: See TracChangeset
for help on using the changeset viewer.