*/
#include "includes.h"
+#include "system/filesys.h"
+#include "passdb.h"
#include "groupdb/mapping.h"
+#include "dbwrap.h"
+#include "util_tdb.h"
+#include "../libcli/security/security.h"
static struct db_context *db; /* used for driver files */
len = tdb_pack(NULL, 0, "ddff",
map->gid, map->sid_name_use, map->nt_name, map->comment);
- buf = TALLOC_ARRAY(key, char, len);
+ buf = talloc_array(key, char, len);
if (!buf) {
TALLOC_FREE(key);
return false;
}
if ((state->domsid != NULL) &&
- (sid_compare_domain(state->domsid, &map.sid) != 0)) {
+ (dom_sid_compare_domain(state->domsid, &map.sid) != 0)) {
DEBUG(11,("enum_group_mapping: group %s is not in domain\n",
sid_string_dbg(&map.sid)));
return 0;
while (next_token_talloc(frame, &p, &string_sid, " ")) {
struct dom_sid alias;
+ uint32_t num_sids;
if (!string_to_sid(&alias, string_sid))
continue;
- status= add_sid_to_array_unique(NULL, &alias, sids, num);
+ num_sids = *num;
+ status= add_sid_to_array_unique(NULL, &alias, sids, &num_sids);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ *num = num_sids;
}
done:
static bool is_aliasmem(const struct dom_sid *alias, const struct dom_sid *member)
{
struct dom_sid *sids;
- size_t i, num;
+ size_t i;
+ size_t num;
/* This feels the wrong way round, but the on-disk data structure
* dictates it this way. */
return False;
for (i=0; i<num; i++) {
- if (sid_compare(alias, &sids[i]) == 0) {
+ if (dom_sid_compare(alias, &sids[i]) == 0) {
TALLOC_FREE(sids);
return True;
}
while (next_token_talloc(frame, &p, &alias_string, " ")) {
struct dom_sid alias, member;
const char *member_string;
+ uint32_t num_sids;
if (!string_to_sid(&alias, alias_string))
continue;
- if (sid_compare(state->alias, &alias) != 0)
+ if (dom_sid_compare(state->alias, &alias) != 0)
continue;
/* Ok, we found the alias we're looking for in the membership
if (!string_to_sid(&member, member_string))
continue;
+ num_sids = *state->num;
if (!NT_STATUS_IS_OK(add_sid_to_array(state->mem_ctx, &member,
state->sids,
- state->num)))
+ &num_sids)))
{
/* talloc fail. */
break;
}
+ *state->num = num_sids;
}
TALLOC_FREE(frame);
}
for (i=0; i<num; i++) {
- if (sid_compare(&sids[i], alias) == 0) {
+ if (dom_sid_compare(&sids[i], alias) == 0) {
found = True;
break;
}
p += len + 1;
num_vals = pull_uint32(p, 0);
- if (StrCaseCmp(name, "member") == 0) {
+ if (strcasecmp_m(name, "member") == 0) {
num_mem = num_vals;
members = talloc_array(tmp_ctx, struct dom_sid, num_mem);
if (members == NULL) {
/* we ignore unknown or uninteresting attributes
* (objectclass, etc.) */
- if (StrCaseCmp(name, "gidNumber") == 0) {
+ if (strcasecmp_m(name, "gidNumber") == 0) {
map.gid = strtoul(val, &q, 10);
if (*q) {
errno = EIO;
goto failed;
}
- } else if (StrCaseCmp(name, "sid") == 0) {
+ } else if (strcasecmp_m(name, "sid") == 0) {
if (!string_to_sid(&map.sid, val)) {
errno = EIO;
goto failed;
}
- } else if (StrCaseCmp(name, "sidNameUse") == 0) {
+ } else if (strcasecmp_m(name, "sidNameUse") == 0) {
map.sid_name_use = strtoul(val, &q, 10);
if (*q) {
errno = EIO;
goto failed;
}
- } else if (StrCaseCmp(name, "ntname") == 0) {
+ } else if (strcasecmp_m(name, "ntname") == 0) {
strlcpy(map.nt_name, val,
- sizeof(map.nt_name) -1);
- } else if (StrCaseCmp(name, "comment") == 0) {
+ sizeof(map.nt_name));
+ } else if (strcasecmp_m(name, "comment") == 0) {
strlcpy(map.comment, val,
- sizeof(map.comment) -1);
- } else if (StrCaseCmp(name, "member") == 0) {
+ sizeof(map.comment));
+ } else if (strcasecmp_m(name, "member") == 0) {
if (!string_to_sid(&members[j], val)) {
errno = EIO;
goto failed;