aboutsummaryrefslogtreecommitdiff
path: root/src/kim
diff options
context:
space:
mode:
authorAlexandra Ellwood <lxs@mit.edu>2008-10-29 20:39:47 +0000
committerAlexandra Ellwood <lxs@mit.edu>2008-10-29 20:39:47 +0000
commit3cbfb6c05fb4778531271444858a605ed12ac6e2 (patch)
treecd4da526ed5f97b25ed14f3dac1e6b479a70ba63 /src/kim
parent7467d84293c39f68221a78e419a5c4b57d6fb789 (diff)
downloadkrb5-3cbfb6c05fb4778531271444858a605ed12ac6e2.zip
krb5-3cbfb6c05fb4778531271444858a605ed12ac6e2.tar.gz
krb5-3cbfb6c05fb4778531271444858a605ed12ac6e2.tar.bz2
Only prompt automatically from GUI apps
Direct callers such as kinit need command line prompts. Do not automatically prompt (via krb5 or gssapi calls) unless the caller has loaded GUI libraries. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20937 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kim')
-rw-r--r--src/kim/lib/kim_library.c5
-rw-r--r--src/kim/lib/kim_library_private.h2
-rw-r--r--src/kim/lib/mac/kim_os_library.c39
3 files changed, 31 insertions, 15 deletions
diff --git a/src/kim/lib/kim_library.c b/src/kim/lib/kim_library.c
index b4b4c39..0272aa7 100644
--- a/src/kim/lib/kim_library.c
+++ b/src/kim/lib/kim_library.c
@@ -244,6 +244,11 @@ kim_boolean kim_library_allow_automatic_prompting (void)
kim_debug_printf ("KIM_NEVER_PROMPT is set.");
allow_automatic_prompting = FALSE;
}
+
+ if (allow_automatic_prompting && !kim_os_library_caller_uses_gui ()) {
+ kim_debug_printf ("Caller is not using gui.");
+ allow_automatic_prompting = FALSE;
+ }
if (allow_automatic_prompting) {
/* Make sure there is at least 1 config file. We don't support DNS
diff --git a/src/kim/lib/kim_library_private.h b/src/kim/lib/kim_library_private.h
index 160fba3..146474b 100644
--- a/src/kim/lib/kim_library_private.h
+++ b/src/kim/lib/kim_library_private.h
@@ -32,6 +32,8 @@
kim_error kim_library_init (void);
+kim_boolean kim_os_library_caller_uses_gui (void);
+
kim_ui_environment kim_os_library_get_ui_environment (void);
kim_ui_environment kim_library_ui_environment (void);
diff --git a/src/kim/lib/mac/kim_os_library.c b/src/kim/lib/mac/kim_os_library.c
index 2c54b8f..f3b2690 100644
--- a/src/kim/lib/mac/kim_os_library.c
+++ b/src/kim/lib/mac/kim_os_library.c
@@ -94,6 +94,28 @@ kim_error kim_os_library_unlock_for_bundle_lookup (void)
/* ------------------------------------------------------------------------ */
+kim_boolean kim_os_library_caller_uses_gui (void)
+{
+ kim_boolean caller_uses_gui = 0;
+
+ /* Check for the HIToolbox (Carbon) or AppKit (Cocoa).
+ * If either is loaded, we are a GUI app! */
+ CFBundleRef appKitBundle = CFBundleGetBundleWithIdentifier (CFSTR ("com.apple.AppKit"));
+ CFBundleRef hiToolBoxBundle = CFBundleGetBundleWithIdentifier (CFSTR ("com.apple.HIToolbox"));
+
+ if (hiToolBoxBundle && CFBundleIsExecutableLoaded (hiToolBoxBundle)) {
+ caller_uses_gui = 1; /* Using Carbon */
+ }
+
+ if (appKitBundle && CFBundleIsExecutableLoaded (appKitBundle)) {
+ caller_uses_gui = 1; /* Using Cocoa */
+ }
+
+ return caller_uses_gui;
+}
+
+/* ------------------------------------------------------------------------ */
+
kim_ui_environment kim_os_library_get_ui_environment (void)
{
#ifdef KIM_BUILTIN_UI
@@ -104,21 +126,8 @@ kim_ui_environment kim_os_library_get_ui_environment (void)
NULL, &sattrs) == noErr) &&
(sattrs & sessionHasGraphicAccess));
- if (has_gui_access) {
- /* Check for the HIToolbox (Carbon) or AppKit (Cocoa).
- * If either is loaded, we are a GUI app! */
- CFBundleRef appKitBundle = CFBundleGetBundleWithIdentifier (CFSTR ("com.apple.AppKit"));
- CFBundleRef hiToolBoxBundle = CFBundleGetBundleWithIdentifier (CFSTR ("com.apple.HIToolbox"));
-
- if (hiToolBoxBundle && CFBundleIsExecutableLoaded (hiToolBoxBundle)) {
- /* Using Carbon */
- return KIM_UI_ENVIRONMENT_GUI;
- }
-
- if (appKitBundle && CFBundleIsExecutableLoaded (appKitBundle)) {
- /* Using Cocoa */
- return KIM_UI_ENVIRONMENT_GUI;
- }
+ if (has_gui_access && kim_os_library_caller_uses_gui ()) {
+ return KIM_UI_ENVIRONMENT_GUI;
}
{