From 547db92fbb3ad164cd44acc8eb34c79756b7a7b6 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Wed, 1 Oct 2008 20:55:49 +0000 Subject: [PATCH] Correctly translate NULL hints when reading from a stream ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20799 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/lib/kim_selection_hints.c | 64 +++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/src/kim/lib/kim_selection_hints.c b/src/kim/lib/kim_selection_hints.c index a825742d3..a04541bd7 100644 --- a/src/kim/lib/kim_selection_hints.c +++ b/src/kim/lib/kim_selection_hints.c @@ -558,7 +558,7 @@ void kim_selection_hints_free (kim_selection_hints *io_selection_hints) } } -#pragma mark - +#pragma mark - /* ------------------------------------------------------------------------ */ @@ -651,7 +651,13 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &explanation); if (!err) { - err = kim_string_copy (&io_selection_hints->explanation, explanation); + if (explanation[0]) { + err = kim_string_copy (&io_selection_hints->explanation, + explanation); + } else { + err = kim_selection_hints_set_explanation (io_selection_hints, + NULL); + } } k5_ipc_stream_free_string (explanation); @@ -672,8 +678,14 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &service_identity); if (!err) { - err = kim_string_copy (&io_selection_hints->service_identity, - service_identity); + if (service_identity[0]) { + err = kim_string_copy (&io_selection_hints->service_identity, + service_identity); + } else { + err = kim_selection_hints_set_hint (io_selection_hints, + kim_hint_key_service_identity, + NULL); + } } k5_ipc_stream_free_string (service_identity); @@ -684,8 +696,14 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &client_realm); if (!err) { - err = kim_string_copy (&io_selection_hints->client_realm, - client_realm); + if (client_realm[0]) { + err = kim_string_copy (&io_selection_hints->client_realm, + client_realm); + } else { + err = kim_selection_hints_set_hint (io_selection_hints, + kim_hint_key_client_realm, + NULL); + } } k5_ipc_stream_free_string (client_realm); @@ -696,7 +714,13 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &user); if (!err) { - err = kim_string_copy (&io_selection_hints->user, user); + if (user[0]) { + err = kim_string_copy (&io_selection_hints->user, user); + } else { + err = kim_selection_hints_set_hint (io_selection_hints, + kim_hint_key_user, + NULL); + } } k5_ipc_stream_free_string (user); @@ -707,8 +731,14 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &service_realm); if (!err) { - err = kim_string_copy (&io_selection_hints->service_realm, - service_realm); + if (service_realm[0]) { + err = kim_string_copy (&io_selection_hints->service_realm, + service_realm); + } else { + err = kim_selection_hints_set_hint (io_selection_hints, + kim_hint_key_service_realm, + NULL); + } } k5_ipc_stream_free_string (service_realm); @@ -719,7 +749,13 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &service); if (!err) { - err = kim_string_copy (&io_selection_hints->service, service); + if (service[0]) { + err = kim_string_copy (&io_selection_hints->service, service); + } else { + err = kim_selection_hints_set_hint (io_selection_hints, + kim_hint_key_service, + NULL); + } } k5_ipc_stream_free_string (service); @@ -730,7 +766,13 @@ kim_error kim_selection_hints_read_from_stream (kim_selection_hints io_selection err = k5_ipc_stream_read_string (io_stream, &server); if (!err) { - err = kim_string_copy (&io_selection_hints->server, server); + if (server[0]) { + err = kim_string_copy (&io_selection_hints->server, server); + } else { + err = kim_selection_hints_set_hint (io_selection_hints, + kim_hint_key_server, + NULL); + } } k5_ipc_stream_free_string (server); -- 2.26.2