mirror of
https://github.com/samba-team/samba.git
synced 2024-12-29 11:21:54 +03:00
s4/drs: Remove unused structures and functions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
db82023af2
commit
c236bb537f
@ -158,11 +158,6 @@ struct dsdb_class {
|
||||
uint32_t subClass_order;
|
||||
};
|
||||
|
||||
struct dsdb_schema_oid_prefix {
|
||||
uint32_t id;
|
||||
const char *oid;
|
||||
size_t oid_len;
|
||||
};
|
||||
|
||||
struct dsdb_schema {
|
||||
|
||||
|
@ -252,94 +252,6 @@ WERROR dsdb_create_prefix_mapping(struct ldb_context *ldb, struct dsdb_schema *s
|
||||
return status;
|
||||
}
|
||||
|
||||
WERROR dsdb_prefix_map_update(TALLOC_CTX *mem_ctx, uint32_t *num_prefixes, struct dsdb_schema_oid_prefix **prefixes, const char *oid)
|
||||
{
|
||||
uint32_t new_num_prefixes, index_new_prefix, new_entry_id;
|
||||
const char* lastDotOffset;
|
||||
size_t size;
|
||||
|
||||
new_num_prefixes = *num_prefixes + 1;
|
||||
index_new_prefix = *num_prefixes;
|
||||
|
||||
/*
|
||||
* this is the algorithm we use to create new mappings for now
|
||||
*
|
||||
* TODO: find what algorithm windows use
|
||||
*/
|
||||
new_entry_id = (*num_prefixes)<<16;
|
||||
|
||||
/* Extract the prefix from the oid*/
|
||||
lastDotOffset = strrchr(oid, '.');
|
||||
if (lastDotOffset == NULL) {
|
||||
DEBUG(0,("dsdb_prefix_map_update: failed to find the last dot\n"));
|
||||
return WERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Calculate the size of the remainig string that should be the prefix of it */
|
||||
size = strlen(oid) - strlen(lastDotOffset);
|
||||
if (size <= 0) {
|
||||
DEBUG(0,("dsdb_prefix_map_update: size of the remaining string invalid\n"));
|
||||
return WERR_FOOBAR;
|
||||
}
|
||||
|
||||
/* Create a spot in the prefixMap for one more prefix*/
|
||||
(*prefixes) = talloc_realloc(mem_ctx, *prefixes, struct dsdb_schema_oid_prefix, new_num_prefixes);
|
||||
W_ERROR_HAVE_NO_MEMORY(*prefixes);
|
||||
|
||||
/* Add the new prefix entry*/
|
||||
(*prefixes)[index_new_prefix].id = new_entry_id;
|
||||
(*prefixes)[index_new_prefix].oid = talloc_strndup(mem_ctx, oid, size);
|
||||
(*prefixes)[index_new_prefix].oid_len = strlen((*prefixes)[index_new_prefix].oid);
|
||||
|
||||
/* Increase num_prefixes because new prefix has been added */
|
||||
++(*num_prefixes);
|
||||
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
WERROR dsdb_find_prefix_for_oid(uint32_t num_prefixes, const struct dsdb_schema_oid_prefix *prefixes, const char *in, uint32_t *out)
|
||||
{
|
||||
uint32_t i;
|
||||
char *oid_prefix;
|
||||
char *pstr;
|
||||
char *end_str;
|
||||
unsigned val;
|
||||
|
||||
/* make oid prefix, i.e. oid w/o last subidentifier */
|
||||
pstr = strrchr(in, '.');
|
||||
if (!pstr) return WERR_INVALID_PARAM;
|
||||
if (pstr < in) return WERR_INVALID_PARAM;
|
||||
if ((pstr - in) < 4) return WERR_INVALID_PARAM;
|
||||
|
||||
oid_prefix = talloc_strndup(0, in, pstr - in);
|
||||
|
||||
for (i=0; i < num_prefixes; i++) {
|
||||
if (strcmp(prefixes[i].oid, oid_prefix) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
talloc_free(oid_prefix);
|
||||
|
||||
if (i < num_prefixes) {
|
||||
/* move next to '.' char */
|
||||
pstr++;
|
||||
|
||||
val = strtoul(pstr, &end_str, 10);
|
||||
if (end_str[0] != '\0') {
|
||||
return WERR_INVALID_PARAM;
|
||||
} else if (val > 0xFFFF) {
|
||||
return WERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
*out = prefixes[i].id | val;
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
DEBUG(5,(__location__ " Failed to find oid %s - have %u prefixes\n", in, num_prefixes));
|
||||
|
||||
return WERR_DS_NO_MSDS_INTID;
|
||||
}
|
||||
|
||||
WERROR dsdb_write_prefixes_from_schema_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
|
||||
const struct dsdb_schema *schema)
|
||||
|
Loading…
Reference in New Issue
Block a user