Changes in / [75a4b85:eda0270]
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r75a4b85 reda0270 39 39 { 40 40 #ifdef IPV6 41 struct sockaddr_in6 listen_addr; 42 #else 41 int use_ipv6 = 1; 42 struct sockaddr_in6 listen_addr6; 43 #endif 43 44 struct sockaddr_in listen_addr; 44 #endif45 45 int i; 46 46 FILE *fp; … … 49 49 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 50 50 51 global.listen_socket = socket( AF_INETx, SOCK_STREAM, 0 ); 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 52 60 if( global.listen_socket == -1 ) 53 61 { … … 61 69 62 70 #ifdef IPV6 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 ); 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 } 70 86 #endif 71 87 … … 76 92 } 77 93 78 i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( listen_addr ) ); 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 ) ); 79 98 if( i == -1 ) 80 99 { -
irc.c
r75a4b85 reda0270 47 47 char buf[128]; 48 48 #ifdef IPV6 49 struct sockaddr_in6 sock[1]; 50 #else 49 struct sockaddr_in6 sock6[1]; 50 unsigned int i6; 51 #endif 51 52 struct sockaddr_in sock[1]; 52 #endif53 53 54 54 irc = g_new0( irc_t, 1 ); … … 70 70 71 71 i = sizeof( *sock ); 72 #ifdef IPV6 73 i6 = sizeof( *sock6 ); 74 #endif 72 75 73 76 if( global.conf->hostname ) 74 77 irc->myhost = g_strdup( global.conf->hostname ); 75 78 #ifdef IPV6 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) ) )79 else if( getsockname( irc->fd, (struct sockaddr*) sock6, &i6 ) == 0 && sock6->sin6_family == AF_INET6 ) 80 { 81 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) ) 79 82 irc->myhost = g_strdup( peer->h_name ); 80 else if( inet_ntop( AF_INET x, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )83 else if( inet_ntop( AF_INET6, &sock6->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 81 84 irc->myhost = g_strdup( ipv6_unwrap( buf ) ); 82 85 } 83 #e lse84 else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET x)85 { 86 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET x) ) )86 #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 ) ) ) 87 90 irc->myhost = g_strdup( peer->h_name ); 88 else if( inet_ntop( AF_INET x, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )91 else if( inet_ntop( AF_INET, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 89 92 irc->myhost = g_strdup( buf ); 90 93 } 91 #endif92 94 93 95 i = sizeof( *sock ); 94 96 #ifdef IPV6 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 ) ) ) 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 ) ) ) 98 101 irc->host = g_strdup( peer->h_name ); 99 else if( inet_ntop( AF_INET x, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )102 else if( inet_ntop( AF_INET6, &sock6->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL ) 100 103 irc->host = g_strdup( ipv6_unwrap( buf ) ); 101 104 } 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 ) ) ) 105 else 106 #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 ) ) ) 106 110 irc->host = g_strdup( peer->h_name ); 107 else if( inet_ntop( AF_INET x, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )111 else if( inet_ntop( AF_INET, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL ) 108 112 irc->host = g_strdup( buf ); 109 113 } 110 #endif111 114 112 115 /* Rare, but possible. */ … … 621 624 char namelist[385] = ""; 622 625 struct conversation *c = NULL; 626 char *ops = set_getstr( irc, "ops" ); 623 627 624 628 /* RFCs say there is no error reply allowed on NAMES, so when the … … 637 641 if( u->gc && !u->away && set_getbool( &irc->set, "away_devoice" ) ) 638 642 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, "@" ); 639 646 640 647 strcat( namelist, u->nick ); -
protocols/msn/msn.c
r75a4b85 reda0270 105 105 } 106 106 107 while( md->groupcount > 0 ) 108 g_free( md->grouplist[--md->groupcount] ); 107 109 g_free( md->grouplist ); 108 110 -
sock.h
r75a4b85 reda0270 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 IPV66 #define AF_INETx AF_INET67 #else8 #define AF_INETx AF_INET9 #endif10 3 11 4 #ifndef _WIN32
Note: See TracChangeset
for help on using the changeset viewer.