2 Unix SMB/CIFS implementation.
4 Copyright (C) Guenther Deschner 2006
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/
23 #define DBGC_CLASS DBGC_IDMAP
25 /* winbind nss info = rfc2307 SO36:sfu FHAIN:rfc2307 PANKOW:template
28 * 1st param: default setting
29 * following ":" separated list elements:
31 * setting can be one of "sfu", "rfc2307", "template", "unixinfo"
34 enum wb_posix_mapping
get_nss_info(const char *domain_name
)
36 const char **list
= lp_winbind_nss_info();
37 enum wb_posix_mapping map_templ
= WB_POSIX_MAP_TEMPLATE
;
40 DEBUG(11,("get_nss_info for %s\n", domain_name
));
42 if (!lp_winbind_nss_info() || !*lp_winbind_nss_info()) {
43 return WB_POSIX_MAP_TEMPLATE
;
46 if ((map_templ
= wb_posix_map_type(list
[0])) == -1) {
47 DEBUG(0,("get_nss_info: invalid setting: %s\n", list
[0]));
48 return WB_POSIX_MAP_TEMPLATE
;
51 DEBUG(11,("get_nss_info: using \"%s\" by default\n", list
[0]));
53 for (i
=0; list
[i
]; i
++) {
55 const char *p
= list
[i
];
58 if (!next_token(&p
, tok
, ":", sizeof(tok
))) {
59 DEBUG(0,("get_nss_info: no \":\" delimitier found\n"));
63 if (strequal(tok
, domain_name
)) {
65 enum wb_posix_mapping type
;
67 if ((type
= wb_posix_map_type(p
)) == -1) {
68 DEBUG(0,("get_nss_info: invalid setting: %s\n", p
));
69 /* return WB_POSIX_MAP_TEMPLATE; */
73 DEBUG(11,("get_nss_info: using \"%s\" for domain: %s\n", p
, tok
));
82 const char *wb_posix_map_str(enum wb_posix_mapping mtype
)
85 case WB_POSIX_MAP_TEMPLATE
:
87 case WB_POSIX_MAP_SFU
:
89 case WB_POSIX_MAP_RFC2307
:
91 case WB_POSIX_MAP_UNIXINFO
:
99 enum wb_posix_mapping
wb_posix_map_type(const char *map_str
)
101 if (strequal(map_str
, "template"))
102 return WB_POSIX_MAP_TEMPLATE
;
103 else if (strequal(map_str
, "sfu"))
104 return WB_POSIX_MAP_SFU
;
105 else if (strequal(map_str
, "rfc2307"))
106 return WB_POSIX_MAP_RFC2307
;
107 else if (strequal(map_str
, "unixinfo"))
108 return WB_POSIX_MAP_UNIXINFO
;