Hello community, here is the log from the commit of package hal-resmgr checked in at Thu Oct 26 20:17:58 CEST 2006. -------- --- hal-resmgr/hal-resmgr.changes 2006-09-28 14:28:05.000000000 +0200 +++ /mounts/work_src_done/STABLE/hal-resmgr/hal-resmgr.changes 2006-10-24 14:25:16.000000000 +0200 @@ -1,0 +2,7 @@ +Tue Oct 24 14:19:49 CEST 2006 - lnussel@suse.de + +- list only accessible devices by default +- add --list-all option +- just unref the dbus connection as closing it causes a warning + +------------------------------------------------------------------- Old: ---- hal-resmgr-0.1_SVNr114.tar.bz2 New: ---- hal-resmgr-0.1_SVNr122.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hal-resmgr.spec ++++++ --- /var/tmp/diff_new_pack.9p2F7h/_old 2006-10-26 20:17:42.000000000 +0200 +++ /var/tmp/diff_new_pack.9p2F7h/_new 2006-10-26 20:17:42.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package hal-resmgr (Version 0.1_SVNr114) +# spec file for package hal-resmgr (Version 0.1_SVNr122) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -12,9 +12,9 @@ Name: hal-resmgr BuildRequires: hal-devel libacl-devel resmgr -License: GPL, Other License(s), see package +License: GNU General Public License (GPL) - all versions, Other License(s), see package Group: System/Daemons -Version: 0.1_SVNr114 +Version: 0.1_SVNr122 Release: 1 Summary: Install ACLs on device nodes Source: %{name}-%{version}.tar.bz2 @@ -59,6 +59,10 @@ %{_libdir}/hal/scripts/hal-resmgr-revoke %changelog -n hal-resmgr +* Tue Oct 24 2006 - lnussel@suse.de +- list only accessible devices by default +- add --list-all option +- just unref the dbus connection as closing it causes a warning * Thu Sep 28 2006 - lnussel@suse.de - fix program help text and README to reflect the new duties of hal-resmgr and resmgr ++++++ hal-resmgr-0.1_SVNr114.tar.bz2 -> hal-resmgr-0.1_SVNr122.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hal-resmgr-0.1_SVNr114/hal-resmgr.c new/hal-resmgr-0.1_SVNr122/hal-resmgr.c --- old/hal-resmgr-0.1_SVNr114/hal-resmgr.c 2006-09-28 14:17:12.000000000 +0200 +++ new/hal-resmgr-0.1_SVNr122/hal-resmgr.c 2006-10-24 14:24:40.000000000 +0200 @@ -43,6 +43,7 @@ #include <limits.h> #include <pwd.h> +#include <errno.h> #include <resmgr.h> @@ -58,7 +59,8 @@ static LibHalContext *hal_ctx; static int retries = 0; static int do_monitor = FALSE; -static int do_list = FALSE; +static char* list_user = NULL; +static int do_list_all = FALSE; static int add_all_users = TRUE; @@ -291,7 +293,22 @@ if((device = guess_device_name(hal_ctx, udi))) { - if(do_list) + int is_privileged = FALSE; + + if(list_user && !do_list_all) + { + unsigned i; + for(i = 0; classes && classes[i]; ++i) + { + if(is_user_privileged(list_user, classes[i])) + { + is_privileged = TRUE; + break; + } + } + } + + if(do_list_all || (list_user && is_privileged)) { unsigned i; printf("UDI %s\n", udi); @@ -311,7 +328,8 @@ if(i) puts(""); } - else + + if(!list_user) { rsm_doit(classes, device, (const char**)flags); } @@ -337,7 +355,8 @@ " --grant=USER grant USER access to devices\n" " --revoke=USER revoke USER's access to devices\n" " --udi=UDI set ACLs on UDI\n" - " --list list devices handled by hal-resmgr\n" + " --list[=USER] list devices handled by hal-resmgr where USER has access to\n" + " --list-all list devices handled by hal-resmgr\n" " --help Show this information and exit\n" "\n" "Set ACLs on device nodes according to resmgr login classes\n" @@ -413,7 +432,8 @@ {"grant", 1, NULL, 7}, {"revoke", 1, NULL, 8}, {"udi", 1, NULL, 9}, - {"list", 0, NULL, 10}, + {"list-all", 0, NULL, 10}, + {"list", 2, NULL, 11}, {NULL, 0, NULL, 0} }; @@ -526,7 +546,34 @@ break; case 10: - do_list = TRUE; + do_list_all = TRUE; + /* fall through */ + + case 11: + { + struct passwd* pw = NULL; + if(optarg) + { + char* endp; + uid_t uid; + + uid = strtol(optarg, &endp, 10); + + if(optarg != endp && !*endp) + pw = getpwuid(uid); + else + pw = getpwnam(optarg); + } + else + { + pw = getpwuid(getuid()); + } + + if(!pw) + DIE(("cannot determine user: %s", strerror(errno))); + + list_user = strdup(pw->pw_name); + } break; default: @@ -575,7 +622,7 @@ get_all_devices(); - if(!do_list) + if(!list_user) resmgr_get_users(); register_devices(); @@ -589,7 +636,6 @@ libhal_ctx_shutdown (hal_ctx, &error); libhal_ctx_free (hal_ctx); - dbus_connection_close (conn); dbus_connection_unref (conn); } @@ -617,11 +663,11 @@ udi = getenv("UDI"); + parse_options(argc, argv); + if(rsm_connect() == -1) DIE(("can't connect to resmgrd")); - parse_options(argc, argv); - if(udi && !login_users && !logout_users) { resmgr_get_users(); @@ -632,5 +678,7 @@ rsm_disconnect(); + free(list_user); + return 0; } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org