From 3e9d84ad529bda7f295b5b981fbc3a470772bd0d Mon Sep 17 00:00:00 2001 From: kotontrion Date: Wed, 17 Jul 2024 08:33:53 +0200 Subject: move header to astal-auth.h --- examples/full_example.c | 2 +- examples/simple_example.c | 2 +- include/astal-auth.h | 100 ++++++++++++++++++++++++++++++++++++++++++++++ include/auth.h | 100 ---------------------------------------------- include/meson.build | 4 +- src/astal-auth.c | 2 +- src/meson.build | 2 +- src/pam.c | 2 +- 8 files changed, 107 insertions(+), 107 deletions(-) create mode 100644 include/astal-auth.h delete mode 100644 include/auth.h diff --git a/examples/full_example.c b/examples/full_example.c index 73096a6..a20c02b 100644 --- a/examples/full_example.c +++ b/examples/full_example.c @@ -1,6 +1,6 @@ #include -#include "auth.h" +#include "astal-auth.h" GMainLoop *loop; diff --git a/examples/simple_example.c b/examples/simple_example.c index e11b5f9..d00bad2 100644 --- a/examples/simple_example.c +++ b/examples/simple_example.c @@ -1,6 +1,6 @@ #include -#include "auth.h" +#include "astal-auth.h" GMainLoop *loop; diff --git a/include/astal-auth.h b/include/astal-auth.h new file mode 100644 index 0000000..e1f4b3d --- /dev/null +++ b/include/astal-auth.h @@ -0,0 +1,100 @@ +#ifndef ASTAL_AUTH_PAM_H +#define ASTAL_AUTH_PAM_H + +#include +#include + +G_BEGIN_DECLS + +#define ASTAL_AUTH_TYPE_PAM (astal_auth_pam_get_type()) + +G_DECLARE_FINAL_TYPE(AstalAuthPam, astal_auth_pam, ASTAL_AUTH, PAM, GObject) + +/** + * astal_auth_pam_set_username + * @self: a AstalAuthPam object + * @username: the new username + * + * Sets the username to be used for authentication. This must be set to + * before calling start_authenticate. + * Changing it afterwards has no effect on the authentication process. + * + * Defaults to the owner of the process. + * + */ +void astal_auth_pam_set_username(AstalAuthPam *self, const gchar *username); + +/** + * astal_auth_pam_get_username + * @self: a AstalAuthPam object + * + * Fetches the username from AsalAuthPam object. + * + * Returns: the username of the AsalAuthPam object. This string is + * owned by the object and must not be modified or freed. + */ +const gchar *astal_auth_pam_get_username(AstalAuthPam *self); + +/** + * astal_auth_pam_set_service + * @self: a AstalAuthPam object + * @service: the pam service used for authentication + * + * Sets the service to be used for authentication. This must be set to + * before calling start_authenticate. + * Changing it afterwards has no effect on the authentication process. + * + * Defaults to `astal-auth`. + * + */ +void astal_auth_pam_set_service(AstalAuthPam *self, const gchar *service); + +/** + * astal_auth_pam_get_service + * @self: a AstalAuthPam + * + * Fetches the service from AsalAuthPam object. + * + * Returns: the service of the AsalAuthPam object. This string is + * owned by the object and must not be modified or freed. + */ +const gchar *astal_auth_pam_get_service(AstalAuthPam *self); + +/** + * astal_auth_pam_start_authentication: + * @self: a AstalAuthPam Object + * + * starts a new authentication process using the PAM (Pluggable Authentication Modules) system. + * Note that this will cancel an already running authentication process + * associated with this AstalAuthPam object. + */ +gboolean astal_auth_pam_start_authenticate(AstalAuthPam *self); + +/** + * astal_auth_pam_supply_secret + * @self: a AstalAuthPam Object + * @secret: (nullable): the secret to be provided to pam. Can be NULL. + * + * provides pam with a secret. This method must be called exactly once after a + * auth-* signal is emitted. + */ +void astal_auth_pam_supply_secret(AstalAuthPam *self, const gchar *secret); + +/** + * astal_auth_pam_authenticate: + * @password: the password to be authenticated + * @result_callback: (scope async) (closure user_data): a GAsyncReadyCallback + * to call when the request is satisfied + * @user_data: the data to pass to callback function + * + * Requests authentication of the provided password using the PAM (Pluggable Authentication Modules) + * system. + */ +gboolean astal_auth_pam_authenticate(const gchar *password, GAsyncReadyCallback result_callback, + gpointer user_data); + +gssize astal_auth_pam_authenticate_finish(GAsyncResult *res, GError **error); + +G_END_DECLS + +#endif // !ASTAL_AUTH_PAM_H diff --git a/include/auth.h b/include/auth.h deleted file mode 100644 index e1f4b3d..0000000 --- a/include/auth.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef ASTAL_AUTH_PAM_H -#define ASTAL_AUTH_PAM_H - -#include -#include - -G_BEGIN_DECLS - -#define ASTAL_AUTH_TYPE_PAM (astal_auth_pam_get_type()) - -G_DECLARE_FINAL_TYPE(AstalAuthPam, astal_auth_pam, ASTAL_AUTH, PAM, GObject) - -/** - * astal_auth_pam_set_username - * @self: a AstalAuthPam object - * @username: the new username - * - * Sets the username to be used for authentication. This must be set to - * before calling start_authenticate. - * Changing it afterwards has no effect on the authentication process. - * - * Defaults to the owner of the process. - * - */ -void astal_auth_pam_set_username(AstalAuthPam *self, const gchar *username); - -/** - * astal_auth_pam_get_username - * @self: a AstalAuthPam object - * - * Fetches the username from AsalAuthPam object. - * - * Returns: the username of the AsalAuthPam object. This string is - * owned by the object and must not be modified or freed. - */ -const gchar *astal_auth_pam_get_username(AstalAuthPam *self); - -/** - * astal_auth_pam_set_service - * @self: a AstalAuthPam object - * @service: the pam service used for authentication - * - * Sets the service to be used for authentication. This must be set to - * before calling start_authenticate. - * Changing it afterwards has no effect on the authentication process. - * - * Defaults to `astal-auth`. - * - */ -void astal_auth_pam_set_service(AstalAuthPam *self, const gchar *service); - -/** - * astal_auth_pam_get_service - * @self: a AstalAuthPam - * - * Fetches the service from AsalAuthPam object. - * - * Returns: the service of the AsalAuthPam object. This string is - * owned by the object and must not be modified or freed. - */ -const gchar *astal_auth_pam_get_service(AstalAuthPam *self); - -/** - * astal_auth_pam_start_authentication: - * @self: a AstalAuthPam Object - * - * starts a new authentication process using the PAM (Pluggable Authentication Modules) system. - * Note that this will cancel an already running authentication process - * associated with this AstalAuthPam object. - */ -gboolean astal_auth_pam_start_authenticate(AstalAuthPam *self); - -/** - * astal_auth_pam_supply_secret - * @self: a AstalAuthPam Object - * @secret: (nullable): the secret to be provided to pam. Can be NULL. - * - * provides pam with a secret. This method must be called exactly once after a - * auth-* signal is emitted. - */ -void astal_auth_pam_supply_secret(AstalAuthPam *self, const gchar *secret); - -/** - * astal_auth_pam_authenticate: - * @password: the password to be authenticated - * @result_callback: (scope async) (closure user_data): a GAsyncReadyCallback - * to call when the request is satisfied - * @user_data: the data to pass to callback function - * - * Requests authentication of the provided password using the PAM (Pluggable Authentication Modules) - * system. - */ -gboolean astal_auth_pam_authenticate(const gchar *password, GAsyncReadyCallback result_callback, - gpointer user_data); - -gssize astal_auth_pam_authenticate_finish(GAsyncResult *res, GError **error); - -G_END_DECLS - -#endif // !ASTAL_AUTH_PAM_H diff --git a/include/meson.build b/include/meson.build index 3db00c1..0575998 100644 --- a/include/meson.build +++ b/include/meson.build @@ -1,4 +1,4 @@ astal_auth_inc = include_directories('.') -astal_auth_headers = files('auth.h') +astal_auth_headers = files('astal-auth.h') -install_headers('auth.h', subdir : 'astal') +install_headers('astal-auth.h') diff --git a/src/astal-auth.c b/src/astal-auth.c index ebacbb3..1c435ae 100644 --- a/src/astal-auth.c +++ b/src/astal-auth.c @@ -2,7 +2,7 @@ #include #include -#include "auth.h" +#include "astal-auth.h" GMainLoop *loop; diff --git a/src/meson.build b/src/meson.build index d8eb796..6a34ae0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -41,7 +41,7 @@ if get_option('introspection') symbol_prefix : 'astal_auth', identifier_prefix : 'AstalAuth', includes : ['GObject-2.0', 'Gio-2.0'], - header : 'astal/auth.h', + header : 'astal-auth.h', export_packages : pkg_config_name, install : true ) diff --git a/src/pam.c b/src/pam.c index a11d768..90d950e 100644 --- a/src/pam.c +++ b/src/pam.c @@ -2,7 +2,7 @@ #include #include -#include "auth.h" +#include "astal-auth.h" struct _AstalAuthPam { GObject parent_instance; -- cgit v1.2.3