diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-05-24 10:16:34 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-05-24 23:08:56 +1000 |
commit | 285647664cf60baa9f8f1a52bea0c55aa01b4e85 (patch) | |
tree | b86e569733a2c0fe8b56f675bd6acfc350d08b88 /source4/winbind | |
parent | 974ed9cf2c10ab3384c1070c22f5cd42908c95f1 (diff) | |
download | samba-285647664cf60baa9f8f1a52bea0c55aa01b4e85.tar.gz samba-285647664cf60baa9f8f1a52bea0c55aa01b4e85.tar.bz2 samba-285647664cf60baa9f8f1a52bea0c55aa01b4e85.zip |
s4:idmap Adjust code to new idmap structure names and layout.
Andrew Bartlett
Diffstat (limited to 'source4/winbind')
-rw-r--r-- | source4/winbind/idmap.c | 54 | ||||
-rw-r--r-- | source4/winbind/wb_gid2sid.c | 9 | ||||
-rw-r--r-- | source4/winbind/wb_sid2gid.c | 6 | ||||
-rw-r--r-- | source4/winbind/wb_sid2uid.c | 6 | ||||
-rw-r--r-- | source4/winbind/wb_uid2sid.c | 9 |
5 files changed, 26 insertions, 58 deletions
diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c index 4a99ac58c5..b024777cf0 100644 --- a/source4/winbind/idmap.c +++ b/source4/winbind/idmap.c @@ -284,7 +284,7 @@ failed: * \param idmap_ctx idmap context to use * \param mem_ctx talloc context to use * \param sid SID to map to an unixid struct - * \param unixid pointer to a unixid struct pointer + * \param unixid pointer to a unixid struct * \return NT_STATUS_OK on success, NT_STATUS_INVALID_SID if the sid is not from * a trusted domain and idmap trusted only = true, NT_STATUS_NONE_MAPPED if the * mapping failed. @@ -292,7 +292,7 @@ failed: static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx, TALLOC_CTX *mem_ctx, const struct dom_sid *sid, - struct unixid **unixid) + struct unixid *unixid) { int ret; NTSTATUS status = NT_STATUS_NONE_MAPPED; @@ -312,13 +312,8 @@ static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx, status = dom_sid_split_rid(tmp_ctx, sid, NULL, &rid); if (!NT_STATUS_IS_OK(status)) goto failed; - *unixid = talloc(mem_ctx, struct unixid); - if (*unixid == NULL) { - status = NT_STATUS_NO_MEMORY; - goto failed; - } - (*unixid)->id = rid; - (*unixid)->type = ID_TYPE_UID; + unixid->id = rid; + unixid->type = ID_TYPE_UID; talloc_free(tmp_ctx); return NT_STATUS_OK; @@ -330,13 +325,8 @@ static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx, status = dom_sid_split_rid(tmp_ctx, sid, NULL, &rid); if (!NT_STATUS_IS_OK(status)) goto failed; - *unixid = talloc(mem_ctx, struct unixid); - if (*unixid == NULL) { - status = NT_STATUS_NO_MEMORY; - goto failed; - } - (*unixid)->id = rid; - (*unixid)->type = ID_TYPE_GID; + unixid->id = rid; + unixid->type = ID_TYPE_GID; talloc_free(tmp_ctx); return NT_STATUS_OK; @@ -368,20 +358,14 @@ static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx, goto failed; } - *unixid = talloc(mem_ctx, struct unixid); - if (*unixid == NULL) { - status = NT_STATUS_NO_MEMORY; - goto failed; - } - - (*unixid)->id = new_xid; + unixid->id = new_xid; if (strcmp(type, "ID_TYPE_BOTH") == 0) { - (*unixid)->type = ID_TYPE_BOTH; + unixid->type = ID_TYPE_BOTH; } else if (strcmp(type, "ID_TYPE_UID") == 0) { - (*unixid)->type = ID_TYPE_UID; + unixid->type = ID_TYPE_UID; } else { - (*unixid)->type = ID_TYPE_GID; + unixid->type = ID_TYPE_GID; } talloc_free(tmp_ctx); @@ -604,14 +588,8 @@ static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx, goto failed; } - *unixid = talloc(mem_ctx, struct unixid); - if (*unixid == NULL) { - status = NT_STATUS_NO_MEMORY; - goto failed; - } - - (*unixid)->id = new_xid; - (*unixid)->type = ID_TYPE_BOTH; + unixid->id = new_xid; + unixid->type = ID_TYPE_BOTH; talloc_free(tmp_ctx); return NT_STATUS_OK; @@ -644,10 +622,10 @@ NTSTATUS idmap_xids_to_sids(struct idmap_context *idmap_ctx, for (i = 0; i < count; ++i) { status = idmap_xid_to_sid(idmap_ctx, mem_ctx, - id[i].unixid, &id[i].sid); + &id[i].xid, &id[i].sid); if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) { status = idmap_xid_to_sid(idmap_ctx, mem_ctx, - id[i].unixid, + &id[i].xid, &id[i].sid); } if (!NT_STATUS_IS_OK(status)) { @@ -693,11 +671,11 @@ NTSTATUS idmap_sids_to_xids(struct idmap_context *idmap_ctx, for (i = 0; i < count; ++i) { status = idmap_sid_to_xid(idmap_ctx, mem_ctx, - id[i].sid, &id[i].unixid); + id[i].sid, &id[i].xid); if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) { status = idmap_sid_to_xid(idmap_ctx, mem_ctx, id[i].sid, - &id[i].unixid); + &id[i].xid); } if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("idmapping sid_to_xid failed for id[%d]\n", i)); diff --git a/source4/winbind/wb_gid2sid.c b/source4/winbind/wb_gid2sid.c index 1cd34fce18..67a145e909 100644 --- a/source4/winbind/wb_gid2sid.c +++ b/source4/winbind/wb_gid2sid.c @@ -37,7 +37,6 @@ struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx, { struct composite_context *result, *ctx; struct gid2sid_state *state; - struct unixid *unixid; struct id_map *ids; DEBUG(5, ("wb_gid2sid_send called\n")); @@ -52,14 +51,10 @@ struct composite_context *wb_gid2sid_send(TALLOC_CTX *mem_ctx, result->private_data = state; state->service = service; - unixid = talloc(result, struct unixid); - if (composite_nomem(unixid, result)) return result; - unixid->id = gid; - unixid->type = ID_TYPE_GID; - ids = talloc(result, struct id_map); if (composite_nomem(ids, result)) return result; - ids->unixid = unixid; + ids->xid.id = gid; + ids->xid.type = ID_TYPE_GID; ids->sid = NULL; ctx = wb_xids2sids_send(result, service, 1, ids); diff --git a/source4/winbind/wb_sid2gid.c b/source4/winbind/wb_sid2gid.c index 9d9fabbbf8..b4026cd635 100644 --- a/source4/winbind/wb_sid2gid.c +++ b/source4/winbind/wb_sid2gid.c @@ -80,9 +80,9 @@ static void sid2gid_recv_gid(struct composite_context *ctx) return; } - if (ids->unixid->type == ID_TYPE_BOTH || - ids->unixid->type == ID_TYPE_GID) { - state->gid = ids->unixid->id; + if (ids->xid.type == ID_TYPE_BOTH || + ids->xid.type == ID_TYPE_GID) { + state->gid = ids->xid.id; composite_done(state->ctx); } else { composite_error(state->ctx, NT_STATUS_INVALID_SID); diff --git a/source4/winbind/wb_sid2uid.c b/source4/winbind/wb_sid2uid.c index 7431601038..1fff66f655 100644 --- a/source4/winbind/wb_sid2uid.c +++ b/source4/winbind/wb_sid2uid.c @@ -80,9 +80,9 @@ static void sid2uid_recv_uid(struct composite_context *ctx) return; } - if (ids->unixid->type == ID_TYPE_BOTH || - ids->unixid->type == ID_TYPE_UID) { - state->uid = ids->unixid->id; + if (ids->xid.type == ID_TYPE_BOTH || + ids->xid.type == ID_TYPE_UID) { + state->uid = ids->xid.id; composite_done(state->ctx); } else { composite_error(state->ctx, NT_STATUS_INVALID_SID); diff --git a/source4/winbind/wb_uid2sid.c b/source4/winbind/wb_uid2sid.c index 98198674b0..61b7704167 100644 --- a/source4/winbind/wb_uid2sid.c +++ b/source4/winbind/wb_uid2sid.c @@ -37,7 +37,6 @@ struct composite_context *wb_uid2sid_send(TALLOC_CTX *mem_ctx, { struct composite_context *result, *ctx; struct uid2sid_state *state; - struct unixid *unixid; struct id_map *ids; DEBUG(5, ("wb_uid2sid_send called\n")); @@ -52,15 +51,11 @@ struct composite_context *wb_uid2sid_send(TALLOC_CTX *mem_ctx, result->private_data = state; state->service = service; - unixid = talloc(result, struct unixid); - if (composite_nomem(unixid, result)) return result; - unixid->id = uid; - unixid->type = ID_TYPE_UID; - ids = talloc(result, struct id_map); if (composite_nomem(ids, result)) return result; - ids->unixid = unixid; ids->sid = NULL; + ids->xid.id = uid; + ids->xid.type = ID_TYPE_UID; ctx = wb_xids2sids_send(result, service, 1, ids); if (composite_nomem(ctx, result)) return result; |