Author: gd
Date: 2006-09-14 09:44:48 +0000 (Thu, 14 Sep 2006)
New Revision: 18508

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18508

Log:
A query for the LDAP schema can never be done anonymously against AD.

Guenther

Modified:
   branches/SAMBA_3_0/source/libads/ldap_schema.c
   branches/SAMBA_3_0_23/source/libads/ldap_schema.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap_schema.c
===================================================================
--- branches/SAMBA_3_0/source/libads/ldap_schema.c      2006-09-14 09:27:10 UTC 
(rev 18507)
+++ branches/SAMBA_3_0/source/libads/ldap_schema.c      2006-09-14 09:44:48 UTC 
(rev 18508)
@@ -181,7 +181,7 @@
  * Check for "Services for Unix" or rfc2307 Schema and load some attributes 
into the ADS_STRUCT
  * @param ads connection to ads server
  * @param enum mapping type
- * @return BOOL status of search (False if one or more attributes couldn't be
+ * @return ADS_STATUS status of search (False if one or more attributes 
couldn't be
  * found in Active Directory)
  **/ 
 ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum 
wb_posix_mapping map_type) 
@@ -191,7 +191,6 @@
        char **oids_out, **names_out;
        size_t num_names;
        char *schema_path = NULL;
-       ADS_STRUCT *ads_s = ads;
        int i;
 
        const char *oids_sfu[] = {      ADS_ATTR_SFU_UIDNUMBER_OID,
@@ -236,22 +235,6 @@
                return ADS_ERROR(LDAP_NO_MEMORY);
        }
 
-       /* 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) {
-                       status = ADS_ERROR(LDAP_SERVER_DOWN);
-                       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_posix_mapping: Unable to retrieve schema 
DN!\n"));
@@ -321,10 +304,6 @@
        
        ads->schema.map_type = map_type;
 done:
-       /* free any temporary ads connections */
-       if (ads_s != ads) {
-               ads_destroy(&ads_s);
-       }
        if (ctx) {
                talloc_destroy(ctx);
        }

Modified: branches/SAMBA_3_0_23/source/libads/ldap_schema.c
===================================================================
--- branches/SAMBA_3_0_23/source/libads/ldap_schema.c   2006-09-14 09:27:10 UTC 
(rev 18507)
+++ branches/SAMBA_3_0_23/source/libads/ldap_schema.c   2006-09-14 09:44:48 UTC 
(rev 18508)
@@ -181,7 +181,7 @@
  * Check for "Services for Unix" or rfc2307 Schema and load some attributes 
into the ADS_STRUCT
  * @param ads connection to ads server
  * @param enum mapping type
- * @return BOOL status of search (False if one or more attributes couldn't be
+ * @return ADS_STATUS status of search (False if one or more attributes 
couldn't be
  * found in Active Directory)
  **/ 
 ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum 
wb_posix_mapping map_type) 
@@ -191,7 +191,6 @@
        char **oids_out, **names_out;
        size_t num_names;
        char *schema_path = NULL;
-       ADS_STRUCT *ads_s = ads;
        int i;
 
        const char *oids_sfu[] = {      ADS_ATTR_SFU_UIDNUMBER_OID,
@@ -236,22 +235,6 @@
                return ADS_ERROR(LDAP_NO_MEMORY);
        }
 
-       /* 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) {
-                       status = ADS_ERROR(LDAP_SERVER_DOWN);
-                       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_posix_mapping: Unable to retrieve schema 
DN!\n"));
@@ -321,10 +304,6 @@
        
        ads->schema.map_type = map_type;
 done:
-       /* free any temporary ads connections */
-       if (ads_s != ads) {
-               ads_destroy(&ads_s);
-       }
        if (ctx) {
                talloc_destroy(ctx);
        }

Reply via email to