From 1f48dbbdb2a6edc6718f6c7b349c34043dc45601 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Mon, 29 Sep 2008 05:25:02 +0000 Subject: [PATCH] test harness for KerberosAgent IPC layer ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20779 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/agent/mac/ServerDemux.m | 31 +++++++++++++++++++++++++++++++ src/kim/agent/mac/main.m | 22 +++++++++++++++------- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/kim/agent/mac/ServerDemux.m b/src/kim/agent/mac/ServerDemux.m index d7cfec949..bc8525b0d 100644 --- a/src/kim/agent/mac/ServerDemux.m +++ b/src/kim/agent/mac/ServerDemux.m @@ -92,6 +92,9 @@ static int32_t kim_handle_request_init (mach_port_t in_client_port, if (!err) { #warning Send init message to main thread with 2 ports, name and path + NSLog (@"Got init message with pid '%d', name '%s', path '%s'", + pid, name, path); + err = kim_handle_reply_init (in_reply_port, 0); } k5_ipc_stream_free_string (name); @@ -137,6 +140,13 @@ static int32_t kim_handle_request_enter_identity (mach_port_t in_client_port, if (!err) { #warning Send enter identity message to main thread with 2 ports + kim_identity identity = NULL; + NSLog (@"Got enter identity message"); + err = kim_identity_create_from_string (&identity, "nobody@TEST-KERBEROS-1.3.1"); + if (!err) { + err = kim_handle_reply_enter_identity (in_reply_port, identity, 0); + } + kim_identity_free (&identity); } return err; @@ -196,6 +206,13 @@ static int32_t kim_handle_request_select_identity (mach_port_t in_client_port, if (!err) { #warning Send select identity message to main thread with 2 ports + kim_identity identity = NULL; + NSLog (@"Got select identity message"); + err = kim_identity_create_from_string (&identity, "nobody@TEST-KERBEROS-1.3.1"); + if (!err) { + err = kim_handle_reply_select_identity (in_reply_port, identity, 0); + } + kim_identity_free (&identity); } kim_selection_hints_free (&hints); @@ -280,6 +297,9 @@ static int32_t kim_handle_request_auth_prompt (mach_port_t in_client_port, } if (!err) { + NSLog (@"Got auth prompt with identity '%s', type '%d', hide '%d', title '%s', message '%s', description '%s'", + identity_string, type, hide_reply, title, message, description); + err = kim_handle_reply_auth_prompt (in_reply_port, "ydobon", 0); #warning Send auth prompt message to main thread with 2 ports and arguments } @@ -344,6 +364,12 @@ static int32_t kim_handle_request_change_password (mach_port_t in_client_port, if (!err) { #warning Send change password message to main thread with 2 ports and arguments + NSLog (@"Got change password with identity '%s', old_password_expired '%d'", + identity_string, old_password_expired); + err = kim_handle_reply_change_password (in_reply_port, + "ydobon", + "foo", + "bar", 0); } k5_ipc_stream_free_string (identity_string); @@ -423,6 +449,9 @@ static int32_t kim_handle_request_handle_error (mach_port_t in_client_port, if (!err) { #warning Send handle error message to main thread with 2 ports and arguments + NSLog (@"Got handle error with identity '%s', error '%d', message '%s', description '%s'", + identity_string, error, message, description); + err = kim_handle_reply_handle_error (in_reply_port, 0); } k5_ipc_stream_free_string (identity_string); @@ -469,6 +498,8 @@ static int32_t kim_handle_request_fini (mach_port_t in_client_port, if (!err) { #warning Send fini message to main thread with 2 ports + NSLog (@"Got fini message"); + err = kim_handle_reply_fini (in_reply_port, 0); } return err; diff --git a/src/kim/agent/mac/main.m b/src/kim/agent/mac/main.m index a6ffad1d0..dec694093 100644 --- a/src/kim/agent/mac/main.m +++ b/src/kim/agent/mac/main.m @@ -1,19 +1,27 @@ #import + +#import "ServerDemux.h" #import "k5_mig_server.h" +#include +#include + int main(int argc, const char *argv[]) { int err = 0; + NSAutoreleasePool *pool = NULL; - err = k5_ipc_server_initialize (argc, argv); + openlog (argv[0], LOG_CONS | LOG_PID, LOG_AUTH); + syslog (LOG_INFO, "Starting up."); + + pool = [[NSAutoreleasePool alloc] init]; + + [NSApplication sharedApplication]; + [NSBundle loadNibNamed: @"MainMenu" owner: NSApp]; - if (!err) { - err = NSApplicationMain(argc, argv); - } + err = k5_ipc_server_listen_loop (); - if (!err) { - err = k5_ipc_server_cleanup (argc, argv); - } + syslog (LOG_NOTICE, "Exiting: %s (%d)", kipc_error_string (err), err); return err; } -- 2.26.2