1
/* Copyright (c) 2006 The Regents of the University of Michigan.
4
* David M. Richter <richterd@citi.umich.edu>
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* 2. Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
* 3. Neither the name of the University nor the names of its
16
* contributors may be used to endorse or promote products derived
17
* from this software without specific prior written permission.
19
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
#include "libacl_nfs4.h"
37
char * nfs4_acl_spec_from_file(FILE *f)
39
char ace_buf[NFS4_MAX_ACESIZE];
46
acl_spec = calloc(1, NFS4_MAX_ACLSIZE);
50
while (fgets(ace_buf, NFS4_MAX_ACESIZE, f) != NULL) {
51
if ((c = strchr(ace_buf, '#')) != NULL)
53
consumed += strlen(ace_buf);
54
if (consumed > NFS4_MAX_ACLSIZE) {
55
fprintf(stderr, "ERROR: maximum ACL buffer size exceeded (%d > %d).\n",
56
NFS4_MAX_ACLSIZE, consumed);
60
strncat(acl_spec, ace_buf, NFS4_MAX_ACESIZE);