From: <the...@us...> - 2006-11-28 09:05:38
|
Revision: 17838 http://svn.sourceforge.net/gaim/?rev=17838&view=rev Author: thekingant Date: 2006-11-28 01:05:34 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Validate the IP address entered by the user in prefs before trying to use it. This should fix a few crashes. I feel like we could get rid of gaim_network_ip_atoi() and just use inet_aton() Modified Paths: -------------- trunk/gtk/gtkprefs.c trunk/libgaim/core.c trunk/libgaim/network.c Modified: trunk/gtk/gtkprefs.c =================================================================== --- trunk/gtk/gtkprefs.c 2006-11-28 08:44:12 UTC (rev 17837) +++ trunk/gtk/gtkprefs.c 2006-11-28 09:05:34 UTC (rev 17838) @@ -967,6 +967,11 @@ static void network_ip_changed(GtkEntry *entry, gpointer data) { + /* + * TODO: It would be nice if we could validate this and show a + * red background in the box when the IP address is invalid + * and a green background when the IP address is valid. + */ gaim_network_set_public_ip(gtk_entry_get_text(entry)); } Modified: trunk/libgaim/core.c =================================================================== --- trunk/libgaim/core.c 2006-11-28 08:44:12 UTC (rev 17837) +++ trunk/libgaim/core.c 2006-11-28 09:05:34 UTC (rev 17838) @@ -136,7 +136,10 @@ gaim_xfers_init(); gaim_idle_init(); - /* Call this early on to try to auto-detect our IP address */ + /* + * Call this early on to try to auto-detect our IP address and + * hopefully save some time later. + */ gaim_network_get_my_ip(-1); if (ops != NULL && ops->ui_init != NULL) Modified: trunk/libgaim/network.c =================================================================== --- trunk/libgaim/network.c 2006-11-28 08:44:12 UTC (rev 17837) +++ trunk/libgaim/network.c 2006-11-28 09:05:34 UTC (rev 17838) @@ -166,7 +166,8 @@ /* Check if the user specified an IP manually */ if (!gaim_prefs_get_bool("/core/network/auto_ip")) { ip = gaim_network_get_public_ip(); - if ((ip != NULL) && (*ip != '\0')) + /* Make sure the IP address entered by the user is valid */ + if ((ip != NULL) && (gaim_network_ip_atoi(ip) != NULL)) return ip; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |