3
* Read the who value from the ace and return its type and optionally
6
* Ace is a reference to the ace to extract the who value from.
7
* Type is a reference where the value of the whotype will be stored.
8
* Who is a double reference that should either be passed as NULL
9
* (and thus no who string will be returned) or as a pointer to a
10
* char* where the who string will be allocated. This string must be
11
* freed by the caller.
13
* Copyright (c) 2002, 2003, 2006 The Regents of the University of Michigan.
14
* All rights reserved.
16
* Nathaniel Gallaher <ngallahe@umich.edu>
18
* Redistribution and use in source and binary forms, with or without
19
* modification, are permitted provided that the following conditions
22
* 1. Redistributions of source code must retain the above copyright
23
* notice, this list of conditions and the following disclaimer.
24
* 2. Redistributions in binary form must reproduce the above copyright
25
* notice, this list of conditions and the following disclaimer in the
26
* documentation and/or other materials provided with the distribution.
27
* 3. Neither the name of the University nor the names of its
28
* contributors may be used to endorse or promote products derived
29
* from this software without specific prior written permission.
31
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
32
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
#include "libacl_nfs4.h"
46
int acl_nfs4_get_who(struct nfs4_ace* ace, int* type, char** who)
52
if (ace == NULL || ace->who == NULL)
55
itype = acl_nfs4_get_whotype(ace->who);
64
case NFS4_ACL_WHO_NAMED:
67
case NFS4_ACL_WHO_OWNER:
68
iwho = NFS4_ACL_WHO_OWNER_STRING;
70
case NFS4_ACL_WHO_GROUP:
71
iwho = NFS4_ACL_WHO_GROUP_STRING;
73
case NFS4_ACL_WHO_EVERYONE:
74
iwho = NFS4_ACL_WHO_EVERYONE_STRING;
80
wholen = strlen(iwho);
84
(*who) = (char *)malloc(sizeof(char) * (wholen + 1));