mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3-auth Rename NT_USER_TOKEN user_sids -> sids
This is closer to the struct security_token from security.idl
This commit is contained in:
parent
6beb5563f3
commit
8c15cf54ae
@ -405,12 +405,12 @@ static NTSTATUS log_nt_token(NT_USER_TOKEN *token)
|
||||
for (i=1; i<token->num_sids; i++) {
|
||||
group_sidstr = talloc_asprintf(
|
||||
frame, "%s %s", group_sidstr,
|
||||
sid_string_talloc(frame, &token->user_sids[i]));
|
||||
sid_string_talloc(frame, &token->sids[i]));
|
||||
}
|
||||
|
||||
command = talloc_string_sub(
|
||||
frame, lp_log_nt_token_command(),
|
||||
"%s", sid_string_talloc(frame, &token->user_sids[0]));
|
||||
"%s", sid_string_talloc(frame, &token->sids[0]));
|
||||
command = talloc_string_sub(frame, command, "%t", group_sidstr);
|
||||
|
||||
if (command == NULL) {
|
||||
@ -477,7 +477,7 @@ NTSTATUS create_local_token(struct auth_serversupplied_info *server_info)
|
||||
|
||||
for (i=1; i<server_info->ptok->num_sids; i++) {
|
||||
gid_t gid;
|
||||
struct dom_sid *sid = &server_info->ptok->user_sids[i];
|
||||
struct dom_sid *sid = &server_info->ptok->sids[i];
|
||||
|
||||
if (!sid_to_gid(sid, &gid)) {
|
||||
DEBUG(10, ("Could not convert SID %s to gid, "
|
||||
@ -505,13 +505,13 @@ NTSTATUS create_local_token(struct auth_serversupplied_info *server_info)
|
||||
uid_to_unix_users_sid(server_info->utok.uid, &tmp_sid);
|
||||
|
||||
add_sid_to_array_unique(server_info->ptok, &tmp_sid,
|
||||
&server_info->ptok->user_sids,
|
||||
&server_info->ptok->sids,
|
||||
&server_info->ptok->num_sids);
|
||||
|
||||
for ( i=0; i<server_info->utok.ngroups; i++ ) {
|
||||
gid_to_unix_groups_sid(server_info->utok.groups[i], &tmp_sid);
|
||||
add_sid_to_array_unique(server_info->ptok, &tmp_sid,
|
||||
&server_info->ptok->user_sids,
|
||||
&server_info->ptok->sids,
|
||||
&server_info->ptok->num_sids);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ bool nt_token_check_sid ( const struct dom_sid *sid, const NT_USER_TOKEN *token
|
||||
return False;
|
||||
|
||||
for ( i=0; i<token->num_sids; i++ ) {
|
||||
if ( sid_equal( sid, &token->user_sids[i] ) )
|
||||
if ( sid_equal( sid, &token->sids[i] ) )
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ NTSTATUS add_aliases(const struct dom_sid *domain_sid,
|
||||
num_aliases = 0;
|
||||
|
||||
status = pdb_enum_alias_memberships(tmp_ctx, domain_sid,
|
||||
token->user_sids,
|
||||
token->sids,
|
||||
token->num_sids,
|
||||
&aliases, &num_aliases);
|
||||
|
||||
@ -158,7 +158,7 @@ NTSTATUS add_aliases(const struct dom_sid *domain_sid,
|
||||
struct dom_sid alias_sid;
|
||||
sid_compose(&alias_sid, domain_sid, aliases[i]);
|
||||
status = add_sid_to_array_unique(token, &alias_sid,
|
||||
&token->user_sids,
|
||||
&token->sids,
|
||||
&token->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0, ("add_sid_to_array failed\n"));
|
||||
@ -200,7 +200,7 @@ static NTSTATUS add_builtin_administrators(struct nt_user_token *token,
|
||||
if ( nt_token_check_sid( &domadm, token ) ) {
|
||||
status = add_sid_to_array(token,
|
||||
&global_sid_Builtin_Administrators,
|
||||
&token->user_sids, &token->num_sids);
|
||||
&token->sids, &token->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
@ -365,8 +365,8 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
|
||||
/* check if the user rid is the special "Domain Guests" rid.
|
||||
* If so pick the first sid for the extra sids instead as it
|
||||
* is a local fake account */
|
||||
usrtok->user_sids = talloc_array(usrtok, struct dom_sid, 2);
|
||||
if (!usrtok->user_sids) {
|
||||
usrtok->sids = talloc_array(usrtok, struct dom_sid, 2);
|
||||
if (!usrtok->sids) {
|
||||
TALLOC_FREE(usrtok);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
@ -383,10 +383,10 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
|
||||
TALLOC_FREE(usrtok);
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
sid_copy(&usrtok->user_sids[0], &extra->user_sid);
|
||||
sid_copy(&usrtok->sids[0], &extra->user_sid);
|
||||
} else {
|
||||
sid_copy(&usrtok->user_sids[0], info3->base.domain_sid);
|
||||
sid_append_rid(&usrtok->user_sids[0], info3->base.rid);
|
||||
sid_copy(&usrtok->sids[0], info3->base.domain_sid);
|
||||
sid_append_rid(&usrtok->sids[0], info3->base.rid);
|
||||
}
|
||||
|
||||
/* GROUP SID */
|
||||
@ -400,10 +400,10 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
|
||||
TALLOC_FREE(usrtok);
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
sid_copy(&usrtok->user_sids[1], &extra->pgid_sid);
|
||||
sid_copy(&usrtok->sids[1], &extra->pgid_sid);
|
||||
} else {
|
||||
sid_copy(&usrtok->user_sids[1], info3->base.domain_sid);
|
||||
sid_append_rid(&usrtok->user_sids[1],
|
||||
sid_copy(&usrtok->sids[1], info3->base.domain_sid);
|
||||
sid_append_rid(&usrtok->sids[1],
|
||||
info3->base.primary_gid);
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
|
||||
sid_append_rid(&tmp_sid, info3->base.groups.rids[i].rid);
|
||||
|
||||
status = add_sid_to_array_unique(usrtok, &tmp_sid,
|
||||
&usrtok->user_sids,
|
||||
&usrtok->sids,
|
||||
&usrtok->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(3, ("Failed to add SID to nt token\n"));
|
||||
@ -434,7 +434,7 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
|
||||
for (i = 0; i < info3->sidcount; i++) {
|
||||
status = add_sid_to_array_unique(usrtok,
|
||||
info3->sids[i].sid,
|
||||
&usrtok->user_sids,
|
||||
&usrtok->sids,
|
||||
&usrtok->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(3, ("Failed to add SID to nt token\n"));
|
||||
@ -479,7 +479,7 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
|
||||
/* Add the user and primary group sid */
|
||||
|
||||
status = add_sid_to_array(result, user_sid,
|
||||
&result->user_sids, &result->num_sids);
|
||||
&result->sids, &result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(result);
|
||||
return NULL;
|
||||
@ -488,7 +488,7 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
|
||||
/* For guest, num_groupsids may be zero. */
|
||||
if (num_groupsids) {
|
||||
status = add_sid_to_array(result, &groupsids[0],
|
||||
&result->user_sids,
|
||||
&result->sids,
|
||||
&result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(result);
|
||||
@ -504,7 +504,7 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
|
||||
|
||||
for (i=1; i<num_groupsids; i++) {
|
||||
status = add_sid_to_array_unique(result, &groupsids[i],
|
||||
&result->user_sids,
|
||||
&result->sids,
|
||||
&result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(result);
|
||||
@ -531,19 +531,19 @@ static NTSTATUS finalize_local_nt_token(struct nt_user_token *result,
|
||||
/* Add in BUILTIN sids */
|
||||
|
||||
status = add_sid_to_array(result, &global_sid_World,
|
||||
&result->user_sids, &result->num_sids);
|
||||
&result->sids, &result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
status = add_sid_to_array(result, &global_sid_Network,
|
||||
&result->user_sids, &result->num_sids);
|
||||
&result->sids, &result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (is_guest) {
|
||||
status = add_sid_to_array(result, &global_sid_Builtin_Guests,
|
||||
&result->user_sids,
|
||||
&result->sids,
|
||||
&result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -551,7 +551,7 @@ static NTSTATUS finalize_local_nt_token(struct nt_user_token *result,
|
||||
} else {
|
||||
status = add_sid_to_array(result,
|
||||
&global_sid_Authenticated_Users,
|
||||
&result->user_sids,
|
||||
&result->sids,
|
||||
&result->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -642,7 +642,7 @@ static NTSTATUS finalize_local_nt_token(struct nt_user_token *result,
|
||||
|
||||
/* Add privileges based on current user sids */
|
||||
|
||||
get_privileges_for_sids(&result->privileges, result->user_sids,
|
||||
get_privileges_for_sids(&result->privileges, result->sids,
|
||||
result->num_sids);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
@ -663,13 +663,13 @@ void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token)
|
||||
|
||||
DEBUGC(dbg_class, dbg_lev,
|
||||
("NT user token of user %s\n",
|
||||
sid_string_dbg(&token->user_sids[0]) ));
|
||||
sid_string_dbg(&token->sids[0]) ));
|
||||
DEBUGADDC(dbg_class, dbg_lev,
|
||||
("contains %lu SIDs\n", (unsigned long)token->num_sids));
|
||||
for (i = 0; i < token->num_sids; i++)
|
||||
DEBUGADDC(dbg_class, dbg_lev,
|
||||
("SID[%3lu]: %s\n", (unsigned long)i,
|
||||
sid_string_dbg(&token->user_sids[i])));
|
||||
sid_string_dbg(&token->sids[i])));
|
||||
|
||||
dump_se_priv( dbg_class, dbg_lev, &token->privileges );
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ extern const struct dom_sid global_sid_Unix_Groups;
|
||||
|
||||
typedef struct nt_user_token {
|
||||
size_t num_sids;
|
||||
struct dom_sid *user_sids;
|
||||
struct dom_sid *sids;
|
||||
SE_PRIV privileges;
|
||||
} NT_USER_TOKEN;
|
||||
|
||||
|
@ -44,11 +44,11 @@ NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ptoken->user_sids && ptoken->num_sids) {
|
||||
token->user_sids = (struct dom_sid *)talloc_memdup(
|
||||
token, ptoken->user_sids, sizeof(struct dom_sid) * ptoken->num_sids );
|
||||
if (ptoken->sids && ptoken->num_sids) {
|
||||
token->sids = (struct dom_sid *)talloc_memdup(
|
||||
token, ptoken->sids, sizeof(struct dom_sid) * ptoken->num_sids );
|
||||
|
||||
if (token->user_sids == NULL) {
|
||||
if (token->sids == NULL) {
|
||||
DEBUG(0, ("talloc_memdup failed\n"));
|
||||
TALLOC_FREE(token);
|
||||
return NULL;
|
||||
@ -88,8 +88,8 @@ NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
|
||||
|
||||
for (i=0; i < token_1->num_sids; i++) {
|
||||
status = add_sid_to_array_unique(mem_ctx,
|
||||
&token_1->user_sids[i],
|
||||
&token->user_sids,
|
||||
&token_1->sids[i],
|
||||
&token->sids,
|
||||
&token->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(token);
|
||||
@ -99,8 +99,8 @@ NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
|
||||
|
||||
for (i=0; i < token_2->num_sids; i++) {
|
||||
status = add_sid_to_array_unique(mem_ctx,
|
||||
&token_2->user_sids[i],
|
||||
&token->user_sids,
|
||||
&token_2->sids[i],
|
||||
&token->sids,
|
||||
&token->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(token);
|
||||
@ -125,7 +125,7 @@ bool token_sid_in_ace(const NT_USER_TOKEN *token, const struct security_ace *ace
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < token->num_sids; i++) {
|
||||
if (sid_equal(&ace->trustee, &token->user_sids[i]))
|
||||
if (sid_equal(&ace->trustee, &token->sids[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ bool is_sid_in_token(const NT_USER_TOKEN *token, const struct dom_sid *sid)
|
||||
int i;
|
||||
|
||||
for (i=0; i<token->num_sids; i++) {
|
||||
if (sid_compare(sid, &token->user_sids[i]) == 0)
|
||||
if (sid_compare(sid, &token->sids[i]) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -40,7 +40,7 @@ struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx)
|
||||
token->privileges = se_priv_all;
|
||||
|
||||
if (!NT_STATUS_IS_OK(add_sid_to_array(token, &global_sid_System,
|
||||
&token->user_sids, &token->num_sids))) {
|
||||
&token->sids, &token->num_sids))) {
|
||||
DEBUG(1,("Error adding nt-authority system sid to token\n"));
|
||||
return NULL;
|
||||
}
|
||||
@ -319,7 +319,7 @@ static WERROR gp_reg_del_groupmembership(TALLOC_CTX *mem_ctx,
|
||||
{
|
||||
const char *path = NULL;
|
||||
|
||||
path = gp_reg_groupmembership_path(mem_ctx, &token->user_sids[0],
|
||||
path = gp_reg_groupmembership_path(mem_ctx, &token->sids[0],
|
||||
flags);
|
||||
W_ERROR_HAVE_NO_MEMORY(path);
|
||||
|
||||
@ -343,7 +343,7 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
|
||||
const char *val = NULL;
|
||||
int count = 0;
|
||||
|
||||
path = gp_reg_groupmembership_path(mem_ctx, &token->user_sids[0],
|
||||
path = gp_reg_groupmembership_path(mem_ctx, &token->sids[0],
|
||||
flags);
|
||||
W_ERROR_HAVE_NO_MEMORY(path);
|
||||
|
||||
@ -358,7 +358,7 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
|
||||
valname = talloc_asprintf(mem_ctx, "Group%d", count++);
|
||||
W_ERROR_HAVE_NO_MEMORY(valname);
|
||||
|
||||
val = sid_string_talloc(mem_ctx, &token->user_sids[i]);
|
||||
val = sid_string_talloc(mem_ctx, &token->sids[i]);
|
||||
W_ERROR_HAVE_NO_MEMORY(val);
|
||||
werr = gp_store_reg_val_sz(mem_ctx, key, valname, val);
|
||||
W_ERROR_NOT_OK_RETURN(werr);
|
||||
@ -410,7 +410,7 @@ static WERROR gp_reg_read_groupmembership(TALLOC_CTX *mem_ctx,
|
||||
werr = gp_read_reg_val_sz(mem_ctx, key, valname, &val);
|
||||
W_ERROR_NOT_OK_RETURN(werr);
|
||||
|
||||
if (!string_to_sid(&tmp_token->user_sids[num_token_sids++],
|
||||
if (!string_to_sid(&tmp_token->sids[num_token_sids++],
|
||||
val)) {
|
||||
return WERR_INSUFFICIENT_BUFFER;
|
||||
}
|
||||
@ -468,7 +468,7 @@ WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
|
||||
W_ERROR_NOT_OK_RETURN(werr);
|
||||
|
||||
werr = gp_secure_key(mem_ctx, flags, reg_ctx->curr_key,
|
||||
&token->user_sids[0]);
|
||||
&token->sids[0]);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
DEBUG(0,("failed to secure key: %s\n", win_errstr(werr)));
|
||||
goto done;
|
||||
@ -480,7 +480,7 @@ WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
subkeyname = gp_req_state_path(mem_ctx, &token->user_sids[0], flags);
|
||||
subkeyname = gp_req_state_path(mem_ctx, &token->sids[0], flags);
|
||||
if (!subkeyname) {
|
||||
werr = WERR_NOMEM;
|
||||
goto done;
|
||||
@ -979,7 +979,7 @@ WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
|
||||
case GP_REG_ACTION_SEC_KEY_SET:
|
||||
werr = gp_secure_key(mem_ctx, flags,
|
||||
key,
|
||||
&token->user_sids[0]);
|
||||
&token->sids[0]);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
DEBUG(0,("reg_apply_registry_entry: "
|
||||
"gp_secure_key failed: %s\n",
|
||||
|
@ -422,8 +422,8 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
&psd,
|
||||
&size,
|
||||
parent_desc,
|
||||
&handle->conn->server_info->ptok->user_sids[PRIMARY_USER_SID_INDEX],
|
||||
&handle->conn->server_info->ptok->user_sids[PRIMARY_GROUP_SID_INDEX],
|
||||
&handle->conn->server_info->ptok->sids[PRIMARY_USER_SID_INDEX],
|
||||
&handle->conn->server_info->ptok->sids[PRIMARY_GROUP_SID_INDEX],
|
||||
is_directory);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
|
@ -330,7 +330,7 @@ static char *smb_traffic_analyzer_create_string( TALLOC_CTX *ctx,
|
||||
* anonymized if needed, by the calling function.
|
||||
*/
|
||||
usersid = dom_sid_string( common_data_count_str,
|
||||
&handle->conn->server_info->ptok->user_sids[0]);
|
||||
&handle->conn->server_info->ptok->sids[0]);
|
||||
|
||||
sidstr = smb_traffic_analyzer_anonymize(
|
||||
common_data_count_str,
|
||||
|
@ -45,7 +45,7 @@ NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
token->privileges = se_disk_operators;
|
||||
status = add_sid_to_array(token, &global_sid_Builtin_Administrators,
|
||||
&token->user_sids, &token->num_sids);
|
||||
&token->sids, &token->num_sids);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1, ("Error adding builtin administrators sid "
|
||||
"to fake token.\n"));
|
||||
|
@ -759,7 +759,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
|
||||
|
||||
status = find_forced_group(
|
||||
conn->force_user, snum, conn->server_info->unix_name,
|
||||
&conn->server_info->ptok->user_sids[1],
|
||||
&conn->server_info->ptok->sids[1],
|
||||
&conn->server_info->utok.gid);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
@ -3406,7 +3406,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
|
||||
for (i = 0, sid_bytes = 0;
|
||||
i < conn->server_info->ptok->num_sids; ++i) {
|
||||
sid_bytes += ndr_size_dom_sid(
|
||||
&conn->server_info->ptok->user_sids[i],
|
||||
&conn->server_info->ptok->sids[i],
|
||||
0);
|
||||
}
|
||||
|
||||
@ -3428,11 +3428,11 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
|
||||
for (i = 0;
|
||||
i < conn->server_info->ptok->num_sids; ++i) {
|
||||
int sid_len = ndr_size_dom_sid(
|
||||
&conn->server_info->ptok->user_sids[i],
|
||||
&conn->server_info->ptok->sids[i],
|
||||
0);
|
||||
|
||||
sid_linearize(pdata + data_len, sid_len,
|
||||
&conn->server_info->ptok->user_sids[i]);
|
||||
&conn->server_info->ptok->sids[i]);
|
||||
data_len += sid_len;
|
||||
}
|
||||
|
||||
|
@ -325,14 +325,14 @@ bool change_to_user(connection_struct *conn, uint16 vuid)
|
||||
conn->force_group_gid;
|
||||
gid = conn->force_group_gid;
|
||||
gid_to_sid(&conn->server_info->ptok
|
||||
->user_sids[1], gid);
|
||||
->sids[1], gid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
conn->server_info->utok.gid = conn->force_group_gid;
|
||||
gid = conn->force_group_gid;
|
||||
gid_to_sid(&conn->server_info->ptok->user_sids[1],
|
||||
gid_to_sid(&conn->server_info->ptok->sids[1],
|
||||
gid);
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
|
||||
|
||||
{
|
||||
WERROR werr = gp_reg_state_read(mem_ctx, flags,
|
||||
&token->user_sids[0],
|
||||
&token->sids[0],
|
||||
&read_list);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
d_printf(_("failed: %s\n"), win_errstr(werr));
|
||||
|
@ -4118,21 +4118,21 @@ static void init_user_token(NT_USER_TOKEN *token, struct dom_sid *user_sid)
|
||||
{
|
||||
token->num_sids = 4;
|
||||
|
||||
if (!(token->user_sids = SMB_MALLOC_ARRAY(struct dom_sid, 4))) {
|
||||
if (!(token->sids = SMB_MALLOC_ARRAY(struct dom_sid, 4))) {
|
||||
d_fprintf(stderr, "malloc %s\n",_("failed"));
|
||||
token->num_sids = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
token->user_sids[0] = *user_sid;
|
||||
sid_copy(&token->user_sids[1], &global_sid_World);
|
||||
sid_copy(&token->user_sids[2], &global_sid_Network);
|
||||
sid_copy(&token->user_sids[3], &global_sid_Authenticated_Users);
|
||||
token->sids[0] = *user_sid;
|
||||
sid_copy(&token->sids[1], &global_sid_World);
|
||||
sid_copy(&token->sids[2], &global_sid_Network);
|
||||
sid_copy(&token->sids[3], &global_sid_Authenticated_Users);
|
||||
}
|
||||
|
||||
static void free_user_token(NT_USER_TOKEN *token)
|
||||
{
|
||||
SAFE_FREE(token->user_sids);
|
||||
SAFE_FREE(token->sids);
|
||||
}
|
||||
|
||||
static void add_sid_to_token(NT_USER_TOKEN *token, struct dom_sid *sid)
|
||||
@ -4140,12 +4140,12 @@ static void add_sid_to_token(NT_USER_TOKEN *token, struct dom_sid *sid)
|
||||
if (is_sid_in_token(token, sid))
|
||||
return;
|
||||
|
||||
token->user_sids = SMB_REALLOC_ARRAY(token->user_sids, struct dom_sid, token->num_sids+1);
|
||||
if (!token->user_sids) {
|
||||
token->sids = SMB_REALLOC_ARRAY(token->sids, struct dom_sid, token->num_sids+1);
|
||||
if (!token->sids) {
|
||||
return;
|
||||
}
|
||||
|
||||
sid_copy(&token->user_sids[token->num_sids], sid);
|
||||
sid_copy(&token->sids[token->num_sids], sid);
|
||||
|
||||
token->num_sids += 1;
|
||||
}
|
||||
@ -4162,7 +4162,7 @@ static void dump_user_token(struct user_token *token)
|
||||
d_printf("%s\n", token->name);
|
||||
|
||||
for (i=0; i<token->token.num_sids; i++) {
|
||||
d_printf(" %s\n", sid_string_tos(&token->token.user_sids[i]));
|
||||
d_printf(" %s\n", sid_string_tos(&token->token.sids[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4201,7 +4201,7 @@ static void collect_alias_memberships(NT_USER_TOKEN *token)
|
||||
int i;
|
||||
|
||||
for (i=0; i<num_global_sids; i++) {
|
||||
collect_sid_memberships(token, token->user_sids[i]);
|
||||
collect_sid_memberships(token, token->sids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4410,7 +4410,7 @@ static bool get_user_tokens_from_file(FILE *f,
|
||||
|
||||
fstrcpy(token->name, line);
|
||||
token->token.num_sids = 0;
|
||||
token->token.user_sids = NULL;
|
||||
token->token.sids = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ static NTSTATUS check_info3_in_group(struct netr_SamInfo3 *info3,
|
||||
}
|
||||
|
||||
status = sid_array_from_info3(talloc_tos(), info3,
|
||||
&token->user_sids,
|
||||
&token->sids,
|
||||
&token->num_sids,
|
||||
true, false);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
Loading…
Reference in New Issue
Block a user