summaryrefslogtreecommitdiff
path: root/source3/sam/get_set_group.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-09-06 12:57:12 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-09-06 12:57:12 +0000
commit68defac58da3f927cd8fb1405f3c648b7dec7f82 (patch)
tree720547e146c77bbaa1acc7dcede029b04dcf4041 /source3/sam/get_set_group.c
parent2d881357149c4cec6c109b801cef487ae0955126 (diff)
downloadsamba-68defac58da3f927cd8fb1405f3c648b7dec7f82.tar.gz
samba-68defac58da3f927cd8fb1405f3c648b7dec7f82.tar.bz2
samba-68defac58da3f927cd8fb1405f3c648b7dec7f82.zip
This commit includes part of the patch from metze posted to the list, and a few
of my own changes. In particular: I've added a SAM_ASSERT macro. This expands to either SMB_ASSERT() (which should help us track down bugs) or a return of NT_STATUS_CHECK_FAIL. Metze's changes are mostly to bring the code into line with current discussions on things like adding users/groups, flags etc. I've adjusted a fair bit of the 'const' in the SAM stuff. Const is currently used only for pointers, not for local variables or non-pointer paramters. The benifits and reasons for extending this further need discussion on samba-technical. Also, some of the 'context' paramters should not be const, to allow backend modules to do fancy caching etc in them. Andrew Bartlett (This used to be commit e13bc432628a6131be082caedc75cd8a3d206e5a)
Diffstat (limited to 'source3/sam/get_set_group.c')
-rw-r--r--source3/sam/get_set_group.c69
1 files changed, 26 insertions, 43 deletions
diff --git a/source3/sam/get_set_group.c b/source3/sam/get_set_group.c
index dac5ffca9f..11ea9258a7 100644
--- a/source3/sam/get_set_group.c
+++ b/source3/sam/get_set_group.c
@@ -27,97 +27,80 @@
/* sam group get functions */
-NTSTATUS sam_get_group_sid(const SAM_GROUP_HANDLE *group, DOM_SID **sid)
+NTSTATUS sam_get_group_sid(const SAM_GROUP_HANDLE *group, const DOM_SID **sid)
{
- if (!group || !sid) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group && sid);
*sid = &(group->private.sid);
return NT_STATUS_OK;
}
-NTSTATUS sam_get_group_typ(const SAM_GROUP_HANDLE *group, uint32 *typ)
+NTSTATUS sam_get_group_ctrl(const SAM_GROUP_HANDLE *group, uint32 *group_ctrl)
{
- if (!group || !typ) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group && group_ctrl);
- *typ = group->private.flags;
+ *group_ctrl = group->private.group_ctrl;
return NT_STATUS_OK;
}
-NTSTATUS sam_get_group_name(const SAM_GROUP_HANDLE *group, char **group_name)
+NTSTATUS sam_get_group_name(const SAM_GROUP_HANDLE *group, const char **group_name)
{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group);
- *group_name = group->private.name;
+ *group_name = group->private.group_name;
return NT_STATUS_OK;
}
-NTSTATUS sam_get_group_comment(const SAM_GROUP_HANDLE *group, char **comment)
+NTSTATUS sam_get_group_comment(const SAM_GROUP_HANDLE *group, const char **group_desc)
{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group);
- *comment = group->private.comment;
-
- return NT_STATUS_OK;
-}
-
-NTSTATUS sam_get_group_priv_set(const SAM_GROUP_HANDLE *group, PRIVILEGE_SET *priv_set)
-{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
-
- *priv_set = group->private.privileges;
+ *group_desc = group->private.group_desc;
return NT_STATUS_OK;
}
/* sam group set functions */
-NTSTATUS sam_set_group_sid(SAM_GROUP_HANDLE *group, DOM_SID *sid)
+NTSTATUS sam_set_group_sid(SAM_GROUP_HANDLE *group, const DOM_SID *sid)
{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group);
- if (!sid) ZERO_STRUCT(group->private.sid);
- else sid_copy(&(group->private.sid), sid);
+ if (!sid)
+ ZERO_STRUCT(group->private.sid);
+ else
+ sid_copy(&(group->private.sid), sid);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_group_typ(SAM_GROUP_HANDLE *group, uint32 typ)
+NTSTATUS sam_set_group_group_ctrl(SAM_GROUP_HANDLE *group, uint32 group_ctrl)
{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group);
- group->private.flags = typ;
+ group->private.group_ctrl = group_ctrl;
return NT_STATUS_OK;
}
-NTSTATUS sam_set_group_name(SAM_GROUP_HANDLE *group, char *group_name)
+NTSTATUS sam_set_group_name(SAM_GROUP_HANDLE *group, const char *group_name)
{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group);
- group->private.name = talloc_strdup(group->mem_ctx, group_name);
+ group->private.group_name = talloc_strdup(group->mem_ctx, group_name);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_group_comment(SAM_GROUP_HANDLE *group, char *comment)
+NTSTATUS sam_set_group_description(SAM_GROUP_HANDLE *group, const char *group_desc)
{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
+ SAM_ASSERT(group);
- group->private.comment = talloc_strdup(group->mem_ctx, comment);
+ group->private.group_desc = talloc_strdup(group->mem_ctx, group_desc);
return NT_STATUS_OK;
}
-
-NTSTATUS sam_set_group_priv_set(SAM_GROUP_HANDLE *group, PRIVILEGE_SET *priv_set)
-{
- if (!group) return NT_STATUS_UNSUCCESSFUL;
-
- if (!priv_set) ZERO_STRUCT(group->private.privileges);
- else memcpy(&(group->private.privileges), priv_set, sizeof(PRIVILEGE_SET));
-
- return NT_STATUS_OK;
-}