Changes in / [2231302:7435ccf]
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r2231302 r7435ccf 52 52 i = getaddrinfo( global.conf->iface, global.conf->port, &hints, 53 53 &addrinfo_bind ); 54 if( i ) 55 { 54 if ( i ) { 56 55 log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s", 57 56 global.conf->iface, gai_strerror(i) ); … … 61 60 global.listen_socket = -1; 62 61 63 for( res = addrinfo_bind; res; res = res->ai_next ) 64 { 62 for ( res = addrinfo_bind; res; res = res->ai_next ) { 65 63 global.listen_socket = socket( res->ai_family, res->ai_socktype, 66 64 res->ai_protocol ); 67 if ( global.listen_socket < 0 )65 if ( global.listen_socket < 0 ) 68 66 continue; 69 67 -
debian/postinst
r2231302 r7435ccf 46 46 db_stop 47 47 48 ## Restore the helpfile in case we weren't upgrading but just reconfiguring:49 if [ -e /usr/share/bitlbee/help.upgrading ]; then50 if [ -e /usr/share/bitlbee/help.txt ]; then51 rm -f /usr/share/bitlbee/help.upgrading52 else53 mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt54 fi55 fi56 57 48 if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then 58 49 /etc/init.d/bitlbee restart -
debian/prerm
r2231302 r7435ccf 2 2 3 3 if [ "$1" = "upgrade" ]; then 4 ## To prevent the help function from breaking in currently running 5 ## BitlBee processes. Have to do it like this because dpkg-reconfigure 6 ## looks a lot like an upgrade and we don't want to lose help.txt... 7 if [ -e /usr/share/bitlbee/help.txt ]; then 8 rm -f /usr/share/bitlbee/help.upgrading 9 mv /usr/share/bitlbee/help.txt /usr/share/bitlbee/help.upgrading 10 fi 4 ## To prevent the help function from breaking in currently running BitlBee processes 5 rm -f /usr/share/bitlbee/help.txt 11 6 else 12 7 /etc/init.d/bitlbee stop || exit 0 -
irc.c
r2231302 r7435ccf 66 66 67 67 if( global.conf->hostname ) 68 {69 68 irc->myhost = g_strdup( global.conf->hostname ); 70 }71 69 else if( getsockname( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 ) 72 70 { 73 char buf[NI_MAXHOST+1]; 74 75 if( getnameinfo( (struct sockaddr *) &sock, socklen, buf, 76 NI_MAXHOST, NULL, -1, 0 ) == 0 ) 77 { 78 irc->myhost = g_strdup( ipv6_unwrap( buf ) ); 79 } 80 else 81 { 71 irc->myhost = g_new0( char, NI_MAXHOST ); 72 73 if (getnameinfo( (struct sockaddr *) &sock, socklen, irc->myhost, 74 NI_MAXHOST, NULL, -1, 0) ) { 82 75 /* Rare, but possible. */ 83 strncpy( irc->myhost, "localhost. localdomain", NI_MAXHOST );76 strncpy( irc->myhost, "localhost.", NI_MAXHOST ); 84 77 } 85 78 } … … 87 80 if( getpeername( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 ) 88 81 { 89 char buf[NI_MAXHOST+1]; 90 91 if( getnameinfo( (struct sockaddr *)&sock, socklen, buf, 92 NI_MAXHOST, NULL, -1, 0 ) == 0 ) 93 { 94 irc->host = g_strdup( ipv6_unwrap( buf ) ); 95 } 96 else 97 { 82 irc->host = g_new0( char, NI_MAXHOST ); 83 84 if ( getnameinfo( (struct sockaddr *)&sock, socklen, irc->host, 85 NI_MAXHOST, NULL, -1, 0 ) ) { 98 86 /* Rare, but possible. */ 99 strncpy( irc-> host, "localhost.localdomain", NI_MAXHOST );87 strncpy( irc->myhost, "localhost.", NI_MAXHOST ); 100 88 } 101 89 } … … 726 714 irc_spawn( irc, u ); 727 715 728 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQ s are answered there." );716 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQ's are answered there." ); 729 717 730 718 if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON ) -
lib/misc.c
r2231302 r7435ccf 322 322 } 323 323 324 /* Wrap an IPv4 address into IPv6 space. Not thread-safe... */325 char *ipv6_wrap( char *src )326 {327 static char dst[64];328 int i;329 330 for( i = 0; src[i]; i ++ )331 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' )332 break;333 334 /* Hmm, it's not even an IP... */335 if( src[i] )336 return src;337 338 g_snprintf( dst, sizeof( dst ), "::ffff:%s", src );339 340 return dst;341 }342 343 /* Unwrap an IPv4 address into IPv6 space. Thread-safe, because it's very simple. :-) */344 char *ipv6_unwrap( char *src )345 {346 int i;347 348 if( g_strncasecmp( src, "::ffff:", 7 ) != 0 )349 return src;350 351 for( i = 7; src[i]; i ++ )352 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' )353 break;354 355 /* Hmm, it's not even an IP... */356 if( src[i] )357 return src;358 359 return ( src + 7 );360 }361 362 324 /* Convert from one charset to another. 363 325 -
lib/misc.h
r2231302 r7435ccf 52 52 G_MODULE_EXPORT void http_encode( char *s ); 53 53 54 G_MODULE_EXPORT char *ipv6_wrap( char *src );55 G_MODULE_EXPORT char *ipv6_unwrap( char *src );56 57 54 G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ); 58 55
Note: See TracChangeset
for help on using the changeset viewer.