hal/hald debug-hald.sh, 1.5, 1.6 hald.c, 1.46, 1.47 hald_dbus.c,
1.52, 1.53 hald_runner.c, 1.3, 1.4 hald_runner.h, 1.1,
1.2 run-hald.sh, 1.8, 1.9 valgrind-hald.sh, 1.2, 1.3
David Zeuthen
david at freedesktop.org
Sat Jan 21 08:54:06 PST 2006
Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv14173/hald
Modified Files:
debug-hald.sh hald.c hald_dbus.c hald_runner.c hald_runner.h
run-hald.sh valgrind-hald.sh
Log Message:
2006-01-21 David Zeuthen <davidz at redhat.com>
* hald-runner/runner.c (find_program): Simply use glib convience
g_find_program_in_path() on the basename of the desired helper since
our allowed paths are now in $PATH
* hald-runner/main.c (main): Print out allowed paths
* hald/linux2/blockdev.c (add_blockdev_probing_helper_done): Fix up
indenting
* hald/hald_runner.h: Modify prototype of hald_runner_start_runner to
not take the path to the runner
* hald/hald_runner.c (hald_runner_start_runner): Use the flag
G_SPAWN_SEARCH_PATH to search for hald-runner. Export HALD_RUNNER_PATH
as PATH for the runner. Always include standard locations, e.g.
$(libexecdir) and $(datadir)/hal/scripts.
* hald/hald_dbus.c (hald_exec_method_cb): Check if there really
was an error
* hald/hald.c (usage): Remove usage for --with-runner
(main): Remove --with-runner option; just search $PATH for it
* hald/run-hald.sh, hald/debug-hald.sh, hald/valgrind-hald.sh:
Set $HALD_RUNNER_PATH and modify $PATH to include local hald-runner
* tools/hal-system-storage-mount: Read and enforce security policy
as specified in fdi/policy/10osvendor/10-security-policy.fdi
* fdi/policy/10osvendor/Makefile.am (dist_fdi_DATA):
Add 10-security-policy.fdi
* fdi/policy/10osvendor/10-security-policy.fdi: New file
Index: debug-hald.sh
===================================================================
RCS file: /cvs/hal/hal/hald/debug-hald.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- debug-hald.sh 21 Jan 2006 02:45:27 -0000 1.5
+++ debug-hald.sh 21 Jan 2006 16:54:03 -0000 1.6
@@ -1,11 +1,12 @@
#!/bin/sh
-export PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux:$PATH
+export HALD_RUNNER_PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux
+export PATH=../hald-runner:$PATH
export HAL_FDI_SOURCE_PREPROBE=../fdi/preprobe
export HAL_FDI_SOURCE_INFORMATION=../fdi/information
export HAL_FDI_SOURCE_POLICY=../fdi/policy
echo ========================================
echo Just type \'run\' to start debugging hald
echo ========================================
-gdb run --args ./hald --daemon=no --verbose=yes --with-runner=../hald-runner/hald-runner
+gdb run --args ./hald --daemon=no --verbose=yes
Index: hald.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- hald.c 21 Jan 2006 02:45:27 -0000 1.46
+++ hald.c 21 Jan 2006 16:54:04 -0000 1.47
@@ -172,7 +172,7 @@
static void
usage ()
{
- fprintf (stderr, "\n" "usage : hald [--daemon=yes|no] [--verbose=yes|no] [--help] [--with-runner=location]\n");
+ fprintf (stderr, "\n" "usage : hald [--daemon=yes|no] [--verbose=yes|no] [--help]\n");
fprintf (stderr,
"\n"
" --daemon=yes|no Become a daemon\n"
@@ -180,8 +180,6 @@
" --use-syslog Print out debug messages to syslog instead of stderr.\n"
" Use this option to get debug messages if HAL runs as\n"
" daemon.\n"
- " --with-runner Use the program at the specified location as the\n"
- "helper.\n"
" --help Show this information and exit\n"
" --version Output version information and exit"
"\n"
@@ -369,7 +367,6 @@
guint sigterm_iochn_listener_source_id;
char *path;
char newpath[512];
- char *runner_location = NULL;
openlog ("hald", LOG_PID, LOG_DAEMON);
@@ -403,7 +400,6 @@
{"verbose", 1, NULL, 0},
{"use-syslog", 0, NULL, 0},
{"help", 0, NULL, 0},
- {"with-runner", 1, NULL, 0},
{"version", 0, NULL, 0},
{NULL, 0, NULL, 0}
};
@@ -441,8 +437,6 @@
usage ();
return 1;
}
- } else if (strcmp (opt, "with-runner") == 0) {
- runner_location = strdup(optarg);
} else if (strcmp (opt, "use-syslog") == 0) {
hald_use_syslog = TRUE;
}
@@ -567,7 +561,7 @@
if (!hald_dbus_local_server_init ())
return 1;
/* Start the runner helper daemon */
- if (!hald_runner_start_runner(runner_location)) {
+ if (!hald_runner_start_runner ()) {
return 1;
}
Index: hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- hald_dbus.c 21 Jan 2006 12:57:15 -0000 1.52
+++ hald_dbus.c 21 Jan 2006 16:54:04 -0000 1.53
@@ -2491,7 +2491,8 @@
message = (DBusMessage *) data1;
- if (exit_type == HALD_RUN_SUCCESS && error != NULL) {
+ if (exit_type == HALD_RUN_SUCCESS && error != NULL &&
+ error[0] != NULL && error[1] != NULL) {
exp_name = error[0];
if (error[0] != NULL) {
exp_detail = error[1];
Index: hald_runner.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_runner.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- hald_runner.c 21 Jan 2006 12:57:15 -0000 1.3
+++ hald_runner.c 21 Jan 2006 16:54:04 -0000 1.4
@@ -70,7 +70,7 @@
}
gboolean
-hald_runner_start_runner(gchar *runner_location)
+hald_runner_start_runner(void)
{
DBusServer *server = NULL;
DBusError err;
@@ -78,6 +78,7 @@
GPid pid;
char *argv[] = { NULL, NULL};
char *env[] = { NULL, NULL, NULL};
+ const char *hald_runner_path;
dbus_error_init(&err);
server = dbus_server_listen(DBUS_SERVER_ADDRESS, &err);
@@ -89,24 +90,23 @@
dbus_server_setup_with_g_main(server, NULL);
dbus_server_set_new_connection_function(server, handle_connection,
NULL, NULL);
- if (runner_location == NULL) {
- runner_location = g_strdup_printf("%s/hald-runner", PACKAGE_LIBEXEC_DIR);
- } else {
- runner_location = g_strdup(runner_location);
- }
- HAL_INFO (("Using runner '%s'\n", runner_location));
- argv[0] = runner_location;
+ argv[0] = "hald-runner";
env[0] = g_strdup_printf("HALD_RUNNER_DBUS_ADDRESS=%s",
dbus_server_get_address(server));
- env[1] = g_strdup_printf("PATH=%s", getenv("PATH"));
-
- if (!g_spawn_async(NULL, argv, env, G_SPAWN_DO_NOT_REAP_CHILD,
+ hald_runner_path = g_getenv("HALD_RUNNER_PATH");
+ if (hald_runner_path != NULL) {
+ env[1] = g_strdup_printf ("PATH=%s:" PACKAGE_LIBEXEC_DIR ":" PACKAGE_SCRIPT_DIR, hald_runner_path);
+ } else {
+ env[1] = g_strdup_printf ("PATH=" PACKAGE_LIBEXEC_DIR ":" PACKAGE_SCRIPT_DIR);
+ }
+
+
+ if (!g_spawn_async(NULL, argv, env, G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH,
NULL, NULL, &pid, &error)) {
HAL_ERROR (("Could not spawn runner : '%s'", error->message));
g_error_free (error);
goto error;
}
- g_free(argv[0]);
g_free(env[0]);
g_free(env[1]);
Index: hald_runner.h
===================================================================
RCS file: /cvs/hal/hal/hald/hald_runner.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hald_runner.h 21 Jan 2006 02:45:27 -0000 1.1
+++ hald_runner.h 21 Jan 2006 16:54:04 -0000 1.2
@@ -47,7 +47,7 @@
/* Start the runner daemon */
gboolean
-hald_runner_start_runner(gchar *runner_location);
+hald_runner_start_runner(void);
/* Start a helper, returns true on a successfull start */
gboolean
Index: run-hald.sh
===================================================================
RCS file: /cvs/hal/hal/hald/run-hald.sh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- run-hald.sh 21 Jan 2006 02:45:27 -0000 1.8
+++ run-hald.sh 21 Jan 2006 16:54:04 -0000 1.9
@@ -1,9 +1,11 @@
#!/bin/sh
-export PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux:$PATH
+export HALD_RUNNER_PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux
+export PATH=../hald-runner:$PATH
export HAL_FDI_SOURCE_PREPROBE=../fdi/preprobe
export HAL_FDI_SOURCE_INFORMATION=../fdi/information
export HAL_FDI_SOURCE_POLICY=../fdi/policy
-./hald --daemon=no --verbose=yes --with-runner=../hald-runner/hald-runner
-#./hald --daemon=no --with-runner=../hald-runner/hald-runner
+./hald --daemon=no --verbose=yes
+#./hald --daemon=no
+
Index: valgrind-hald.sh
===================================================================
RCS file: /cvs/hal/hal/hald/valgrind-hald.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- valgrind-hald.sh 21 Jan 2006 02:45:27 -0000 1.2
+++ valgrind-hald.sh 21 Jan 2006 16:54:04 -0000 1.3
@@ -1,7 +1,8 @@
#!/bin/sh
-export PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux:$PATH
+export HALD_RUNNER_PATH=linux2:linux2/probing:linux2/addons:.:../tools:../tools/linux
+export PATH=../hald-runner:$PATH
export HAL_FDI_SOURCE_PREPROBE=../fdi/preprobe
export HAL_FDI_SOURCE_INFORMATION=../fdi/information
export HAL_FDI_SOURCE_POLICY=../fdi/policy
-valgrind --num-callers=20 --show-reachable=yes --leak-check=yes --tool=memcheck ./hald --daemon=no --verbose=yes --with-runner=../hald-runner/hald-runner
+valgrind --num-callers=20 --show-reachable=yes --leak-check=yes --tool=memcheck ./hald --daemon=no --verbose=yes
More information about the hal-commit
mailing list