s3:idmap_tdb2: don't call smb_register_idmap_alloc() in idmap_tdb2_init
[amitay/samba.git] / source3 / winbindd / idmap_tdb2.c
index f39969d1f84e295342b57be9e56ac4f83943ed25..e546d4459415a9c4c3a17a7347537ac647d9ddfc 100644 (file)
@@ -289,7 +289,7 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
 
        if (NT_STATUS_IS_OK(status)) {
                xid->id = state.hwm;
-               DEBUG(10,("New %s = %d\n", hwmtype, hwm));
+               DEBUG(10,("New %s = %d\n", hwmtype, state.hwm));
        } else {
                DEBUG(1, ("Error allocating a new %s\n", hwmtype));
        }
@@ -297,65 +297,6 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
        return status;
 }
 
-/*
-  Get current highest id. 
-*/
-static NTSTATUS idmap_tdb2_get_hwm(struct unixid *xid)
-{
-       const char *hwmkey;
-       const char *hwmtype;
-       uint32_t hwm;
-       uint32_t high_hwm;
-       NTSTATUS status;
-
-       status = idmap_tdb2_open_db();
-       NT_STATUS_NOT_OK_RETURN(status);
-
-       /* Get current high water mark */
-       switch (xid->type) {
-
-       case ID_TYPE_UID:
-               hwmkey = HWM_USER;
-               hwmtype = "UID";
-               high_hwm = idmap_tdb2_state.high_uid;
-               break;
-
-       case ID_TYPE_GID:
-               hwmkey = HWM_GROUP;
-               hwmtype = "GID";
-               high_hwm = idmap_tdb2_state.high_gid;
-               break;
-
-       default:
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       if ((hwm = dbwrap_fetch_int32(idmap_tdb2, hwmkey)) == -1) {
-               return NT_STATUS_INTERNAL_DB_ERROR;
-       }
-
-       xid->id = hwm;
-
-       /* Warn if it is out of range */
-       if (hwm >= high_hwm) {
-               DEBUG(0, ("Warning: %s range full!! (max: %lu)\n", 
-                         hwmtype, (unsigned long)high_hwm));
-       }
-
-       return NT_STATUS_OK;
-}
-
-/*
-  Set high id. 
-*/
-static NTSTATUS idmap_tdb2_set_hwm(struct unixid *xid)
-{
-       /* not supported, or we would invalidate the cache tdb on
-          other nodes */
-       DEBUG(0,("idmap_tdb2_set_hwm not supported\n"));
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 /*
   Close the alloc tdb 
 */
@@ -925,17 +866,6 @@ done:
        return ret;
 }
 
-/*
-  remove a mapping. 
-*/
-static NTSTATUS idmap_tdb2_remove_mapping(struct idmap_domain *dom, const struct id_map *map)
-{
-       /* not supported as it would invalidate the cache tdb on other
-          nodes */
-       DEBUG(0,("idmap_tdb2_remove_mapping not supported\n"));
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 /*
   Close the idmap tdb instance
 */
@@ -945,44 +875,20 @@ static NTSTATUS idmap_tdb2_close(struct idmap_domain *dom)
        return NT_STATUS_OK;
 }
 
-
-/*
-  Dump all mappings out
-*/
-static NTSTATUS idmap_tdb2_dump_data(struct idmap_domain *dom, struct id_map **maps, int *num_maps)
-{
-       DEBUG(0,("idmap_tdb2_dump_data not supported\n"));
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 static struct idmap_methods db_methods = {
        .init            = idmap_tdb2_db_init,
        .unixids_to_sids = idmap_tdb2_unixids_to_sids,
        .sids_to_unixids = idmap_tdb2_sids_to_unixids,
-       .set_mapping     = idmap_tdb2_set_mapping,
-       .remove_mapping  = idmap_tdb2_remove_mapping,
-       .dump_data       = idmap_tdb2_dump_data,
        .close_fn        = idmap_tdb2_close
 };
 
 static struct idmap_alloc_methods db_alloc_methods = {
        .init        = idmap_tdb2_alloc_init,
        .allocate_id = idmap_tdb2_allocate_id,
-       .get_id_hwm  = idmap_tdb2_get_hwm,
-       .set_id_hwm  = idmap_tdb2_set_hwm,
        .close_fn    = idmap_tdb2_alloc_close
 };
 
 NTSTATUS idmap_tdb2_init(void)
 {
-       NTSTATUS ret;
-
-       /* register both backends */
-       ret = smb_register_idmap_alloc(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_alloc_methods);
-       if (! NT_STATUS_IS_OK(ret)) {
-               DEBUG(0, ("Unable to register idmap alloc tdb2 module: %s\n", get_friendly_nt_error_msg(ret)));
-               return ret;
-       }
-
        return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_methods);
 }