summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-05-18 16:08:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:17:08 -0500
commit39c45ce4f1a0cce9dc23e6d8df3f93bb124a19a0 (patch)
tree29d57a8b855a9f98c42d7b8c4e940419c2d68639 /source3/nsswitch
parente129dc40f71e9b10c293d8d3f923c5636597bf6f (diff)
downloadsamba-39c45ce4f1a0cce9dc23e6d8df3f93bb124a19a0.tar.gz
samba-39c45ce4f1a0cce9dc23e6d8df3f93bb124a19a0.tar.bz2
samba-39c45ce4f1a0cce9dc23e6d8df3f93bb124a19a0.zip
r15697: I take no comments as no objections :)
Expand the "winbind nss info" to also take "rfc2307" to support the plain posix attributes LDAP schema from win2k3-r2. This work is based on patches from Howard Wilkinson and Bob Gautier (and closes bug #3345). Guenther (This used to be commit 52423e01dc209ba5abde808a446287714ed11567)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_ads.c48
-rw-r--r--source3/nsswitch/winbindd_user.c2
2 files changed, 37 insertions, 13 deletions
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index 6115af9d2f..3dc26f4cfa 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -38,6 +38,9 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
{
ADS_STRUCT *ads;
ADS_STATUS status;
+ enum wb_posix_mapping map_type;
+
+ DEBUG(10,("ads_cached_connection\n"));
if (domain->private_data) {
ads = (ADS_STRUCT *)domain->private_data;
@@ -125,11 +128,18 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
return NULL;
}
- if (use_nss_info("sfu") && (!ads_check_sfu_mapping(ads))) {
- DEBUG(0,("ads_cached_connection: failed to check sfu attributes\n"));
- return NULL;
- }
+ map_type = get_nss_info(domain->name);
+
+ if ((map_type == WB_POSIX_MAP_RFC2307)||
+ (map_type == WB_POSIX_MAP_SFU)) {
+ status = ads_check_posix_schema_mapping(ads, map_type);
+ if (!ADS_ERR_OK(status)) {
+ DEBUG(10,("ads_check_posix_schema_mapping failed "
+ "with: %s\n", ads_errstr(status)));
+ }
+ }
+
/* set the flag that says we don't own the memory even
though we do so that ads_destroy() won't destroy the
structure we pass back by reference */
@@ -155,6 +165,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
ADS_ATTR_SFU_HOMEDIR_OID,
ADS_ATTR_SFU_SHELL_OID,
ADS_ATTR_SFU_GECOS_OID,
+ ADS_ATTR_RFC2307_HOMEDIR_OID,
+ ADS_ATTR_RFC2307_SHELL_OID,
+ ADS_ATTR_RFC2307_GECOS_OID,
NULL};
int i, count;
ADS_STATUS rc;
@@ -208,13 +221,17 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
name = ads_pull_username(ads, mem_ctx, msg);
- if (use_nss_info("sfu")) {
+ if (get_nss_info(domain->name) && ads->schema.map_type) {
+
+ DEBUG(10,("pulling posix attributes (%s schema)\n",
+ wb_posix_map_str(ads->schema.map_type)));
+
homedir = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_homedir_attr);
+ ads->schema.posix_homedir_attr);
shell = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_shell_attr);
+ ads->schema.posix_shell_attr);
gecos = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_gecos_attr);
+ ads->schema.posix_gecos_attr);
}
if (gecos == NULL) {
@@ -446,6 +463,9 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
ADS_ATTR_SFU_HOMEDIR_OID,
ADS_ATTR_SFU_SHELL_OID,
ADS_ATTR_SFU_GECOS_OID,
+ ADS_ATTR_RFC2307_HOMEDIR_OID,
+ ADS_ATTR_RFC2307_SHELL_OID,
+ ADS_ATTR_RFC2307_GECOS_OID,
NULL};
ADS_STATUS rc;
int count;
@@ -484,13 +504,17 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
info->acct_name = ads_pull_username(ads, mem_ctx, msg);
- if (use_nss_info("sfu")) {
+ if (get_nss_info(domain->name) && ads->schema.map_type) {
+
+ DEBUG(10,("pulling posix attributes (%s schema)\n",
+ wb_posix_map_str(ads->schema.map_type)));
+
info->homedir = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_homedir_attr);
+ ads->schema.posix_homedir_attr);
info->shell = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_shell_attr);
+ ads->schema.posix_shell_attr);
info->full_name = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_gecos_attr);
+ ads->schema.posix_gecos_attr);
}
if (info->full_name == NULL) {
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index 6179e497b7..07bd2a30bf 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -43,7 +43,7 @@ static BOOL fillup_pw_field(const char *lp_template,
if (out == NULL)
return False;
- if (in && !strequal(in,"") && lp_security() == SEC_ADS && use_nss_info("sfu")) {
+ if (in && !strequal(in,"") && lp_security() == SEC_ADS && (get_nss_info(domname))) {
safe_strcpy(out, in, sizeof(fstring) - 1);
return True;
}