From 9f48bdb9311315d054286e98a207ed061428ed6f Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Tue, 14 Oct 2008 19:49:27 +0000 Subject: [PATCH] Pre-populate new clients with default client identity if that is set, as found by kim_preferences_get_client_identity() ticket:6183 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20869 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/agent/mac/IPCClient.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/kim/agent/mac/IPCClient.m b/src/kim/agent/mac/IPCClient.m index e42ef9965..e422dc64d 100644 --- a/src/kim/agent/mac/IPCClient.m +++ b/src/kim/agent/mac/IPCClient.m @@ -71,12 +71,34 @@ enum krb_agent_client_state { { self = [super init]; if (self != nil) { + kim_error err = KIM_NO_ERROR; + kim_preferences prefs = NULL; + kim_identity identity = NULL; + kim_string identity_string = NULL; + self.state = ipc_client_state_init; self.selectController = [[[SelectIdentityController alloc] init] autorelease]; self.authController = [[[AuthenticationController alloc] init] autorelease]; self.selectController.associatedClient = self; self.authController.associatedClient = self; self.currentInfo = [NSMutableDictionary dictionary]; + + // pre-populate the identity_string if there's a default identity + err = kim_preferences_create(&prefs); + if (!err && prefs) { + err = kim_preferences_get_client_identity(prefs, &identity); + } + if (!err && identity) { + err = kim_identity_get_display_string(identity, &identity_string); + } + if (!err && identity_string) { + [self.currentInfo setObject:[NSString stringWithUTF8String:identity_string] + forKey:@"identity_string"]; + } + + kim_string_free(&identity_string); + kim_identity_free(&identity); + kim_preferences_free(&prefs); } return self; } -- 2.26.2