aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-09-29 17:36:22 +0200
committerGuido Günther <agx@sigxcpu.org>2010-09-29 17:36:22 +0200
commit2745b08d34f1bbb130abdd01e008c4f81c91efb9 (patch)
treee05deea55345915877a1bb023da3deaca976b519 /plugins
parentImported Upstream version 0.16 (diff)
downloadkrb5-auth-dialog-2745b08d34f1bbb130abdd01e008c4f81c91efb9.tar.gz
krb5-auth-dialog-2745b08d34f1bbb130abdd01e008c4f81c91efb9.tar.bz2
krb5-auth-dialog-2745b08d34f1bbb130abdd01e008c4f81c91efb9.zip
New upstream version 0.17
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am17
-rw-r--r--plugins/Makefile.in53
-rw-r--r--plugins/ka-plugin-afs.c114
-rw-r--r--plugins/ka-plugin-afs.h50
-rw-r--r--plugins/ka-plugin-dummy.c67
-rw-r--r--plugins/ka-plugin-dummy.h13
-rw-r--r--plugins/ka-plugin-pam.c88
-rw-r--r--plugins/ka-plugin-pam.h15
8 files changed, 308 insertions, 109 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 8fecd5c..cf69e7b 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -11,6 +11,7 @@ endif
pkglib_LTLIBRARIES = \
libka-plugin-dummy.la \
$(PAM_PLUGIN) \
+ libka-plugin-afs.la \
$(NULL)
# Dummy example plugin
@@ -47,3 +48,19 @@ libka_plugin_pam_la_LDFLAGS = \
$(PAM_LIBS) \
$(NULL)
endif
+
+# AFS plugin
+libka_plugin_afs_la_SOURCES = \
+ ka-plugin-afs.c \
+ ka-plugin-afs.h \
+ $(NULL)
+
+libka_plugin_afs_la_CPPFLAGS = \
+ $(GTK_CFLAGS) \
+ -I$(top_srcdir)/src \
+ $(NULL)
+
+libka_plugin_afs_la_LDFLAGS = \
+ -module \
+ -avoid-version \
+ $(NULL)
diff --git a/plugins/Makefile.in b/plugins/Makefile.in
index 34ec198..1047119 100644
--- a/plugins/Makefile.in
+++ b/plugins/Makefile.in
@@ -68,14 +68,22 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(pkglibdir)"
LTLIBRARIES = $(pkglib_LTLIBRARIES)
-libka_plugin_dummy_la_LIBADD =
+libka_plugin_afs_la_LIBADD =
am__objects_1 =
-am_libka_plugin_dummy_la_OBJECTS = \
- libka_plugin_dummy_la-ka-plugin-dummy.lo $(am__objects_1)
-libka_plugin_dummy_la_OBJECTS = $(am_libka_plugin_dummy_la_OBJECTS)
+am_libka_plugin_afs_la_OBJECTS = libka_plugin_afs_la-ka-plugin-afs.lo \
+ $(am__objects_1)
+libka_plugin_afs_la_OBJECTS = $(am_libka_plugin_afs_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
+libka_plugin_afs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libka_plugin_afs_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+libka_plugin_dummy_la_LIBADD =
+am_libka_plugin_dummy_la_OBJECTS = \
+ libka_plugin_dummy_la-ka-plugin-dummy.lo $(am__objects_1)
+libka_plugin_dummy_la_OBJECTS = $(am_libka_plugin_dummy_la_OBJECTS)
libka_plugin_dummy_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libka_plugin_dummy_la_LDFLAGS) \
@@ -118,9 +126,11 @@ am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libka_plugin_dummy_la_SOURCES) \
+SOURCES = $(libka_plugin_afs_la_SOURCES) \
+ $(libka_plugin_dummy_la_SOURCES) \
$(libka_plugin_pam_la_SOURCES)
-DIST_SOURCES = $(libka_plugin_dummy_la_SOURCES) \
+DIST_SOURCES = $(libka_plugin_afs_la_SOURCES) \
+ $(libka_plugin_dummy_la_SOURCES) \
$(am__libka_plugin_pam_la_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
@@ -167,8 +177,6 @@ GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
GIO_CFLAGS = @GIO_CFLAGS@
GIO_LIBS = @GIO_LIBS@
-GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@
-GIO_UNIX_LIBS = @GIO_UNIX_LIBS@
GMODULE_CFLAGS = @GMODULE_CFLAGS@
GMODULE_LIBS = @GMODULE_LIBS@
GMOFILES = @GMOFILES@
@@ -312,6 +320,7 @@ NULL =
pkglib_LTLIBRARIES = \
libka-plugin-dummy.la \
$(PAM_PLUGIN) \
+ libka-plugin-afs.la \
$(NULL)
@@ -349,6 +358,23 @@ libka_plugin_dummy_la_LDFLAGS = \
@ENABLE_PAM_PLUGIN_TRUE@ $(PAM_LIBS) \
@ENABLE_PAM_PLUGIN_TRUE@ $(NULL)
+
+# AFS plugin
+libka_plugin_afs_la_SOURCES = \
+ ka-plugin-afs.c \
+ ka-plugin-afs.h \
+ $(NULL)
+
+libka_plugin_afs_la_CPPFLAGS = \
+ $(GTK_CFLAGS) \
+ -I$(top_srcdir)/src \
+ $(NULL)
+
+libka_plugin_afs_la_LDFLAGS = \
+ -module \
+ -avoid-version \
+ $(NULL)
+
all: all-am
.SUFFIXES:
@@ -414,6 +440,8 @@ clean-pkglibLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
+libka-plugin-afs.la: $(libka_plugin_afs_la_OBJECTS) $(libka_plugin_afs_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libka_plugin_afs_la_LINK) -rpath $(pkglibdir) $(libka_plugin_afs_la_OBJECTS) $(libka_plugin_afs_la_LIBADD) $(LIBS)
libka-plugin-dummy.la: $(libka_plugin_dummy_la_OBJECTS) $(libka_plugin_dummy_la_DEPENDENCIES)
$(AM_V_CCLD)$(libka_plugin_dummy_la_LINK) -rpath $(pkglibdir) $(libka_plugin_dummy_la_OBJECTS) $(libka_plugin_dummy_la_LIBADD) $(LIBS)
libka-plugin-pam.la: $(libka_plugin_pam_la_OBJECTS) $(libka_plugin_pam_la_DEPENDENCIES)
@@ -425,6 +453,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libka_plugin_afs_la-ka-plugin-afs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libka_plugin_dummy_la-ka-plugin-dummy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libka_plugin_pam_la-ka-plugin-pam.Plo@am__quote@
@@ -452,6 +481,14 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+libka_plugin_afs_la-ka-plugin-afs.lo: ka-plugin-afs.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libka_plugin_afs_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libka_plugin_afs_la-ka-plugin-afs.lo -MD -MP -MF $(DEPDIR)/libka_plugin_afs_la-ka-plugin-afs.Tpo -c -o libka_plugin_afs_la-ka-plugin-afs.lo `test -f 'ka-plugin-afs.c' || echo '$(srcdir)/'`ka-plugin-afs.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libka_plugin_afs_la-ka-plugin-afs.Tpo $(DEPDIR)/libka_plugin_afs_la-ka-plugin-afs.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ka-plugin-afs.c' object='libka_plugin_afs_la-ka-plugin-afs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libka_plugin_afs_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libka_plugin_afs_la-ka-plugin-afs.lo `test -f 'ka-plugin-afs.c' || echo '$(srcdir)/'`ka-plugin-afs.c
+
libka_plugin_dummy_la-ka-plugin-dummy.lo: ka-plugin-dummy.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libka_plugin_dummy_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libka_plugin_dummy_la-ka-plugin-dummy.lo -MD -MP -MF $(DEPDIR)/libka_plugin_dummy_la-ka-plugin-dummy.Tpo -c -o libka_plugin_dummy_la-ka-plugin-dummy.lo `test -f 'ka-plugin-dummy.c' || echo '$(srcdir)/'`ka-plugin-dummy.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libka_plugin_dummy_la-ka-plugin-dummy.Tpo $(DEPDIR)/libka_plugin_dummy_la-ka-plugin-dummy.Plo
diff --git a/plugins/ka-plugin-afs.c b/plugins/ka-plugin-afs.c
new file mode 100644
index 0000000..57daed0
--- /dev/null
+++ b/plugins/ka-plugin-afs.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2010 Guido Guenther <agx@sigxcpu.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "ka-plugin-afs.h"
+#include <gmodule.h>
+
+G_DEFINE_TYPE (KaPluginAfs, ka_plugin_afs, KA_TYPE_PLUGIN)
+#define GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), KA_TYPE_PLUGIN_AFS, KaPluginAfsPrivate))
+
+int ka_plugin_major_version = KA_PLUGIN_MAJOR_VERSION;
+int ka_plugin_minor_version = KA_PLUGIN_MINOR_VERSION;
+
+G_MODULE_EXPORT KaPlugin *
+ka_plugin_create (void)
+{
+ return KA_PLUGIN (ka_plugin_afs_new ());
+}
+
+typedef struct _KaPluginAfsPrivate KaPluginAfsPrivate;
+
+struct _KaPluginAfsPrivate {
+ gulong handlers[2];
+};
+
+static void
+event_cb (gpointer *applet, gchar *princ, guint when, gpointer user_data)
+{
+ GError *err = NULL;
+ gboolean ret;
+ int i;
+ const char *afslog_cmds[] = { "aklog", "afslog" };
+
+ for (i = 0; i < G_N_ELEMENTS (afslog_cmds); i++) {
+ ret = g_spawn_command_line_async (afslog_cmds[i], &err);
+ if (!ret) {
+ if (G_SPAWN_ERROR_NOENT != err->code)
+ g_warning ("%s", err->message);
+ } else
+ break;
+ g_clear_error (&err);
+ }
+
+ if (!ret)
+ g_warning ("Couldn't run any afslog command");
+}
+
+static void
+ka_plugin_afs_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (ka_plugin_afs_parent_class)->finalize (object);
+}
+
+static void
+ka_plugin_afs_activate (KaPlugin *self, KaApplet *applet)
+{
+ KaPluginAfsPrivate *priv = GET_PRIVATE (self);
+
+ priv->handlers[0] = g_signal_connect (applet,
+ "krb-tgt-acquired",
+ G_CALLBACK (event_cb), "Acquired");
+ priv->handlers[1] = g_signal_connect (applet,
+ "krb-tgt-renewed",
+ G_CALLBACK (event_cb), "Renewed");
+}
+
+static void
+ka_plugin_afs_deactivate (KaPlugin *self, KaApplet *applet)
+{
+ int i;
+ KaPluginAfsPrivate *priv = GET_PRIVATE (self);
+
+ for (i = 0; i < G_N_ELEMENTS (priv->handlers); i++)
+ g_signal_handler_disconnect (applet, priv->handlers[i]);
+}
+
+static void
+ka_plugin_afs_class_init (KaPluginAfsClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ KaPluginClass *plugin_class = KA_PLUGIN_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (KaPluginAfsPrivate));
+
+ plugin_class->activate = ka_plugin_afs_activate;
+ plugin_class->deactivate = ka_plugin_afs_deactivate;
+ object_class->finalize = ka_plugin_afs_finalize;
+}
+
+static void
+ka_plugin_afs_init (KaPluginAfs *self)
+{
+}
+
+KaPluginAfs *
+ka_plugin_afs_new (void)
+{
+ return g_object_new (KA_TYPE_PLUGIN_AFS, KA_PLUGIN_PROP_NAME, "afs", NULL);
+}
diff --git a/plugins/ka-plugin-afs.h b/plugins/ka-plugin-afs.h
new file mode 100644
index 0000000..c4fb71d
--- /dev/null
+++ b/plugins/ka-plugin-afs.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Guido Guenther <agx@sigxcpu.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _KA_PLUGIN_DUMMY
+#define _KA_PLUGIN_DUMMY
+
+#include "ka-plugin.h"
+
+G_BEGIN_DECLS
+#define KA_TYPE_PLUGIN_AFS ka_plugin_afs_get_type()
+#define KA_PLUGIN_AFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), KA_TYPE_PLUGIN_AFS, KaPluginAfs))
+#define KA_PLUGIN_AFS_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), KA_TYPE_PLUGIN_AFS, KaPluginAfsClass))
+#define KA_IS_PLUGIN_AFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KA_TYPE_PLUGIN_AFS))
+#define KA_IS_PLUGIN_AFS_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), KA_TYPE_PLUGIN_AFS))
+#define KA_PLUGIN_AFS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), KA_TYPE_PLUGIN_AFS, KaPluginAfsClass))
+
+typedef struct {
+ KaPlugin parent;
+} KaPluginAfs;
+
+typedef struct {
+ KaPluginClass parent_class;
+} KaPluginAfsClass;
+
+GType ka_plugin_afs_get_type (void);
+
+KaPluginAfs *ka_plugin_afs_new (void);
+
+G_END_DECLS
+#endif /* _KA_PLUGIN_AFS */
diff --git a/plugins/ka-plugin-dummy.c b/plugins/ka-plugin-dummy.c
index 6485c0d..99bd739 100644
--- a/plugins/ka-plugin-dummy.c
+++ b/plugins/ka-plugin-dummy.c
@@ -20,17 +20,16 @@
#include <gmodule.h>
G_DEFINE_TYPE (KaPluginDummy, ka_plugin_dummy, KA_TYPE_PLUGIN)
-
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), KA_TYPE_PLUGIN_DUMMY, KaPluginDummyPrivate))
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_dummy_new());
+ return KA_PLUGIN (ka_plugin_dummy_new ());
}
typedef struct _KaPluginDummyPrivate KaPluginDummyPrivate;
@@ -39,57 +38,55 @@ struct _KaPluginDummyPrivate {
gulong handlers[3];
};
-event_cb (gpointer* applet, gchar* princ, guint when, gpointer user_data)
+static void
+event_cb (gpointer *applet, gchar *princ, guint when, gpointer user_data)
{
- g_message("%s %s @%d", user_data, princ, when);
+ g_message ("%s %s @%d", user_data, princ, when);
}
static void
ka_plugin_dummy_finalize (GObject *object)
{
- G_OBJECT_CLASS (ka_plugin_dummy_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ka_plugin_dummy_parent_class)->finalize (object);
}
static void
-ka_plugin_dummy_activate (KaPlugin *self, KaApplet* applet)
+ka_plugin_dummy_activate (KaPlugin *self, KaApplet *applet)
{
- KaPluginDummyPrivate *priv = GET_PRIVATE (self);
-
- priv->handlers[0] = g_signal_connect (applet,
- "krb-tgt-expired",
- G_CALLBACK (event_cb),
- "Expired");
- priv->handlers[1] = g_signal_connect (applet,
- "krb-tgt-acquired",
- G_CALLBACK (event_cb),
- "Acquired");
- priv->handlers[2] = g_signal_connect (applet,
- "krb-tgt-renewed",
- G_CALLBACK (event_cb),
- "Renewed");
+ KaPluginDummyPrivate *priv = GET_PRIVATE (self);
+
+ priv->handlers[0] = g_signal_connect (applet,
+ "krb-tgt-expired",
+ G_CALLBACK (event_cb), "Expired");
+ priv->handlers[1] = g_signal_connect (applet,
+ "krb-tgt-acquired",
+ G_CALLBACK (event_cb), "Acquired");
+ priv->handlers[2] = g_signal_connect (applet,
+ "krb-tgt-renewed",
+ G_CALLBACK (event_cb), "Renewed");
}
static void
-ka_plugin_dummy_deactivate (KaPlugin *self, KaApplet* applet)
+ka_plugin_dummy_deactivate (KaPlugin *self, KaApplet *applet)
{
- int i;
- KaPluginDummyPrivate *priv = GET_PRIVATE (self);
+ int i;
+ KaPluginDummyPrivate *priv = GET_PRIVATE (self);
- for (i = 0; i < G_N_ELEMENTS(priv->handlers); i++)
- g_signal_handler_disconnect (applet, priv->handlers[i]);
+ for (i = 0; i < G_N_ELEMENTS (priv->handlers); i++)
+ g_signal_handler_disconnect (applet, priv->handlers[i]);
}
static void
ka_plugin_dummy_class_init (KaPluginDummyClass *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 (KaPluginDummyPrivate));
+ g_type_class_add_private (klass, sizeof (KaPluginDummyPrivate));
- plugin_class->activate = ka_plugin_dummy_activate;
- plugin_class->deactivate = ka_plugin_dummy_deactivate;
- object_class->finalize = ka_plugin_dummy_finalize;
+ plugin_class->activate = ka_plugin_dummy_activate;
+ plugin_class->deactivate = ka_plugin_dummy_deactivate;
+ object_class->finalize = ka_plugin_dummy_finalize;
}
static void
@@ -97,9 +94,9 @@ ka_plugin_dummy_init (KaPluginDummy *self)
{
}
-KaPluginDummy*
+KaPluginDummy *
ka_plugin_dummy_new (void)
{
- return g_object_new (KA_TYPE_PLUGIN_DUMMY, KA_PLUGIN_PROP_NAME,
- "dummy", NULL);
+ return g_object_new (KA_TYPE_PLUGIN_DUMMY, KA_PLUGIN_PROP_NAME,
+ "dummy", NULL);
}
diff --git a/plugins/ka-plugin-dummy.h b/plugins/ka-plugin-dummy.h
index 311861a..460d64a 100644
--- a/plugins/ka-plugin-dummy.h
+++ b/plugins/ka-plugin-dummy.h
@@ -22,36 +22,29 @@
#include "ka-plugin.h"
G_BEGIN_DECLS
-
#define KA_TYPE_PLUGIN_DUMMY ka_plugin_dummy_get_type()
-
#define KA_PLUGIN_DUMMY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), KA_TYPE_PLUGIN_DUMMY, KaPluginDummy))
-
#define KA_PLUGIN_DUMMY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), KA_TYPE_PLUGIN_DUMMY, KaPluginDummyClass))
-
#define KA_IS_PLUGIN_DUMMY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), KA_TYPE_PLUGIN_DUMMY))
-
#define KA_IS_PLUGIN_DUMMY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), KA_TYPE_PLUGIN_DUMMY))
-
#define KA_PLUGIN_DUMMY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), KA_TYPE_PLUGIN_DUMMY, KaPluginDummyClass))
typedef struct {
- KaPlugin parent;
+ KaPlugin parent;
} KaPluginDummy;
typedef struct {
- KaPluginClass parent_class;
+ KaPluginClass parent_class;
} KaPluginDummyClass;
GType ka_plugin_dummy_get_type (void);
-KaPluginDummy* ka_plugin_dummy_new (void);
+KaPluginDummy *ka_plugin_dummy_new (void);
G_END_DECLS
-
#endif /* _KA_PLUGIN_DUMMY */
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);
}
diff --git a/plugins/ka-plugin-pam.h b/plugins/ka-plugin-pam.h
index c693121..5f9b34a 100644
--- a/plugins/ka-plugin-pam.h
+++ b/plugins/ka-plugin-pam.h
@@ -22,38 +22,29 @@
#include <ka-plugin.h>
G_BEGIN_DECLS
-
#define KA_TYPE_PLUGIN_PAM ka_plugin_pam_get_type()
-
#define KA_PLUGIN_PAM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), KA_TYPE_PLUGIN_PAM, KaPluginPam))
-
#define KA_PLUGIN_PAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), KA_TYPE_PLUGIN_PAM, KaPluginPamClass))
-
#define KA_IS_PLUGIN_PAM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), KA_TYPE_PLUGIN_PAM))
-
#define KA_IS_PLUGIN_PAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), KA_TYPE_PLUGIN_PAM))
-
#define KA_PLUGIN_PAM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), KA_TYPE_PLUGIN_PAM, KaPluginPamClass))
typedef struct {
- KaPlugin parent;
+ KaPlugin parent;
} KaPluginPam;
typedef struct {
- KaPluginClass parent_class;
+ KaPluginClass parent_class;
} KaPluginPamClass;
GType ka_plugin_pam_get_type (void);
-KaPluginPam* ka_plugin_pam_new (void);
+KaPluginPam *ka_plugin_pam_new (void);
G_END_DECLS
-
#endif /* _KA_PLUGIN_PAM */
-
-/* ka-plugin-pam.c */
bgstack15