aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-03-09 10:55:17 +0100
committerGuido Günther <agx@sigxcpu.org>2011-03-09 10:55:17 +0100
commitb05bdc2712e5f3e0dd1df73f7675462012538a3e (patch)
treed76971cbfd67b2833693d2c985bdb74c0f882704
parentDocument changes and release 2.91.90-1 (diff)
parentNew upstream version 2.91.91 (diff)
downloadkrb5-auth-dialog-b05bdc2712e5f3e0dd1df73f7675462012538a3e.tar.gz
krb5-auth-dialog-b05bdc2712e5f3e0dd1df73f7675462012538a3e.tar.bz2
krb5-auth-dialog-b05bdc2712e5f3e0dd1df73f7675462012538a3e.zip
Merge commit 'upstream/2.91.91'
-rw-r--r--ChangeLog58
-rw-r--r--CodingStyle5
-rw-r--r--Makefile.in2
-rw-r--r--NEWS6
-rw-r--r--cc-panel/Makefile.in2
-rwxr-xr-xconfigure155
-rw-r--r--configure.ac14
-rw-r--r--etpo/Makefile.am2
-rw-r--r--etpo/Makefile.in4
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/Makefile.in4
-rw-r--r--examples/destroy-ccache.py8
-rw-r--r--examples/tgt-acquire.py8
-rw-r--r--help/Makefile.in2
-rw-r--r--icons/22x22/Makefile.in2
-rw-r--r--icons/48x48/Makefile.in2
-rw-r--r--icons/Makefile.in2
-rw-r--r--icons/scalable/Makefile.in2
-rw-r--r--krb5-auth-dialog.spec2
-rw-r--r--plugins/Makefile.in2
-rw-r--r--plugins/ka-plugin-afs.c6
-rw-r--r--secmem/Makefile.in2
-rw-r--r--src/Makefile.am14
-rw-r--r--src/Makefile.in30
-rw-r--r--src/ka-applet-priv.h5
-rw-r--r--src/ka-applet.c28
-rw-r--r--src/ka-dbus.c273
-rw-r--r--src/ka-dbus.h12
-rw-r--r--src/ka-dbus.xml30
-rw-r--r--src/ka-dialog.c1514
-rw-r--r--src/ka-pwdialog.c403
-rw-r--r--src/ka-pwdialog.h21
-rw-r--r--src/ka-tickets.c147
-rw-r--r--src/ka-tickets.h18
34 files changed, 1419 insertions, 1368 deletions
diff --git a/ChangeLog b/ChangeLog
index c5be144..0065bac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,63 @@
# Generated by Makefile. Do not edit.
+commit 461783f5ff6469a1e0803954e120394cc3172afd
+Author: Guido Günther <agx@sigxcpu.org>
+Date: Mon Mar 7 18:26:50 2011 +0100
+
+ Bump version to 2.91.91
+
+ NEWS | 6 ++++++
+ configure.ac | 2 +-
+ 2 files changed, 7 insertions(+), 1 deletions(-)
+
+commit ce202b6975ff0390ac2ef56d2f24f5f15b56c384
+Author: Guido Günther <agx@sigxcpu.org>
+Date: Fri Feb 25 23:09:22 2011 +0100
+
+ Port to GDBus
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=622885
+
+ configure.ac | 12 +--
+ etpo/Makefile.am | 2 -
+ plugins/ka-plugin-afs.c | 6 +-
+ src/.gitignore | 1 -
+ src/Makefile.am | 14 ---
+ src/ka-applet-priv.h | 5 +
+ src/ka-applet.c | 28 ++++--
+ src/ka-dbus.c | 249 +++++++++++++++++++++++++++++++++++-----------
+ src/ka-dbus.h | 12 +--
+ src/ka-dbus.xml | 30 ------
+ src/ka-dialog.c | 15 ++-
+ 11 files changed, 234 insertions(+), 140 deletions(-)
+
+commit d7fb06fed1ef841e854ede85980c9e5d6544e868
+Author: Guido Günther <agx@sigxcpu.org>
+Date: Thu Feb 24 21:59:36 2011 +0100
+
+ Reindent according to CodingStyle
+
+ CodingStyle | 5 +-
+ src/ka-dbus.c | 134 +++---
+ src/ka-dbus.h | 12 +-
+ src/ka-dialog.c | 1509 ++++++++++++++++++++++++++---------------------------
+ src/ka-pwdialog.c | 403 ++++++++-------
+ src/ka-pwdialog.h | 21 +-
+ src/ka-tickets.c | 147 +++---
+ src/ka-tickets.h | 18 +-
+ 8 files changed, 1132 insertions(+), 1117 deletions(-)
+
+commit 345521f0e3bd7e3ba0b9975da9db70702aec60e4
+Author: Guido Günther <agx@sigxcpu.org>
+Date: Sun Feb 27 15:43:16 2011 +0100
+
+ Add acquire ticket and destroy ccache via DBus examples
+
+ examples/Makefile.am | 2 ++
+ examples/destroy-ccache.py | 8 ++++++++
+ examples/tgt-acquire.py | 8 ++++++++
+ 3 files changed, 18 insertions(+), 0 deletions(-)
+
commit 1824f443fcd94b2cce375d3f3b3d1636230e332b
Author: Guido Günther <agx@sigxcpu.org>
Date: Thu Feb 24 19:39:37 2011 +0100
diff --git a/CodingStyle b/CodingStyle
index 81fa5e1..2862939 100644
--- a/CodingStyle
+++ b/CodingStyle
@@ -27,7 +27,10 @@ CodingStyle
-Tgchar -Tgpointer -TG_MODULE_EXPORT \
-TGParamSpec -TGValue -TGObject \
-TGtkWidget -TGtkMenuItem \
+ -TGtkBuilder -TGdkEventWindowState \
-TKaPlugin -TKaApplet -TKaAppletClass \
-TKaPluginDummy -TKaPluginDummyClass \
-TKaPluginPam -TKaPluginPamClass \
- -TKaPluginAfs -TKaPluginAfsClass
+ -TKaPluginAfs -TKaPluginAfsClass \
+ -TKaPwDialog \
+ -Tkrb5_creds -TDBusGMethodInvocation \
diff --git a/Makefile.in b/Makefile.in
index cd96018..742962f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -132,8 +132,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper
diff --git a/NEWS b/NEWS
index cfad6e0..9742bdd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,10 @@
===============
+Version 2.91.91
+===============
+* Migrate to GDBus (#622885)
+* add more DBus examples
+
+===============
Version 2.91.90
===============
* Check credential cache right after startup so the user gets immediate
diff --git a/cc-panel/Makefile.in b/cc-panel/Makefile.in
index e786c21..9a0d52c 100644
--- a/cc-panel/Makefile.in
+++ b/cc-panel/Makefile.in
@@ -136,8 +136,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/configure b/configure
index 932044d..9f98833 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for krb5-auth-dialog 2.91.90.
+# Generated by GNU Autoconf 2.67 for krb5-auth-dialog 2.91.91.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -698,8 +698,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='krb5-auth-dialog'
PACKAGE_TARNAME='krb5-auth-dialog'
-PACKAGE_VERSION='2.91.90'
-PACKAGE_STRING='krb5-auth-dialog 2.91.90'
+PACKAGE_VERSION='2.91.91'
+PACKAGE_STRING='krb5-auth-dialog 2.91.91'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -778,8 +778,6 @@ GIO_LIBS
GIO_CFLAGS
GCONF_LIBS
GCONF_CFLAGS
-DBUS_LIBS
-DBUS_CFLAGS
GTK_LIBS
GTK_CFLAGS
HAVE_GNOME_DOC_UTILS_FALSE
@@ -999,8 +997,6 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
GTK_CFLAGS
GTK_LIBS
-DBUS_CFLAGS
-DBUS_LIBS
GCONF_CFLAGS
GCONF_LIBS
GIO_CFLAGS
@@ -1555,7 +1551,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures krb5-auth-dialog 2.91.90 to adapt to many kinds of systems.
+\`configure' configures krb5-auth-dialog 2.91.91 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1626,7 +1622,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of krb5-auth-dialog 2.91.90:";;
+ short | recursive ) echo "Configuration of krb5-auth-dialog 2.91.91:";;
esac
cat <<\_ACEOF
@@ -1699,8 +1695,6 @@ Some influential environment variables:
path overriding pkg-config's built-in search path
GTK_CFLAGS C compiler flags for GTK, overriding pkg-config
GTK_LIBS linker flags for GTK, overriding pkg-config
- DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config
- DBUS_LIBS linker flags for DBUS, overriding pkg-config
GCONF_CFLAGS
C compiler flags for GCONF, overriding pkg-config
GCONF_LIBS linker flags for GCONF, overriding pkg-config
@@ -1789,7 +1783,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-krb5-auth-dialog configure 2.91.90
+krb5-auth-dialog configure 2.91.91
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2211,7 +2205,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by krb5-auth-dialog $as_me 2.91.90, which was
+It was created by krb5-auth-dialog $as_me 2.91.91, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -3027,7 +3021,7 @@ fi
# Define the identity of the package.
PACKAGE='krb5-auth-dialog'
- VERSION='2.91.90'
+ VERSION='2.91.91'
cat >>confdefs.h <<_ACEOF
@@ -7140,13 +7134,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:7143: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:7137: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:7146: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:7140: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:7149: output\"" >&5)
+ (eval echo "\"\$as_me:7143: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -8351,7 +8345,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 8354 "configure"' > conftest.$ac_ext
+ echo '#line 8348 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -9609,11 +9603,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9612: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9606: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9616: \$? = $ac_status" >&5
+ echo "$as_me:9610: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9948,11 +9942,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9951: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9945: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9955: \$? = $ac_status" >&5
+ echo "$as_me:9949: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10053,11 +10047,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10056: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10050: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10060: \$? = $ac_status" >&5
+ echo "$as_me:10054: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10108,11 +10102,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10111: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10105: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10115: \$? = $ac_status" >&5
+ echo "$as_me:10109: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12492,7 +12486,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12495 "configure"
+#line 12489 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12588,7 +12582,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12591 "configure"
+#line 12585 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13516,17 +13510,15 @@ $as_echo "$with_gtk" >&6; }
case "$with_gtk" in
2.0) GTK_API_VERSION=2.0
GTK_REQUIRED=2.18.0
- GLIB_REQUIRED=2.16.0
- DBUS_REQUIRED=0.60
+ GLIB_REQUIRED=2.26.0
GCONF_REQUIRED=2.8
LIBNOTIFY_REQUIRED=0.4
;;
3.0) GTK_API_VERSION=3.0
GTK_REQUIRED=2.90.4
- GLIB_REQUIRED="2.25.10"
- DBUS_REQUIRED="0.82"
- GCONF_REQUIRED="2.31"
- LIBNOTIFY_REQUIRED="0.5.1"
+ GLIB_REQUIRED=2.26.0
+ GCONF_REQUIRED=2.31
+ LIBNOTIFY_REQUIRED=0.5.1
;;
esac
@@ -13621,95 +13613,6 @@ $as_echo "yes" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBUS" >&5
-$as_echo_n "checking for DBUS... " >&6; }
-
-if test -n "$DBUS_CFLAGS"; then
- pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-glib-1 >= \$DBUS_REQUIRED\""; } >&5
- ($PKG_CONFIG --exists --print-errors "dbus-glib-1 >= $DBUS_REQUIRED") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-glib-1 >= $DBUS_REQUIRED" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$DBUS_LIBS"; then
- pkg_cv_DBUS_LIBS="$DBUS_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-glib-1 >= \$DBUS_REQUIRED\""; } >&5
- ($PKG_CONFIG --exists --print-errors "dbus-glib-1 >= $DBUS_REQUIRED") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-glib-1 >= $DBUS_REQUIRED" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "dbus-glib-1 >= $DBUS_REQUIRED" 2>&1`
- else
- DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors "dbus-glib-1 >= $DBUS_REQUIRED" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$DBUS_PKG_ERRORS" >&5
-
- as_fn_error $? "Package requirements (dbus-glib-1 >= $DBUS_REQUIRED) were not met:
-
-$DBUS_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables DBUS_CFLAGS
-and DBUS_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
-elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables DBUS_CFLAGS
-and DBUS_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }
-else
- DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS
- DBUS_LIBS=$pkg_cv_DBUS_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-fi
-
-pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCONF" >&5
$as_echo_n "checking for GCONF... " >&6; }
@@ -15752,7 +15655,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by krb5-auth-dialog $as_me 2.91.90, which was
+This file was extended by krb5-auth-dialog $as_me 2.91.91, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15818,7 +15721,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-krb5-auth-dialog config.status 2.91.90
+krb5-auth-dialog config.status 2.91.91
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
@@ -17623,8 +17526,6 @@ $as_echo "$as_me: " >&6;}
$as_echo "$as_me: Kerberos: $KRB5_CFLAGS $KRB5_LIBS" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: GTK: $GTK_CFLAGS $GTK_LIBS" >&5
$as_echo "$as_me: GTK: $GTK_CFLAGS $GTK_LIBS" >&6;}
-{ $as_echo "$as_me:${as_lineno-$LINENO}: DBus: $DBUS_CFLAGS $DBUS_LIBS" >&5
-$as_echo "$as_me: DBus: $DBUS_CFLAGS $DBUS_LIBS" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: gconf: $GCONF_CFLAGS $GCONF_LIBS" >&5
$as_echo "$as_me: gconf: $GCONF_CFLAGS $GCONF_LIBS" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: gio-unix: $GIO_UNIX_CFLAGS $GIO_UNIX_LIBS $GIO_CFLAGS $GIO_LIBS" >&5
diff --git a/configure.ac b/configure.ac
index 80509e2..406eeae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([krb5-auth-dialog], [2.91.90])
+AC_INIT([krb5-auth-dialog], [2.91.91])
AC_CONFIG_SRCDIR(src/ka-dialog.c)
dnl Make automake keep quiet about wildcards & other GNUmake-isms
AM_INIT_AUTOMAKE([-Wno-portability])
@@ -40,22 +40,19 @@ AC_MSG_RESULT([$with_gtk])
case "$with_gtk" in
2.0) GTK_API_VERSION=2.0
GTK_REQUIRED=2.18.0
- GLIB_REQUIRED=2.16.0
- DBUS_REQUIRED=0.60
+ GLIB_REQUIRED=2.26.0
GCONF_REQUIRED=2.8
LIBNOTIFY_REQUIRED=0.4
;;
3.0) GTK_API_VERSION=3.0
GTK_REQUIRED=2.90.4
- GLIB_REQUIRED="2.25.10"
- DBUS_REQUIRED="0.82"
- GCONF_REQUIRED="2.31"
- LIBNOTIFY_REQUIRED="0.5.1"
+ GLIB_REQUIRED=2.26.0
+ GCONF_REQUIRED=2.31
+ LIBNOTIFY_REQUIRED=0.5.1
;;
esac
PKG_CHECK_MODULES(GTK, [gtk+-$GTK_API_VERSION >= $GTK_REQUIRED, glib-2.0 >= $GLIB_REQUIRED])
-PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_REQUIRED)
PKG_CHECK_MODULES(GCONF, gconf-2.0 >= $GCONF_REQUIRED)
PKG_CHECK_MODULES(GIO, [gio-2.0, gio-unix-2.0])
PKG_CHECK_MODULES(GMODULE, gmodule-2.0)
@@ -293,7 +290,6 @@ AC_MSG_NOTICE([Libraries])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Kerberos: $KRB5_CFLAGS $KRB5_LIBS])
AC_MSG_NOTICE([ GTK: $GTK_CFLAGS $GTK_LIBS])
-AC_MSG_NOTICE([ DBus: $DBUS_CFLAGS $DBUS_LIBS])
AC_MSG_NOTICE([ gconf: $GCONF_CFLAGS $GCONF_LIBS])
AC_MSG_NOTICE([ gio-unix: $GIO_UNIX_CFLAGS $GIO_UNIX_LIBS $GIO_CFLAGS $GIO_LIBS])
if test "$with_libnotify" = "yes" ; then
diff --git a/etpo/Makefile.am b/etpo/Makefile.am
index 2a92ecd..e7fa933 100644
--- a/etpo/Makefile.am
+++ b/etpo/Makefile.am
@@ -4,7 +4,6 @@ lexer.c: grammar.h
AM_YFLAGS=-d
AM_CFLAGS=\
@GTK_CFLAGS@ \
- @DBUS_CFLAGS@ \
@GCONF_CFLAGS@ \
@KRB5_CFLAGS@ \
@NETWORK_MANAGER_CFLAGS@ \
@@ -14,7 +13,6 @@ AM_LDFLAGS=\
@NETWORK_MANAGER_LIBS@ \
@KRB5_LIBS@ \
@LIBNOTIFY_LIBS@ \
- @DBUS_LIBS@ \
@GCONF_LIBS@ \
@GTK_LIBS@
diff --git a/etpo/Makefile.in b/etpo/Makefile.in
index 0171af7..18ad3fa 100644
--- a/etpo/Makefile.in
+++ b/etpo/Makefile.in
@@ -122,8 +122,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
@@ -286,7 +284,6 @@ etpo_SOURCES = lexer.l grammar.y
AM_YFLAGS = -d
AM_CFLAGS = \
@GTK_CFLAGS@ \
- @DBUS_CFLAGS@ \
@GCONF_CFLAGS@ \
@KRB5_CFLAGS@ \
@NETWORK_MANAGER_CFLAGS@ \
@@ -297,7 +294,6 @@ AM_LDFLAGS = \
@NETWORK_MANAGER_LIBS@ \
@KRB5_LIBS@ \
@LIBNOTIFY_LIBS@ \
- @DBUS_LIBS@ \
@GCONF_LIBS@ \
@GTK_LIBS@
diff --git a/examples/Makefile.am b/examples/Makefile.am
index c0d930a..529f035 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -2,4 +2,6 @@ NULL =
EXTRA_DIST = \
tgt-signals.py \
+ tgt-acquire.py \
+ destroy-ccache.py \
$(NULL)
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 27aa765..2c08d72 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -75,8 +75,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
@@ -238,6 +236,8 @@ top_srcdir = @top_srcdir@
NULL =
EXTRA_DIST = \
tgt-signals.py \
+ tgt-acquire.py \
+ destroy-ccache.py \
$(NULL)
all: all-am
diff --git a/examples/destroy-ccache.py b/examples/destroy-ccache.py
new file mode 100644
index 0000000..33cb20c
--- /dev/null
+++ b/examples/destroy-ccache.py
@@ -0,0 +1,8 @@
+import dbus
+
+bus = dbus.SessionBus()
+ka = bus.get_object('org.gnome.KrbAuthDialog',
+ '/org/gnome/KrbAuthDialog')
+ret = ka.destroyCCache(dbus_interface='org.gnome.KrbAuthDialog')
+if not ret:
+ print >>sys.stderr, "Could not destroy credentials cache"
diff --git a/examples/tgt-acquire.py b/examples/tgt-acquire.py
new file mode 100644
index 0000000..cc8dc28
--- /dev/null
+++ b/examples/tgt-acquire.py
@@ -0,0 +1,8 @@
+import dbus
+
+bus = dbus.SessionBus()
+ka = bus.get_object('org.gnome.KrbAuthDialog',
+ '/org/gnome/KrbAuthDialog')
+ret = ka.acquireTgt("", dbus_interface='org.gnome.KrbAuthDialog')
+if not ret:
+ print >>sys.stderr, "Cannot acuire TGT, aborting."
diff --git a/help/Makefile.in b/help/Makefile.in
index 415e515..d24bb64 100644
--- a/help/Makefile.in
+++ b/help/Makefile.in
@@ -100,8 +100,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/icons/22x22/Makefile.in b/icons/22x22/Makefile.in
index 06395b9..c249c98 100644
--- a/icons/22x22/Makefile.in
+++ b/icons/22x22/Makefile.in
@@ -99,8 +99,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/icons/48x48/Makefile.in b/icons/48x48/Makefile.in
index 3b44a5b..c453731 100644
--- a/icons/48x48/Makefile.in
+++ b/icons/48x48/Makefile.in
@@ -99,8 +99,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/icons/Makefile.in b/icons/Makefile.in
index 69350d3..0de37ad 100644
--- a/icons/Makefile.in
+++ b/icons/Makefile.in
@@ -115,8 +115,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/icons/scalable/Makefile.in b/icons/scalable/Makefile.in
index bb6fbaa..857e1a6 100644
--- a/icons/scalable/Makefile.in
+++ b/icons/scalable/Makefile.in
@@ -99,8 +99,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/krb5-auth-dialog.spec b/krb5-auth-dialog.spec
index ac8a33d..c7412d3 100644
--- a/krb5-auth-dialog.spec
+++ b/krb5-auth-dialog.spec
@@ -1,6 +1,6 @@
Summary: Kerberos 5 authentication dialog
Name: krb5-auth-dialog
-Version: 2.91.90
+Version: 2.91.91
Release: 1
License: GPL
Group: User Interface/X
diff --git a/plugins/Makefile.in b/plugins/Makefile.in
index 74894c5..a101b98 100644
--- a/plugins/Makefile.in
+++ b/plugins/Makefile.in
@@ -157,8 +157,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/plugins/ka-plugin-afs.c b/plugins/ka-plugin-afs.c
index 57daed0..831e016 100644
--- a/plugins/ka-plugin-afs.c
+++ b/plugins/ka-plugin-afs.c
@@ -39,7 +39,7 @@ struct _KaPluginAfsPrivate {
};
static void
-event_cb (gpointer *applet, gchar *princ, guint when, gpointer user_data)
+event_cb (gpointer *applet, gchar *princ, guint when, gpointer user_data G_GNUC_UNUSED)
{
GError *err = NULL;
gboolean ret;
@@ -73,10 +73,10 @@ ka_plugin_afs_activate (KaPlugin *self, KaApplet *applet)
priv->handlers[0] = g_signal_connect (applet,
"krb-tgt-acquired",
- G_CALLBACK (event_cb), "Acquired");
+ G_CALLBACK (event_cb), NULL);
priv->handlers[1] = g_signal_connect (applet,
"krb-tgt-renewed",
- G_CALLBACK (event_cb), "Renewed");
+ G_CALLBACK (event_cb), NULL);
}
static void
diff --git a/secmem/Makefile.in b/secmem/Makefile.in
index d67a12f..4376dac 100644
--- a/secmem/Makefile.in
+++ b/secmem/Makefile.in
@@ -129,8 +129,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
diff --git a/src/Makefile.am b/src/Makefile.am
index fb64219..65d2a92 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -66,7 +66,6 @@ krb5_auth_dialog_CPPFLAGS = \
krb5_auth_dialog_CFLAGS = \
$(GMODULE_CFLAGS) \
$(GTK_CFLAGS) \
- $(DBUS_CFLAGS) \
$(GCONF_CFLAGS) \
$(KRB5_CFLAGS) \
$(NETWORK_MANAGER_CFLAGS) \
@@ -81,23 +80,12 @@ krb5_auth_dialog_LDADD = \
$(LIBCAP) \
$(KRB5_LIBS) \
$(LIBNOTIFY_LIBS) \
- $(DBUS_LIBS) \
$(GCONF_LIBS) \
$(GIO_LIBS) \
$(GMODULE_LIBS) \
$(GTK_LIBS) \
$(NULL)
-BUILT_SOURCES = \
- ka-dbus-glue.h \
- $(NULL)
-
-ka-dbus-glue.h: $(srcdir)/ka-dbus.xml
- dbus-binding-tool \
- --mode=glib-server \
- --prefix=krb5_auth_dialog \
- $< > $@
-
AM_CPPFLAGS = \
-I $(top_srcdir)/secmem/ \
$(DISABLE_DEPRECATED) \
@@ -113,14 +101,12 @@ EXTRA_DIST = \
$(schema_in_files) \
$(autostart_in_files) \
$(service_in_files) \
- $(srcdir)/ka-dbus.xml \
krb5-auth-dialog.1.in \
$(NULL)
CLEANFILES = $(schema_DATA) $(service_DATA)
DISTCLEANFILES = \
krb5-auth-dialog.desktop \
- ka-dbus-glue.h \
$(NULL)
install-data-local: $(schema_DATA)
diff --git a/src/Makefile.in b/src/Makefile.in
index 12cb8fa..f2e9f97 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -74,7 +74,7 @@ krb5_auth_dialog_DEPENDENCIES = $(top_builddir)/secmem/libsecmem.a \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
@@ -161,8 +161,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
@@ -377,7 +375,6 @@ krb5_auth_dialog_CPPFLAGS = \
krb5_auth_dialog_CFLAGS = \
$(GMODULE_CFLAGS) \
$(GTK_CFLAGS) \
- $(DBUS_CFLAGS) \
$(GCONF_CFLAGS) \
$(KRB5_CFLAGS) \
$(NETWORK_MANAGER_CFLAGS) \
@@ -392,17 +389,12 @@ krb5_auth_dialog_LDADD = \
$(LIBCAP) \
$(KRB5_LIBS) \
$(LIBNOTIFY_LIBS) \
- $(DBUS_LIBS) \
$(GCONF_LIBS) \
$(GIO_LIBS) \
$(GMODULE_LIBS) \
$(GTK_LIBS) \
$(NULL)
-BUILT_SOURCES = \
- ka-dbus-glue.h \
- $(NULL)
-
AM_CPPFLAGS = \
-I $(top_srcdir)/secmem/ \
$(DISABLE_DEPRECATED) \
@@ -417,18 +409,15 @@ EXTRA_DIST = \
$(schema_in_files) \
$(autostart_in_files) \
$(service_in_files) \
- $(srcdir)/ka-dbus.xml \
krb5-auth-dialog.1.in \
$(NULL)
CLEANFILES = $(schema_DATA) $(service_DATA)
DISTCLEANFILES = \
krb5-auth-dialog.desktop \
- ka-dbus-glue.h \
$(NULL)
-all: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) all-am
+all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -1003,15 +992,13 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
-check: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) check-am
+check: check-am
all-am: Makefile $(PROGRAMS) $(MANS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(autostartdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(schemadir)" "$(DESTDIR)$(servicedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) install-am
+install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -1038,7 +1025,6 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
@@ -1115,7 +1101,7 @@ uninstall-am: uninstall-autostartDATA uninstall-binPROGRAMS \
uninstall-man: uninstall-man1
-.MAKE: all check install install-am install-strip
+.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
@@ -1142,12 +1128,6 @@ uninstall-man: uninstall-man1
$(service_DATA): $(service_in_files) Makefile
sed -e "s|\@BINDIR\@|$(bindir)|" $< > $@
-ka-dbus-glue.h: $(srcdir)/ka-dbus.xml
- dbus-binding-tool \
- --mode=glib-server \
- --prefix=krb5_auth_dialog \
- $< > $@
-
install-data-local: $(schema_DATA)
@GCONF_SCHEMAS_INSTALL_TRUE@ if test -z "$(DESTDIR)" ; then \
@GCONF_SCHEMAS_INSTALL_TRUE@ for p in $^ ; do \
diff --git a/src/ka-applet-priv.h b/src/ka-applet-priv.h
index a64848c..bd55996 100644
--- a/src/ka-applet-priv.h
+++ b/src/ka-applet-priv.h
@@ -42,6 +42,8 @@ G_BEGIN_DECLS
KA_SIGNAL_COUNT
} KaAppletSignalNumber;
+extern const gchar *ka_signal_names[];
+
/* public functions */
gboolean ka_applet_get_show_trayicon (const KaApplet *self);
void ka_applet_set_tgt_renewable (KaApplet *self, gboolean renewable);
@@ -53,8 +55,11 @@ void ka_applet_signal_emit (KaApplet *self, KaAppletSignalNumber signum,
krb5_timestamp expiry);
void ka_applet_set_msg (KaApplet *self, const char *msg);
+
/* create the applet */
KaApplet *ka_applet_create (void);
+/* destroy the applet */
+void ka_applet_destroy (KaApplet *self);
/* update tooltip and icon */
int ka_applet_update_status (KaApplet *self, krb5_timestamp expiry);
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 7de9204..2d4981e 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -51,6 +51,14 @@ enum {
KA_PROP_TGT_RENEWABLE,
};
+
+const gchar *ka_signal_names[KA_SIGNAL_COUNT] = {
+ "krb-tgt-acquired",
+ "krb-tgt-renewed",
+ "krb-tgt-expired",
+};
+
+
struct _KaApplet {
GObject parent;
@@ -252,12 +260,6 @@ ka_applet_class_init (KaAppletClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
-
- const gchar *signalNames[KA_SIGNAL_COUNT] = {
- "krb-tgt-acquired",
- "krb-tgt-renewed",
- "krb-tgt-expired"
- };
int i;
object_class->dispose = ka_applet_dispose;
@@ -320,7 +322,7 @@ ka_applet_class_init (KaAppletClass *klass)
for (i = 0; i < KA_SIGNAL_COUNT; i++) {
guint signalId;
- signalId = g_signal_new (signalNames[i], G_OBJECT_CLASS_TYPE (klass),
+ signalId = g_signal_new (ka_signal_names[i], G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
ka_closure_VOID__STRING_UINT,
G_TYPE_NONE, 2, /* number of parameters */
@@ -707,8 +709,7 @@ ka_applet_cb_quit (GtkMenuItem *menuitem G_GNUC_UNUSED, gpointer user_data)
{
KaApplet *applet = KA_APPLET (user_data);
- g_object_unref (applet);
- gtk_main_quit ();
+ ka_applet_destroy (applet);
}
@@ -978,6 +979,15 @@ ka_ns_check_persistence (KaApplet *self)
}
+/* destroy the applet and quit */
+void
+ka_applet_destroy (KaApplet* applet)
+{
+ g_object_unref (applet);
+ gtk_main_quit ();
+}
+
+
/* create the tray icon applet */
KaApplet *
ka_applet_create ()
diff --git a/src/ka-dbus.c b/src/ka-dbus.c
index f8a00d6..4a7be2c 100644
--- a/src/ka-dbus.c
+++ b/src/ka-dbus.c
@@ -1,6 +1,6 @@
/* Krb5 Auth Applet -- Acquire and release kerberos tickets
*
- * (C) 2008,2009 Guido Guenther <agx@sigxcpu.org>
+ * (C) 2008,2009,2011 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
@@ -20,100 +20,227 @@
#include "config.h"
-#include <dbus/dbus-glib.h>
#include "ka-applet-priv.h"
#include "ka-dialog.h"
#include "ka-dbus.h"
-#include "ka-dbus-glue.h"
-static DBusGConnection *session;
+static guint dbus_owner_id;
+static GDBusConnection *dbus_connection;
+static const char *dbus_object_path = "/org/gnome/KrbAuthDialog";
+static const char *dbus_interface_name = "org.gnome.KrbAuthDialog";
+static GDBusNodeInfo *introspection_data;
+
gboolean
ka_dbus_acquire_tgt (KaApplet *applet,
- const gchar *principal, DBusGMethodInvocation *context)
+ const gchar *principal)
{
- gboolean success;
+ gboolean success;
- KA_DEBUG("Getting TGT for '%s'", principal);
- success = ka_check_credentials(applet, principal);
- dbus_g_method_return(context, success);
- return TRUE;
+ KA_DEBUG ("Getting TGT for '%s'", principal);
+ success = ka_check_credentials (applet, principal);
+ return success;
}
gboolean
-ka_dbus_destroy_ccache(KaApplet* applet, DBusGMethodInvocation *context)
+ka_dbus_destroy_ccache (KaApplet *applet)
{
- gboolean success;
+ gboolean success;
- KA_DEBUG("Destroying ticket cache");
- success = ka_destroy_ccache (applet);
- dbus_g_method_return(context, success);
- return TRUE;
+ KA_DEBUG ("Destroying ticket cache");
+ success = ka_destroy_ccache (applet);
+ return success;
}
-gboolean
-ka_dbus_service(KaApplet* applet)
+static const gchar ka_dbus_introspection_xml[] =
+ "<node>"
+ " <interface name='org.gnome.KrbAuthDialog'>"
+ " <method name='acquireTgt'>"
+ " <arg type='s' name='principal' direction='in' />"
+ " <arg type='b' name='success' direction='out'/>"
+ " </method>"
+ " <method name='destroyCCache'>"
+ " <arg type='b' name='success' direction='out'/>"
+ " </method>"
+ " <signal name='krb_tgt_acquired'>"
+ " <arg type='s' name='principal' direction ='out'/>"
+ " <arg type='u' name='expiry' direction ='out'/>"
+ " </signal>"
+ " <signal name='krb_tgt_renewed'>"
+ " <arg type='s' name='principal' direction ='out'/>"
+ " <arg type='u' name='expiry' direction ='out'/>"
+ " </signal>"
+ " <signal name='krb_tgt_expired'>"
+ " <arg type='s' name='principal' direction ='out'/>"
+ " <arg type='u' name='expiry' direction ='out'/>"
+ " </signal>"
+ " </interface>"
+ "</node>";
+
+
+static void
+ka_dbus_handle_method_call (GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *sender G_GNUC_UNUSED,
+ const gchar *object_path G_GNUC_UNUSED,
+ const gchar *interface_name G_GNUC_UNUSED,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
{
- dbus_g_connection_register_g_object (session,
- "/org/gnome/KrbAuthDialog",
- G_OBJECT(applet));
- return TRUE;
+ KaApplet *applet = user_data;
+ gboolean ret;
+
+ g_warn_if_fail (applet != NULL);
+
+ if (g_strcmp0 (method_name, "acquireTgt") == 0) {
+ const char *principal;
+
+ g_variant_get (parameters, "(s)", &principal);
+ ret = ka_dbus_acquire_tgt (applet, principal);
+ g_dbus_method_invocation_return_value (invocation,
+ g_variant_new("(b)", ret));
+ } else if (g_strcmp0 (method_name, "destroyCCache") == 0) {
+ ret = ka_dbus_destroy_ccache (applet);
+ g_dbus_method_invocation_return_value (invocation,
+ g_variant_new("(b)", ret));
+ }
+}
+
+static gchar* ka_dbus_signal_name (const gchar *name)
+{
+ gchar *c;
+ gchar *signal_name = g_strdup(name);
+
+ /* The DBus signal names use underscores */
+ for (c = signal_name; *c != '\0'; c++ ) {
+ if (*c == '-')
+ *c = '_';
+ }
+
+ return signal_name;
+}
+
+/* Emit DBus signals */
+static void
+ka_dbus_signal_cb (gpointer *applet G_GNUC_UNUSED,
+ gchar *princ,
+ guint when, gpointer user_data)
+{
+ GError *error = NULL;
+ gchar *signal_name;
+
+ signal_name = ka_dbus_signal_name(user_data);
+ if (!g_dbus_connection_emit_signal (dbus_connection,
+ NULL,
+ dbus_object_path,
+ dbus_interface_name,
+ signal_name,
+ g_variant_new ("(su)",
+ princ,
+ when),
+ &error)) {
+ g_warning ("Failed to emit DBus signal %s: %s",
+ signal_name,
+ error->message);
+ g_clear_error (&error);
+ }
+ g_free (signal_name);
+}
+
+
+static void
+ka_dbus_connect_signals(KaApplet *applet)
+{
+ int i;
+
+ for (i = 0; i < KA_SIGNAL_COUNT; i++) {
+ g_signal_connect (applet, ka_signal_names[i],
+ G_CALLBACK (ka_dbus_signal_cb),
+ (gpointer)ka_signal_names[i]);
+ }
+}
+
+
+static const GDBusInterfaceVTable interface_vtable =
+{
+ .method_call = ka_dbus_handle_method_call,
+};
+
+
+static void
+ka_dbus_on_name_acquired (GDBusConnection *connection,
+ const gchar *name G_GNUC_UNUSED,
+ gpointer user_data)
+{
+ KaApplet *applet = user_data;
+ guint id;
+
+ introspection_data = g_dbus_node_info_new_for_xml (
+ ka_dbus_introspection_xml,
+ NULL);
+
+ id = g_dbus_connection_register_object (connection,
+ "/org/gnome/KrbAuthDialog",
+ introspection_data->interfaces[0],
+ &interface_vtable,
+ applet,
+ NULL, /* user_data_free_func */
+ NULL); /* GError** */
+ if (!id)
+ g_error ("Failed to regiester DBus object");
+ ka_dbus_connect_signals (applet);
+
+ dbus_connection = connection;
+}
+
+
+static void
+ka_dbus_on_name_lost (GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *name G_GNUC_UNUSED,
+ gpointer user_data)
+{
+ KaApplet *applet = user_data;
+
+ g_warning ("Cannot acquire DBUS name");
+ ka_applet_destroy (applet);
+}
+
+
+void
+ka_dbus_disconnect ()
+{
+ if (introspection_data) {
+ g_dbus_node_info_unref (introspection_data);
+ introspection_data = NULL;
+ }
+
+ if (dbus_owner_id) {
+ g_bus_unown_name (dbus_owner_id);
+ dbus_owner_id = 0;
+ }
+ dbus_connection = NULL;
}
gboolean
-ka_dbus_connect(unsigned int* status)
+ka_dbus_connect (KaApplet *applet)
{
- guint request_name_reply;
- unsigned int flags;
- DBusGProxy *bus_proxy;
- GError *error = NULL;
-
- /* Connect to the session bus so we get exit-on-disconnect semantics. */
- session = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (session == NULL) {
- g_error ("couldn't connect to session bus: %s", (error) ? error->message : "(null)");
- *status = 1;
- g_clear_error (&error);
- return FALSE;
- }
- flags = DBUS_NAME_FLAG_DO_NOT_QUEUE;
- bus_proxy = dbus_g_proxy_new_for_name (session,
- "org.freedesktop.DBus",
- "/org/freedesktop/DBus",
- "org.freedesktop.DBus");
-
- dbus_g_object_type_install_info(KA_TYPE_APPLET,
- &dbus_glib_krb5_auth_dialog_object_info);
-
- if (!dbus_g_proxy_call (bus_proxy,
- "RequestName",
- &error,
- G_TYPE_STRING,
- "org.gnome.KrbAuthDialog",
- G_TYPE_UINT,
- flags,
- G_TYPE_INVALID,
- G_TYPE_UINT,
- &request_name_reply,
- G_TYPE_INVALID)) {
- g_warning ("Failed to invoke RequestName: %s",
- error->message);
- }
- g_clear_error (&error);
- g_object_unref (bus_proxy);
-
- if (request_name_reply == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
- || request_name_reply == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER)
- ;
- else if (request_name_reply == DBUS_REQUEST_NAME_REPLY_EXISTS
- || request_name_reply == DBUS_REQUEST_NAME_REPLY_IN_QUEUE) {
- *status = 0;
- return FALSE;
- } else {
- g_assert_not_reached();
- }
- return TRUE;
+ g_return_val_if_fail (applet != 0, FALSE);
+
+ dbus_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+ "org.gnome.KrbAuthDialog",
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT,
+ NULL,
+ ka_dbus_on_name_acquired,
+ ka_dbus_on_name_lost,
+ applet,
+ NULL);
+ return TRUE;
}
+
+/*
+ * vim:ts=4:sts=4:sw=4:et:
+ */
diff --git a/src/ka-dbus.h b/src/ka-dbus.h
index 23828b7..41b30d7 100644
--- a/src/ka-dbus.h
+++ b/src/ka-dbus.h
@@ -22,16 +22,12 @@
#define KA_DBUS_H
#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include "ka-applet-priv.h"
-gboolean ka_dbus_connect(unsigned int* status);
-gboolean ka_dbus_service(KaApplet* applet);
+gboolean ka_dbus_connect (KaApplet *applet);
+void ka_dbus_disconnect (void);
gboolean ka_dbus_acquire_tgt (KaApplet *applet,
- const gchar *principal,
- DBusGMethodInvocation *context);
-gboolean ka_dbus_destroy_ccache(KaApplet* applet,
- DBusGMethodInvocation *context);
+ const gchar *principal);
+gboolean ka_dbus_destroy_ccache (KaApplet *applet);
#endif /* KA_DBUS_H */
diff --git a/src/ka-dbus.xml b/src/ka-dbus.xml
deleted file mode 100644
index 9d6b1a4..0000000
--- a/src/ka-dbus.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<node name="/org/gnome/KrbAuthDialog">
- <interface name="org.gnome.KrbAuthDialog">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="KaApplet"/>
- <method name="acquireTgt">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ka_dbus_acquire_tgt"/>
- <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
- <arg type="s" name="principal" direction="in" />
- <arg type="b" name="success" direction="out"/>
- </method>
- <method name="destroyCCache">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ka_dbus_destroy_ccache"/>
- <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
- <arg type="b" name="success" direction="out"/>
- </method>
- <signal name="krb_tgt_acquired">
- <arg type="s" name="principal" direction ="out"/>
- <arg type="u" name="expiry" direction ="out"/>
- </signal>
- <signal name="krb_tgt_renewed">
- <arg type="s" name="principal" direction ="out"/>
- <arg type="u" name="expiry" direction ="out"/>
- </signal>
- <signal name="krb_tgt_expired">
- <arg type="s" name="principal" direction ="out"/>
- <arg type="u" name="expiry" direction ="out"/>
- </signal>
- </interface>
-</node>
diff --git a/src/ka-dialog.c b/src/ka-dialog.c
index 3114f49..5b11621 100644
--- a/src/ka-dialog.c
+++ b/src/ka-dialog.c
@@ -47,7 +47,7 @@
#endif
#ifdef HAVE_HX509_ERR_H
-# include <hx509_err.h>
+#include <hx509_err.h>
#endif
static krb5_context kcontext;
@@ -59,9 +59,10 @@ static gboolean invalid_auth;
static gboolean always_run;
static gboolean is_online = TRUE;
-static int grab_credentials (KaApplet* applet);
-static int ka_renew_credentials (KaApplet* applet);
-static gboolean ka_get_tgt_from_ccache (krb5_context context, krb5_creds *creds);
+static int grab_credentials (KaApplet *applet);
+static int ka_renew_credentials (KaApplet *applet);
+static gboolean ka_get_tgt_from_ccache (krb5_context context,
+ krb5_creds *creds);
#ifdef ENABLE_NETWORK_MANAGER
NMClient *nm_client;
@@ -69,82 +70,82 @@ NMClient *nm_client;
/* YAY for different Kerberos implementations */
static int
-get_cred_forwardable(krb5_creds *creds)
+get_cred_forwardable (krb5_creds *creds)
{
#if defined(HAVE_KRB5_CREDS_TICKET_FLAGS) && defined(TKT_FLG_FORWARDABLE)
- return creds->ticket_flags & TKT_FLG_FORWARDABLE;
+ return creds->ticket_flags & TKT_FLG_FORWARDABLE;
#elif defined(HAVE_KRB5_CREDS_FLAGS_B_FORWARDABLE)
- return creds->flags.b.forwardable;
+ return creds->flags.b.forwardable;
#elif defined(HAVE_KRB5_CREDS_FLAGS) && defined(KDC_OPT_FORWARDABLE)
- return creds->flags & KDC_OPT_FORWARDABLE;
+ return creds->flags & KDC_OPT_FORWARDABLE;
#endif
}
static int
-get_cred_renewable(krb5_creds *creds)
+get_cred_renewable (krb5_creds *creds)
{
#if defined(HAVE_KRB5_CREDS_TICKET_FLAGS) && defined(TKT_FLG_RENEWABLE)
- return creds->ticket_flags & TKT_FLG_RENEWABLE;
+ return creds->ticket_flags & TKT_FLG_RENEWABLE;
#elif defined(HAVE_KRB5_CREDS_FLAGS_B_RENEWABLE)
- return creds->flags.b.renewable;
+ return creds->flags.b.renewable;
#elif defined(HAVE_KRB5_CREDS_FLAGS) && defined(KDC_OPT_RENEWABLE)
- return creds->flags & KDC_OPT_RENEWABLE;
+ return creds->flags & KDC_OPT_RENEWABLE;
#endif
}
static krb5_error_code
-get_renewed_creds(krb5_context context,
- krb5_creds *creds,
- krb5_principal client,
- krb5_ccache ccache,
- char *in_tkt_service)
+get_renewed_creds (krb5_context context,
+ krb5_creds *creds,
+ krb5_principal client,
+ krb5_ccache ccache, char *in_tkt_service)
{
#ifdef HAVE_KRB5_GET_RENEWED_CREDS
- return krb5_get_renewed_creds (context, creds, client, ccache, in_tkt_service);
+ return krb5_get_renewed_creds (context, creds, client, ccache,
+ in_tkt_service);
#else
- return 1; /* XXX is there something better to return? */
+ return 1; /* XXX is there something better to return? */
#endif
}
static int
-get_cred_proxiable(krb5_creds *creds)
+get_cred_proxiable (krb5_creds *creds)
{
#if defined(HAVE_KRB5_CREDS_TICKET_FLAGS) && defined(TKT_FLG_PROXIABLE)
- return creds->ticket_flags & TKT_FLG_PROXIABLE;
+ return creds->ticket_flags & TKT_FLG_PROXIABLE;
#elif defined(HAVE_KRB5_CREDS_FLAGS_B_PROXIABLE)
- return creds->flags.b.proxiable;
+ return creds->flags.b.proxiable;
#elif defined(HAVE_KRB5_CREDS_FLAGS) && defined(KDC_OPT_PROXIABLE)
- return creds->flags & KDC_OPT_PROXIABLE;
+ return creds->flags & KDC_OPT_PROXIABLE;
#endif
}
static size_t
-get_principal_realm_length(krb5_principal p)
+get_principal_realm_length (krb5_principal p)
{
#if defined(HAVE_KRB5_PRINCIPAL_REALM_AS_STRING)
- return strlen(p->realm);
+ return strlen (p->realm);
#elif defined(HAVE_KRB5_PRINCIPAL_REALM_AS_DATA)
- return p->realm.length;
+ return p->realm.length;
#endif
}
static const char *
-get_principal_realm_data(krb5_principal p)
+get_principal_realm_data (krb5_principal p)
{
#if defined(HAVE_KRB5_PRINCIPAL_REALM_AS_STRING)
- return p->realm;
+ return p->realm;
#elif defined(HAVE_KRB5_PRINCIPAL_REALM_AS_DATA)
- return p->realm.data;
+ return p->realm.data;
#endif
}
static void
-ka_krb5_free_error_message(krb5_context context, const char* msg)
+ka_krb5_free_error_message (krb5_context context, const char *msg)
{
#if defined(HAVE_KRB5_FREE_ERROR_MESSAGE)
- krb5_free_error_message(context, msg);
+ krb5_free_error_message (context, msg);
#elif defined(HAVE_KRB5_FREE_ERROR_STRING)
- krb5_free_error_string(context, (char *) msg);
+ krb5_free_error_string (context, (char *) msg);
#else
# error No way to free error string.
#endif
@@ -154,32 +155,33 @@ ka_krb5_free_error_message(krb5_context context, const char* msg)
* Returns a descriptive error message or kerberos related error
* returned pointer must be freed using g_free().
*/
-static char*
-ka_get_error_message(krb5_context context, krb5_error_code err)
+static char *
+ka_get_error_message (krb5_context context, krb5_error_code err)
{
- char *msg = NULL;
+ char *msg = NULL;
+
#if defined(HAVE_KRB5_GET_ERROR_MESSAGE)
- const char *krberr;
+ const char *krberr;
- krberr = krb5_get_error_message(context, err);
- msg = g_strdup(krberr);
- ka_krb5_free_error_message(context, krberr);
+ krberr = krb5_get_error_message (context, err);
+ msg = g_strdup (krberr);
+ ka_krb5_free_error_message (context, krberr);
#else
# error No detailed error message information
#endif
- if (msg == NULL)
- msg = g_strdup(_("unknown error"));
- return msg;
+ if (msg == NULL)
+ msg = g_strdup (_("unknown error"));
+ return msg;
}
static void
-ka_krb5_cc_clear_mcred(krb5_creds* mcred)
+ka_krb5_cc_clear_mcred (krb5_creds *mcred)
{
#if defined HAVE_KRB5_CC_CLEAR_MCRED
- krb5_cc_clear_mcred(mcred);
+ krb5_cc_clear_mcred (mcred);
#else
- memset(mcred, 0, sizeof(krb5_creds));
+ memset (mcred, 0, sizeof (krb5_creds));
#endif
}
@@ -189,181 +191,177 @@ ka_krb5_cc_clear_mcred(krb5_creds* mcred)
/* log a kerberos error messge */
static void
-ka_log_error_message(const char* prefix, krb5_context context, krb5_error_code err)
+ka_log_error_message (const char *prefix, krb5_context context,
+ krb5_error_code err)
{
- char *errmsg = ka_get_error_message(context, err);
+ char *errmsg = ka_get_error_message (context, err);
- g_warning("%s: %s", prefix, errmsg);
- g_free (errmsg);
+ g_warning ("%s: %s", prefix, errmsg);
+ g_free (errmsg);
}
static gboolean
-credentials_expiring_real (KaApplet* applet)
+credentials_expiring_real (KaApplet *applet)
{
- krb5_creds my_creds;
- krb5_timestamp now;
- gboolean retval = FALSE;
-
- memset(&my_creds, 0, sizeof(my_creds));
- ka_applet_set_tgt_renewable(applet, FALSE);
- if (!ka_get_tgt_from_ccache (kcontext, &my_creds)) {
- creds_expiry = 0;
- retval = TRUE;
- goto out;
- }
-
- /* copy principal from cache if any */
- if (krb5_principal_compare (kcontext, my_creds.client, kprincipal)) {
- krb5_free_principal(kcontext, kprincipal);
- krb5_copy_principal(kcontext, my_creds.client, &kprincipal);
- }
- creds_expiry = my_creds.times.endtime;
- if ((krb5_timeofday(kcontext, &now) == 0) &&
- (now + ka_applet_get_pw_prompt_secs(applet) > my_creds.times.endtime))
- retval = TRUE;
-
- /* If our creds are expiring, determine whether they are renewable.
- * If the expiry is already at the renew_till time, don't consider
- * credentials renewable */
- if (retval && get_cred_renewable(&my_creds)
- && my_creds.times.renew_till > now
- && my_creds.times.renew_till > creds_expiry) {
- ka_applet_set_tgt_renewable(applet, TRUE);
- }
-
-out:
- krb5_free_cred_contents (kcontext, &my_creds);
- ka_applet_update_status(applet, creds_expiry);
- return retval;
+ krb5_creds my_creds;
+ krb5_timestamp now;
+ gboolean retval = FALSE;
+
+ memset (&my_creds, 0, sizeof (my_creds));
+ ka_applet_set_tgt_renewable (applet, FALSE);
+ if (!ka_get_tgt_from_ccache (kcontext, &my_creds)) {
+ creds_expiry = 0;
+ retval = TRUE;
+ goto out;
+ }
+
+ /* copy principal from cache if any */
+ if (krb5_principal_compare (kcontext, my_creds.client, kprincipal)) {
+ krb5_free_principal (kcontext, kprincipal);
+ krb5_copy_principal (kcontext, my_creds.client, &kprincipal);
+ }
+ creds_expiry = my_creds.times.endtime;
+ if ((krb5_timeofday (kcontext, &now) == 0) &&
+ (now + ka_applet_get_pw_prompt_secs (applet) >
+ my_creds.times.endtime))
+ retval = TRUE;
+
+ /* If our creds are expiring, determine whether they are renewable.
+ * If the expiry is already at the renew_till time, don't consider
+ * credentials renewable */
+ if (retval && get_cred_renewable (&my_creds)
+ && my_creds.times.renew_till > now
+ && my_creds.times.renew_till > creds_expiry) {
+ ka_applet_set_tgt_renewable (applet, TRUE);
+ }
+
+ out:
+ krb5_free_cred_contents (kcontext, &my_creds);
+ ka_applet_update_status (applet, creds_expiry);
+ return retval;
}
/* time in seconds the tgt will be still valid */
int
-ka_tgt_valid_seconds()
+ka_tgt_valid_seconds ()
{
- krb5_timestamp now;
+ krb5_timestamp now;
- if (krb5_timeofday(kcontext, &now))
- return 0;
+ if (krb5_timeofday (kcontext, &now))
+ return 0;
- return (creds_expiry - now);
+ return (creds_expiry - now);
}
/* return credential cache filename, strip "FILE:" prefix if necessary */
-static const char*
+static const char *
ka_ccache_filename (void)
{
- const gchar *name;
-
- name = krb5_cc_default_name (kcontext);
- if (g_str_has_prefix (name, "FILE:"))
- return strchr(name,':')+1;
- else if (g_str_has_prefix (name, "SCC:"))
- g_warning ("Cannot monitor sqlite based cache '%s'", name);
- else
- g_warning ("Unsupported cache type for '%s'", name);
- return NULL;
+ const gchar *name;
+
+ name = krb5_cc_default_name (kcontext);
+ if (g_str_has_prefix (name, "FILE:"))
+ return strchr (name, ':') + 1;
+ else if (g_str_has_prefix (name, "SCC:"))
+ g_warning ("Cannot monitor sqlite based cache '%s'", name);
+ else
+ g_warning ("Unsupported cache type for '%s'", name);
+ return NULL;
}
static void
ka_format_time (time_t t, gchar *ts, size_t len)
{
- g_strlcpy(ts, ctime(&t)+ 4, len);
- ts[15] = 0;
+ g_strlcpy (ts, ctime (&t) + 4, len);
+ ts[15] = 0;
}
/* fill in service tickets data */
gboolean
-ka_get_service_tickets (GtkListStore *tickets)
+ka_get_service_tickets (GtkListStore * tickets)
{
- krb5_cc_cursor cursor;
- krb5_creds creds;
- krb5_error_code ret;
- GtkTreeIter iter;
- krb5_ccache ccache;
- char *name;
- krb5_timestamp sec;
- gchar start_time[128], end_time[128], end_time_markup[256];
- gboolean retval = FALSE;
-
- gtk_list_store_clear(tickets);
-
- krb5_timeofday (kcontext, &sec);
- ret = krb5_cc_default (kcontext, &ccache);
- g_return_val_if_fail (!ret, FALSE);
-
- ret = krb5_cc_start_seq_get (kcontext, ccache, &cursor);
- if (ret) {
- ka_log_error_message("krb5_cc_start_seq_get", kcontext, ret);
-
- /* if the file doesn't exist, it's not an error if we can't
- * parse it */
- if (!g_file_test(ka_ccache_filename (),
- G_FILE_TEST_EXISTS))
- retval = TRUE;
- goto out;
- }
-
- while ((ret = krb5_cc_next_cred (kcontext,
- ccache,
- &cursor,
- &creds)) == 0) {
- gboolean renewable, proxiable, forwardable;
-
- if (creds.times.starttime)
- ka_format_time(creds.times.starttime, start_time,
- sizeof(start_time));
- else
- ka_format_time(creds.times.authtime, start_time,
- sizeof(start_time));
-
- ka_format_time(creds.times.endtime, end_time,
- sizeof(end_time));
- if (creds.times.endtime > sec)
- strcpy(end_time_markup, end_time);
- else
- g_snprintf(end_time_markup, sizeof(end_time_markup),
- "%s <span foreground=\"red\" style=\"italic\">(%s)</span>",
- end_time, _("Expired"));
-
- forwardable = get_cred_forwardable(&creds);
- renewable = get_cred_renewable(&creds);
- proxiable = get_cred_proxiable(&creds);
-
- ret = krb5_unparse_name (kcontext, creds.server, &name);
- if (!ret) {
- gtk_list_store_append(tickets, &iter);
- gtk_list_store_set(tickets, &iter,
- PRINCIPAL_COLUMN, name,
- START_TIME_COLUMN, start_time,
- END_TIME_COLUMN, end_time_markup,
- FORWARDABLE_COLUMN, forwardable,
- RENEWABLE_COLUMN, renewable,
- PROXIABLE_COLUMN, proxiable,
- -1);
- free(name);
- } else
- ka_log_error_message("krb5_unparse_name", kcontext, ret);
- krb5_free_cred_contents (kcontext, &creds);
- }
- if(ret != KRB5_CC_END)
- ka_log_error_message("krb5_cc_get_next", kcontext, ret);
-
- ret = krb5_cc_end_seq_get (kcontext, ccache, &cursor);
- if (ret)
- ka_log_error_message("krb5_cc_end_seq_get", kcontext, ret);
-
- retval = TRUE;
-out:
- ret = krb5_cc_close (kcontext, ccache);
- g_return_val_if_fail (!ret, FALSE);
-
- return retval;
+ krb5_cc_cursor cursor;
+ krb5_creds creds;
+ krb5_error_code ret;
+ GtkTreeIter iter;
+ krb5_ccache ccache;
+ char *name;
+ krb5_timestamp sec;
+ gchar start_time[128], end_time[128], end_time_markup[256];
+ gboolean retval = FALSE;
+
+ gtk_list_store_clear (tickets);
+
+ krb5_timeofday (kcontext, &sec);
+ ret = krb5_cc_default (kcontext, &ccache);
+ g_return_val_if_fail (!ret, FALSE);
+
+ ret = krb5_cc_start_seq_get (kcontext, ccache, &cursor);
+ if (ret) {
+ ka_log_error_message ("krb5_cc_start_seq_get", kcontext, ret);
+
+ /* if the file doesn't exist, it's not an error if we can't
+ * parse it */
+ if (!g_file_test (ka_ccache_filename (), G_FILE_TEST_EXISTS))
+ retval = TRUE;
+ goto out;
+ }
+
+ while ((ret = krb5_cc_next_cred (kcontext, ccache, &cursor, &creds)) == 0) {
+ gboolean renewable, proxiable, forwardable;
+
+ if (creds.times.starttime)
+ ka_format_time (creds.times.starttime, start_time,
+ sizeof (start_time));
+ else
+ ka_format_time (creds.times.authtime, start_time,
+ sizeof (start_time));
+
+ ka_format_time (creds.times.endtime, end_time, sizeof (end_time));
+ if (creds.times.endtime > sec)
+ strcpy (end_time_markup, end_time);
+ else
+ g_snprintf (end_time_markup, sizeof (end_time_markup),
+ "%s <span foreground=\"red\" style=\"italic\">(%s)</span>",
+ end_time, _("Expired"));
+
+ forwardable = get_cred_forwardable (&creds);
+ renewable = get_cred_renewable (&creds);
+ proxiable = get_cred_proxiable (&creds);
+
+ ret = krb5_unparse_name (kcontext, creds.server, &name);
+ if (!ret) {
+ gtk_list_store_append (tickets, &iter);
+ gtk_list_store_set (tickets, &iter,
+ PRINCIPAL_COLUMN, name,
+ START_TIME_COLUMN, start_time,
+ END_TIME_COLUMN, end_time_markup,
+ FORWARDABLE_COLUMN, forwardable,
+ RENEWABLE_COLUMN, renewable,
+ PROXIABLE_COLUMN, proxiable, -1);
+ free (name);
+ } else
+ ka_log_error_message ("krb5_unparse_name", kcontext, ret);
+ krb5_free_cred_contents (kcontext, &creds);
+ }
+ if (ret != KRB5_CC_END)
+ ka_log_error_message ("krb5_cc_get_next", kcontext, ret);
+
+ ret = krb5_cc_end_seq_get (kcontext, ccache, &cursor);
+ if (ret)
+ ka_log_error_message ("krb5_cc_end_seq_get", kcontext, ret);
+
+ retval = TRUE;
+ out:
+ ret = krb5_cc_close (kcontext, ccache);
+ g_return_val_if_fail (!ret, FALSE);
+
+ return retval;
}
@@ -371,17 +369,17 @@ out:
static gboolean
krb5_auth_dialog_do_updates (gpointer data)
{
- KaApplet* applet = KA_APPLET(data);
- KaPwDialog* pwdialog = ka_applet_get_pwdialog(applet);
+ KaApplet *applet = KA_APPLET (data);
+ KaPwDialog *pwdialog = ka_applet_get_pwdialog (applet);
- g_return_val_if_fail (pwdialog != NULL, FALSE);
- /* Update creds_expiry and close the applet if we got the creds by other means (e.g. kinit) */
- if (!credentials_expiring_real(applet))
- ka_pwdialog_hide(pwdialog, FALSE);
+ g_return_val_if_fail (pwdialog != NULL, FALSE);
+ /* Update creds_expiry and close the applet if we got the creds by other means (e.g. kinit) */
+ if (!credentials_expiring_real (applet))
+ ka_pwdialog_hide (pwdialog, FALSE);
- /* Update the expiry information in the dialog */
- ka_pwdialog_status_update (pwdialog);
- return TRUE;
+ /* Update the expiry information in the dialog */
+ ka_pwdialog_status_update (pwdialog);
+ return TRUE;
}
@@ -390,95 +388,97 @@ auth_dialog_prompter (krb5_context ctx G_GNUC_UNUSED,
void *data,
const char *name G_GNUC_UNUSED,
const char *banner G_GNUC_UNUSED,
- int num_prompts,
- krb5_prompt prompts[])
+ int num_prompts, krb5_prompt prompts[])
{
- KaApplet *applet = KA_APPLET(data);
- KaPwDialog *pwdialog = ka_applet_get_pwdialog(applet);
- krb5_error_code errcode;
- int i;
-
- errcode = KRB5KRB_ERR_GENERIC;
- canceled = FALSE;
- canceled_creds_expiry = 0;
-
- if (banner && !num_prompts)
- ka_applet_set_msg (applet, banner);
-
- for (i = 0; i < num_prompts; i++) {
- const gchar *password = NULL;
- int password_len = 0;
- int response;
- guint32 source_id;
-
- errcode = KRB5_LIBOS_CANTREADPWD;
-
- source_id = g_timeout_add_seconds (5, (GSourceFunc)krb5_auth_dialog_do_updates, applet);
- ka_pwdialog_setup (pwdialog, (gchar *) prompts[i].prompt, invalid_auth);
- response = ka_pwdialog_run (pwdialog);
- switch (response)
- {
- case GTK_RESPONSE_OK:
- password = ka_pwdialog_get_password(pwdialog);
- password_len = strlen (password);
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CANCEL:
- canceled = TRUE;
- break;
- case GTK_RESPONSE_NONE:
- break;
- default:
- g_warning ("Unknown Response: %d", response);
- g_assert_not_reached ();
- }
- g_source_remove (source_id);
-
- if (!password)
- goto cleanup;
- if (password_len+1 > prompts[i].reply->length) {
- g_warning("Password too long %d/%d", password_len+1, prompts[i].reply->length);
- goto cleanup;
- }
-
- memcpy(prompts[i].reply->data, (char *) password, password_len + 1);
- prompts[i].reply->length = password_len;
- errcode = 0;
- }
-cleanup:
- ka_pwdialog_hide (pwdialog, TRUE);
- /* Reset this, so we know the next time we get a TRUE value, it is accurate. */
- invalid_auth = FALSE;
-
- return errcode;
+ KaApplet *applet = KA_APPLET (data);
+ KaPwDialog *pwdialog = ka_applet_get_pwdialog (applet);
+ krb5_error_code errcode;
+ int i;
+
+ errcode = KRB5KRB_ERR_GENERIC;
+ canceled = FALSE;
+ canceled_creds_expiry = 0;
+
+ if (banner && !num_prompts)
+ ka_applet_set_msg (applet, banner);
+
+ for (i = 0; i < num_prompts; i++) {
+ const gchar *password = NULL;
+ int password_len = 0;
+ int response;
+ guint32 source_id;
+
+ errcode = KRB5_LIBOS_CANTREADPWD;
+
+ source_id =
+ g_timeout_add_seconds (5,
+ (GSourceFunc) krb5_auth_dialog_do_updates,
+ applet);
+ ka_pwdialog_setup (pwdialog, (gchar *) prompts[i].prompt,
+ invalid_auth);
+ response = ka_pwdialog_run (pwdialog);
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ password = ka_pwdialog_get_password (pwdialog);
+ password_len = strlen (password);
+ break;
+ case GTK_RESPONSE_DELETE_EVENT:
+ case GTK_RESPONSE_CANCEL:
+ canceled = TRUE;
+ break;
+ case GTK_RESPONSE_NONE:
+ break;
+ default:
+ g_warning ("Unknown Response: %d", response);
+ g_assert_not_reached ();
+ }
+ g_source_remove (source_id);
+
+ if (!password)
+ goto cleanup;
+ if (password_len + 1 > prompts[i].reply->length) {
+ g_warning ("Password too long %d/%d", password_len + 1,
+ prompts[i].reply->length);
+ goto cleanup;
+ }
+
+ memcpy (prompts[i].reply->data, (char *) password, password_len + 1);
+ prompts[i].reply->length = password_len;
+ errcode = 0;
+ }
+ cleanup:
+ ka_pwdialog_hide (pwdialog, TRUE);
+ /* Reset this, so we know the next time we get a TRUE value, it is accurate. */
+ invalid_auth = FALSE;
+
+ return errcode;
}
#ifdef ENABLE_NETWORK_MANAGER
static void
-ka_nm_client_state_changed_cb (NMClient *client,
- GParamSpec *pspec G_GNUC_UNUSED,
- gpointer data)
+ka_nm_client_state_changed_cb (NMClient * client,
+ GParamSpec *pspec G_GNUC_UNUSED, gpointer data)
{
- NMState state;
- gboolean *online = (gboolean*) data;
+ NMState state;
+ gboolean *online = (gboolean *) data;
- state = nm_client_get_state(client);
+ state = nm_client_get_state (client);
switch (state) {
- case NM_STATE_UNKNOWN:
- case NM_STATE_ASLEEP:
- case NM_STATE_CONNECTING:
- KA_DEBUG("Network state: %d", state);
- /* do nothing */
- break;
- case NM_STATE_DISCONNECTED:
- KA_DEBUG("Network disconnected");
- *online = FALSE;
- break;
- case NM_STATE_CONNECTED:
- KA_DEBUG("Network connected");
- *online = TRUE;
- break;
+ case NM_STATE_UNKNOWN:
+ case NM_STATE_ASLEEP:
+ case NM_STATE_CONNECTING:
+ KA_DEBUG ("Network state: %d", state);
+ /* do nothing */
+ break;
+ case NM_STATE_DISCONNECTED:
+ KA_DEBUG ("Network disconnected");
+ *online = FALSE;
+ break;
+ case NM_STATE_CONNECTED:
+ KA_DEBUG ("Network connected");
+ *online = TRUE;
+ break;
}
}
#endif
@@ -487,18 +487,18 @@ ka_nm_client_state_changed_cb (NMClient *client,
static gboolean
credentials_expiring (gpointer *data)
{
- KaApplet* applet = KA_APPLET(data);
+ KaApplet *applet = KA_APPLET (data);
- KA_DEBUG("Checking expiry <%ds", ka_applet_get_pw_prompt_secs(applet));
- if (credentials_expiring_real (applet) && is_online) {
- KA_DEBUG("Expiry @ %ld", creds_expiry);
+ KA_DEBUG ("Checking expiry <%ds", ka_applet_get_pw_prompt_secs (applet));
+ if (credentials_expiring_real (applet) && is_online) {
+ KA_DEBUG ("Expiry @ %ld", creds_expiry);
- if (!ka_renew_credentials (applet))
- KA_DEBUG("Credentials renewed");
- }
- ka_applet_update_status(applet, creds_expiry);
+ if (!ka_renew_credentials (applet))
+ KA_DEBUG ("Credentials renewed");
+ }
+ ka_applet_update_status (applet, creds_expiry);
- return TRUE;
+ return TRUE;
}
@@ -506,7 +506,7 @@ credentials_expiring (gpointer *data)
static gboolean
credentials_expiring_once (gpointer *data)
{
- credentials_expiring(data);
+ credentials_expiring (data);
return FALSE;
}
@@ -515,122 +515,117 @@ credentials_expiring_once (gpointer *data)
* set ticket options by looking at krb5.conf and gconf
*/
static void
-ka_set_ticket_options(KaApplet* applet, krb5_context context,
- krb5_get_init_creds_opt *out,
- const char* pk_userid G_GNUC_UNUSED,
- const char* pk_anchors G_GNUC_UNUSED)
+ka_set_ticket_options (KaApplet *applet, krb5_context context,
+ krb5_get_init_creds_opt * out,
+ const char *pk_userid G_GNUC_UNUSED,
+ const char *pk_anchors G_GNUC_UNUSED)
{
- gboolean flag;
+ gboolean flag;
+
#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS
- krb5_get_init_creds_opt_set_default_flags(context, PACKAGE,
- krb5_principal_get_realm(context, kprincipal), out);
+ krb5_get_init_creds_opt_set_default_flags (context, PACKAGE,
+ krb5_principal_get_realm
+ (context, kprincipal), out);
#endif
- g_object_get(applet, "tgt-forwardable", &flag, NULL);
- if (flag)
- krb5_get_init_creds_opt_set_forwardable(out, flag);
- g_object_get(applet, "tgt-proxiable", &flag, NULL);
- if (flag)
- krb5_get_init_creds_opt_set_proxiable(out, flag);
- g_object_get(applet, "tgt-renewable", &flag, NULL);
- if (flag) {
- krb5_deltat r = 3600*24*30; /* 1 month */
- krb5_get_init_creds_opt_set_renew_life (out, r);
- }
-
+ g_object_get (applet, "tgt-forwardable", &flag, NULL);
+ if (flag)
+ krb5_get_init_creds_opt_set_forwardable (out, flag);
+ g_object_get (applet, "tgt-proxiable", &flag, NULL);
+ if (flag)
+ krb5_get_init_creds_opt_set_proxiable (out, flag);
+ g_object_get (applet, "tgt-renewable", &flag, NULL);
+ if (flag) {
+ krb5_deltat r = 3600 * 24 * 30; /* 1 month */
+
+ krb5_get_init_creds_opt_set_renew_life (out, r);
+ }
#if ENABLE_PKINIT && HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PA
- /* pkinit optins for MIT Kerberos */
- if (pk_userid && strlen(pk_userid)) {
- KA_DEBUG("pkinit with '%s'", pk_userid);
- krb5_get_init_creds_opt_set_pa(context, out,
- "X509_user_identity", pk_userid);
- if (pk_anchors && strlen(pk_anchors)) {
- KA_DEBUG("pkinit anchors '%s'", pk_anchors);
- krb5_get_init_creds_opt_set_pa(context, out,
- "X509_anchors", pk_anchors);
- }
- }
+ /* pkinit optins for MIT Kerberos */
+ if (pk_userid && strlen (pk_userid)) {
+ KA_DEBUG ("pkinit with '%s'", pk_userid);
+ krb5_get_init_creds_opt_set_pa (context, out,
+ "X509_user_identity", pk_userid);
+ if (pk_anchors && strlen (pk_anchors)) {
+ KA_DEBUG ("pkinit anchors '%s'", pk_anchors);
+ krb5_get_init_creds_opt_set_pa (context, out,
+ "X509_anchors", pk_anchors);
+ }
+ }
#endif /* HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PA */
}
#if ENABLE_PKINIT && HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PKINIT
static krb5_error_code
-ka_auth_heimdal_pkinit(KaApplet* applet, krb5_creds* creds,
- const char* pk_userid, const char* pk_anchors)
+ka_auth_heimdal_pkinit (KaApplet *applet, krb5_creds *creds,
+ const char *pk_userid, const char *pk_anchors)
{
- krb5_get_init_creds_opt *opts = NULL;
- krb5_error_code retval;
- const char* pkinit_anchors = NULL;
-
- KA_DEBUG("pkinit with '%s'", pk_userid);
- if (pk_anchors && strlen (pk_anchors)) {
- pkinit_anchors = pk_anchors;
- KA_DEBUG("pkinit anchors '%s'", pkinit_anchors);
- }
-
- if ((retval = krb5_get_init_creds_opt_alloc (kcontext, &opts)))
- goto out;
-
- ka_set_ticket_options (applet, kcontext, opts, NULL, NULL);
- retval = krb5_get_init_creds_opt_set_pkinit(kcontext, opts,
- kprincipal,
- pk_userid,
- pkinit_anchors,
- NULL,
- NULL,
- 0, /* pk_use_enc_key */
- auth_dialog_prompter,
- applet, /* data */
- NULL); /* passwd */
- KA_DEBUG("pkinit returned with %d", retval);
- if (retval)
- goto out;
-
- retval = krb5_get_init_creds_password(kcontext, creds, kprincipal,
- NULL, auth_dialog_prompter, applet,
- 0, NULL, opts);
-out:
- if (opts)
- krb5_get_init_creds_opt_free(kcontext, opts);
- return retval;
+ krb5_get_init_creds_opt *opts = NULL;
+ krb5_error_code retval;
+ const char *pkinit_anchors = NULL;
+
+ KA_DEBUG ("pkinit with '%s'", pk_userid);
+ if (pk_anchors && strlen (pk_anchors)) {
+ pkinit_anchors = pk_anchors;
+ KA_DEBUG ("pkinit anchors '%s'", pkinit_anchors);
+ }
+
+ if ((retval = krb5_get_init_creds_opt_alloc (kcontext, &opts)))
+ goto out;
+
+ ka_set_ticket_options (applet, kcontext, opts, NULL, NULL);
+ retval = krb5_get_init_creds_opt_set_pkinit (kcontext, opts, kprincipal, pk_userid, pkinit_anchors, NULL, NULL, 0, /* pk_use_enc_key */
+ auth_dialog_prompter, applet, /* data */
+ NULL); /* passwd */
+ KA_DEBUG ("pkinit returned with %d", retval);
+ if (retval)
+ goto out;
+
+ retval = krb5_get_init_creds_password (kcontext, creds, kprincipal,
+ NULL, auth_dialog_prompter, applet,
+ 0, NULL, opts);
+ out:
+ if (opts)
+ krb5_get_init_creds_opt_free (kcontext, opts);
+ return retval;
}
#endif /* ! ENABLE_PKINIT */
static krb5_error_code
-ka_auth_password(KaApplet* applet, krb5_creds* creds,
- const char* pk_userid, const char* pk_anchors)
+ka_auth_password (KaApplet *applet, krb5_creds *creds,
+ const char *pk_userid, const char *pk_anchors)
{
- krb5_error_code retval;
- krb5_get_init_creds_opt *opts = NULL;
-
- if ((retval = krb5_get_init_creds_opt_alloc (kcontext, &opts)))
- goto out;
- ka_set_ticket_options (applet, kcontext, opts,
- pk_userid, pk_anchors);
-
- retval = krb5_get_init_creds_password(kcontext, creds, kprincipal,
- NULL, auth_dialog_prompter, applet,
- 0, NULL, opts);
-out:
- if (opts)
- krb5_get_init_creds_opt_free(kcontext, opts);
- return retval;
+ krb5_error_code retval;
+ krb5_get_init_creds_opt *opts = NULL;
+
+ if ((retval = krb5_get_init_creds_opt_alloc (kcontext, &opts)))
+ goto out;
+ ka_set_ticket_options (applet, kcontext, opts, pk_userid, pk_anchors);
+
+ retval = krb5_get_init_creds_password (kcontext, creds, kprincipal,
+ NULL, auth_dialog_prompter, applet,
+ 0, NULL, opts);
+ out:
+ if (opts)
+ krb5_get_init_creds_opt_free (kcontext, opts);
+ return retval;
}
static krb5_error_code
-ka_parse_name(KaApplet* applet, krb5_context krbcontext, krb5_principal* kprinc)
+ka_parse_name (KaApplet *applet, krb5_context krbcontext,
+ krb5_principal * kprinc)
{
- krb5_error_code ret;
- gchar *principal = NULL;
+ krb5_error_code ret;
+ gchar *principal = NULL;
- if (*kprinc != NULL)
- krb5_free_principal(krbcontext, *kprinc);
+ if (*kprinc != NULL)
+ krb5_free_principal (krbcontext, *kprinc);
- g_object_get(applet, "principal", &principal, NULL);
- ret = krb5_parse_name(krbcontext, principal, kprinc);
+ g_object_get (applet, "principal", &principal, NULL);
+ ret = krb5_parse_name (krbcontext, principal, kprinc);
- g_free(principal);
- return ret;
+ g_free (principal);
+ return ret;
}
@@ -639,208 +634,206 @@ ka_parse_name(KaApplet* applet, krb5_context krbcontext, krb5_principal* kprinc)
*
* caller needs to free the returned result using g_free();
*/
-char*
+char *
ka_unparse_name ()
{
- char *princ, *gprinc = NULL;
- krb5_error_code err;
+ char *princ, *gprinc = NULL;
+ krb5_error_code err;
- if (!kprincipal)
- goto out;
+ if (!kprincipal)
+ goto out;
- if ((err = krb5_unparse_name (kcontext, kprincipal, &princ))) {
- ka_log_error_message(__func__, kcontext, err);
- goto out;
- }
+ if ((err = krb5_unparse_name (kcontext, kprincipal, &princ))) {
+ ka_log_error_message (__func__, kcontext, err);
+ goto out;
+ }
- gprinc = g_strdup (princ);
- free (princ);
-out:
- return gprinc;
+ gprinc = g_strdup (princ);
+ free (princ);
+ out:
+ return gprinc;
}
static void
-ccache_changed_cb (GFileMonitor *monitor G_GNUC_UNUSED,
- GFile *file,
- GFile *other_file G_GNUC_UNUSED,
- GFileMonitorEvent event_type,
- gpointer data)
+ccache_changed_cb (GFileMonitor * monitor G_GNUC_UNUSED,
+ GFile * file,
+ GFile * other_file G_GNUC_UNUSED,
+ GFileMonitorEvent event_type, gpointer data)
{
- KaApplet *applet = KA_APPLET(data);
- gchar *ccache_name = g_file_get_path(file);
-
- switch (event_type) {
- case G_FILE_MONITOR_EVENT_DELETED:
- case G_FILE_MONITOR_EVENT_CREATED:
- case G_FILE_MONITOR_EVENT_CHANGED:
- KA_DEBUG ("%s changed", ccache_name);
- credentials_expiring ((gpointer)applet);
- break;
- default:
- KA_DEBUG ("%s unhandled event: %d", ccache_name, event_type);
- }
- g_free (ccache_name);
+ KaApplet *applet = KA_APPLET (data);
+ gchar *ccache_name = g_file_get_path (file);
+
+ switch (event_type) {
+ case G_FILE_MONITOR_EVENT_DELETED:
+ case G_FILE_MONITOR_EVENT_CREATED:
+ case G_FILE_MONITOR_EVENT_CHANGED:
+ KA_DEBUG ("%s changed", ccache_name);
+ credentials_expiring ((gpointer) applet);
+ break;
+ default:
+ KA_DEBUG ("%s unhandled event: %d", ccache_name, event_type);
+ }
+ g_free (ccache_name);
}
-static GFileMonitor*
-monitor_ccache(KaApplet *applet)
+static GFileMonitor *
+monitor_ccache (KaApplet *applet)
{
- const gchar *ccache_name;
- GFile *ccache;
- GFileMonitor *monitor = NULL;
- GError *err = NULL;
-
- ccache_name = ka_ccache_filename ();
- g_return_val_if_fail (ccache_name != NULL, FALSE);
-
- ccache = g_file_new_for_path (ccache_name);
- monitor = g_file_monitor_file (ccache, G_FILE_MONITOR_NONE, NULL, &err);
- g_assert ((!monitor && err) || (monitor && !err));
- if (!monitor) {
- /* cache disappeared? */
- if (err->code == G_FILE_ERROR_NOENT)
- credentials_expiring ((gpointer)applet);
- else
- g_warning ("Failed to monitor %s: %s", ccache_name, err->message);
- } else {
- /* g_file_monitor_set_rate_limit(monitor, 10*1000); */
- g_signal_connect (monitor, "changed", G_CALLBACK (ccache_changed_cb), applet);
- KA_DEBUG ("Monitoring %s", ccache_name);
- }
- g_object_unref (ccache);
- g_clear_error (&err);
- return monitor;
+ const gchar *ccache_name;
+ GFile *ccache;
+ GFileMonitor *monitor = NULL;
+ GError *err = NULL;
+
+ ccache_name = ka_ccache_filename ();
+ g_return_val_if_fail (ccache_name != NULL, FALSE);
+
+ ccache = g_file_new_for_path (ccache_name);
+ monitor = g_file_monitor_file (ccache, G_FILE_MONITOR_NONE, NULL, &err);
+ g_assert ((!monitor && err) || (monitor && !err));
+ if (!monitor) {
+ /* cache disappeared? */
+ if (err->code == G_FILE_ERROR_NOENT)
+ credentials_expiring ((gpointer) applet);
+ else
+ g_warning ("Failed to monitor %s: %s", ccache_name, err->message);
+ } else {
+ /* g_file_monitor_set_rate_limit(monitor, 10*1000); */
+ g_signal_connect (monitor, "changed", G_CALLBACK (ccache_changed_cb),
+ applet);
+ KA_DEBUG ("Monitoring %s", ccache_name);
+ }
+ g_object_unref (ccache);
+ g_clear_error (&err);
+ return monitor;
}
/* grab credentials interactively */
static int
-grab_credentials (KaApplet* applet)
+grab_credentials (KaApplet *applet)
{
- krb5_error_code retval = KRB5_KDC_UNREACH;
- krb5_creds my_creds;
- krb5_ccache ccache;
- gchar *pk_userid = NULL;
- gchar *pk_anchors = NULL;
- gchar *errmsg = NULL;
- gboolean pw_auth = TRUE;
-
- memset(&my_creds, 0, sizeof(my_creds));
-
- retval = ka_parse_name(applet, kcontext, &kprincipal);
- if (retval)
- goto out2;
-
- retval = krb5_cc_default (kcontext, &ccache);
- if (retval)
- goto out2;
-
- g_object_get(applet, "pk-userid", &pk_userid,
- "pk-anchors", &pk_anchors,
- NULL);
+ krb5_error_code retval = KRB5_KDC_UNREACH;
+ krb5_creds my_creds;
+ krb5_ccache ccache;
+ gchar *pk_userid = NULL;
+ gchar *pk_anchors = NULL;
+ gchar *errmsg = NULL;
+ gboolean pw_auth = TRUE;
+
+ memset (&my_creds, 0, sizeof (my_creds));
+
+ retval = ka_parse_name (applet, kcontext, &kprincipal);
+ if (retval)
+ goto out2;
+
+ retval = krb5_cc_default (kcontext, &ccache);
+ if (retval)
+ goto out2;
+
+ g_object_get (applet, "pk-userid", &pk_userid,
+ "pk-anchors", &pk_anchors, NULL);
#if ENABLE_PKINIT && HAVE_HX509_ERR_H && HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PKINIT
- /* pk_userid set: try pkinit */
- if (pk_userid && strlen(pk_userid)) {
- retval = ka_auth_heimdal_pkinit(applet, &my_creds,
- pk_userid, pk_anchors);
- /* other error than: "no token found" - no need to try password auth: */
- if (retval != HX509_PKCS11_NO_TOKEN && retval != HX509_PKCS11_NO_SLOT)
- pw_auth = FALSE;
- }
+ /* pk_userid set: try pkinit */
+ if (pk_userid && strlen (pk_userid)) {
+ retval = ka_auth_heimdal_pkinit (applet, &my_creds,
+ pk_userid, pk_anchors);
+ /* other error than: "no token found" - no need to try password auth: */
+ if (retval != HX509_PKCS11_NO_TOKEN && retval != HX509_PKCS11_NO_SLOT)
+ pw_auth = FALSE;
+ }
#endif /* ENABLE_PKINIT */
- if (pw_auth)
- retval = ka_auth_password(applet, &my_creds,
- pk_userid, pk_anchors);
-
- creds_expiry = my_creds.times.endtime;
- if (canceled)
- canceled_creds_expiry = creds_expiry;
- if (retval) {
- switch (retval) {
- case KRB5KDC_ERR_PREAUTH_FAILED:
- case KRB5KRB_AP_ERR_BAD_INTEGRITY:
+ if (pw_auth)
+ retval = ka_auth_password (applet, &my_creds, pk_userid, pk_anchors);
+
+ creds_expiry = my_creds.times.endtime;
+ if (canceled)
+ canceled_creds_expiry = creds_expiry;
+ if (retval) {
+ switch (retval) {
+ case KRB5KDC_ERR_PREAUTH_FAILED:
+ case KRB5KRB_AP_ERR_BAD_INTEGRITY:
#ifdef HAVE_HX509_ERR_H
- case HX509_PKCS11_LOGIN:
-#endif /* Invalid password/pin, try again. */
- invalid_auth = TRUE;
- break;
- default:
- errmsg = ka_get_error_message(kcontext, retval);
- KA_DEBUG("Auth failed with %d: %s", retval,
- errmsg);
- g_free(errmsg);
- break;
- }
- goto out;
- }
- retval = krb5_cc_initialize(kcontext, ccache, kprincipal);
- if (retval)
- goto out;
-
- retval = krb5_cc_store_cred(kcontext, ccache, &my_creds);
- if (retval)
- goto out;
-out:
- krb5_free_cred_contents (kcontext, &my_creds);
- krb5_cc_close (kcontext, ccache);
-out2:
- g_free(pk_userid);
- return retval;
+ case HX509_PKCS11_LOGIN:
+#endif /* Invalid password/pin, try again. */
+ invalid_auth = TRUE;
+ break;
+ default:
+ errmsg = ka_get_error_message (kcontext, retval);
+ KA_DEBUG ("Auth failed with %d: %s", retval, errmsg);
+ g_free (errmsg);
+ break;
+ }
+ goto out;
+ }
+ retval = krb5_cc_initialize (kcontext, ccache, kprincipal);
+ if (retval)
+ goto out;
+
+ retval = krb5_cc_store_cred (kcontext, ccache, &my_creds);
+ if (retval)
+ goto out;
+ out:
+ krb5_free_cred_contents (kcontext, &my_creds);
+ krb5_cc_close (kcontext, ccache);
+ out2:
+ g_free (pk_userid);
+ return retval;
}
/* try to renew the credentials noninteractively */
static int
-ka_renew_credentials (KaApplet* applet)
+ka_renew_credentials (KaApplet *applet)
{
- krb5_error_code retval;
- krb5_creds my_creds;
- krb5_ccache ccache;
-
- memset(&my_creds, 0, sizeof(my_creds));
- if (kprincipal == NULL) {
- retval = ka_parse_name(applet, kcontext, &kprincipal);
- if (retval)
- return retval;
- }
-
- retval = krb5_cc_default (kcontext, &ccache);
- if (retval)
- return retval;
-
- retval = ka_get_tgt_from_ccache (kcontext, &my_creds);
- if (!retval) {
- krb5_free_cred_contents (kcontext, &my_creds);
- krb5_cc_close (kcontext, ccache);
- return -1;
- }
-
- if (ka_applet_get_tgt_renewable(applet)) {
- krb5_free_cred_contents (kcontext, &my_creds);
- retval = get_renewed_creds (kcontext, &my_creds, kprincipal, ccache, NULL);
- if (retval)
- goto out;
-
- retval = krb5_cc_initialize(kcontext, ccache, kprincipal);
- if(retval) {
- ka_log_error_message("krb5_cc_initialize", kcontext, retval);
- goto out;
- }
- retval = krb5_cc_store_cred(kcontext, ccache, &my_creds);
- if (retval) {
- ka_log_error_message("krb5_cc_store_cred", kcontext, retval);
- goto out;
- }
- ka_applet_signal_emit (applet, KA_SIGNAL_RENEWED_TGT,
- my_creds.times.endtime);
- }
-out:
- if (!retval)
- creds_expiry = my_creds.times.endtime;
- krb5_free_cred_contents (kcontext, &my_creds);
- krb5_cc_close (kcontext, ccache);
- return retval;
+ krb5_error_code retval;
+ krb5_creds my_creds;
+ krb5_ccache ccache;
+
+ memset (&my_creds, 0, sizeof (my_creds));
+ if (kprincipal == NULL) {
+ retval = ka_parse_name (applet, kcontext, &kprincipal);
+ if (retval)
+ return retval;
+ }
+
+ retval = krb5_cc_default (kcontext, &ccache);
+ if (retval)
+ return retval;
+
+ retval = ka_get_tgt_from_ccache (kcontext, &my_creds);
+ if (!retval) {
+ krb5_free_cred_contents (kcontext, &my_creds);
+ krb5_cc_close (kcontext, ccache);
+ return -1;
+ }
+
+ if (ka_applet_get_tgt_renewable (applet)) {
+ krb5_free_cred_contents (kcontext, &my_creds);
+ retval =
+ get_renewed_creds (kcontext, &my_creds, kprincipal, ccache, NULL);
+ if (retval)
+ goto out;
+
+ retval = krb5_cc_initialize (kcontext, ccache, kprincipal);
+ if (retval) {
+ ka_log_error_message ("krb5_cc_initialize", kcontext, retval);
+ goto out;
+ }
+ retval = krb5_cc_store_cred (kcontext, ccache, &my_creds);
+ if (retval) {
+ ka_log_error_message ("krb5_cc_store_cred", kcontext, retval);
+ goto out;
+ }
+ ka_applet_signal_emit (applet, KA_SIGNAL_RENEWED_TGT,
+ my_creds.times.endtime);
+ }
+ out:
+ if (!retval)
+ creds_expiry = my_creds.times.endtime;
+ krb5_free_cred_contents (kcontext, &my_creds);
+ krb5_cc_close (kcontext, ccache);
+ return retval;
}
@@ -849,77 +842,77 @@ out:
static gboolean
ka_get_tgt_from_ccache (krb5_context context, krb5_creds *creds)
{
- krb5_ccache ccache;
- krb5_creds pattern;
- krb5_principal principal;
- gboolean ret = FALSE;
-
- ka_krb5_cc_clear_mcred(&pattern);
-
- if (krb5_cc_default(context, &ccache))
- return FALSE;
-
- if (krb5_cc_get_principal(context, ccache, &principal))
- goto out;
-
- if (krb5_build_principal_ext(context, &pattern.server,
- get_principal_realm_length(principal),
- get_principal_realm_data(principal),
- KRB5_TGS_NAME_SIZE,
- KRB5_TGS_NAME,
- get_principal_realm_length(principal),
- get_principal_realm_data(principal), 0)) {
- goto out_free_princ;
- }
- pattern.client = principal;
- if (!krb5_cc_retrieve_cred(context, ccache, 0, &pattern, creds))
- ret = TRUE;
-
- krb5_free_principal(context, pattern.server);
-out_free_princ:
- krb5_free_principal(context, principal);
-out:
- krb5_cc_close(context, ccache);
- return ret;
+ krb5_ccache ccache;
+ krb5_creds pattern;
+ krb5_principal principal;
+ gboolean ret = FALSE;
+
+ ka_krb5_cc_clear_mcred (&pattern);
+
+ if (krb5_cc_default (context, &ccache))
+ return FALSE;
+
+ if (krb5_cc_get_principal (context, ccache, &principal))
+ goto out;
+
+ if (krb5_build_principal_ext (context, &pattern.server,
+ get_principal_realm_length (principal),
+ get_principal_realm_data (principal),
+ KRB5_TGS_NAME_SIZE,
+ KRB5_TGS_NAME,
+ get_principal_realm_length (principal),
+ get_principal_realm_data (principal), 0)) {
+ goto out_free_princ;
+ }
+ pattern.client = principal;
+ if (!krb5_cc_retrieve_cred (context, ccache, 0, &pattern, creds))
+ ret = TRUE;
+
+ krb5_free_principal (context, pattern.server);
+ out_free_princ:
+ krb5_free_principal (context, principal);
+ out:
+ krb5_cc_close (context, ccache);
+ return ret;
}
static gboolean
-using_krb5(void)
+using_krb5 (void)
{
- krb5_error_code err;
- gboolean have_tgt = FALSE;
- krb5_creds creds;
-
- err = krb5_init_context(&kcontext);
- if (err)
- return FALSE;
-
- have_tgt = ka_get_tgt_from_ccache(kcontext, &creds);
- if (have_tgt) {
- krb5_copy_principal(kcontext, creds.client, &kprincipal);
- krb5_free_cred_contents (kcontext, &creds);
- }
- return have_tgt;
+ krb5_error_code err;
+ gboolean have_tgt = FALSE;
+ krb5_creds creds;
+
+ err = krb5_init_context (&kcontext);
+ if (err)
+ return FALSE;
+
+ have_tgt = ka_get_tgt_from_ccache (kcontext, &creds);
+ if (have_tgt) {
+ krb5_copy_principal (kcontext, creds.client, &kprincipal);
+ krb5_free_cred_contents (kcontext, &creds);
+ }
+ return have_tgt;
}
gboolean
ka_destroy_ccache (KaApplet *applet)
{
- krb5_ccache ccache;
- const char* cache;
- krb5_error_code ret;
+ krb5_ccache ccache;
+ const char *cache;
+ krb5_error_code ret;
- cache = krb5_cc_default_name(kcontext);
- ret = krb5_cc_resolve(kcontext, cache, &ccache);
- ret = krb5_cc_destroy (kcontext, ccache);
+ cache = krb5_cc_default_name (kcontext);
+ ret = krb5_cc_resolve (kcontext, cache, &ccache);
+ ret = krb5_cc_destroy (kcontext, ccache);
- credentials_expiring_real(applet);
+ credentials_expiring_real (applet);
- if (ret)
- return FALSE;
- else
- return TRUE;
+ if (ret)
+ return FALSE;
+ else
+ return TRUE;
}
@@ -928,101 +921,104 @@ ka_destroy_ccache (KaApplet *applet)
* principal: requested principal - if empty use default
*/
gboolean
-ka_check_credentials (KaApplet *applet, const char* newprincipal)
+ka_check_credentials (KaApplet *applet, const char *newprincipal)
{
- gboolean success = FALSE;
- int retval;
- char* principal;
-
- g_object_get(applet, "principal", &principal, NULL);
-
- if (strlen(newprincipal)) {
- krb5_principal knewprinc;
-
- /* no ticket cache: is requested princ the one from our config? */
- if (!kprincipal && g_strcmp0(principal, newprincipal)) {
- KA_DEBUG("Requested principal %s not %s", principal, newprincipal);
- goto out;
- }
-
- /* ticket cache: check if the requested principal is the one we have */
- retval = krb5_parse_name(kcontext, newprincipal, &knewprinc);
- if (retval) {
- g_warning ("Cannot parse principal '%s'", newprincipal);
- goto out;
- }
- if (kprincipal && !krb5_principal_compare (kcontext, kprincipal, knewprinc)) {
- KA_DEBUG("Current Principal '%s' not '%s'", principal, newprincipal);
- krb5_free_principal(kcontext, knewprinc);
- goto out;
- }
- krb5_free_principal(kcontext, knewprinc);
- }
-
- if (credentials_expiring_real (applet)) {
- if (!is_online)
- success = FALSE;
- else
- success = ka_grab_credentials (applet);
- } else
- success = TRUE;
-out:
- g_free (principal);
- return success;
+ gboolean success = FALSE;
+ int retval;
+ char *principal;
+
+ g_object_get (applet, "principal", &principal, NULL);
+
+ if (strlen (newprincipal)) {
+ krb5_principal knewprinc;
+
+ /* no ticket cache: is requested princ the one from our config? */
+ if (!kprincipal && g_strcmp0 (principal, newprincipal)) {
+ KA_DEBUG ("Requested principal %s not %s", principal,
+ newprincipal);
+ goto out;
+ }
+
+ /* ticket cache: check if the requested principal is the one we have */
+ retval = krb5_parse_name (kcontext, newprincipal, &knewprinc);
+ if (retval) {
+ g_warning ("Cannot parse principal '%s'", newprincipal);
+ goto out;
+ }
+ if (kprincipal
+ && !krb5_principal_compare (kcontext, kprincipal, knewprinc)) {
+ KA_DEBUG ("Current Principal '%s' not '%s'", principal,
+ newprincipal);
+ krb5_free_principal (kcontext, knewprinc);
+ goto out;
+ }
+ krb5_free_principal (kcontext, knewprinc);
+ }
+
+ if (credentials_expiring_real (applet)) {
+ if (!is_online)
+ success = FALSE;
+ else
+ success = ka_grab_credentials (applet);
+ } else
+ success = TRUE;
+ out:
+ g_free (principal);
+ return success;
}
/* initiate grabbing of credentials (e.g. on leftclick of tray icon) */
gboolean
-ka_grab_credentials (KaApplet* applet)
+ka_grab_credentials (KaApplet *applet)
{
- int retval;
- int success = FALSE;
- KaPwDialog *pwdialog = ka_applet_get_pwdialog(applet);
-
- ka_pwdialog_set_persist(pwdialog, TRUE);
- do {
- retval = grab_credentials (applet);
- if (invalid_auth)
- continue;
- if (canceled)
- break;
- if (retval) {
- gchar *errmsg;
-
- errmsg = ka_get_error_message(kcontext, retval);
- ka_pwdialog_error(pwdialog, errmsg);
- g_free (errmsg);
- break;
- } else {
- success = TRUE;
- break;
- }
- } while(TRUE);
-
- ka_pwdialog_set_persist(pwdialog, FALSE);
- credentials_expiring_real(applet);
-
- return success;
+ int retval;
+ int success = FALSE;
+ KaPwDialog *pwdialog = ka_applet_get_pwdialog (applet);
+
+ ka_pwdialog_set_persist (pwdialog, TRUE);
+ do {
+ retval = grab_credentials (applet);
+ if (invalid_auth)
+ continue;
+ if (canceled)
+ break;
+ if (retval) {
+ gchar *errmsg;
+
+ errmsg = ka_get_error_message (kcontext, retval);
+ ka_pwdialog_error (pwdialog, errmsg);
+ g_free (errmsg);
+ break;
+ } else {
+ success = TRUE;
+ break;
+ }
+ } while (TRUE);
+
+ ka_pwdialog_set_persist (pwdialog, FALSE);
+ credentials_expiring_real (applet);
+
+ return success;
}
static void
ka_secmem_init (void)
{
- /* Initialize secure memory. 1 is too small, so the default size
- will be used. */
- secmem_init (1);
- secmem_set_flags (SECMEM_WARN);
- drop_privs ();
-
- if (atexit (secmem_term))
- g_error("Couln't register atexit handler");
+ /* Initialize secure memory. 1 is too small, so the default size
+ will be used. */
+ secmem_init (1);
+ secmem_set_flags (SECMEM_WARN);
+ drop_privs ();
+
+ if (atexit (secmem_term))
+ g_error ("Couln't register atexit handler");
}
static void
-ka_nm_shutdown(void)
+ka_nm_shutdown (void)
{
#ifdef ENABLE_NETWORK_MANAGER
if (nm_client) {
@@ -1034,18 +1030,18 @@ ka_nm_shutdown(void)
static gboolean
-ka_nm_init(void)
+ka_nm_init (void)
{
#ifdef ENABLE_NETWORK_MANAGER
- nm_client = nm_client_new();
+ nm_client = nm_client_new ();
if (!nm_client) {
g_warning ("Could not initialize nm-client");
} else {
- g_signal_connect(nm_client, "notify::state",
- G_CALLBACK(ka_nm_client_state_changed_cb),
- &is_online);
- /* Set initial state */
- ka_nm_client_state_changed_cb(nm_client, NULL, &is_online);
+ g_signal_connect (nm_client, "notify::state",
+ G_CALLBACK (ka_nm_client_state_changed_cb),
+ &is_online);
+ /* Set initial state */
+ ka_nm_client_state_changed_cb (nm_client, NULL, &is_online);
}
#endif /* ENABLE_NETWORK_MANAGER */
return TRUE;
@@ -1055,64 +1051,70 @@ ka_nm_init(void)
int
main (int argc, char *argv[])
{
- KaApplet *applet;
- GOptionContext *context;
- GError *error = NULL;
-
- guint status = 0;
- gboolean run_auto = FALSE, run_always = FALSE;
-
- const char *help_msg = "Run '" PACKAGE " --help' to see a full list of available command line options";
- const GOptionEntry options [] = {
- {"auto", 'a', 0, G_OPTION_ARG_NONE, &run_auto,
- "Only run if an initialized ccache is found", NULL},
- /* accepted for compatibility only */
- {"always", 'A', 0, G_OPTION_ARG_NONE, &run_always,
- "Always run (default)", NULL},
- { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
- };
- GFileMonitor *monitor = NULL;
-
- context = g_option_context_new ("- Kerberos 5 credential checking");
- g_option_context_add_main_entries (context, options, NULL);
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
- g_option_context_parse (context, &argc, &argv, &error);
-
- if (error) {
- g_print ("%s\n%s\n",
- error->message,
- help_msg);
- g_clear_error (&error);
- return 1;
- }
- g_option_context_free (context);
-
- textdomain (PACKAGE);
- bind_textdomain_codeset (PACKAGE, "UTF-8");
- bindtextdomain (PACKAGE, LOCALE_DIR);
- ka_secmem_init();
-
- if (!ka_dbus_connect (&status))
- exit(status);
-
- always_run = !run_auto;
- if (using_krb5 () || always_run) {
- g_set_application_name (KA_NAME);
-
- applet = ka_applet_create ();
- if (!applet)
- return 1;
- ka_nm_init();
-
- g_timeout_add_seconds (CREDENTIAL_CHECK_INTERVAL, (GSourceFunc)credentials_expiring, applet);
- g_idle_add ((GSourceFunc)credentials_expiring_once, applet);
- monitor = monitor_ccache (applet);
-
- ka_dbus_service(applet);
- gtk_main ();
- }
- ka_nm_shutdown();
- if (monitor)
- g_object_unref (monitor);
- return 0;
+ KaApplet *applet;
+ GOptionContext *context;
+ GError *error = NULL;
+
+ gboolean run_auto = FALSE, run_always = FALSE;
+
+ const char *help_msg =
+ "Run '" PACKAGE
+ " --help' to see a full list of available command line options";
+ const GOptionEntry options[] = {
+ {"auto", 'a', 0, G_OPTION_ARG_NONE, &run_auto,
+ "Only run if an initialized ccache is found", NULL},
+ /* accepted for compatibility only */
+ {"always", 'A', 0, G_OPTION_ARG_NONE, &run_always,
+ "Always run (default)", NULL},
+ {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
+ };
+ GFileMonitor *monitor = NULL;
+
+ context = g_option_context_new ("- Kerberos 5 credential checking");
+ g_option_context_add_main_entries (context, options, NULL);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_parse (context, &argc, &argv, &error);
+
+ if (error) {
+ g_print ("%s\n%s\n", error->message, help_msg);
+ g_clear_error (&error);
+ return 1;
+ }
+ g_option_context_free (context);
+
+ textdomain (PACKAGE);
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
+ bindtextdomain (PACKAGE, LOCALE_DIR);
+ ka_secmem_init ();
+
+ always_run = !run_auto;
+ if (using_krb5 () || always_run) {
+ g_set_application_name (KA_NAME);
+
+ applet = ka_applet_create ();
+ if (!applet)
+ return 1;
+
+ if (!ka_dbus_connect (applet)) {
+ ka_applet_destroy (applet);
+ return 1;
+ }
+ ka_nm_init ();
+
+ g_timeout_add_seconds (CREDENTIAL_CHECK_INTERVAL,
+ (GSourceFunc) credentials_expiring, applet);
+ g_idle_add ((GSourceFunc) credentials_expiring_once, applet);
+ monitor = monitor_ccache (applet);
+
+ gtk_main ();
+ }
+ ka_dbus_disconnect ();
+ ka_nm_shutdown ();
+ if (monitor)
+ g_object_unref (monitor);
+ return 0;
}
+
+/*
+ * vim:ts=4:sts=4:sw=4:et:
+ */
diff --git a/src/ka-pwdialog.c b/src/ka-pwdialog.c
index 0570ac2..49ed2e4 100644
--- a/src/ka-pwdialog.c
+++ b/src/ka-pwdialog.c
@@ -28,281 +28,298 @@
#include "ka-entry-buffer.h"
struct _KaPwDialog {
- GObject parent;
+ GObject parent;
- KaPwDialogPrivate *priv;
+ KaPwDialogPrivate *priv;
};
struct _KaPwDialogClass {
- GObjectClass parent;
+ GObjectClass parent;
};
-G_DEFINE_TYPE(KaPwDialog, ka_pwdialog, G_TYPE_OBJECT);
-
-struct _KaPwDialogPrivate
-{
- /* The password dialog */
- GtkWidget* dialog; /* the password dialog itself */
- GtkWidget* status_label; /* the wrong password/timeout label */
- GtkWidget* krb_label; /* krb5 passwort prompt label */
- GtkWidget* pw_entry; /* password entry field */
- gboolean persist; /* don't hide the dialog when creds are still valid */
- gboolean grabbed; /* keyboard grabbed? */
- GtkWidget* error_dialog; /* error dialog */
+G_DEFINE_TYPE (KaPwDialog, ka_pwdialog, G_TYPE_OBJECT);
+
+struct _KaPwDialogPrivate {
+ /* The password dialog */
+ GtkWidget *dialog; /* the password dialog itself */
+ GtkWidget *status_label; /* the wrong password/timeout label */
+ GtkWidget *krb_label; /* krb5 passwort prompt label */
+ GtkWidget *pw_entry; /* password entry field */
+ gboolean persist; /* don't hide the dialog when creds are still valid */
+ gboolean grabbed; /* keyboard grabbed? */
+ GtkWidget *error_dialog; /* error dialog */
};
static void
-ka_pwdialog_init(KaPwDialog *pwdialog)
+ka_pwdialog_init (KaPwDialog *pwdialog)
{
- pwdialog->priv = G_TYPE_INSTANCE_GET_PRIVATE(pwdialog,
- KA_TYPE_PWDIALOG,
- KaPwDialogPrivate);
+ pwdialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (pwdialog,
+ KA_TYPE_PWDIALOG,
+ KaPwDialogPrivate);
}
static void
-ka_pwdialog_finalize(GObject *object)
+ka_pwdialog_finalize (GObject *object)
{
- KaPwDialog* pwdialog = KA_PWDIALOG (object);
- GObjectClass *parent_class = G_OBJECT_CLASS (ka_pwdialog_parent_class);
+ KaPwDialog *pwdialog = KA_PWDIALOG (object);
+ GObjectClass *parent_class = G_OBJECT_CLASS (ka_pwdialog_parent_class);
- gtk_widget_destroy (pwdialog->priv->error_dialog);
- pwdialog->priv->error_dialog = NULL;
+ gtk_widget_destroy (pwdialog->priv->error_dialog);
+ pwdialog->priv->error_dialog = NULL;
- if (parent_class->finalize != NULL)
- parent_class->finalize (object);
+ if (parent_class->finalize != NULL)
+ parent_class->finalize (object);
}
static void
-ka_pwdialog_class_init(KaPwDialogClass *klass)
+ka_pwdialog_class_init (KaPwDialogClass * klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = ka_pwdialog_finalize;
- g_type_class_add_private(klass, sizeof(KaPwDialogPrivate));
+ object_class->finalize = ka_pwdialog_finalize;
+ g_type_class_add_private (klass, sizeof (KaPwDialogPrivate));
}
-static KaPwDialog*
-ka_pwdialog_new(void)
+static KaPwDialog *
+ka_pwdialog_new (void)
{
- return g_object_new (KA_TYPE_PWDIALOG, NULL);
+ return g_object_new (KA_TYPE_PWDIALOG, NULL);
}
static gboolean
-grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
+grab_keyboard (GtkWidget *win, GdkEvent * event, gpointer data)
{
- KaPwDialog* pwdialog = KA_PWDIALOG(data);
-
- GdkGrabStatus status;
- if (!pwdialog->priv->grabbed) {
- status = gdk_keyboard_grab (gtk_widget_get_window (win),
- FALSE, gdk_event_get_time (event));
- if (status == GDK_GRAB_SUCCESS)
- pwdialog->priv->grabbed = TRUE;
- else
- g_message ("could not grab keyboard: %d", (int)status);
- }
- return FALSE;
+ KaPwDialog *pwdialog = KA_PWDIALOG (data);
+
+ GdkGrabStatus status;
+
+ if (!pwdialog->priv->grabbed) {
+ status = gdk_keyboard_grab (gtk_widget_get_window (win),
+ FALSE, gdk_event_get_time (event));
+ if (status == GDK_GRAB_SUCCESS)
+ pwdialog->priv->grabbed = TRUE;
+ else
+ g_message ("could not grab keyboard: %d", (int) status);
+ }
+ return FALSE;
}
static gboolean
ungrab_keyboard (GtkWidget *win G_GNUC_UNUSED,
- GdkEvent *event,
- gpointer data)
+ GdkEvent * event, gpointer data)
{
- KaPwDialog* pwdialog = KA_PWDIALOG(data);
+ KaPwDialog *pwdialog = KA_PWDIALOG (data);
- if (pwdialog->priv->grabbed)
- gdk_keyboard_ungrab (gdk_event_get_time (event));
- pwdialog->priv->grabbed = FALSE;
- return FALSE;
+ if (pwdialog->priv->grabbed)
+ gdk_keyboard_ungrab (gdk_event_get_time (event));
+ pwdialog->priv->grabbed = FALSE;
+ return FALSE;
}
static gboolean
-window_state_changed (GtkWidget *win, GdkEventWindowState *event, gpointer data)
+window_state_changed (GtkWidget *win, GdkEventWindowState *event,
+ gpointer data)
{
- GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (win));
+ GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (win));
- if (state & GDK_WINDOW_STATE_WITHDRAWN ||
- state & GDK_WINDOW_STATE_ICONIFIED ||
- state & GDK_WINDOW_STATE_FULLSCREEN ||
- state & GDK_WINDOW_STATE_MAXIMIZED)
- ungrab_keyboard (win, (GdkEvent*)event, data);
- else
- grab_keyboard (win, (GdkEvent*)event, data);
+ if (state & GDK_WINDOW_STATE_WITHDRAWN ||
+ state & GDK_WINDOW_STATE_ICONIFIED ||
+ state & GDK_WINDOW_STATE_FULLSCREEN ||
+ state & GDK_WINDOW_STATE_MAXIMIZED)
+ ungrab_keyboard (win, (GdkEvent *) event, data);
+ else
+ grab_keyboard (win, (GdkEvent *) event, data);
- return FALSE;
+ return FALSE;
}
gint
-ka_pwdialog_run(KaPwDialog* self)
+ka_pwdialog_run (KaPwDialog *self)
{
- GtkWidget *dialog = self->priv->dialog;
-
- /* cleanup old error dialog, if present (e.g. user didn't acknowledge
- * the error but clicked the tray icon again) */
- if (self->priv->error_dialog)
- gtk_widget_hide (self->priv->error_dialog);
-
- /* make sure we pop up on top */
- gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
-
- /*
- * grab the keyboard so that people don't accidentally type their
- * passwords in other windows.
- */
- g_signal_connect (dialog, "map-event", G_CALLBACK (grab_keyboard), self);
- g_signal_connect (dialog, "unmap-event", G_CALLBACK (ungrab_keyboard), self);
- g_signal_connect (dialog, "window-state-event", G_CALLBACK (window_state_changed), self);
-
- gtk_widget_grab_focus (self->priv->pw_entry);
- gtk_widget_show(dialog);
- return gtk_dialog_run (GTK_DIALOG(dialog));
+ GtkWidget *dialog = self->priv->dialog;
+
+ /* cleanup old error dialog, if present (e.g. user didn't acknowledge
+ * the error but clicked the tray icon again) */
+ if (self->priv->error_dialog)
+ gtk_widget_hide (self->priv->error_dialog);
+
+ /* make sure we pop up on top */
+ gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
+
+ /*
+ * grab the keyboard so that people don't accidentally type their
+ * passwords in other windows.
+ */
+ g_signal_connect (dialog, "map-event", G_CALLBACK (grab_keyboard), self);
+ g_signal_connect (dialog, "unmap-event", G_CALLBACK (ungrab_keyboard),
+ self);
+ g_signal_connect (dialog, "window-state-event",
+ G_CALLBACK (window_state_changed), self);
+
+ gtk_widget_grab_focus (self->priv->pw_entry);
+ gtk_widget_show (dialog);
+ return gtk_dialog_run (GTK_DIALOG (dialog));
}
void
-ka_pwdialog_error(KaPwDialog* self, const char *msg)
+ka_pwdialog_error (KaPwDialog *self, const char *msg)
{
- GtkWidget *dialog = self->priv->error_dialog;
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("Couldn't acquire kerberos ticket: '%s'"),
- _(msg));
- gtk_widget_show (GTK_WIDGET(dialog));
- gtk_dialog_run (GTK_DIALOG(dialog));
- gtk_widget_hide(dialog);
+ GtkWidget *dialog = self->priv->error_dialog;
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _
+ ("Couldn't acquire kerberos ticket: '%s'"),
+ _(msg));
+ gtk_widget_show (GTK_WIDGET (dialog));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_hide (dialog);
}
void
-ka_pwdialog_set_persist (KaPwDialog* pwdialog, gboolean persist)
+ka_pwdialog_set_persist (KaPwDialog *pwdialog, gboolean persist)
{
- pwdialog->priv->persist = persist;
+ pwdialog->priv->persist = persist;
}
void
-ka_pwdialog_hide (const KaPwDialog* pwdialog, gboolean force)
+ka_pwdialog_hide (const KaPwDialog *pwdialog, gboolean force)
{
- KA_DEBUG("PW Dialog persist: %d", pwdialog->priv->persist);
- if (!pwdialog->priv->persist || force)
- gtk_widget_hide(pwdialog->priv->dialog);
+ KA_DEBUG ("PW Dialog persist: %d", pwdialog->priv->persist);
+ if (!pwdialog->priv->persist || force)
+ gtk_widget_hide (pwdialog->priv->dialog);
}
-const gchar*
-ka_pwdialog_get_password(KaPwDialog *pwdialog)
+const gchar *
+ka_pwdialog_get_password (KaPwDialog *pwdialog)
{
- return gtk_entry_get_text (GTK_ENTRY(pwdialog->priv->pw_entry));
+ return gtk_entry_get_text (GTK_ENTRY (pwdialog->priv->pw_entry));
}
gboolean
-ka_pwdialog_status_update (KaPwDialog* pwdialog)
+ka_pwdialog_status_update (KaPwDialog *pwdialog)
{
- gchar *expiry_text;
- gchar *expiry_markup;
- int minutes_left = ka_tgt_valid_seconds() / 60;
-
- g_return_val_if_fail (pwdialog != NULL, FALSE);
- if (minutes_left > 0) {
- expiry_text = g_strdup_printf (ngettext("Your credentials expire in %d minute",
- "Your credentials expire in %d minutes",
- minutes_left), minutes_left);
- } else {
- expiry_text = g_strdup_printf ("<span foreground=\"red\">%s</span>",
- _("Your credentials have expired"));
- }
- expiry_markup = g_strdup_printf ("<span size=\"smaller\" style=\"italic\">%s</span>", expiry_text);
- gtk_label_set_markup (GTK_LABEL(pwdialog->priv->status_label), expiry_markup);
- g_free (expiry_text);
- g_free (expiry_markup);
-
- return TRUE;
+ gchar *expiry_text;
+ gchar *expiry_markup;
+ int minutes_left = ka_tgt_valid_seconds () / 60;
+
+ g_return_val_if_fail (pwdialog != NULL, FALSE);
+ if (minutes_left > 0) {
+ expiry_text =
+ g_strdup_printf (ngettext
+ ("Your credentials expire in %d minute",
+ "Your credentials expire in %d minutes",
+ minutes_left), minutes_left);
+ } else {
+ expiry_text = g_strdup_printf ("<span foreground=\"red\">%s</span>",
+ _("Your credentials have expired"));
+ }
+ expiry_markup =
+ g_strdup_printf ("<span size=\"smaller\" style=\"italic\">%s</span>",
+ expiry_text);
+ gtk_label_set_markup (GTK_LABEL (pwdialog->priv->status_label),
+ expiry_markup);
+ g_free (expiry_text);
+ g_free (expiry_markup);
+
+ return TRUE;
}
void
-ka_pwdialog_setup (KaPwDialog* pwdialog, const gchar *krb5prompt,
+ka_pwdialog_setup (KaPwDialog *pwdialog, const gchar *krb5prompt,
gboolean invalid_auth)
{
- KaPwDialogPrivate *priv = pwdialog->priv;
- gchar *wrong_markup = NULL;
- gchar *prompt;
- int pw4len;
-
- if (krb5prompt == NULL) {
- prompt = g_strdup (_("Please enter your Kerberos password:"));
- } else {
- /* Kerberos's prompts are a mess, and basically impossible to
- * translate. There's basically no way short of doing a lot of
- * string parsing to translate them. The most common prompt is
- * "Password for $uid:". We special case that one at least. We
- * cannot do any of the fancier strings (like challenges),
- * though. */
- pw4len = strlen ("Password for ");
- if (strncmp (krb5prompt, "Password for ", pw4len) == 0) {
- gchar *uid = (gchar *) (krb5prompt + pw4len);
- prompt = g_strdup_printf (_("Please enter the password for '%s':"), uid);
- } else {
- prompt = g_strdup (krb5prompt);
- }
- }
-
- /* Clear the password entry field */
- gtk_entry_set_text (GTK_ENTRY (priv->pw_entry), "");
-
- /* Use the prompt label that krb5 provides us */
- gtk_label_set_text (GTK_LABEL (priv->krb_label), prompt);
-
- /* Add our extra message hints */
- if (invalid_auth) {
- wrong_markup = g_strdup_printf ("<span size=\"smaller\" style=\"italic\">%s</span>",
- _("The password you entered is invalid"));
- gtk_label_set_markup (GTK_LABEL (priv->status_label), wrong_markup);
- } else
- ka_pwdialog_status_update (pwdialog);
-
- g_free(wrong_markup);
- g_free (prompt);
+ KaPwDialogPrivate *priv = pwdialog->priv;
+ gchar *wrong_markup = NULL;
+ gchar *prompt;
+ int pw4len;
+
+ if (krb5prompt == NULL) {
+ prompt = g_strdup (_("Please enter your Kerberos password:"));
+ } else {
+ /* Kerberos's prompts are a mess, and basically impossible to
+ * translate. There's basically no way short of doing a lot of
+ * string parsing to translate them. The most common prompt is
+ * "Password for $uid:". We special case that one at least. We
+ * cannot do any of the fancier strings (like challenges),
+ * though. */
+ pw4len = strlen ("Password for ");
+ if (strncmp (krb5prompt, "Password for ", pw4len) == 0) {
+ gchar *uid = (gchar *) (krb5prompt + pw4len);
+
+ prompt =
+ g_strdup_printf (_("Please enter the password for '%s':"),
+ uid);
+ } else {
+ prompt = g_strdup (krb5prompt);
+ }
+ }
+
+ /* Clear the password entry field */
+ gtk_entry_set_text (GTK_ENTRY (priv->pw_entry), "");
+
+ /* Use the prompt label that krb5 provides us */
+ gtk_label_set_text (GTK_LABEL (priv->krb_label), prompt);
+
+ /* Add our extra message hints */
+ if (invalid_auth) {
+ wrong_markup =
+ g_strdup_printf
+ ("<span size=\"smaller\" style=\"italic\">%s</span>",
+ _("The password you entered is invalid"));
+ gtk_label_set_markup (GTK_LABEL (priv->status_label), wrong_markup);
+ } else
+ ka_pwdialog_status_update (pwdialog);
+
+ g_free (wrong_markup);
+ g_free (prompt);
}
-static GtkWidget*
-ka_error_dialog_new(void)
+static GtkWidget *
+ka_error_dialog_new (void)
{
- GtkWidget *dialog = gtk_message_dialog_new (
- NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("%s Error"), KA_NAME);
- gtk_window_set_title(GTK_WINDOW(dialog), _(KA_NAME));
- gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
- return dialog;
+ GtkWidget *dialog =
+ gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("%s Error"), KA_NAME);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _(KA_NAME));
+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
+ return dialog;
}
-KaPwDialog*
-ka_pwdialog_create(GtkBuilder* xml)
+KaPwDialog *
+ka_pwdialog_create (GtkBuilder *xml)
{
- KaPwDialog *pwdialog = ka_pwdialog_new();
- KaEntryBuffer *buffer = ka_entry_buffer_new ();
- KaPwDialogPrivate *priv = pwdialog->priv;
- GtkWidget *entry_hbox = NULL;
-
- priv->dialog = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_dialog"));
- priv->status_label = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_status_label"));
- priv->krb_label = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_message_label"));
- priv->pw_entry = GTK_WIDGET (gtk_entry_new_with_buffer (GTK_ENTRY_BUFFER(buffer)));
- gtk_entry_set_visibility(GTK_ENTRY(priv->pw_entry), FALSE);
- g_object_unref (buffer);
- priv->error_dialog = ka_error_dialog_new();
-
- entry_hbox = GTK_WIDGET (gtk_builder_get_object (xml, "entry_hbox"));
- gtk_container_add (GTK_CONTAINER (entry_hbox), priv->pw_entry);
- gtk_entry_set_activates_default (GTK_ENTRY (priv->pw_entry), TRUE);
- gtk_widget_show (priv->pw_entry);
-
- return pwdialog;
+ KaPwDialog *pwdialog = ka_pwdialog_new ();
+ KaEntryBuffer *buffer = ka_entry_buffer_new ();
+ KaPwDialogPrivate *priv = pwdialog->priv;
+ GtkWidget *entry_hbox = NULL;
+
+ priv->dialog = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_dialog"));
+ priv->status_label =
+ GTK_WIDGET (gtk_builder_get_object (xml, "krb5_status_label"));
+ priv->krb_label =
+ GTK_WIDGET (gtk_builder_get_object (xml, "krb5_message_label"));
+ priv->pw_entry =
+ GTK_WIDGET (gtk_entry_new_with_buffer (GTK_ENTRY_BUFFER (buffer)));
+ gtk_entry_set_visibility (GTK_ENTRY (priv->pw_entry), FALSE);
+ g_object_unref (buffer);
+ priv->error_dialog = ka_error_dialog_new ();
+
+ entry_hbox = GTK_WIDGET (gtk_builder_get_object (xml, "entry_hbox"));
+ gtk_container_add (GTK_CONTAINER (entry_hbox), priv->pw_entry);
+ gtk_entry_set_activates_default (GTK_ENTRY (priv->pw_entry), TRUE);
+ gtk_widget_show (priv->pw_entry);
+
+ return pwdialog;
}
diff --git a/src/ka-pwdialog.h b/src/ka-pwdialog.h
index 1c244f8..ff518dc 100644
--- a/src/ka-pwdialog.h
+++ b/src/ka-pwdialog.h
@@ -28,7 +28,6 @@
#include "config.h"
G_BEGIN_DECLS
-
#define KA_TYPE_PWDIALOG (ka_pwdialog_get_type ())
#define KA_PWDIALOG(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), KA_TYPE_PWDIALOG, KaPwDialog))
@@ -40,26 +39,26 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE ((klass), KA_TYPE_PWDIALOG))
#define KA_PWDIALOG_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), KA_TYPE_PWDIALOG, KaPwDialogClass))
-
-typedef struct _KaPwDialog KaPwDialog;
-typedef struct _KaPwDialogClass KaPwDialogClass;
+ typedef struct _KaPwDialog KaPwDialog;
+typedef struct _KaPwDialogClass KaPwDialogClass;
typedef struct _KaPwDialogPrivate KaPwDialogPrivate;
GType ka_pwdialog_get_type (void);
/* public functions */
-KaPwDialog* ka_pwdialog_create(GtkBuilder *xml);
+KaPwDialog *ka_pwdialog_create (GtkBuilder *xml);
+
/* setup everything for the next prompting */
-void ka_pwdialog_setup (KaPwDialog* pwdialog, const gchar *krb5prompt,
+void ka_pwdialog_setup (KaPwDialog *pwdialog, const gchar *krb5prompt,
gboolean invalid_auth);
-gint ka_pwdialog_run(KaPwDialog *pwdialog);
-void ka_pwdialog_hide(const KaPwDialog *pwdialog, gboolean force);
-void ka_pwdialog_set_persist(KaPwDialog *pwdialog, gboolean persist);
+gint ka_pwdialog_run (KaPwDialog *pwdialog);
+void ka_pwdialog_hide (const KaPwDialog *pwdialog, gboolean force);
+void ka_pwdialog_set_persist (KaPwDialog *pwdialog, gboolean persist);
void ka_pwdialog_error (KaPwDialog *pwdialog, const char *msg);
+
/* update the expiry information in the status entry */
gboolean ka_pwdialog_status_update (KaPwDialog *pwdialog);
-const gchar* ka_pwdialog_get_password(KaPwDialog *dialog);
+const gchar *ka_pwdialog_get_password (KaPwDialog *dialog);
G_END_DECLS
-
#endif
diff --git a/src/ka-tickets.c b/src/ka-tickets.c
index 8734546..c7d9ea7 100644
--- a/src/ka-tickets.c
+++ b/src/ka-tickets.c
@@ -27,89 +27,90 @@
#include "ka-dialog.h"
static GtkListStore *tickets;
-static GtkWidget *tickets_dialog;
+static GtkWidget *tickets_dialog;
-GtkWidget*
-ka_tickets_dialog_create(GtkBuilder *xml)
+GtkWidget *
+ka_tickets_dialog_create (GtkBuilder *xml)
{
- GtkCellRenderer *text_renderer, *toggle_renderer;
- GtkTreeViewColumn *column;
- GtkTreeView *tickets_view;
+ GtkCellRenderer *text_renderer, *toggle_renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeView *tickets_view;
- tickets = gtk_list_store_new (N_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN);
+ tickets = gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
- tickets_dialog = GTK_WIDGET (gtk_builder_get_object (xml, "krb5_tickets_dialog"));
- tickets_view = GTK_TREE_VIEW (gtk_builder_get_object (xml, "krb5_tickets_treeview"));
- gtk_tree_view_set_model(GTK_TREE_VIEW(tickets_view), GTK_TREE_MODEL(tickets));
+ tickets_dialog =
+ GTK_WIDGET (gtk_builder_get_object (xml, "krb5_tickets_dialog"));
+ tickets_view =
+ GTK_TREE_VIEW (gtk_builder_get_object (xml, "krb5_tickets_treeview"));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tickets_view),
+ GTK_TREE_MODEL (tickets));
- text_renderer = gtk_cell_renderer_text_new();
- toggle_renderer = gtk_cell_renderer_toggle_new();
+ text_renderer = gtk_cell_renderer_text_new ();
+ toggle_renderer = gtk_cell_renderer_toggle_new ();
- column = gtk_tree_view_column_new_with_attributes(_("Principal"),
- text_renderer,
- "text",
- PRINCIPAL_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
- column = gtk_tree_view_column_new_with_attributes(_("Start Time"),
- text_renderer,
- "text",
- START_TIME_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
- column = gtk_tree_view_column_new_with_attributes(_("End Time"),
- text_renderer,
- "markup",
- END_TIME_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
- column = gtk_tree_view_column_new_with_attributes(_("Fwd"),
- toggle_renderer,
- "active",
- FORWARDABLE_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
- column = gtk_tree_view_column_new_with_attributes(_("Proxy"),
- toggle_renderer,
- "active",
- PROXIABLE_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
- column = gtk_tree_view_column_new_with_attributes(_("Renew"),
- toggle_renderer,
- "active",
- RENEWABLE_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
- return tickets_dialog;
+ column = gtk_tree_view_column_new_with_attributes (_("Principal"),
+ text_renderer,
+ "text",
+ PRINCIPAL_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("Start Time"),
+ text_renderer,
+ "text",
+ START_TIME_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("End Time"),
+ text_renderer,
+ "markup",
+ END_TIME_COLUMN, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("Fwd"),
+ toggle_renderer,
+ "active",
+ FORWARDABLE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("Proxy"),
+ toggle_renderer,
+ "active",
+ PROXIABLE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("Renew"),
+ toggle_renderer,
+ "active",
+ RENEWABLE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tickets_view), column);
+ return tickets_dialog;
}
void
-ka_tickets_dialog_run()
+ka_tickets_dialog_run ()
{
- if (ka_get_service_tickets(tickets)) {
- gtk_window_present(GTK_WINDOW(tickets_dialog));
- gtk_dialog_run(GTK_DIALOG(tickets_dialog));
- gtk_widget_hide(tickets_dialog);
- } else {
- GtkWidget *message_dialog;
+ if (ka_get_service_tickets (tickets)) {
+ gtk_window_present (GTK_WINDOW (tickets_dialog));
+ gtk_dialog_run (GTK_DIALOG (tickets_dialog));
+ gtk_widget_hide (tickets_dialog);
+ } else {
+ GtkWidget *message_dialog;
- message_dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Error displaying service ticket information"));
- gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
+ message_dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _
+ ("Error displaying service ticket information"));
+ gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
- g_signal_connect (message_dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
- gtk_widget_show (message_dialog);
- }
+ g_signal_connect (message_dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+ gtk_widget_show (message_dialog);
+ }
}
diff --git a/src/ka-tickets.h b/src/ka-tickets.h
index a1002f5..2a8aa3f 100644
--- a/src/ka-tickets.h
+++ b/src/ka-tickets.h
@@ -22,18 +22,18 @@
#define KA_TICKETS_H
enum ticket_columns {
- PRINCIPAL_COLUMN,
- START_TIME_COLUMN,
- END_TIME_COLUMN,
- FORWARDABLE_COLUMN,
- RENEWABLE_COLUMN,
- PROXIABLE_COLUMN,
- N_COLUMNS
+ PRINCIPAL_COLUMN,
+ START_TIME_COLUMN,
+ END_TIME_COLUMN,
+ FORWARDABLE_COLUMN,
+ RENEWABLE_COLUMN,
+ PROXIABLE_COLUMN,
+ N_COLUMNS
};
-GtkWidget* ka_tickets_dialog_create(GtkBuilder *xml);
-void ka_tickets_dialog_run(void);
+GtkWidget *ka_tickets_dialog_create (GtkBuilder *xml);
+void ka_tickets_dialog_run (void);
#endif
bgstack15