summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap_ad.c34
-rw-r--r--source3/winbindd/idmap_nss.c8
-rw-r--r--source3/winbindd/idmap_passdb.c8
-rw-r--r--source3/winbindd/idmap_tdb.c6
-rw-r--r--source3/winbindd/idmap_tdb2.c28
-rw-r--r--source3/winbindd/idmap_util.c12
-rw-r--r--source3/winbindd/nss_info.c33
-rw-r--r--source3/winbindd/nss_info_template.c10
8 files changed, 69 insertions, 70 deletions
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index 0d7c068844..2e79413ffc 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -108,7 +108,7 @@ static ADS_STRUCT *ad_idmap_cached_connection_internal(void)
/* setup server affinity */
get_dc_name( NULL, ads->auth.realm, dc_name, &dc_ip );
-
+
status = ads_connect(ads);
if (!ADS_ERR_OK(status)) {
DEBUG(1, ("ad_idmap_init: failed to connect to AD\n"));
@@ -129,7 +129,7 @@ static ADS_STRUCT *ad_idmap_cached_connection_internal(void)
static ADS_STRUCT *ad_idmap_cached_connection(void)
{
ADS_STRUCT *ads = ad_idmap_cached_connection_internal();
-
+
if ( !ads )
return NULL;
@@ -146,14 +146,14 @@ static ADS_STRUCT *ad_idmap_cached_connection(void)
(ad_map_type == WB_POSIX_MAP_RFC2307) )
{
ADS_STATUS schema_status;
-
+
schema_status = ads_check_posix_schema_mapping( NULL, ads, ad_map_type, &ad_schema);
if ( !ADS_ERR_OK(schema_status) ) {
DEBUG(2,("ad_idmap_cached_connection: Failed to obtain schema details!\n"));
return NULL;
}
}
-
+
return ads;
}
@@ -320,7 +320,7 @@ again:
(unsigned long)ids[idx]->xid.id);
CHECK_ALLOC_DONE(u_filter);
break;
-
+
case ID_TYPE_GID:
if ( ! g_filter) {
g_filter = talloc_asprintf(memctx, "(&(|"
@@ -527,7 +527,7 @@ again:
")(|",
ATYPE_NORMAL_ACCOUNT, ATYPE_WORKSTATION_TRUST, ATYPE_INTERDOMAIN_TRUST,
ATYPE_SECURITY_GLOBAL_GROUP, ATYPE_SECURITY_LOCAL_GROUP);
-
+
CHECK_ALLOC_DONE(filter);
bidx = idx;
@@ -535,7 +535,7 @@ again:
sidstr = sid_binstring(ids[idx]->sid);
filter = talloc_asprintf_append_buffer(filter, "(objectSid=%s)", sidstr);
-
+
free(sidstr);
CHECK_ALLOC_DONE(filter);
}
@@ -668,7 +668,7 @@ static NTSTATUS idmap_ad_close(struct idmap_domain *dom)
}
TALLOC_FREE( ad_schema );
-
+
return NT_STATUS_OK;
}
@@ -692,7 +692,7 @@ static NTSTATUS nss_sfu_init( struct nss_domain_entry *e )
"Mixed schema models not supported!\n"));
return NT_STATUS_NOT_SUPPORTED;
}
-
+
ad_map_type = WB_POSIX_MAP_SFU;
return NT_STATUS_OK;
@@ -710,7 +710,7 @@ static NTSTATUS nss_sfu20_init( struct nss_domain_entry *e )
"Mixed schema models not supported!\n"));
return NT_STATUS_NOT_SUPPORTED;
}
-
+
ad_map_type = WB_POSIX_MAP_SFU20;
return NT_STATUS_OK;
@@ -720,7 +720,7 @@ static NTSTATUS nss_rfc2307_init( struct nss_domain_entry *e )
{
/* Sanity check if we have previously been called with a
different schema model */
-
+
if ( (ad_map_type != WB_POSIX_MAP_UNKNOWN) &&
(ad_map_type != WB_POSIX_MAP_RFC2307) )
{
@@ -728,7 +728,7 @@ static NTSTATUS nss_rfc2307_init( struct nss_domain_entry *e )
"Mixed schema models not supported!\n"));
return NT_STATUS_NOT_SUPPORTED;
}
-
+
ad_map_type = WB_POSIX_MAP_RFC2307;
return NT_STATUS_OK;
@@ -761,19 +761,19 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
if ( !ads_internal || !ad_schema )
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-
+
if ( !homedir || !shell || !gecos )
return NT_STATUS_INVALID_PARAMETER;
*homedir = ads_pull_string( ads, ctx, msg, ad_schema->posix_homedir_attr );
*shell = ads_pull_string( ads, ctx, msg, ad_schema->posix_shell_attr );
*gecos = ads_pull_string( ads, ctx, msg, ad_schema->posix_gecos_attr );
-
+
if ( gid ) {
if ( !ads_pull_uint32(ads, msg, ad_schema->posix_gidnumber_attr, gid ) )
*gid = (uint32)-1;
}
-
+
return NT_STATUS_OK;
}
@@ -800,7 +800,7 @@ static struct idmap_methods ad_methods = {
/* The SFU and RFC2307 NSS plugins share everything but the init
function which sets the intended schema model to use */
-
+
static struct nss_info_methods nss_rfc2307_methods = {
.init = nss_rfc2307_init,
.get_nss_info = nss_ad_get_info,
@@ -841,7 +841,7 @@ NTSTATUS idmap_ad_init(void)
if ( !NT_STATUS_IS_OK(status_idmap_ad) )
return status_idmap_ad;
}
-
+
if ( !NT_STATUS_IS_OK( status_nss_rfc2307 ) ) {
status_nss_rfc2307 = smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION,
"rfc2307", &nss_rfc2307_methods );
diff --git a/source3/winbindd/idmap_nss.c b/source3/winbindd/idmap_nss.c
index e4acd9ce65..c4115b1ee3 100644
--- a/source3/winbindd/idmap_nss.c
+++ b/source3/winbindd/idmap_nss.c
@@ -4,17 +4,17 @@
idmap PASSDB backend
Copyright (C) Simo Sorce 2006
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -60,7 +60,7 @@ static NTSTATUS idmap_nss_unixids_to_sids(struct idmap_domain *dom, struct id_ma
const char *name;
enum lsa_SidType type;
bool ret;
-
+
switch (ids[i]->xid.type) {
case ID_TYPE_UID:
pw = getpwuid((uid_t)ids[i]->xid.id);
diff --git a/source3/winbindd/idmap_passdb.c b/source3/winbindd/idmap_passdb.c
index 17afd71ab8..6fbb47b979 100644
--- a/source3/winbindd/idmap_passdb.c
+++ b/source3/winbindd/idmap_passdb.c
@@ -4,17 +4,17 @@
idmap PASSDB backend
Copyright (C) Simo Sorce 2006
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -85,7 +85,7 @@ static NTSTATUS idmap_pdb_sids_to_unixids(struct idmap_domain *dom, struct id_ma
for (i = 0; ids[i]; i++) {
enum lsa_SidType type;
union unid_t id;
-
+
if (pdb_sid_to_id(ids[i]->sid, &id, &type)) {
switch (type) {
case SID_NAME_USER:
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index e5f605361b..26dc2fdac7 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -7,17 +7,17 @@
Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
Copyright (C) Jeremy Allison 2006
Copyright (C) Simo Sorce 2003-2006
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index ab89e615f7..b8049d00e5 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -15,17 +15,17 @@
Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
Copyright (C) Jeremy Allison 2006
Copyright (C) Simo Sorce 2003-2006
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -88,7 +88,7 @@ static NTSTATUS idmap_tdb2_alloc_load(void);
static NTSTATUS idmap_tdb2_open_perm_db(void)
{
char *db_path;
-
+
if (idmap_tdb2_perm) {
/* its already open */
return NT_STATUS_OK;
@@ -281,7 +281,7 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
hwmtype, (unsigned long)high_hwm));
return NT_STATUS_UNSUCCESSFUL;
}
-
+
xid->id = hwm;
DEBUG(10,("New %s = %d\n", hwmtype, hwm));
@@ -384,7 +384,7 @@ static TDB_DATA tdb2_fetch_bystring(TALLOC_CTX *mem_ctx, const char *keystr)
}
return ret;
}
-
+
status = idmap_tdb2_open_perm_db();
if (!NT_STATUS_IS_OK(status)) {
return ret;
@@ -570,7 +570,7 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_m
case ID_TYPE_UID:
keystr = talloc_asprintf(ctx, "UID %lu", (unsigned long)map->xid.id);
break;
-
+
case ID_TYPE_GID:
keystr = talloc_asprintf(ctx, "GID %lu", (unsigned long)map->xid.id);
break;
@@ -621,7 +621,7 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_m
}
goto done;
}
-
+
if (!string_to_sid(map->sid, (const char *)data.dptr)) {
DEBUG(10,("INVALID SID (%s) in record %s\n",
(const char *)data.dptr, keystr));
@@ -667,7 +667,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
ret = NT_STATUS_NONE_MAPPED;
goto done;
}
-
+
ret = idmap_tdb2_script(ctx, map, "SIDTOID %s", keystr);
/* store it on shared storage */
if (!NT_STATUS_IS_OK(ret)) {
@@ -702,7 +702,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
DEBUG(2, ("Found INVALID record %s -> %s\n", keystr, (const char *)data.dptr));
ret = NT_STATUS_INTERNAL_DB_ERROR;
}
-
+
/* apply filters before returning result */
if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) ||
(ctx->filter_high_id && (map->xid.id > ctx->filter_high_id))) {
@@ -746,7 +746,7 @@ static NTSTATUS idmap_tdb2_unixids_to_sids(struct idmap_domain *dom, struct id_m
ids[i]->status = ID_UNMAPPED;
continue;
}
-
+
/* some fatal error occurred, return immediately */
goto done;
}
@@ -791,7 +791,7 @@ static NTSTATUS idmap_tdb2_sids_to_unixids(struct idmap_domain *dom, struct id_m
ids[i]->status = ID_UNMAPPED;
continue;
}
-
+
/* some fatal error occurred, return immediately */
goto done;
}
@@ -835,7 +835,7 @@ static NTSTATUS idmap_tdb2_set_mapping(struct idmap_domain *dom, const struct id
data.dptr = NULL;
/* TODO: should we filter a set_mapping using low/high filters ? */
-
+
ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
switch (map->xid.type) {
@@ -843,7 +843,7 @@ static NTSTATUS idmap_tdb2_set_mapping(struct idmap_domain *dom, const struct id
case ID_TYPE_UID:
kidstr = talloc_asprintf(ctx, "UID %lu", (unsigned long)map->xid.id);
break;
-
+
case ID_TYPE_GID:
kidstr = talloc_asprintf(ctx, "GID %lu", (unsigned long)map->xid.id);
break;
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c
index 0d24070dd6..78f4d13ec1 100644
--- a/source3/winbindd/idmap_util.c
+++ b/source3/winbindd/idmap_util.c
@@ -41,7 +41,7 @@ NTSTATUS idmap_uid_to_sid(DOM_SID *sid, uid_t uid)
maps[0] = &map;
maps[1] = NULL;
-
+
ret = idmap_unixids_to_sids(maps);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping uid [%lu]\n", (unsigned long)uid));
@@ -75,7 +75,7 @@ NTSTATUS idmap_gid_to_sid(DOM_SID *sid, gid_t gid)
maps[0] = &map;
maps[1] = NULL;
-
+
ret = idmap_unixids_to_sids(maps);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping gid [%lu]\n", (unsigned long)gid));
@@ -105,10 +105,10 @@ NTSTATUS idmap_sid_to_uid(DOM_SID *sid, uid_t *uid)
map.sid = sid;
map.xid.type = ID_TYPE_UID;
-
+
maps[0] = &map;
maps[1] = NULL;
-
+
ret = idmap_sids_to_unixids(maps);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping sid [%s] to uid\n",
@@ -145,10 +145,10 @@ NTSTATUS idmap_sid_to_gid(DOM_SID *sid, gid_t *gid)
map.sid = sid;
map.xid.type = ID_TYPE_GID;
-
+
maps[0] = &map;
maps[1] = NULL;
-
+
ret = idmap_sids_to_unixids(maps);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping sid [%s] to gid\n",
diff --git a/source3/winbindd/nss_info.c b/source3/winbindd/nss_info.c
index daa3dd037d..af73fe2900 100644
--- a/source3/winbindd/nss_info.c
+++ b/source3/winbindd/nss_info.c
@@ -8,12 +8,12 @@
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
-
+
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -89,12 +89,12 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain )
int len;
*backend = *domain = NULL;
-
+
if ( !config )
return False;
-
+
p = strchr( config, ':' );
-
+
/* if no : then the string must be the backend name only */
if ( !p ) {
@@ -107,13 +107,13 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain )
if ( strlen(p+1) > 0 ) {
*domain = SMB_STRDUP( p+1 );
}
-
+
len = PTR_DIFF(p,config)+1;
if ( (q = SMB_MALLOC_ARRAY( char, len )) == NULL ) {
SAFE_FREE( *backend );
return False;
}
-
+
StrnCpy( q, config, len-1);
q[len-1] = '\0';
*backend = q;
@@ -139,7 +139,7 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain )
if ( NT_STATUS_IS_OK(nss_initialized) )
return NT_STATUS_OK;
-
+
/* The "template" backend should alqays be registered as it
is a static module */
@@ -166,7 +166,7 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain )
if ( !NT_STATUS_IS_OK(status) ) {
continue;
}
-
+
/* try again */
if ( (nss_backend = nss_get_backend( backend )) == NULL ) {
DEBUG(0,("nss_init: unregistered backend %s!. Skipping\n",
@@ -184,7 +184,7 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain )
DEBUG(0,("nss_init: talloc() failure!\n"));
return NT_STATUS_NO_MEMORY;
}
-
+
nss_domain->backend = nss_backend;
nss_domain->domain = talloc_strdup( nss_domain, domain );
@@ -210,10 +210,9 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain )
/* we shouild default to use template here */
}
-
-
+
nss_initialized = NT_STATUS_OK;
-
+
return NT_STATUS_OK;
}
@@ -231,19 +230,19 @@ static struct nss_domain_entry *find_nss_domain( const char *domain )
nt_errstr(status)));
return NULL;
}
-
+
for ( p=nss_domain_list; p; p=p->next ) {
if ( strequal( p->domain, domain ) )
break;
}
-
+
/* If we didn't find a match, then use the default nss info */
if ( !p ) {
if ( !nss_domain_list ) {
return NULL;
}
-
+
p = nss_domain_list;
}
@@ -271,7 +270,7 @@ static struct nss_domain_entry *find_nss_domain( const char *domain )
domain ));
return NT_STATUS_NOT_FOUND;
}
-
+
m = p->backend->methods;
return m->get_nss_info( p, user_sid, ctx, ads, msg,
diff --git a/source3/winbindd/nss_info_template.c b/source3/winbindd/nss_info_template.c
index aaf02e4abe..641bfe9eaf 100644
--- a/source3/winbindd/nss_info_template.c
+++ b/source3/winbindd/nss_info_template.c
@@ -8,12 +8,12 @@
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
-
+
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -44,7 +44,7 @@ static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
{
if ( !homedir || !shell || !gecos )
return NT_STATUS_INVALID_PARAMETER;
-
+
*homedir = talloc_strdup( ctx, lp_template_homedir() );
*shell = talloc_strdup( ctx, lp_template_shell() );
*gecos = NULL;
@@ -52,7 +52,7 @@ static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
if ( !*homedir || !*shell ) {
return NT_STATUS_NO_MEMORY;
}
-
+
return NT_STATUS_OK;
}
@@ -73,7 +73,7 @@ static struct nss_info_methods nss_template_methods = {
.get_nss_info = nss_template_get_info,
.close_fn = nss_template_close
};
-
+
NTSTATUS nss_info_template_init( void )
{
return smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION,