aboutsummaryrefslogtreecommitdiff
path: root/plugins/ka-plugin-pam.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ka-plugin-pam.c')
-rw-r--r--plugins/ka-plugin-pam.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/plugins/ka-plugin-pam.c b/plugins/ka-plugin-pam.c
index 53d1f06..b700854 100644
--- a/plugins/ka-plugin-pam.c
+++ b/plugins/ka-plugin-pam.c
@@ -22,7 +22,6 @@
#include <security/pam_appl.h>
G_DEFINE_TYPE (KaPluginPam, ka_plugin_pam, KA_TYPE_PLUGIN)
-
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), KA_TYPE_PLUGIN_PAM, KaPluginPamPrivate))
@@ -31,10 +30,10 @@ typedef struct _KaPluginPamPrivate KaPluginPamPrivate;
int ka_plugin_major_version = KA_PLUGIN_MAJOR_VERSION;
int ka_plugin_minor_version = KA_PLUGIN_MINOR_VERSION;
-G_MODULE_EXPORT KaPlugin*
+G_MODULE_EXPORT KaPlugin *
ka_plugin_create (void)
{
- return KA_PLUGIN (ka_plugin_pam_new());
+ return KA_PLUGIN (ka_plugin_pam_new ());
}
struct _KaPluginPamPrivate {
@@ -44,76 +43,77 @@ struct _KaPluginPamPrivate {
static void
ka_plugin_pam_finalize (GObject *object)
{
- G_OBJECT_CLASS (ka_plugin_pam_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ka_plugin_pam_parent_class)->finalize (object);
}
-static int simple_conv( int n, const struct pam_message **msg, struct pam_response **resp, void *data)
+static int
+simple_conv (int n, const struct pam_message **msg, struct pam_response **resp,
+ void *data)
{
- return (PAM_CONV_ERR);
+ return (PAM_CONV_ERR);
}
static struct pam_conv simplepamconv = { simple_conv, NULL };
static void
-renewed_event_cb (gpointer* applet, gchar* princ, guint when, gpointer user_data)
+renewed_event_cb (gpointer *applet, gchar *princ, guint when,
+ gpointer user_data)
{
- const char *user;
- pam_handle_t *pamh = NULL;
- int retval = 0;
+ const char *user;
+ pam_handle_t *pamh = NULL;
+ int retval = 0;
- user = g_get_user_name ();
- retval = pam_start("ka-plugin-pam", user, &simplepamconv, &pamh);
- if (retval)
- goto out;
+ user = g_get_user_name ();
+ retval = pam_start ("ka-plugin-pam", user, &simplepamconv, &pamh);
+ if (retval)
+ goto out;
- retval = pam_setcred(pamh, PAM_ESTABLISH_CRED);
- if (retval)
- goto out;
+ retval = pam_setcred (pamh, PAM_ESTABLISH_CRED);
+ if (retval)
+ goto out;
out:
- if (retval)
- g_warning("PAM plugin: %s", pam_strerror(pamh, retval));
+ if (retval)
+ g_warning ("PAM plugin: %s", pam_strerror (pamh, retval));
- if (pamh)
- pam_end(pamh, PAM_SUCCESS);
+ if (pamh)
+ pam_end (pamh, PAM_SUCCESS);
}
static void
-ka_plugin_pam_activate (KaPlugin *self, KaApplet* applet)
+ka_plugin_pam_activate (KaPlugin *self, KaApplet *applet)
{
- KaPluginPamPrivate *priv = GET_PRIVATE (self);
-
- priv->handlers[1] = g_signal_connect (applet,
- "krb-tgt-acquired",
- G_CALLBACK (renewed_event_cb),
- NULL);
- priv->handlers[0] = g_signal_connect (applet,
- "krb-tgt-renewed",
- G_CALLBACK (renewed_event_cb),
- NULL);
+ KaPluginPamPrivate *priv = GET_PRIVATE (self);
+
+ priv->handlers[1] = g_signal_connect (applet,
+ "krb-tgt-acquired",
+ G_CALLBACK (renewed_event_cb), NULL);
+ priv->handlers[0] = g_signal_connect (applet,
+ "krb-tgt-renewed",
+ G_CALLBACK (renewed_event_cb), NULL);
}
static void
-ka_plugin_pam_deactivate (KaPlugin *self, KaApplet* applet)
+ka_plugin_pam_deactivate (KaPlugin *self, KaApplet *applet)
{
- KaPluginPamPrivate *priv = GET_PRIVATE (self);
+ KaPluginPamPrivate *priv = GET_PRIVATE (self);
- g_signal_handler_disconnect (applet, priv->handlers[0]);
- g_signal_handler_disconnect (applet, priv->handlers[1]);
+ g_signal_handler_disconnect (applet, priv->handlers[0]);
+ g_signal_handler_disconnect (applet, priv->handlers[1]);
}
static void
ka_plugin_pam_class_init (KaPluginPamClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- KaPluginClass *plugin_class = KA_PLUGIN_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ KaPluginClass *plugin_class = KA_PLUGIN_CLASS (klass);
- g_type_class_add_private (klass, sizeof (KaPluginPamPrivate));
+ g_type_class_add_private (klass, sizeof (KaPluginPamPrivate));
- plugin_class->activate = ka_plugin_pam_activate;
- plugin_class->deactivate = ka_plugin_pam_deactivate;
- object_class->finalize = ka_plugin_pam_finalize;
+ plugin_class->activate = ka_plugin_pam_activate;
+ plugin_class->deactivate = ka_plugin_pam_deactivate;
+ object_class->finalize = ka_plugin_pam_finalize;
}
static void
@@ -121,8 +121,8 @@ ka_plugin_pam_init (KaPluginPam *self)
{
}
-KaPluginPam*
+KaPluginPam *
ka_plugin_pam_new (void)
{
- return g_object_new (KA_TYPE_PLUGIN_PAM, KA_PLUGIN_PROP_NAME, "pam", NULL);
+ return g_object_new (KA_TYPE_PLUGIN_PAM, KA_PLUGIN_PROP_NAME, "pam", NULL);
}
bgstack15