From 62c23c1ccafedab1bf8bed2fb0e511462b8ab4cc Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 7 Dec 2009 16:37:47 +0100 Subject: fix lockdownd_pair returning success on error This fixes a bug where lockdown_check_result() might return -1 and lockdownd_pair() still returns success. Thanks to dborca for spotting this. --- src/lockdown.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lockdown.c') diff --git a/src/lockdown.c b/src/lockdown.c index 6bf4c84..02b0024 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -755,8 +755,8 @@ lockdownd_error_t lockdownd_pair(lockdownd_client_t client, char *uuid, char *ho if (ret != LOCKDOWN_E_SUCCESS) return ret; - if (lockdown_check_result(dict, "Pair") == RESULT_SUCCESS) { - ret = LOCKDOWN_E_SUCCESS; + if (lockdown_check_result(dict, "Pair") != RESULT_SUCCESS) { + ret = LOCKDOWN_E_PAIRING_FAILED; } plist_free(dict); dict = NULL; @@ -767,7 +767,6 @@ lockdownd_error_t lockdownd_pair(lockdownd_client_t client, char *uuid, char *ho userpref_set_device_public_key(uuid, public_key); } else { log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pair failure\n", __func__); - ret = LOCKDOWN_E_PAIRING_FAILED; } free(public_key.data); return ret; -- cgit v1.1-32-gdbae