Changes in / [2231302:7435ccf]


Ignore:
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    r2231302 r7435ccf  
    5252        i = getaddrinfo( global.conf->iface, global.conf->port, &hints,
    5353                                                &addrinfo_bind );
    54         if( i )
    55         {
     54        if ( i ) {
    5655                log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s",
    5756                                         global.conf->iface, gai_strerror(i) );
     
    6160        global.listen_socket = -1;
    6261
    63         for( res = addrinfo_bind; res; res = res->ai_next )
    64         {
     62        for ( res = addrinfo_bind; res; res = res->ai_next ) {
    6563                global.listen_socket = socket( res->ai_family, res->ai_socktype,
    6664                                                                           res->ai_protocol );
    67                 if( global.listen_socket < 0 )
     65                if ( global.listen_socket < 0 )
    6866                        continue;
    6967
  • debian/postinst

    r2231302 r7435ccf  
    4646db_stop
    4747
    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 
    5748if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then
    5849        /etc/init.d/bitlbee restart
  • debian/prerm

    r2231302 r7435ccf  
    22
    33if [ "$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
    116else
    127        /etc/init.d/bitlbee stop || exit 0
  • irc.c

    r2231302 r7435ccf  
    6666       
    6767        if( global.conf->hostname )
    68         {
    6968                irc->myhost = g_strdup( global.conf->hostname );
    70         }
    7169        else if( getsockname( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 )
    7270        {
    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) ) {
    8275                        /* Rare, but possible. */
    83                         strncpy( irc->myhost, "localhost.localdomain", NI_MAXHOST );
     76                        strncpy( irc->myhost, "localhost.", NI_MAXHOST );
    8477                }
    8578        }
     
    8780        if( getpeername( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 )
    8881        {
    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 ) ) {
    9886                        /* Rare, but possible. */
    99                         strncpy( irc->host, "localhost.localdomain", NI_MAXHOST );
     87                        strncpy( irc->myhost, "localhost.", NI_MAXHOST );
    10088                }
    10189        }
     
    726714        irc_spawn( irc, u );
    727715       
    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." );
     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." );
    729717       
    730718        if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )
  • lib/misc.c

    r2231302 r7435ccf  
    322322}
    323323
    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 
    362324/* Convert from one charset to another.
    363325   
  • lib/misc.h

    r2231302 r7435ccf  
    5252G_MODULE_EXPORT void http_encode( char *s );
    5353
    54 G_MODULE_EXPORT char *ipv6_wrap( char *src );
    55 G_MODULE_EXPORT char *ipv6_unwrap( char *src );
    56 
    5754G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf );
    5855
Note: See TracChangeset for help on using the changeset viewer.