hal/tools Makefile.am,1.34,1.35 hal-policy-is-privileged.c,1.1,1.2
David Zeuthen
david at kemper.freedesktop.org
Sun Feb 26 15:43:43 PST 2006
- Previous message: hal/policy/txt power-hibernate.policy, 1.1,
1.2 power-poweroff.policy, 1.1, 1.2 power-suspend.policy, 1.1,
1.2 storage-removable-mount-change-uid.policy, 1.1,
1.2 storage-removable-mount.policy, 1.1, 1.2
- Next message: hal ChangeLog,1.838,1.839
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/tools
In directory kemper:/tmp/cvs-serv17046/tools
Modified Files:
Makefile.am hal-policy-is-privileged.c
Log Message:
2006-02-26 David Zeuthen <davidz at redhat.com>
* policy/txt/power-hibernate.policy (Allow),
* policy/txt/power-poweroff.policy (Allow),
* policy/txt/power-suspend.policy (Allow),
* policy/txt/storage-removable-mount.policy (Allow),
* policy/txt/storage-removable-mount-change-uid.policy (Allow):
Ugh, replace uid:all with uid:__all__ as the former was malformed
* tools/hal-policy-is-privileged.c: Add verbose operation
* tools/Makefile.am (bin_PROGRAMS): Ugh, forgot backslash when
adding hal-policy-is-privileged
Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/tools/Makefile.am,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Makefile.am 26 Feb 2006 23:03:57 -0000 1.34
+++ Makefile.am 26 Feb 2006 23:43:41 -0000 1.35
@@ -13,13 +13,13 @@
-I$(top_srcdir) -I$(top_srcdir)/libhal \
@PACKAGE_CFLAGS@
-bin_PROGRAMS = \
- lshal \
- hal-get-property \
- hal-set-property \
- hal-find-by-capability \
- hal-find-by-property \
- hal-device
+bin_PROGRAMS = \
+ lshal \
+ hal-get-property \
+ hal-set-property \
+ hal-find-by-capability \
+ hal-find-by-property \
+ hal-device \
hal-policy-is-privileged
hal_policy_is_privileged_SOURCES = hal-policy-is-privileged.c
Index: hal-policy-is-privileged.c
===================================================================
RCS file: /cvs/hal/hal/tools/hal-policy-is-privileged.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-policy-is-privileged.c 26 Feb 2006 23:03:57 -0000 1.1
+++ hal-policy-is-privileged.c 26 Feb 2006 23:43:41 -0000 1.2
@@ -47,6 +47,7 @@
" -r, --resource Resource\n"
" -p, --policy policy to test for\n"
" -h, --help Show this information and exit\n"
+ " -v, --verbose Verbose operation\n"
" -V, --version Print version number\n"
"\n"
"Queries system policy whether a given user is allowed for a given\n"
@@ -69,6 +70,7 @@
{"resource", required_argument, NULL, 'r'},
{"policy", required_argument, NULL, 'p'},
{"help", no_argument, NULL, 'h'},
+ {"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
};
@@ -76,13 +78,14 @@
char *endp;
gboolean is_allowed;
LibHalPolicyResult result;
+ gboolean is_verbose = FALSE;
rc = 1;
while (TRUE) {
int c;
- c = getopt_long (argc, argv, "u:r:p:UhV", long_options, NULL);
+ c = getopt_long (argc, argv, "u:r:p:UhVv", long_options, NULL);
if (c == -1)
break;
@@ -100,11 +103,15 @@
policy = g_strdup (optarg);
break;
+ case 'v':
+ is_verbose = TRUE;
+ break;
+
case 'h':
usage (argc, argv);
rc = 0;
goto out;
-
+
case 'V':
printf ("hal-policy-is-privileged version " PACKAGE_VERSION "\n");
rc = 0;
@@ -121,11 +128,11 @@
return 1;
}
-/*
- printf ("user = '%s'\n", user);
- printf ("policy = '%s'\n", policy);
- printf ("resource = '%s'\n", resource);
-*/
+ if (is_verbose) {
+ printf ("user = '%s'\n", user);
+ printf ("policy = '%s'\n", policy);
+ printf ("resource = '%s'\n", resource);
+ }
ctx = libhal_policy_new_context ();
if (ctx == NULL) {
@@ -142,9 +149,10 @@
}
}
-/*
- printf ("uid %d\n", (int) uid);
-*/
+ if (is_verbose) {
+ printf ("user '%s' is uid %d\n", user, (int) uid);
+ }
+
result = libhal_policy_is_uid_allowed_for_policy (ctx,
uid,
policy,
@@ -171,10 +179,11 @@
g_warning ("no such policy '%s'", policy);
break;
}
-/*
- printf ("result %d\n", result);
- printf ("is_allowed %d\n", is_allowed);
-*/
+
+ if (is_verbose) {
+ printf ("result %d\n", result);
+ printf ("is_allowed %d\n", is_allowed);
+ }
out:
if (ctx != NULL)
- Previous message: hal/policy/txt power-hibernate.policy, 1.1,
1.2 power-poweroff.policy, 1.1, 1.2 power-suspend.policy, 1.1,
1.2 storage-removable-mount-change-uid.policy, 1.1,
1.2 storage-removable-mount.policy, 1.1, 1.2
- Next message: hal ChangeLog,1.838,1.839
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list