diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/idmap.h | 1 | ||||
-rw-r--r-- | source3/winbindd/idmap_ldap.c | 119 | ||||
-rw-r--r-- | source3/winbindd/idmap_tdb.c | 45 | ||||
-rw-r--r-- | source3/winbindd/idmap_tdb2.c | 12 |
4 files changed, 0 insertions, 177 deletions
diff --git a/source3/include/idmap.h b/source3/include/idmap.h index b3f9af47d0..27e4f8d51a 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -62,7 +62,6 @@ struct idmap_alloc_methods { NTSTATUS (*init)(const char *compat_params); NTSTATUS (*allocate_id)(struct unixid *id); - NTSTATUS (*set_id_hwm)(struct unixid *id); /* Called when backend is unloaded */ NTSTATUS (*close_fn)(void); diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c index 453d31aeca..32bcff9e61 100644 --- a/source3/winbindd/idmap_ldap.c +++ b/source3/winbindd/idmap_ldap.c @@ -512,124 +512,6 @@ done: } /********************************** - Set highest id. -**********************************/ - -static NTSTATUS idmap_ldap_set_hwm(struct unixid *xid) -{ - TALLOC_CTX *ctx; - NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; - int rc = LDAP_SERVER_DOWN; - int count = 0; - LDAPMessage *result = NULL; - LDAPMessage *entry = NULL; - LDAPMod **mods = NULL; - char *new_id_str; - char *filter = NULL; - const char *dn = 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; - } - - ctx = talloc_new(idmap_alloc_ldap); - if ( ! ctx) { - 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(ctx, "(objectClass=%s)", LDAP_OBJ_IDPOOL); - CHECK_ALLOC_DONE(filter); - - attr_list = get_attr_list(ctx, 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(ctx, 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); - - dn = smbldap_talloc_dn(ctx, - idmap_alloc_ldap->smbldap_state->ldap_struct, - entry); - if ( ! dn) { - goto done; - } - - new_id_str = talloc_asprintf(ctx, "%lu", (unsigned long)xid->id); - if ( ! new_id_str) { - DEBUG(0,("Out of memory\n")); - ret = NT_STATUS_NO_MEMORY; - goto done; - } - - smbldap_set_mod(&mods, LDAP_MOD_REPLACE, type, new_id_str); - - if (mods == NULL) { - DEBUG(0,("smbldap_set_mod() failed.\n")); - goto done; - } - - rc = smbldap_modify(idmap_alloc_ldap->smbldap_state, dn, mods); - - ldap_mods_free(mods, True); - - if (rc != LDAP_SUCCESS) { - DEBUG(1,("Failed to allocate new %s. " - "smbldap_modify() failed.\n", type)); - goto done; - } - - ret = NT_STATUS_OK; - -done: - talloc_free(ctx); - return ret; -} - -/********************************** Close idmap ldap alloc **********************************/ @@ -1420,7 +1302,6 @@ static struct idmap_alloc_methods idmap_ldap_alloc_methods = { .init = idmap_ldap_alloc_init, .allocate_id = idmap_ldap_allocate_id, - .set_id_hwm = idmap_ldap_set_hwm, .close_fn = idmap_ldap_alloc_close, }; diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index af91ee9278..095889f255 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -476,50 +476,6 @@ static NTSTATUS idmap_tdb_allocate_id(struct unixid *xid) } /********************************** - Set high id. -**********************************/ - -static NTSTATUS idmap_tdb_set_hwm(struct unixid *xid) -{ - const char *hwmkey; - const char *hwmtype; - uint32_t hwm; - uint32_t high_hwm; - NTSTATUS ret; - - /* 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; - } - - hwm = xid->id; - - /* 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)); - } - - ret = dbwrap_trans_store_uint32(idmap_alloc_db, hwmkey, hwm); - - return ret; -} - -/********************************** Close the alloc tdb **********************************/ @@ -973,7 +929,6 @@ static struct idmap_alloc_methods db_alloc_methods = { .init = idmap_tdb_alloc_init, .allocate_id = idmap_tdb_allocate_id, - .set_id_hwm = idmap_tdb_set_hwm, .close_fn = idmap_tdb_alloc_close }; diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index d5044ed5c6..4576ed68f2 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -298,17 +298,6 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid) } /* - 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 */ static NTSTATUS idmap_tdb2_alloc_close(void) @@ -897,7 +886,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, - .set_id_hwm = idmap_tdb2_set_hwm, .close_fn = idmap_tdb2_alloc_close }; |