• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba-3.5.8/source3/include/
1/*
2   Unix SMB/CIFS implementation.
3   Idmap NSS headers
4
5   Copyright (C) Gerald Carter             2006
6
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public
9   License as published by the Free Software Foundation; either
10   version 3 of the License, or (at your option) any later version.
11
12   This library is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Library General Public License for more details.
16
17   You should have received a copy of the GNU Lesser General Public License
18   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef _IDMAP_NSS_H
22#define _IDMAP_NSS_H
23
24#ifndef HAVE_LDAP
25#  ifndef LDAPMessage
26#    define LDAPMessage void
27#  endif
28#endif
29
30/* The interface version specifier */
31
32#define SMB_NSS_INFO_INTERFACE_VERSION	  1
33
34/* List of available backends.  All backends must
35   register themselves */
36
37struct nss_function_entry {
38	struct nss_function_entry *prev, *next;
39
40	const char *name;
41	struct nss_info_methods *methods;
42};
43
44/* List of configured domains.  Each domain points
45   back to its configured backend. */
46
47struct nss_domain_entry {
48	struct nss_domain_entry *prev, *next;
49
50	const char *domain;
51
52	NTSTATUS init_status;
53	struct nss_function_entry *backend;
54
55	/* hold state on a per domain basis */
56
57	void *state;
58};
59
60/* API */
61
62struct nss_info_methods {
63	NTSTATUS (*init)( struct nss_domain_entry *e );
64	NTSTATUS (*get_nss_info)( struct nss_domain_entry *e,
65				  const DOM_SID *sid,
66				  TALLOC_CTX *ctx,
67				  ADS_STRUCT *ads, LDAPMessage *msg,
68				  const char **homedir, const char **shell,
69				  const char **gecos, gid_t *p_gid);
70	NTSTATUS (*map_to_alias)(TALLOC_CTX *mem_ctx,
71				 struct nss_domain_entry *e,
72				 const char *name, char **alias);
73	NTSTATUS (*map_from_alias)(TALLOC_CTX *mem_ctx,
74				   struct nss_domain_entry *e,
75				   const char *alias, char **name);
76	NTSTATUS (*close_fn)( void );
77};
78
79
80/* The following definitions come from nsswitch/nss_info.c  */
81
82NTSTATUS smb_register_idmap_nss(int version,
83				const char *name,
84				struct nss_info_methods *methods);
85
86NTSTATUS nss_init( const char **nss_list );
87
88NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
89		       TALLOC_CTX *ctx,
90		       ADS_STRUCT *ads, LDAPMessage *msg,
91		       const char **homedir, const char **shell,
92		       const char **gecos, gid_t *p_gid);
93
94NTSTATUS nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain,
95			   const char *name, char **alias );
96
97NTSTATUS nss_map_from_alias( TALLOC_CTX *mem_ctx, const char *domain,
98			     const char *alias, char **name );
99
100NTSTATUS nss_close( const char *parameters );
101
102#endif /* _IDMAP_NSS_H_ */
103
104