-/* -*- mode: C; c-file-style: "gnu" -*- */
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-auth-script.c Test DBusAuth using a special script file (internal to D-Bus implementation)
*
* Copyright (C) 2003 Red Hat, Inc.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <config.h>
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#include "dbus-auth-script.h"
#include "dbus-auth.h"
if (uid != DBUS_UID_UNSET)
_dbus_credentials_add_unix_uid (credentials, uid);
if (pid != DBUS_PID_UNSET)
- _dbus_credentials_add_unix_pid (credentials, pid);
+ _dbus_credentials_add_pid (credentials, pid);
_dbus_auth_set_credentials (auth, credentials);
_dbus_auth_script_run (const DBusString *filename)
{
DBusString file;
- DBusError error;
+ DBusError error = DBUS_ERROR_INIT;
DBusString line;
dbus_bool_t retval;
int line_no;
return FALSE;
}
- dbus_error_init (&error);
if (!_dbus_file_get_contents (&file, filename, &error)) {
_dbus_warn ("Getting contents of %s failed: %s\n",
_dbus_string_get_const_data (filename), error.message);
/* Ignore this comment */
goto next_iteration;
}
+#ifdef DBUS_WIN
+ else if (_dbus_string_starts_with_c_str (&line,
+ "WIN_ONLY"))
+ {
+ /* Ignore this line */
+ goto next_iteration;
+ }
+ else if (_dbus_string_starts_with_c_str (&line,
+ "UNIX_ONLY"))
+ {
+ /* skip this file */
+ _dbus_warn ("skipping unix only auth script\n");
+ retval = TRUE;
+ goto out;
+ }
+#endif
+#ifdef DBUS_UNIX
+ else if (_dbus_string_starts_with_c_str (&line,
+ "UNIX_ONLY"))
+ {
+ /* Ignore this line */
+ goto next_iteration;
+ }
+ else if (_dbus_string_starts_with_c_str (&line,
+ "WIN_ONLY"))
+ {
+ /* skip this file */
+ _dbus_warn ("skipping windows only auth script\n");
+ retval = TRUE;
+ goto out;
+ }
+#endif
else if (_dbus_string_starts_with_c_str (&line,
"CLIENT"))
{
}
/** @} */
-#endif /* DBUS_BUILD_TESTS */
+#endif /* DBUS_ENABLE_EMBEDDED_TESTS */