summaryrefslogtreecommitdiff
path: root/source3/libads/ldap.c
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/libads/ldap.c
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/libads/ldap.c')
-rw-r--r--source3/libads/ldap.c150
1 files changed, 0 insertions, 150 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index b208e58504..4a14527a22 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2322,49 +2322,6 @@ static time_t ads_parse_time(const char *str)
return timegm(&tm);
}
-
-const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID)
-{
- ADS_STATUS rc;
- int count = 0;
- void *res = NULL;
- char *expr = NULL;
- const char *attrs[] = { "lDAPDisplayName", NULL };
- char *result;
-
- if (ads == NULL || mem_ctx == NULL || OID == NULL) {
- goto failed;
- }
-
- expr = talloc_asprintf(mem_ctx, "(attributeId=%s)", OID);
- if (expr == NULL) {
- goto failed;
- }
-
- rc = ads_do_search_retry(ads, schema_path, LDAP_SCOPE_SUBTREE,
- expr, attrs, &res);
- if (!ADS_ERR_OK(rc)) {
- goto failed;
- }
-
- count = ads_count_replies(ads, res);
- if (count == 0 || !res) {
- goto failed;
- }
-
- result = ads_pull_string(ads, mem_ctx, res, "lDAPDisplayName");
- ads_msgfree(ads, res);
-
- return result;
-
-failed:
- DEBUG(0,("ads_get_attrname_by_oid: failed to retrieve name for oid: %s\n",
- OID));
-
- ads_msgfree(ads, res);
- return NULL;
-}
-
/**
* Find the servers name and realm - this can be done before authentication
* The ldapServiceName field on w2k looks like this:
@@ -2436,113 +2393,6 @@ done:
return status;
}
-/*********************************************************************
-*********************************************************************/
-
-static ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path)
-{
- ADS_STATUS status;
- void *res;
- const char *schema;
- const char *attrs[] = { "schemaNamingContext", NULL };
-
- status = ads_do_search(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res);
- if (!ADS_ERR_OK(status)) {
- return status;
- }
-
- if ( (schema = ads_pull_string(ads, mem_ctx, res, "schemaNamingContext")) == NULL ) {
- return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
- }
-
- if ( (*schema_path = talloc_strdup(mem_ctx, schema)) == NULL ) {
- return ADS_ERROR(LDAP_NO_MEMORY);
- }
-
- ads_msgfree(ads, res);
-
- return status;
-}
-
-/**
- * Check for "Services for Unix"-Schema and load some attributes into the ADS_STRUCT
- * @param ads connection to ads server
- * @return BOOL status of search (False if one or more attributes couldn't be
- * found in Active Directory)
- **/
-BOOL ads_check_sfu_mapping(ADS_STRUCT *ads)
-{
- BOOL ret = False;
- TALLOC_CTX *ctx = NULL;
- const char *gidnumber, *uidnumber, *homedir, *shell, *gecos;
- char *schema_path = NULL;
- ADS_STRUCT *ads_s = ads;
- ADS_STATUS status;
-
- if ( (ctx = talloc_init("ads_check_sfu_mapping")) == NULL ) {
- goto done;
- }
-
- /* establish a new ldap tcp session if necessary */
-
- if ( !ads->ld ) {
- if ( (ads_s = ads_init( ads->server.realm, ads->server.workgroup,
- ads->server.ldap_server )) == NULL )
- {
- goto done;
- }
-
- ads_s->auth.flags = ADS_AUTH_ANON_BIND;
- status = ads_connect( ads_s );
- if ( !ADS_ERR_OK(status))
- goto done;
- }
-
- status = ads_schema_path( ads, ctx, &schema_path );
- if ( !ADS_ERR_OK(status) ) {
- DEBUG(3,("ads_check_sfu_mapping: Unable to retrieve schema DN!\n"));
- goto done;
- }
-
- gidnumber = ads_get_attrname_by_oid(ads_s, schema_path, ctx, ADS_ATTR_SFU_GIDNUMBER_OID);
- if (gidnumber == NULL)
- goto done;
- ads->schema.sfu_gidnumber_attr = SMB_STRDUP(gidnumber);
-
- uidnumber = ads_get_attrname_by_oid(ads_s, schema_path, ctx, ADS_ATTR_SFU_UIDNUMBER_OID);
- if (uidnumber == NULL)
- goto done;
- ads->schema.sfu_uidnumber_attr = SMB_STRDUP(uidnumber);
-
- homedir = ads_get_attrname_by_oid(ads_s, schema_path, ctx, ADS_ATTR_SFU_HOMEDIR_OID);
- if (homedir == NULL)
- goto done;
- ads->schema.sfu_homedir_attr = SMB_STRDUP(homedir);
-
- shell = ads_get_attrname_by_oid(ads_s, schema_path, ctx, ADS_ATTR_SFU_SHELL_OID);
- if (shell == NULL)
- goto done;
- ads->schema.sfu_shell_attr = SMB_STRDUP(shell);
-
- gecos = ads_get_attrname_by_oid(ads_s, schema_path, ctx, ADS_ATTR_SFU_GECOS_OID);
- if (gecos == NULL)
- goto done;
- ads->schema.sfu_gecos_attr = SMB_STRDUP(gecos);
-
- ret = True;
-done:
- /* free any temporary ads connections */
- if ( ads_s != ads ) {
- ads_destroy( &ads_s );
- }
-
- if (ctx) {
- talloc_destroy(ctx);
- }
-
- return ret;
-}
-
/**
* find the domain sid for our domain
* @param ads connection to ads server