/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "sd-bus.h"
#include "alloc-util.h"
#include "dbus-job.h"
#include "dbus.h"
#include "job.h"
#include "log.h"
#include "selinux-access.h"
#include "string-util.h"
static int property_get_unit(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
assert(j);
p = unit_dbus_path(j->unit);
if (!p)
return -ENOMEM;
}
int r;
assert(j);
if (r < 0)
return r;
/* Access is granted to the job owner */
/* And for everybody else consult PolicyKit */
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
job_finish_and_invalidate(j, JOB_CANCELED, true);
}
SD_BUS_PROPERTY("JobType", "s", property_get_type, offsetof(Job, type), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("State", "s", property_get_state, offsetof(Job, state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
};
_cleanup_free_ char *p = NULL;
int r;
assert(j);
p = job_dbus_path(j);
if (!p)
return -ENOMEM;
bus,
&m,
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"JobNew");
if (r < 0)
return r;
if (r < 0)
return r;
}
_cleanup_free_ char *p = NULL;
assert(j);
p = job_dbus_path(j);
if (!p)
return -ENOMEM;
}
int r;
assert(j);
if (j->in_dbus_queue) {
j->in_dbus_queue = false;
}
r = bus_foreach_bus(j->manager, j->clients, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal, j);
if (r < 0)
j->sent_dbus_new_signal = true;
}
_cleanup_free_ char *p = NULL;
int r;
assert(j);
p = job_dbus_path(j);
if (!p)
return -ENOMEM;
bus,
&m,
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"JobRemoved");
if (r < 0)
return r;
if (r < 0)
return r;
}
int r;
assert(j);
if (!j->sent_dbus_new_signal)
if (r < 0)
}