return status;
}
+struct user_token {
+ fstring name;
+ struct security_token *token;
+};
+
static void add_sid_to_token(struct security_token *token, const struct dom_sid *sid)
{
NTSTATUS status = add_sid_to_array_unique(token, sid,
SMB_ASSERT(NT_STATUS_IS_OK(status));
}
-static void init_user_token(struct security_token **token, struct dom_sid *user_sid)
+static void init_user_token(struct user_token *token_list,
+ struct security_token **token,
+ struct dom_sid *user_sid)
{
/*
* This token is not from the auth stack, only has user SIDs
* and must fail if conditional ACEs are found in the security
* descriptor
*/
- *token = security_token_initialise(NULL, CLAIMS_EVALUATION_INVALID_STATE);
+ *token = security_token_initialise(token_list, CLAIMS_EVALUATION_INVALID_STATE);
SMB_ASSERT(*token);
add_sid_to_token(*token,
&global_sid_Authenticated_Users);
}
-struct user_token {
- fstring name;
- struct security_token *token;
-};
-
static void dump_user_token(struct user_token *token)
{
uint32_t i;
}
}
-static bool get_user_sids(const char *domain, const char *user, struct security_token **token)
+static bool get_user_sids(const char *domain, const char *user,
+ struct user_token *token_list,
+ struct security_token **token)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
enum wbcSidType type;
return false;
}
- init_user_token(token, &user_sid);
+ init_user_token(token_list, token, &user_sid);
/* And now the groups winbind knows about */
return false;
}
- result = SMB_MALLOC_ARRAY(struct user_token, num_users);
+ result = talloc_zero_array(NULL, struct user_token, num_users);
if (result == NULL) {
- DEBUG(1, ("Could not malloc sid array\n"));
+ DBG_ERR("Could not talloc token array\n");
wbcFreeMemory(users);
return false;
}
fstrcpy(user, p);
}
- get_user_sids(domain, user, &(result[i].token));
+ get_user_sids(domain, user, result, &(result[i].token));
}
TALLOC_FREE(frame);
wbcFreeMemory(users);
/* And a new user... */
*num_tokens += 1;
- *tokens = SMB_REALLOC_ARRAY(*tokens, struct user_token, *num_tokens);
+ *tokens = talloc_realloc(NULL,
+ *tokens,
+ struct user_token,
+ *num_tokens);
if (*tokens == NULL) {
- DEBUG(0, ("Could not realloc tokens\n"));
+ DBG_ERR("Could not talloc_realloc tokens\n");
return false;
}
return false;
}
token->token
- = security_token_initialise(NULL,
+ = security_token_initialise(*tokens,
CLAIMS_EVALUATION_INVALID_STATE);
if (token->token == NULL) {
DBG_ERR("security_token_initialise() failed: "
num_tokens, tokens);
}
done:
- for (i=0; i<num_tokens; i++) {
- TALLOC_FREE(tokens[i].token);
- }
- SAFE_FREE(tokens);
+ TALLOC_FREE(tokens);
TALLOC_FREE(server_aliases);
return nt_status;
for (i=0; i<num_tokens; i++) {
dump_user_token(&tokens[i]);
- TALLOC_FREE(tokens[i].token);
}
- SAFE_FREE(tokens);
+ TALLOC_FREE(tokens);
return 0;
}