2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26
27 #include <syslog.h>
28 #include "ldap_common.h"
29
30 /* netgroup attributes filters */
31 #define _N_TRIPLE "nisnetgrouptriple"
32 #define _N_MEMBER "membernisnetgroup"
33
34 #define PRINT_VAL(a) (((a).argc == 0) || ((a).argv == NULL) || \
35 ((a).argv[0] == NULL)) ? "*" : (a).argv[0]
36 #define ISNULL(a) (a == NULL ? "<NULL>" : a)
37 #define MAX_DOMAIN_LEN 1024
38 #define MAX_TRIPLE_LEN (MAXHOSTNAMELEN + LOGNAME_MAX + \
39 MAX_DOMAIN_LEN + 5)
40
41 #define _F_SETMEMBER "(&(objectClass=nisNetGroup)(cn=%s))"
42 #define _F_SETMEMBER_SSD "(&(%%s)(cn=%s))"
43
44 #define N_HASH 257
45 #define COMMA ','
46
47 static const char *netgrent_attrs[] = {
48 _N_TRIPLE,
49 _N_MEMBER,
50 (char *)NULL
51 };
52
53 typedef struct netgroup_name {
54 char *name;
55 struct netgroup_name *next;
56 struct netgroup_name *next_hash;
57 } netgroup_name_t;
58
59 typedef struct {
|
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2013 Gary Mills
23 *
24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28
29 #include <syslog.h>
30 #include "ldap_common.h"
31
32 /* netgroup attributes filters */
33 #define _N_TRIPLE "nisnetgrouptriple"
34 #define _N_MEMBER "membernisnetgroup"
35
36 #define PRINT_VAL(a) (((a).argc == 0) || ((a).argv == NULL) || \
37 ((a).argv[0] == NULL)) ? "*" : (a).argv[0]
38 #define ISNULL(a) (a == NULL ? "<NULL>" : a)
39 #define MAX_DOMAIN_LEN 1024
40 #ifdef LOGNAME_MAX_ILLUMOS
41 #define MAX_TRIPLE_LEN (MAXHOSTNAMELEN + LOGNAME_MAX_ILLUMOS + \
42 MAX_DOMAIN_LEN + 5)
43 #else /* LOGNAME_MAX_ILLUMOS */
44 #define MAX_TRIPLE_LEN (MAXHOSTNAMELEN + LOGNAME_MAX + \
45 MAX_DOMAIN_LEN + 5)
46 #endif /* LOGNAME_MAX_ILLUMOS */
47
48 #define _F_SETMEMBER "(&(objectClass=nisNetGroup)(cn=%s))"
49 #define _F_SETMEMBER_SSD "(&(%%s)(cn=%s))"
50
51 #define N_HASH 257
52 #define COMMA ','
53
54 static const char *netgrent_attrs[] = {
55 _N_TRIPLE,
56 _N_MEMBER,
57 (char *)NULL
58 };
59
60 typedef struct netgroup_name {
61 char *name;
62 struct netgroup_name *next;
63 struct netgroup_name *next_hash;
64 } netgroup_name_t;
65
66 typedef struct {
|