fix Bun.secrets bug on linux (#22249)

### What does this PR do?
SecretSchema was missing some reserved fields.

fixes #22246
fixes #22190
### How did you verify your code works?
manually

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Dylan Conway
2025-08-30 04:48:36 +00:00
committed by GitHub
parent 822445d922
commit 9142cdcb1a

View File

@@ -25,6 +25,7 @@ typedef int gboolean;
typedef char gchar;
typedef void* gpointer;
typedef unsigned int guint;
typedef int gint;
// GLib constants
#define G_FALSE 0
@@ -38,7 +39,8 @@ typedef enum {
typedef enum {
SECRET_SCHEMA_ATTRIBUTE_STRING = 0,
SECRET_SCHEMA_ATTRIBUTE_INTEGER = 1
SECRET_SCHEMA_ATTRIBUTE_INTEGER = 1,
SECRET_SCHEMA_ATTRIBUTE_BOOLEAN = 2
} SecretSchemaAttributeType;
typedef struct {
@@ -50,6 +52,16 @@ struct _SecretSchema {
const gchar* name;
SecretSchemaFlags flags;
SecretSchemaAttribute attributes[32];
/* <private> */
gint reserved;
gpointer reserved1;
gpointer reserved2;
gpointer reserved3;
gpointer reserved4;
gpointer reserved5;
gpointer reserved6;
gpointer reserved7;
};
struct _GError {
@@ -126,9 +138,6 @@ public:
void* cancellable,
GError** error);
// Collection name constant
const gchar* SECRET_COLLECTION_DEFAULT;
LibsecretFramework()
: secret_handle(nullptr)
, glib_handle(nullptr)
@@ -213,13 +222,6 @@ private:
secret_item_get_attributes = (GHashTable * (*)(SecretItem*)) dlsym(secret_handle, "secret_item_get_attributes");
secret_item_load_secret_sync = (gboolean(*)(SecretItem*, void*, GError**))dlsym(secret_handle, "secret_item_load_secret_sync");
// Load constants
void* ptr = dlsym(secret_handle, "SECRET_COLLECTION_DEFAULT");
if (ptr)
SECRET_COLLECTION_DEFAULT = *(const gchar**)ptr;
else
SECRET_COLLECTION_DEFAULT = "default";
return g_error_free && g_free && g_hash_table_new && g_hash_table_destroy && g_hash_table_lookup && g_hash_table_insert && g_list_free && secret_password_store_sync && secret_password_lookup_sync && secret_password_clear_sync && secret_password_free;
}
};