Skip to content

Commit

Permalink
s3:dom_sid Global replace of DOM_SID with struct dom_sid
Browse files Browse the repository at this point in the history
This matches the structure that new code is being written to,
and removes one more of the old-style named structures, and
the need to know that is is just an alias for struct dom_sid.

Andrew Bartlett

Signed-off-by: Günther Deschner <[email protected]>
  • Loading branch information
abartlet authored and gd committed May 21, 2010
1 parent a92b653 commit cba7f8b
Show file tree
Hide file tree
Showing 125 changed files with 1,290 additions and 1,297 deletions.
2 changes: 1 addition & 1 deletion examples/pdb/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static NTSTATUS testsam_getsampwnam (struct pdb_methods *methods, struct samu *u
Search by sid
**************************************************************************/

static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const struct dom_sid *sid)
{
DEBUG(10, ("testsam_getsampwsid called\n"));
return NT_STATUS_NOT_IMPLEMENTED;
Expand Down
10 changes: 5 additions & 5 deletions libgpo/gpo_ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,11 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
NT_USER_TOKEN **token)
{
ADS_STATUS status;
DOM_SID object_sid;
DOM_SID primary_group_sid;
DOM_SID *ad_token_sids;
struct dom_sid object_sid;
struct dom_sid primary_group_sid;
struct dom_sid *ad_token_sids;
size_t num_ad_token_sids = 0;
DOM_SID *token_sids;
struct dom_sid *token_sids;
size_t num_token_sids = 0;
NT_USER_TOKEN *new_token = NULL;
int i;
Expand All @@ -638,7 +638,7 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
return status;
}

token_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, 1);
token_sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, 1);
ADS_ERROR_HAVE_NO_MEMORY(token_sids);

status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx,
Expand Down
20 changes: 10 additions & 10 deletions source3/auth/auth_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
****************************************************************************/

static void sort_sid_array_for_smbd(struct auth_serversupplied_info *result,
const DOM_SID *pgroup_sid)
const struct dom_sid *pgroup_sid)
{
unsigned int i;

Expand Down Expand Up @@ -504,7 +504,7 @@ NTSTATUS create_local_token(struct auth_serversupplied_info *server_info)

for (i=1; i<server_info->ptok->num_sids; i++) {
gid_t gid;
DOM_SID *sid = &server_info->ptok->user_sids[i];
struct dom_sid *sid = &server_info->ptok->user_sids[i];

if (!sid_to_gid(sid, &gid)) {
DEBUG(10, ("Could not convert SID %s to gid, "
Expand Down Expand Up @@ -573,7 +573,7 @@ NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
gid_t *gids;
char *qualified_name = NULL;
TALLOC_CTX *mem_ctx = NULL;
DOM_SID u_sid;
struct dom_sid u_sid;
enum lsa_SidType type;
struct auth_serversupplied_info *result;

Expand Down Expand Up @@ -689,7 +689,7 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser
{
NTSTATUS status;
struct samu *sampass = NULL;
DOM_SID guest_sid;
struct dom_sid guest_sid;
bool ret;
static const char zeros[16] = {0, };
fstring tmp;
Expand Down Expand Up @@ -1052,8 +1052,8 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
const char *nt_domain;
const char *nt_username;
struct samu *sam_account = NULL;
DOM_SID user_sid;
DOM_SID group_sid;
struct dom_sid user_sid;
struct dom_sid group_sid;
bool username_was_mapped;

uid_t uid = (uid_t)-1;
Expand Down Expand Up @@ -1301,8 +1301,8 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
const char *nt_domain;
const char *nt_username;
struct samu *sam_account = NULL;
DOM_SID user_sid;
DOM_SID group_sid;
struct dom_sid user_sid;
struct dom_sid group_sid;
bool username_was_mapped;
uint32_t i;

Expand Down Expand Up @@ -1489,7 +1489,7 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
/* Create a 'combined' list of all SIDs we might want in the SD */

result->num_sids = info->num_sids - 2;
result->sids = talloc_array(result, DOM_SID, result->num_sids);
result->sids = talloc_array(result, struct dom_sid, result->num_sids);
if (result->sids == NULL) {
TALLOC_FREE(result);
return NT_STATUS_NO_MEMORY;
Expand Down Expand Up @@ -1537,7 +1537,7 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,

bool is_trusted_domain(const char* dom_name)
{
DOM_SID trustdom_sid;
struct dom_sid trustdom_sid;
bool ret;

/* no trusted domains for a standalone server */
Expand Down
10 changes: 5 additions & 5 deletions source3/auth/server_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx)
********************************************************************/

static NTSTATUS nt_token_to_group_list(TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
const struct dom_sid *domain_sid,
size_t num_sids,
const DOM_SID *sids,
const struct dom_sid *sids,
int *numgroups,
struct samr_RidWithAttribute **pgids)
{
Expand Down Expand Up @@ -99,9 +99,9 @@ static NTSTATUS serverinfo_to_SamInfo_base(TALLOC_CTX *mem_ctx,
{
struct samu *sampw;
struct samr_RidWithAttribute *gids = NULL;
const DOM_SID *user_sid = NULL;
const DOM_SID *group_sid = NULL;
DOM_SID domain_sid;
const struct dom_sid *user_sid = NULL;
const struct dom_sid *group_sid = NULL;
struct dom_sid domain_sid;
uint32 user_rid, group_rid;
NTSTATUS status;

Expand Down
48 changes: 24 additions & 24 deletions source3/auth/token_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Check for a SID in an NT_USER_TOKEN
****************************************************************************/

bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token )
bool nt_token_check_sid ( const struct dom_sid *sid, const NT_USER_TOKEN *token )
{
int i;

Expand All @@ -47,7 +47,7 @@ bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token )

bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid )
{
DOM_SID domain_sid;
struct dom_sid domain_sid;

/* if we are a domain member, the get the domain SID, else for
a DC or standalone server, use our own SID */
Expand Down Expand Up @@ -78,7 +78,7 @@ bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid )
NT_USER_TOKEN *get_root_nt_token( void )
{
struct nt_user_token *token, *for_cache;
DOM_SID u_sid, g_sid;
struct dom_sid u_sid, g_sid;
struct passwd *pw;
void *cache_data;

Expand Down Expand Up @@ -124,7 +124,7 @@ NT_USER_TOKEN *get_root_nt_token( void )
* Add alias SIDs from memberships within the partially created token SID list
*/

NTSTATUS add_aliases(const DOM_SID *domain_sid,
NTSTATUS add_aliases(const struct dom_sid *domain_sid,
struct nt_user_token *token)
{
uint32 *aliases;
Expand All @@ -151,7 +151,7 @@ NTSTATUS add_aliases(const DOM_SID *domain_sid,
}

for (i=0; i<num_aliases; i++) {
DOM_SID alias_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,
Expand All @@ -171,9 +171,9 @@ NTSTATUS add_aliases(const DOM_SID *domain_sid,
*******************************************************************/

static NTSTATUS add_builtin_administrators(struct nt_user_token *token,
const DOM_SID *dom_sid)
const struct dom_sid *dom_sid)
{
DOM_SID domadm;
struct dom_sid domadm;
NTSTATUS status;

/* nothing to do if we aren't in a domain */
Expand Down Expand Up @@ -215,7 +215,7 @@ static NTSTATUS add_builtin_administrators(struct nt_user_token *token,
static NTSTATUS create_builtin(uint32 rid)
{
NTSTATUS status = NT_STATUS_OK;
DOM_SID sid;
struct dom_sid sid;
gid_t gid;

if (!sid_compose(&sid, &global_sid_Builtin, rid)) {
Expand All @@ -238,8 +238,8 @@ static NTSTATUS create_builtin(uint32 rid)
* @param[in] dom_sid sid to add as a member of builtin_sid.
* @return Normal NTSTATUS return
*/
static NTSTATUS add_sid_to_builtin(const DOM_SID *builtin_sid,
const DOM_SID *dom_sid)
static NTSTATUS add_sid_to_builtin(const struct dom_sid *builtin_sid,
const struct dom_sid *dom_sid)
{
NTSTATUS status = NT_STATUS_OK;

Expand Down Expand Up @@ -267,10 +267,10 @@ static NTSTATUS add_sid_to_builtin(const DOM_SID *builtin_sid,
/*******************************************************************
*******************************************************************/

NTSTATUS create_builtin_users(const DOM_SID *dom_sid)
NTSTATUS create_builtin_users(const struct dom_sid *dom_sid)
{
NTSTATUS status;
DOM_SID dom_users;
struct dom_sid dom_users;

status = create_builtin(BUILTIN_RID_USERS);
if ( !NT_STATUS_IS_OK(status) ) {
Expand All @@ -292,10 +292,10 @@ NTSTATUS create_builtin_users(const DOM_SID *dom_sid)
/*******************************************************************
*******************************************************************/

NTSTATUS create_builtin_administrators(const DOM_SID *dom_sid)
NTSTATUS create_builtin_administrators(const struct dom_sid *dom_sid)
{
NTSTATUS status;
DOM_SID dom_admins, root_sid;
struct dom_sid dom_admins, root_sid;
fstring root_name;
enum lsa_SidType type;
TALLOC_CTX *ctx;
Expand Down Expand Up @@ -341,16 +341,16 @@ NTSTATUS create_builtin_administrators(const DOM_SID *dom_sid)
*******************************************************************/

struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
const struct dom_sid *user_sid,
bool is_guest,
int num_groupsids,
const DOM_SID *groupsids)
const struct dom_sid *groupsids)
{
struct nt_user_token *result = NULL;
int i;
NTSTATUS status;
gid_t gid;
DOM_SID dom_sid;
struct dom_sid dom_sid;

DEBUG(10, ("Create local NT token for %s\n",
sid_string_dbg(user_sid)));
Expand Down Expand Up @@ -585,11 +585,11 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
{
NTSTATUS result = NT_STATUS_NO_SUCH_USER;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
DOM_SID user_sid;
struct dom_sid user_sid;
enum lsa_SidType type;
gid_t *gids;
DOM_SID *group_sids;
DOM_SID unix_group_sid;
struct dom_sid *group_sids;
struct dom_sid unix_group_sid;
size_t num_group_sids;
size_t num_gids;
size_t i;
Expand Down Expand Up @@ -715,7 +715,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
}

if (num_group_sids) {
group_sids = TALLOC_ARRAY(tmp_ctx, DOM_SID, num_group_sids);
group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids);
if (group_sids == NULL) {
DEBUG(1, ("TALLOC_ARRAY failed\n"));
result = NT_STATUS_NO_MEMORY;
Expand Down Expand Up @@ -756,7 +756,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
}

num_group_sids = 1;
group_sids = TALLOC_ARRAY(tmp_ctx, DOM_SID, num_group_sids);
group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids);
if (group_sids == NULL) {
DEBUG(1, ("TALLOC_ARRAY failed\n"));
result = NT_STATUS_NO_MEMORY;
Expand Down Expand Up @@ -829,7 +829,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
member of a particular group.
***************************************************************************/

bool user_in_group_sid(const char *username, const DOM_SID *group_sid)
bool user_in_group_sid(const char *username, const struct dom_sid *group_sid)
{
NTSTATUS status;
uid_t uid;
Expand Down Expand Up @@ -858,7 +858,7 @@ bool user_in_group_sid(const char *username, const DOM_SID *group_sid)
bool user_in_group(const char *username, const char *groupname)
{
TALLOC_CTX *mem_ctx = talloc_stackframe();
DOM_SID group_sid;
struct dom_sid group_sid;
bool ret;

ret = lookup_name(mem_ctx, groupname, LOOKUP_NAME_ALL,
Expand Down
Loading

0 comments on commit cba7f8b

Please sign in to comment.