Author: jerry
Date: 2007-04-10 21:14:44 +0000 (Tue, 10 Apr 2007)
New Revision: 22158

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

Log:
BUG 4501 (partial): Fix a crash caused by not using the 
nss_info_{rfc2307,sfu} plugin with idmap_ad.


Modified:
   branches/SAMBA_3_0/source/nsswitch/idmap_ad.c
   branches/SAMBA_3_0_25/source/nsswitch/idmap_ad.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/idmap_ad.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/idmap_ad.c       2007-04-10 20:35:30 UTC 
(rev 22157)
+++ branches/SAMBA_3_0/source/nsswitch/idmap_ad.c       2007-04-10 21:14:44 UTC 
(rev 22158)
@@ -164,14 +164,10 @@
 {
        struct idmap_ad_context *ctx;
        char *config_option;
-       const char *range;
+       const char *range = NULL;
+       const char *schema_mode = NULL; 
        ADS_STRUCT *ads;
 
-       /* verify AD is reachable (not critical, we may just be offline at 
start) */
-       if ( (ads = ad_idmap_cached_connection()) == NULL ) {
-               DEBUG(1, ("WARNING: Could not init an AD connection! Mapping 
might not work.\n"));
-       }
-
        if ( (ctx = talloc_zero(dom, struct idmap_ad_context)) == NULL ) {
                DEBUG(0, ("Out of memory!\n"));
                return NT_STATUS_NO_MEMORY;
@@ -194,6 +190,20 @@
                }
        }
 
+       /* schema mode */
+       if ( ad_map_type == WB_POSIX_MAP_UNKNOWN )
+               ad_map_type = WB_POSIX_MAP_RFC2307;
+       schema_mode = lp_parm_const_string(-1, config_option, "schema_mode", 
NULL);
+       if ( schema_mode && schema_mode[0] ) {
+               if ( strequal(schema_mode, "sfu") )
+                       ad_map_type = WB_POSIX_MAP_SFU;
+               else if ( strequal(schema_mode, "rfc2307" ) )
+                       ad_map_type = WB_POSIX_MAP_RFC2307;
+               else
+                       DEBUG(0,("idmap_ad_initialize: Unknown schema_mode 
(%s)\n",
+                                schema_mode));
+       }
+
        dom->private_data = ctx;
 
        talloc_free(config_option);

Modified: branches/SAMBA_3_0_25/source/nsswitch/idmap_ad.c
===================================================================
--- branches/SAMBA_3_0_25/source/nsswitch/idmap_ad.c    2007-04-10 20:35:30 UTC 
(rev 22157)
+++ branches/SAMBA_3_0_25/source/nsswitch/idmap_ad.c    2007-04-10 21:14:44 UTC 
(rev 22158)
@@ -164,14 +164,10 @@
 {
        struct idmap_ad_context *ctx;
        char *config_option;
-       const char *range;
+       const char *range = NULL;
+       const char *schema_mode = NULL; 
        ADS_STRUCT *ads;
 
-       /* verify AD is reachable (not critical, we may just be offline at 
start) */
-       if ( (ads = ad_idmap_cached_connection()) == NULL ) {
-               DEBUG(1, ("WARNING: Could not init an AD connection! Mapping 
might not work.\n"));
-       }
-
        if ( (ctx = talloc_zero(dom, struct idmap_ad_context)) == NULL ) {
                DEBUG(0, ("Out of memory!\n"));
                return NT_STATUS_NO_MEMORY;
@@ -194,6 +190,20 @@
                }
        }
 
+       /* schema mode */
+       if ( ad_map_type == WB_POSIX_MAP_UNKNOWN )
+               ad_map_type = WB_POSIX_MAP_RFC2307;
+       schema_mode = lp_parm_const_string(-1, config_option, "schema_mode", 
NULL);
+       if ( schema_mode && schema_mode[0] ) {
+               if ( strequal(schema_mode, "sfu") )
+                       ad_map_type = WB_POSIX_MAP_SFU;
+               else if ( strequal(schema_mode, "rfc2307" ) )
+                       ad_map_type = WB_POSIX_MAP_RFC2307;
+               else
+                       DEBUG(0,("idmap_ad_initialize: Unknown schema_mode 
(%s)\n",
+                                schema_mode));
+       }
+
        dom->private_data = ctx;
 
        talloc_free(config_option);

Reply via email to