acl_from_text.c (70841) | acl_from_text.c (71142) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999, 2000 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libc/posix1e/acl_from_text.c 70841 2001-01-09 05:45:03Z rwatson $ | 26 * $FreeBSD: head/lib/libc/posix1e/acl_from_text.c 71142 2001-01-17 02:40:39Z rwatson $ |
27 */ 28/* 29 * acl_from_text: Convert a text-form ACL from a string to an acl_t. 30 */ 31 32#include <sys/types.h> 33#include <sys/acl.h> 34#include <sys/errno.h> --- 78 unchanged lines hidden (view full) --- 113 uid_t id; 114 char *mybuf_p, *line, *cur, *notcomment, *comment, *entry; 115 char *tag, *qualifier, *permission; 116 int error; 117 118 /* Local copy we can mess up. */ 119 mybuf_p = strdup(buf_p); 120 if (!mybuf_p) | 27 */ 28/* 29 * acl_from_text: Convert a text-form ACL from a string to an acl_t. 30 */ 31 32#include <sys/types.h> 33#include <sys/acl.h> 34#include <sys/errno.h> --- 78 unchanged lines hidden (view full) --- 113 uid_t id; 114 char *mybuf_p, *line, *cur, *notcomment, *comment, *entry; 115 char *tag, *qualifier, *permission; 116 int error; 117 118 /* Local copy we can mess up. */ 119 mybuf_p = strdup(buf_p); 120 if (!mybuf_p) |
121 return(0); | 121 return(NULL); |
122 123 acl = acl_init(3); 124 if (!acl) { 125 free(mybuf_p); | 122 123 acl = acl_init(3); 124 if (!acl) { 125 free(mybuf_p); |
126 return(0); | 126 return(NULL); |
127 } 128 129 /* Outer loop: delimit at \n boundaries. */ 130 cur = mybuf_p; 131 while ((line = strsep(&cur, "\n"))) { 132 /* Now split the line on the first # to strip out comments. */ 133 comment = line; 134 notcomment = strsep(&comment, "#"); --- 83 unchanged lines hidden (view full) --- 218 } 219#endif 220 221 return(acl); 222 223error_label: 224 acl_free(acl); 225 free(mybuf_p); | 127 } 128 129 /* Outer loop: delimit at \n boundaries. */ 130 cur = mybuf_p; 131 while ((line = strsep(&cur, "\n"))) { 132 /* Now split the line on the first # to strip out comments. */ 133 comment = line; 134 notcomment = strsep(&comment, "#"); --- 83 unchanged lines hidden (view full) --- 218 } 219#endif 220 221 return(acl); 222 223error_label: 224 acl_free(acl); 225 free(mybuf_p); |
226 return(0); | 226 return(NULL); |
227} 228 229 230 | 227} 228 229 230 |