fixes
authorSimo Sorce <idra@samba.org>
Sat, 19 Apr 2003 15:29:39 +0000 (15:29 +0000)
committerSimo Sorce <idra@samba.org>
Sat, 19 Apr 2003 15:29:39 +0000 (15:29 +0000)
fix debug, add "idmap" string to the list of classes
fix idmap, check init failures, and enhance debugging
fix idmap_tdb, _do_ init uid and gid low,high states (too bad I missed that
before)
fix smbd/uid.c, use gid_t for gids and uid_t for uids
(This used to be commit bc95de4ebb014080bc70173e7df94c672cea8df6)

source3/lib/debug.c
source3/sam/idmap.c
source3/sam/idmap_tdb.c
source3/smbd/uid.c

index dc675037a0d090dd4880ebc913462f054ccf521e..fdbd54fafb01756f4e6d851229f638720ab15309 100644 (file)
@@ -154,6 +154,7 @@ static const char *default_classname_table[] = {
        "auth",              /* DBGC_AUTH         */
        "winbind",           /* DBGC_WINBIND      */
        "vfs",               /* DBGC_VFS          */
+       "idmap",             /* DBGC_IDMAP        */
        NULL
 };
 
index 8b5e23de25c69a0d4cc32802442924837eaeb642..771f4169a279fddc4a5dd6d35824917807b9e1c9 100644 (file)
@@ -67,15 +67,18 @@ BOOL idmap_init(const char *remote_backend)
 {
        if (!local_map) {
                idmap_reg_tdb(&local_map);
-               local_map->init();
+               if (NT_STATUS_IS_ERR(local_map->init())) {
+                       DEBUG(0, ("idmap_init: could not load or create local backend!\n"));
+                       return False;
+               }
        }
        
        if (!remote_map && remote_backend && *remote_backend != 0) {
-               DEBUG(3, ("load_methods: using '%s' as remote backend\n", remote_backend));
+               DEBUG(3, ("idmap_init: using '%s' as remote backend\n", remote_backend));
                
                remote_map = get_methods(remote_backend);
                if (!remote_map) {
-                       DEBUG(0, ("load_methods: could not load remote backend '%s'\n", remote_backend));
+                       DEBUG(0, ("idmap_init: could not load remote backend '%s'\n", remote_backend));
                        return False;
                }
                remote_map->init();
index c494cf595faafef10d1b122875ad397b29302d5d..a43f5824a1fa5b9da0e0ec331ffdfdc2e7f569f3 100644 (file)
@@ -60,7 +60,7 @@ static NTSTATUS db_allocate_id(unid_t *id, int id_type)
                        }
 
                        if (hwm > idmap_state.uid_high) {
-                               DEBUG(0, ("idmap Fatal Error: UID range full!!\n"));
+                               DEBUG(0, ("idmap Fatal Error: UID range full!! (max: %u)\n", idmap_state.uid_high));
                                return NT_STATUS_UNSUCCESSFUL;
                        }
 
@@ -75,7 +75,7 @@ static NTSTATUS db_allocate_id(unid_t *id, int id_type)
                        }
 
                        if (hwm > idmap_state.gid_high) {
-                               DEBUG(0, ("idmap Fatal Error: GID range full!!\n"));
+                               DEBUG(0, ("idmap Fatal Error: GID range full!! (max: %u)\n", idmap_state.gid_high));
                                return NT_STATUS_UNSUCCESSFUL;
                        }
 
@@ -284,6 +284,16 @@ static NTSTATUS db_idmap_init(void)
                }
        }
 
+       if (!lp_idmap_uid(&idmap_state.uid_low, &idmap_state.uid_high)) {
+               DEBUG(0, ("idmap uid range missing or invalid\n"));
+               DEBUGADD(0, ("idmap will be unable to map foreign SIDs\n"));
+       }
+       
+       if (!lp_idmap_gid(&idmap_state.gid_low, &idmap_state.gid_high)) {
+               DEBUG(0, ("idmap gid range missing or invalid\n"));
+               DEBUGADD(0, ("idmap will be unable to map foreign SIDs\n"));
+       }
+       
        return NT_STATUS_OK;
 }
 
index 0fa65f47caeb306345a05d1284108e705ab0c84f..0b67b53c7197fb905e7a6e05ad067384eb166cc0 100644 (file)
@@ -873,6 +873,8 @@ BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid, enum SID_NAME_USE *sidtype)
 
        if (sid_compare_domain(get_global_sam_sid(), psid) == 0) {
                BOOL result;
+
+               DEBUG(10,("sid_to_uid: sid is local [%s]\n", sid_string_static(get_global_sam_sid())));
                become_root();
                result = local_sid_to_uid(puid, psid, sidtype);
                unbecome_root();