Changes in / [7435ccf:2231302]
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r7435ccf r2231302 52 52 i = getaddrinfo( global.conf->iface, global.conf->port, &hints, 53 53 &addrinfo_bind ); 54 if ( i ) { 54 if( i ) 55 { 55 56 log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s", 56 57 global.conf->iface, gai_strerror(i) ); … … 60 61 global.listen_socket = -1; 61 62 62 for ( res = addrinfo_bind; res; res = res->ai_next ) { 63 for( res = addrinfo_bind; res; res = res->ai_next ) 64 { 63 65 global.listen_socket = socket( res->ai_family, res->ai_socktype, 64 66 res->ai_protocol ); 65 if 67 if( global.listen_socket < 0 ) 66 68 continue; 67 69 -
debian/postinst
r7435ccf r2231302 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 ]; then 50 if [ -e /usr/share/bitlbee/help.txt ]; then 51 rm -f /usr/share/bitlbee/help.upgrading 52 else 53 mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt 54 fi 55 fi 56 48 57 if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then 49 58 /etc/init.d/bitlbee restart -
debian/prerm
r7435ccf r2231302 2 2 3 3 if [ "$1" = "upgrade" ]; then 4 ## To prevent the help function from breaking in currently running BitlBee processes 5 rm -f /usr/share/bitlbee/help.txt 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 6 11 else 7 12 /etc/init.d/bitlbee stop || exit 0 -
irc.c
r7435ccf r2231302 66 66 67 67 if( global.conf->hostname ) 68 { 68 69 irc->myhost = g_strdup( global.conf->hostname ); 70 } 69 71 else if( getsockname( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 ) 70 72 { 71 irc->myhost = g_new0( char, NI_MAXHOST ); 72 73 if (getnameinfo( (struct sockaddr *) &sock, socklen, irc->myhost, 74 NI_MAXHOST, NULL, -1, 0) ) { 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 { 75 82 /* Rare, but possible. */ 76 strncpy( irc->myhost, "localhost. ", NI_MAXHOST );83 strncpy( irc->myhost, "localhost.localdomain", NI_MAXHOST ); 77 84 } 78 85 } … … 80 87 if( getpeername( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 ) 81 88 { 82 irc->host = g_new0( char, NI_MAXHOST ); 83 84 if ( getnameinfo( (struct sockaddr *)&sock, socklen, irc->host, 85 NI_MAXHOST, NULL, -1, 0 ) ) { 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 { 86 98 /* Rare, but possible. */ 87 strncpy( irc-> myhost, "localhost.", NI_MAXHOST );99 strncpy( irc->host, "localhost.localdomain", NI_MAXHOST ); 88 100 } 89 101 } … … 714 726 irc_spawn( irc, u ); 715 727 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." );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 FAQs are answered there." ); 717 729 718 730 if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON ) -
lib/misc.c
r7435ccf r2231302 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 324 362 /* Convert from one charset to another. 325 363 -
lib/misc.h
r7435ccf r2231302 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 54 57 G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ); 55 58
Note: See TracChangeset
for help on using the changeset viewer.