From 2449673f87d931ee63af5a0022f7b0b04c11e158 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 28 Jan 2016 12:58:43 -0800 Subject: [PATCH] Add an invalid state in DBusAuthState to use for invalid lines in auth scripts. --- dbus/dbus-auth-script.c | 4 +++- dbus/dbus-auth.h | 3 ++- dbus/dbus-transport-socket.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index aaaed30..e42c8e5 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -146,7 +146,7 @@ auth_state_from_string (const DBusString *str) else if (_dbus_string_starts_with_c_str (str, "AUTHENTICATED")) return DBUS_AUTH_STATE_AUTHENTICATED; else - return -1; + return DBUS_AUTH_STATE_INVALID; } static const char* @@ -164,6 +164,8 @@ auth_state_to_string (DBusAuthState state) return "NEED_DISCONNECT"; case DBUS_AUTH_STATE_AUTHENTICATED: return "AUTHENTICATED"; + default: + break; } return "unknown"; diff --git a/dbus/dbus-auth.h b/dbus/dbus-auth.h index e032302..7c182b7 100644 --- a/dbus/dbus-auth.h +++ b/dbus/dbus-auth.h @@ -38,7 +38,8 @@ typedef enum DBUS_AUTH_STATE_WAITING_FOR_MEMORY, DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND, DBUS_AUTH_STATE_NEED_DISCONNECT, - DBUS_AUTH_STATE_AUTHENTICATED + DBUS_AUTH_STATE_AUTHENTICATED, + DBUS_AUTH_STATE_INVALID = -1, } DBusAuthState; DBUS_PRIVATE_EXPORT diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 35c3cbf..9dcfdf6 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -476,6 +476,8 @@ do_authentication (DBusTransport *transport, _dbus_verbose (" %s auth state: authenticated\n", TRANSPORT_SIDE (transport)); break; + default: + _dbus_assert_not_reached ("invalid auth state"); } } -- 2.7.0.rc3.207.g0ac5344