summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-auth-script.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-13 02:33:32 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-13 02:33:32 +0000
commitc9ea8fac502c6109713aa372c4c8cfafd0b86858 (patch)
treebf6440f13fdf3d49bdca498f829cc464f3f8669a /dbus/dbus-auth-script.c
parent32dc75ee6b1bb06e8cc1b956e7d80b54f24b5df6 (diff)
2003-02-12 Havoc Pennington <hp@pobox.com>
* 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
Diffstat (limited to 'dbus/dbus-auth-script.c')
-rw-r--r--dbus/dbus-auth-script.c22
1 files changed, 17 insertions, 5 deletions
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;