summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-02-23 14:28:41 +0000
committerGünther Deschner <gd@samba.org>2006-02-23 14:28:41 +0000
commite8765f3db9db3d7ce264ffd50dd0b8a3e03511d0 (patch)
tree9b42b20df13a870d0d3229719fbbc0c341e2be35
parent61d43a6d92d9f7b9a6e3855513b183879074288d (diff)
downloadsamba-e8765f3db9db3d7ce264ffd50dd0b8a3e03511d0.tar.gz
samba-e8765f3db9db3d7ce264ffd50dd0b8a3e03511d0.tar.xz
samba-e8765f3db9db3d7ce264ffd50dd0b8a3e03511d0.zip
r13657: Let winbindd try to obtain the gecos field from the msSFU30Gecos
attribute when "winbind nss info = sfu" is set. Fixes #3539. Guenther
-rw-r--r--source/include/ads.h2
-rw-r--r--source/libads/ads_struct.c1
-rw-r--r--source/libads/ldap.c7
-rw-r--r--source/nsswitch/winbindd_ads.c35
4 files changed, 33 insertions, 12 deletions
diff --git a/source/include/ads.h b/source/include/ads.h
index ce643666ad9..a9072490365 100644
--- a/source/include/ads.h
+++ b/source/include/ads.h
@@ -48,6 +48,7 @@ typedef struct {
char *sfu_shell_attr;
char *sfu_uidnumber_attr;
char *sfu_gidnumber_attr;
+ char *sfu_gecos_attr;
} schema;
} ADS_STRUCT;
@@ -99,6 +100,7 @@ typedef void **ADS_MODLIST;
#define ADS_ATTR_SFU_GIDNUMBER_OID "1.2.840.113556.1.6.18.1.311"
#define ADS_ATTR_SFU_HOMEDIR_OID "1.2.840.113556.1.6.18.1.344"
#define ADS_ATTR_SFU_SHELL_OID "1.2.840.113556.1.6.18.1.312"
+#define ADS_ATTR_SFU_GECOS_OID "1.2.840.113556.1.6.18.1.337"
/* ldap bitwise searches */
#define ADS_LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803"
diff --git a/source/libads/ads_struct.c b/source/libads/ads_struct.c
index d8676d050dd..9b2179ad316 100644
--- a/source/libads/ads_struct.c
+++ b/source/libads/ads_struct.c
@@ -139,6 +139,7 @@ void ads_destroy(ADS_STRUCT **ads)
SAFE_FREE((*ads)->schema.sfu_gidnumber_attr);
SAFE_FREE((*ads)->schema.sfu_shell_attr);
SAFE_FREE((*ads)->schema.sfu_homedir_attr);
+ SAFE_FREE((*ads)->schema.sfu_gecos_attr);
ZERO_STRUCTP(*ads);
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 6d2155fae08..cb7dbc575bc 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -2628,7 +2628,7 @@ BOOL ads_check_sfu_mapping(ADS_STRUCT *ads)
{
BOOL ret = False;
TALLOC_CTX *ctx = NULL;
- const char *gidnumber, *uidnumber, *homedir, *shell;
+ const char *gidnumber, *uidnumber, *homedir, *shell, *gecos;
ctx = talloc_init("ads_check_sfu_mapping");
if (ctx == NULL)
@@ -2654,6 +2654,11 @@ BOOL ads_check_sfu_mapping(ADS_STRUCT *ads)
goto done;
ads->schema.sfu_shell_attr = SMB_STRDUP(shell);
+ gecos = ads_get_attrname_by_oid(ads, ctx, ADS_ATTR_SFU_GECOS_OID);
+ if (gecos == NULL)
+ goto done;
+ ads->schema.sfu_gecos_attr = SMB_STRDUP(gecos);
+
ret = True;
done:
if (ctx)
diff --git a/source/nsswitch/winbindd_ads.c b/source/nsswitch/winbindd_ads.c
index a8663650423..179659f86f1 100644
--- a/source/nsswitch/winbindd_ads.c
+++ b/source/nsswitch/winbindd_ads.c
@@ -153,7 +153,8 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
"name", "objectSid", "primaryGroupID",
"sAMAccountType",
ADS_ATTR_SFU_HOMEDIR_OID,
- ADS_ATTR_SFU_SHELL_OID,
+ ADS_ATTR_SFU_SHELL_OID,
+ ADS_ATTR_SFU_GECOS_OID,
NULL};
int i, count;
ADS_STATUS rc;
@@ -193,7 +194,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
i = 0;
for (msg = ads_first_entry(ads, res); msg; msg = ads_next_entry(ads, msg)) {
- char *name, *gecos;
+ char *name, *gecos = NULL;
char *homedir = NULL;
char *shell = NULL;
uint32 group;
@@ -206,12 +207,18 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
}
name = ads_pull_username(ads, mem_ctx, msg);
- gecos = ads_pull_string(ads, mem_ctx, msg, "name");
+
if (use_nss_info("sfu")) {
homedir = ads_pull_string(ads, mem_ctx, msg,
ads->schema.sfu_homedir_attr);
- shell = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_shell_attr);
+ shell = ads_pull_string(ads, mem_ctx, msg,
+ ads->schema.sfu_shell_attr);
+ gecos = ads_pull_string(ads, mem_ctx, msg,
+ ads->schema.sfu_gecos_attr);
+ }
+
+ if (gecos == NULL) {
+ gecos = ads_pull_string(ads, mem_ctx, msg, "name");
}
if (!ads_pull_sid(ads, msg, "objectSid",
@@ -437,7 +444,8 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
"name",
"primaryGroupID",
ADS_ATTR_SFU_HOMEDIR_OID,
- ADS_ATTR_SFU_SHELL_OID,
+ ADS_ATTR_SFU_SHELL_OID,
+ ADS_ATTR_SFU_GECOS_OID,
NULL};
ADS_STATUS rc;
int count;
@@ -475,13 +483,18 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
}
info->acct_name = ads_pull_username(ads, mem_ctx, msg);
- info->full_name = ads_pull_string(ads, mem_ctx, msg, "name");
if (use_nss_info("sfu")) {
- info->homedir = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_homedir_attr);
- info->shell = ads_pull_string(ads, mem_ctx, msg,
- ads->schema.sfu_shell_attr);
+ info->homedir = ads_pull_string(ads, mem_ctx, msg,
+ ads->schema.sfu_homedir_attr);
+ info->shell = ads_pull_string(ads, mem_ctx, msg,
+ ads->schema.sfu_shell_attr);
+ info->full_name = ads_pull_string(ads, mem_ctx, msg,
+ ads->schema.sfu_gecos_attr);
+ }
+
+ if (info->full_name == NULL) {
+ info->full_name = ads_pull_string(ads, mem_ctx, msg, "name");
}
if (!ads_pull_uint32(ads, msg, "primaryGroupID", &group_rid)) {