From: kremlin Date: Sat, 16 Aug 2014 02:11:32 +0000 (-0500) Subject: add polkit auth object, compile it in makefile, add header to interfaces X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=0670162551150bd34110874600d1c2e1d119d6f2;p=systembsd.git add polkit auth object, compile it in makefile, add header to interfaces src/polkit-auth.c and its header are seperately built objects, linked to interfaces, which expose a single, safe auth checking function --- diff --git a/Makefile b/Makefile index 9664f9e..93f52f2 100644 --- a/Makefile +++ b/Makefile @@ -67,17 +67,20 @@ clean: install: _install_conf _install_interface_binaries _build_interface_objs: _build_genfile_objs - $(CC) -o bin/systemd-hostnamed $(CFLAGS) $(GLIBEF) $(INTFDIR)/hostnamed/hostnamed.c bin/obj/hostnamed-gen.o - $(CC) -o bin/systemd-localed $(CFLAGS) $(GLIBEF) $(INTFDIR)/localed/localed.c bin/obj/localed-gen.o - $(CC) -o bin/systemd-timedated $(CFLAGS) $(GLIBEF) $(INTFDIR)/timedated/timedated.c bin/obj/timedated-gen.o - $(CC) -o bin/systemd-logind $(CFLAGS) $(GLIBEF) $(INTFDIR)/logind/logind.c bin/obj/logind-gen.o + $(CC) -o bin/systemd-hostnamed $(CFLAGS) $(GLIBEF) $(INTFDIR)/hostnamed/hostnamed.c bin/obj/hostnamed-gen.o bin/obj/polkit-auth.o + $(CC) -o bin/systemd-localed $(CFLAGS) $(GLIBEF) $(INTFDIR)/localed/localed.c bin/obj/localed-gen.o bin/obj/polkit-auth.o + $(CC) -o bin/systemd-timedated $(CFLAGS) $(GLIBEF) $(INTFDIR)/timedated/timedated.c bin/obj/timedated-gen.o bin/obj/polkit-auth.o + $(CC) -o bin/systemd-logind $(CFLAGS) $(GLIBEF) $(INTFDIR)/logind/logind.c bin/obj/logind-gen.o bin/obj/polkit-auth.o -_build_genfile_objs: _generate_genfiles +_build_genfile_objs: _generate_genfiles _build_auth_obj $(CC) -o bin/obj/hostnamed-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/hostnamed/hostnamed-gen.c $(CC) -o bin/obj/localed-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/localed/localed-gen.c $(CC) -o bin/obj/timedated-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/timedated/timedated-gen.c $(CC) -o bin/obj/logind-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/logind/logind-gen.c +_build_auth_obj: + $(CC) -o bin/obj/polkit-auth.o $(CFLAGS) $(GLIBOF) -c $(SRCDIR)/polkit-auth.c + _generate_genfiles: $(INVOKE_GENFILE_SCRIPT) hostnamed $(INVOKE_GENFILE_SCRIPT) localed diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c index b10b4b7..574357d 100644 --- a/src/interfaces/hostnamed/hostnamed.c +++ b/src/interfaces/hostnamed/hostnamed.c @@ -34,6 +34,8 @@ #include "hostnamed-gen.h" #include "hostnamed.h" +#include "../../polkit-auth.h" + /* format: { * (1) string to be matched against runtime machine's sysctl output. * can be either the exact string or a substring contained @@ -403,6 +405,8 @@ int main() { CHASSIS = ICON = OS_CPENAME = 0; KERN_NAME = KERN_RELEASE = KERN_VERS = 0; HOSTNAME = STATIC_HOSTNAME = PRETTY_HOSTNAME = NULL; + + test_func(); set_signal_handlers(); diff --git a/src/interfaces/localed/localed.c b/src/interfaces/localed/localed.c index 596c2e3..33769a3 100644 --- a/src/interfaces/localed/localed.c +++ b/src/interfaces/localed/localed.c @@ -28,6 +28,8 @@ #include "localed-gen.h" #include "localed.h" +#include "../../polkit-auth.h" + GPtrArray *localed_freeable; Locale1 *localed_interf; diff --git a/src/interfaces/logind/logind.c b/src/interfaces/logind/logind.c index 9ccde2f..c445665 100644 --- a/src/interfaces/logind/logind.c +++ b/src/interfaces/logind/logind.c @@ -28,6 +28,8 @@ #include "logind-gen.h" #include "logind.h" +#include "../../polkit-auth.h" + GPtrArray *logind_freeable; Login1Manager *logind_interf; diff --git a/src/interfaces/timedated/timedated.c b/src/interfaces/timedated/timedated.c index 67f7a0c..f76850c 100644 --- a/src/interfaces/timedated/timedated.c +++ b/src/interfaces/timedated/timedated.c @@ -28,6 +28,8 @@ #include "timedated-gen.h" #include "timedated.h" +#include "../../polkit-auth.h" + GPtrArray *timedated_freeable; Timedate1 *timedated_interf; diff --git a/src/polkit-auth.c b/src/polkit-auth.c new file mode 100644 index 0000000..2e4178f --- /dev/null +++ b/src/polkit-auth.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 Ian Sutton + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include + +#include +#include +#include + +#include "polkit-auth.h" + +void test_func() { + g_printf("test!\n"); +} diff --git a/src/polkit-auth.h b/src/polkit-auth.h new file mode 100644 index 0000000..17a919b --- /dev/null +++ b/src/polkit-auth.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2014 Ian Sutton + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +void test_func();