| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ufs_quota.c,v 1.85 2012/01/29 06:49:43 dholland Exp $ */ | | 1 | /* $NetBSD: ufs_quota.c,v 1.86 2012/01/29 06:50:15 dholland Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1982, 1986, 1990, 1993, 1995 | | 4 | * Copyright (c) 1982, 1986, 1990, 1993, 1995 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Robert Elz at The University of Melbourne. | | 8 | * Robert Elz at The University of Melbourne. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | * | | 33 | * |
34 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | | 34 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.85 2012/01/29 06:49:43 dholland Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.86 2012/01/29 06:50:15 dholland Exp $"); |
39 | | | 39 | |
40 | #if defined(_KERNEL_OPT) | | 40 | #if defined(_KERNEL_OPT) |
41 | #include "opt_quota.h" | | 41 | #include "opt_quota.h" |
42 | #endif | | 42 | #endif |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/kernel.h> | | 44 | #include <sys/kernel.h> |
45 | #include <sys/systm.h> | | 45 | #include <sys/systm.h> |
46 | #include <sys/namei.h> | | 46 | #include <sys/namei.h> |
47 | #include <sys/file.h> | | 47 | #include <sys/file.h> |
48 | #include <sys/proc.h> | | 48 | #include <sys/proc.h> |
49 | #include <sys/vnode.h> | | 49 | #include <sys/vnode.h> |
50 | #include <sys/mount.h> | | 50 | #include <sys/mount.h> |
51 | #include <sys/kauth.h> | | 51 | #include <sys/kauth.h> |
| @@ -275,48 +275,45 @@ quota_handle_cmd_put(struct mount *mp, s | | | @@ -275,48 +275,45 @@ quota_handle_cmd_put(struct mount *mp, s |
275 | | | 275 | |
276 | KASSERT(args->qc_type == QCT_PUT); | | 276 | KASSERT(args->qc_type == QCT_PUT); |
277 | qk = args->u.put.qc_key; | | 277 | qk = args->u.put.qc_key; |
278 | qv = args->u.put.qc_val; | | 278 | qv = args->u.put.qc_val; |
279 | | | 279 | |
280 | if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0) | | 280 | if ((ump->um_flags & (UFS_QUOTA|UFS_QUOTA2)) == 0) |
281 | return EOPNOTSUPP; | | 281 | return EOPNOTSUPP; |
282 | | | 282 | |
283 | kauth_id = qk->qk_id; | | 283 | kauth_id = qk->qk_id; |
284 | if (kauth_id == QUOTA_DEFAULTID) { | | 284 | if (kauth_id == QUOTA_DEFAULTID) { |
285 | kauth_id = 0; | | 285 | kauth_id = 0; |
286 | } | | 286 | } |
287 | | | 287 | |
288 | /* avoid whitespace changes */ | | 288 | error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, |
289 | { | | 289 | KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id), |
290 | error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FS_QUOTA, | | 290 | NULL); |
291 | KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id), | | 291 | if (error != 0) |
292 | NULL); | | 292 | goto err; |
293 | if (error != 0) | | | |
294 | goto err; | | | |
295 | #ifdef QUOTA | | 293 | #ifdef QUOTA |
296 | if (ump->um_flags & UFS_QUOTA) | | 294 | if (ump->um_flags & UFS_QUOTA) |
297 | error = quota1_handle_cmd_put(ump, qk, qv); | | 295 | error = quota1_handle_cmd_put(ump, qk, qv); |
298 | else | | 296 | else |
299 | #endif | | 297 | #endif |
300 | #ifdef QUOTA2 | | 298 | #ifdef QUOTA2 |
301 | if (ump->um_flags & UFS_QUOTA2) { | | 299 | if (ump->um_flags & UFS_QUOTA2) { |
302 | error = quota2_handle_cmd_put(ump, qk, qv); | | 300 | error = quota2_handle_cmd_put(ump, qk, qv); |
303 | } else | | 301 | } else |
304 | #endif | | 302 | #endif |
305 | panic("quota_handle_cmd_get: no support ?"); | | 303 | panic("quota_handle_cmd_get: no support ?"); |
306 | | | 304 | |
307 | if (error && error != ENOENT) | | 305 | if (error && error != ENOENT) |
308 | goto err; | | 306 | goto err; |
309 | } | | | |
310 | | | 307 | |
311 | return 0; | | 308 | return 0; |
312 | err: | | 309 | err: |
313 | return error; | | 310 | return error; |
314 | } | | 311 | } |
315 | | | 312 | |
316 | static int | | 313 | static int |
317 | quota_handle_cmd_clear(struct mount *mp, struct lwp *l, | | 314 | quota_handle_cmd_clear(struct mount *mp, struct lwp *l, |
318 | struct vfs_quotactl_args *args) | | 315 | struct vfs_quotactl_args *args) |
319 | { | | 316 | { |
320 | prop_array_t replies; | | 317 | prop_array_t replies; |
321 | prop_object_iterator_t iter; | | 318 | prop_object_iterator_t iter; |
322 | prop_dictionary_t data; | | 319 | prop_dictionary_t data; |