gdm/SOURCES/0001-display-access-file-drop-unused-function.patch
2021-10-08 11:13:36 +00:00

207 lines
8.3 KiB
Diff

From fb55ec1c2e2957eb4c11a220874e5089fd357286 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 16 May 2018 14:06:29 -0400
Subject: [PATCH] display-access-file: drop unused function
gdm_display_access_file_remove_display is unused.
This commit drops it.
https://bugzilla.gnome.org/show_bug.cgi?id=796176
---
daemon/gdm-display-access-file.c | 79 --------------------------------
daemon/gdm-display-access-file.h | 3 --
2 files changed, 82 deletions(-)
diff --git a/daemon/gdm-display-access-file.c b/daemon/gdm-display-access-file.c
index 9bf818d2a..c1f0f17a8 100644
--- a/daemon/gdm-display-access-file.c
+++ b/daemon/gdm-display-access-file.c
@@ -536,139 +536,60 @@ gdm_display_access_file_add_display_with_cookie (GdmDisplayAccessFile *file,
|| fflush (file->priv->fp) == EOF) {
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
"%s", g_strerror (errno));
display_added = FALSE;
} else {
display_added = TRUE;
}
/* If we wrote a FamilyLocal entry, we still want a FamilyWild
* entry, because it's more resiliant against hostname changes
*
*/
if (auth_entry.family == FamilyLocal) {
auth_entry.family = FamilyWild;
if (XauWriteAuth (file->priv->fp, &auth_entry)
&& fflush (file->priv->fp) != EOF) {
display_added = TRUE;
}
}
g_free (auth_entry.address);
g_free (auth_entry.number);
g_free (auth_entry.name);
return display_added;
}
-gboolean
-gdm_display_access_file_remove_display (GdmDisplayAccessFile *file,
- GdmDisplay *display,
- GError **error)
-{
- Xauth *auth_entry;
- unsigned short family;
- unsigned short address_length;
- char *address;
- unsigned short number_length;
- char *number;
- unsigned short name_length;
- char *name;
-
- gboolean result = FALSE;
-
- g_return_val_if_fail (file != NULL, FALSE);
- g_return_val_if_fail (file->priv->path != NULL, FALSE);
-
- _get_auth_info_for_display (file, display,
- &family,
- &address_length,
- &address,
- &number_length,
- &number,
- &name_length,
- &name);
-
- auth_entry = XauGetAuthByAddr (family,
- address_length,
- address,
- number_length,
- number,
- name_length,
- name);
- g_free (address);
- g_free (number);
- g_free (name);
-
- if (auth_entry != NULL) {
- XauDisposeAuth (auth_entry);
- result = TRUE;
- }
-
- /* If FamilyLocal, we also added a FamilyWild entry,
- * so we need to clean that up too
- */
- if (family == FamilyLocal) {
- auth_entry = XauGetAuthByAddr (FamilyWild,
- address_length,
- address,
- number_length,
- number,
- name_length,
- name);
-
- if (auth_entry != NULL) {
- XauDisposeAuth (auth_entry);
- result = TRUE;
- }
- }
-
-
- if (result == FALSE) {
- g_set_error (error,
- GDM_DISPLAY_ACCESS_FILE_ERROR,
- GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
- "could not find authorization entry");
- } else if (fflush (file->priv->fp) == EOF) {
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (errno),
- "%s", g_strerror (errno));
- result = FALSE;
- }
-
- return result;
-}
-
void
gdm_display_access_file_close (GdmDisplayAccessFile *file)
{
char *auth_dir;
g_return_if_fail (file != NULL);
g_return_if_fail (file->priv->fp != NULL);
g_return_if_fail (file->priv->path != NULL);
errno = 0;
if (g_unlink (file->priv->path) != 0) {
g_warning ("GdmDisplayAccessFile: Unable to remove X11 authority database '%s': %s",
file->priv->path,
g_strerror (errno));
}
/* still try to remove dir even if file remove failed,
may have already been removed by someone else */
/* we own the parent directory too */
auth_dir = g_path_get_dirname (file->priv->path);
if (auth_dir != NULL) {
errno = 0;
if (g_rmdir (auth_dir) != 0) {
g_warning ("GdmDisplayAccessFile: Unable to remove X11 authority directory '%s': %s",
auth_dir,
g_strerror (errno));
}
g_free (auth_dir);
}
diff --git a/daemon/gdm-display-access-file.h b/daemon/gdm-display-access-file.h
index cc7de9e35..eff8dd011 100644
--- a/daemon/gdm-display-access-file.h
+++ b/daemon/gdm-display-access-file.h
@@ -50,39 +50,36 @@ struct _GdmDisplayAccessFile
GdmDisplayAccessFilePrivate *priv;
};
struct _GdmDisplayAccessFileClass
{
GObjectClass parent_class;
};
enum _GdmDisplayAccessFileError
{
GDM_DISPLAY_ACCESS_FILE_ERROR_GENERAL = 0,
GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY
};
GQuark gdm_display_access_file_error_quark (void);
GType gdm_display_access_file_get_type (void);
GdmDisplayAccessFile *gdm_display_access_file_new (const char *username);
gboolean gdm_display_access_file_open (GdmDisplayAccessFile *file,
GError **error);
gboolean gdm_display_access_file_add_display (GdmDisplayAccessFile *file,
GdmDisplay *display,
char **cookie,
gsize *cookie_size,
GError **error);
gboolean gdm_display_access_file_add_display_with_cookie (GdmDisplayAccessFile *file,
GdmDisplay *display,
const char *cookie,
gsize cookie_size,
GError **error);
-gboolean gdm_display_access_file_remove_display (GdmDisplayAccessFile *file,
- GdmDisplay *display,
- GError **error);
void gdm_display_access_file_close (GdmDisplayAccessFile *file);
char *gdm_display_access_file_get_path (GdmDisplayAccessFile *file);
G_END_DECLS
#endif /* __GDM_DISPLAY_ACCESS_FILE_H__ */
--
2.17.1