gnome-session/gnome-session-remove-dns-warning.patch

140 lines
2.9 KiB
Diff
Raw Normal View History

--- gnome-session/main.c
+++ gnome-session/main.c
@@ -162,126 +162,6 @@
*bool_value ? "On" : "Off");
}
-/* returns the hostname */
-static gchar *
-get_hostname (gboolean readable)
-{
- static gboolean init = FALSE;
- static gchar *result = NULL;
-
- if (!init)
- {
- char hostname[256];
-
- if (gethostname (hostname, sizeof (hostname)) == 0)
- result = g_strdup (hostname);
-
- init = TRUE;
- }
-
- if (result)
- return result;
- else
- return readable ? "(Unknown)" : NULL;
-}
-
-#ifdef ENABLE_IPV6
-/*Check whether the node is IPv6 enabled.*/
-static gboolean
-have_ipv6 (void)
-{
- int s;
-
- s = socket (AF_INET6, SOCK_STREAM, 0);
- if (s != -1) {
- close (s);
- return TRUE;
- }
- return FALSE;
-}
-#endif
-
-/* Check if a DNS lookup on `hostname` can be done */
-static gboolean
-check_for_dns (void)
-{
- char *hostname;
-
- hostname = get_hostname (FALSE);
-
- if (!hostname)
- return FALSE;
-
-#ifdef ENABLE_IPV6
- if (have_ipv6 ())
- {
- struct addrinfo hints, *result = NULL;
-
- memset (&hints, 0, sizeof(hints));
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME;
-
- if (getaddrinfo (hostname, NULL, &hints, &result) != 0)
- return FALSE;
-
- if (!result->ai_canonname)
- return FALSE;
- }
- else
-#endif
- {
- /*
- * FIXME:
- * we should probably be a lot more robust here
- */
- if (!gethostbyname (hostname))
- return FALSE;
- }
-
- return TRUE;
-}
-
-enum {
- RESPONSE_LOG_IN,
- RESPONSE_TRY_AGAIN
-};
-
-static void
-gnome_login_check (void)
-{
- GtkWidget *tmp_msgbox = NULL;
-
- while (!check_for_dns ())
- {
- if (!tmp_msgbox)
- {
- tmp_msgbox = gtk_message_dialog_new (NULL, 0,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Could not look up internet address for %s.\n"
- "This will prevent GNOME from operating correctly.\n"
- "It may be possible to correct the problem by adding\n"
- "%s to the file /etc/hosts."),
- get_hostname(TRUE), get_hostname(TRUE));
-
- gtk_dialog_add_buttons (GTK_DIALOG (tmp_msgbox),
- _("Log in Anyway"), RESPONSE_LOG_IN,
- _("Try Again"), RESPONSE_TRY_AGAIN,
- NULL);
-
- gtk_window_set_position (GTK_WINDOW (tmp_msgbox), GTK_WIN_POS_CENTER);
- }
-
- gtk_dialog_set_default_response (GTK_DIALOG (tmp_msgbox), RESPONSE_TRY_AGAIN);
-
- if (RESPONSE_TRY_AGAIN != gtk_dialog_run (GTK_DIALOG (tmp_msgbox)))
- break;
- }
-
- if (tmp_msgbox)
- gtk_widget_destroy (tmp_msgbox);
-}
-
static void
gsm_shutdown_gconfd (void)
{
@@ -370,9 +250,6 @@
/* We need to do this as early as possible */
gsm_set_display_properties ();
- if (ORBit_proto_use ("IPv4") || ORBit_proto_use ("IPv6"))
- gnome_login_check ();
-
err = NULL;
g_spawn_command_line_sync (GCONF_SANITY_CHECK, NULL, NULL, &status, &err);
if (err != NULL)