From c9ea8fac502c6109713aa372c4c8cfafd0b86858 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 13 Feb 2003 02:33:32 +0000 Subject: 2003-02-12 Havoc Pennington * dbus/dbus-string.c (_dbus_string_pop_line): fix to also strip \r off of popped lines * dbus/dbus-auth.c (_dbus_auth_test): write code to run auth scripts * dbus/dbus-auth-script.c (_dbus_auth_script_run): when doing a SEND, append \r\n --- dbus/dbus-auth-script.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'dbus/dbus-auth-script.c') diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index a9df6d90..6c5009a5 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -82,8 +82,6 @@ append_quoted_string (DBusString *dest, ++i; } - if (!_dbus_string_append_byte (dest, '\0')) - return FALSE; return TRUE; } @@ -280,6 +278,20 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } + { + const char *s4; + _dbus_string_get_const_data (&to_send, &s4); + _dbus_verbose ("Sending '%s'\n", s4); + } + + if (!_dbus_string_append (&to_send, "\r\n")) + { + _dbus_warn ("failed to append \r\n from line %d\n", + line_no); + _dbus_string_free (&to_send); + goto out; + } + if (!_dbus_auth_bytes_received (auth, &to_send)) { _dbus_warn ("not enough memory to call bytes_received\n"); @@ -340,8 +352,8 @@ _dbus_auth_script_run (const DBusString *filename) const char *s1, *s2; _dbus_string_get_const_data (&line, &s1); _dbus_string_get_const_data (&received, &s2); - _dbus_warn ("expected command '%s' and got '%s' line %d\n", - s1, s2, line_no); + _dbus_warn ("line %d expected command '%s' and got '%s'\n", + line_no, s1, s2); _dbus_string_free (&received); goto out; } @@ -386,7 +398,7 @@ _dbus_auth_script_run (const DBusString *filename) _dbus_auth_unref (auth); _dbus_string_free (&file); - _dbus_string_free (&file); + _dbus_string_free (&line); _dbus_string_free (&from_auth); return retval; -- cgit