s3:idmap: remove unused alloc method get_id_hwm from idmap API
authorMichael Adam <obnox@samba.org>
Thu, 22 Jan 2009 16:56:19 +0000 (17:56 +0100)
committerMichael Adam <obnox@samba.org>
Sat, 14 Aug 2010 00:10:35 +0000 (02:10 +0200)
Michael

source3/include/idmap.h
source3/winbindd/idmap_ldap.c
source3/winbindd/idmap_tdb.c
source3/winbindd/idmap_tdb2.c

index e32ade709f015d996bfcb08625a21dc15344f46c..b3f9af47d07901ed587c57c996993cb0372a2e2c 100644 (file)
@@ -62,7 +62,6 @@ struct idmap_alloc_methods {
        NTSTATUS (*init)(const char *compat_params);
 
        NTSTATUS (*allocate_id)(struct unixid *id);
-       NTSTATUS (*get_id_hwm)(struct unixid *id);
        NTSTATUS (*set_id_hwm)(struct unixid *id);
 
        /* Called when backend is unloaded */
index 994a6bc0772249fa3db9283c42cb2429544b9a16..453d31aeca3fd6128f836bcb115e5f1c446d7b93 100644 (file)
@@ -511,103 +511,6 @@ done:
        return ret;
 }
 
-/**********************************
- Get current highest id.
-**********************************/
-
-static NTSTATUS idmap_ldap_get_hwm(struct unixid *xid)
-{
-       TALLOC_CTX *memctx;
-       NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
-       int rc = LDAP_SERVER_DOWN;
-       int count = 0;
-       LDAPMessage *result = NULL;
-       LDAPMessage *entry = NULL;
-       char *id_str;
-       char *filter = NULL;
-       const char **attr_list;
-       const char *type;
-
-       /* Only do query if we are online */
-       if (idmap_is_offline()) {
-               return NT_STATUS_FILE_IS_OFFLINE;
-       }
-
-       if ( ! idmap_alloc_ldap) {
-               return NT_STATUS_UNSUCCESSFUL;
-       }
-
-       memctx = talloc_new(idmap_alloc_ldap);
-       if ( ! memctx) {
-               DEBUG(0, ("Out of memory!\n"));
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       /* get type */
-       switch (xid->type) {
-
-       case ID_TYPE_UID:
-               type = get_attr_key2string(idpool_attr_list,
-                                          LDAP_ATTR_UIDNUMBER);
-               break;
-
-       case ID_TYPE_GID:
-               type = get_attr_key2string(idpool_attr_list,
-                                          LDAP_ATTR_GIDNUMBER);
-               break;
-
-       default:
-               DEBUG(2, ("Invalid ID type (0x%x)\n", xid->type));
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       filter = talloc_asprintf(memctx, "(objectClass=%s)", LDAP_OBJ_IDPOOL);
-       CHECK_ALLOC_DONE(filter);
-
-       attr_list = get_attr_list(memctx, idpool_attr_list);
-       CHECK_ALLOC_DONE(attr_list);
-
-       rc = smbldap_search(idmap_alloc_ldap->smbldap_state,
-                           idmap_alloc_ldap->suffix,
-                           LDAP_SCOPE_SUBTREE, filter,
-                           attr_list, 0, &result);
-
-       if (rc != LDAP_SUCCESS) {
-               DEBUG(0,("%s object not found\n", LDAP_OBJ_IDPOOL));
-               goto done;
-       }
-
-       talloc_autofree_ldapmsg(memctx, result);
-
-       count = ldap_count_entries(idmap_alloc_ldap->smbldap_state->ldap_struct,
-                                  result);
-       if (count != 1) {
-               DEBUG(0,("Single %s object not found\n", LDAP_OBJ_IDPOOL));
-               goto done;
-       }
-
-       entry = ldap_first_entry(idmap_alloc_ldap->smbldap_state->ldap_struct,
-                                result);
-
-       id_str = smbldap_talloc_single_attribute(idmap_alloc_ldap->smbldap_state->ldap_struct,
-                       entry, type, memctx);
-       if ( ! id_str) {
-               DEBUG(0,("%s attribute not found\n", type));
-               goto done;
-       }
-       if ( ! id_str) {
-               DEBUG(0,("Out of memory\n"));
-               ret = NT_STATUS_NO_MEMORY;
-               goto done;
-       }
-
-       xid->id = strtoul(id_str, NULL, 10);
-
-       ret = NT_STATUS_OK;
-done:
-       talloc_free(memctx);
-       return ret;
-}
 /**********************************
  Set highest id.
 **********************************/
@@ -1517,7 +1420,6 @@ static struct idmap_alloc_methods idmap_ldap_alloc_methods = {
 
        .init = idmap_ldap_alloc_init,
        .allocate_id = idmap_ldap_allocate_id,
-       .get_id_hwm = idmap_ldap_get_hwm,
        .set_id_hwm = idmap_ldap_set_hwm,
        .close_fn = idmap_ldap_alloc_close,
 };
index 6acf1e4573348cea0135dd48484d3a534a37a829..af91ee9278b62589a1896daa85d9e789e6436d9a 100644 (file)
@@ -475,51 +475,6 @@ static NTSTATUS idmap_tdb_allocate_id(struct unixid *xid)
        return NT_STATUS_OK;
 }
 
-/**********************************
- Get current highest id. 
-**********************************/
-
-static NTSTATUS idmap_tdb_get_hwm(struct unixid *xid)
-{
-       const char *hwmkey;
-       const char *hwmtype;
-       uint32_t hwm;
-       uint32_t high_hwm;
-
-       /* Get current high water mark */
-       switch (xid->type) {
-
-       case ID_TYPE_UID:
-               hwmkey = HWM_USER;
-               hwmtype = "UID";
-               high_hwm = idmap_tdb_state.high_uid;
-               break;
-
-       case ID_TYPE_GID:
-               hwmkey = HWM_GROUP;
-               hwmtype = "GID";
-               high_hwm = idmap_tdb_state.high_gid;
-               break;
-
-       default:
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       if ((hwm = dbwrap_fetch_int32(idmap_alloc_db, 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. 
 **********************************/
@@ -1018,7 +973,6 @@ static struct idmap_alloc_methods db_alloc_methods = {
 
        .init = idmap_tdb_alloc_init,
        .allocate_id = idmap_tdb_allocate_id,
-       .get_id_hwm = idmap_tdb_get_hwm,
        .set_id_hwm = idmap_tdb_set_hwm,
        .close_fn = idmap_tdb_alloc_close
 };
index bd30a253938ac8a1840ea1ae6e5d512f7dee54f5..d5044ed5c60c13616fff5f5eaf85368e2a0e21f3 100644 (file)
@@ -297,54 +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. 
 */
@@ -945,7 +897,6 @@ static struct idmap_methods db_methods = {
 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
 };