fix wrong string handling
[Samba.git] / source / sam / get_set_group.c
blob11ea9258a704fc23bd8b4dde98b44e26ac97a71a
1 /*
2 Unix SMB/CIFS implementation.
3 SAM_USER_HANDLE access routines
4 Copyright (C) Andrew Bartlett 2002
5 Copyright (C) Stefan (metze) Metzmacher 2002
6 Copyright (C) Jelmer Vernooij 2002
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "includes.h"
25 #undef DBGC_CLASS
26 #define DBGC_CLASS DBGC_SAM
28 /* sam group get functions */
30 NTSTATUS sam_get_group_sid(const SAM_GROUP_HANDLE *group, const DOM_SID **sid)
32 SAM_ASSERT(group && sid);
34 *sid = &(group->private.sid);
36 return NT_STATUS_OK;
39 NTSTATUS sam_get_group_ctrl(const SAM_GROUP_HANDLE *group, uint32 *group_ctrl)
41 SAM_ASSERT(group && group_ctrl);
43 *group_ctrl = group->private.group_ctrl;
45 return NT_STATUS_OK;
48 NTSTATUS sam_get_group_name(const SAM_GROUP_HANDLE *group, const char **group_name)
50 SAM_ASSERT(group);
52 *group_name = group->private.group_name;
54 return NT_STATUS_OK;
57 NTSTATUS sam_get_group_comment(const SAM_GROUP_HANDLE *group, const char **group_desc)
59 SAM_ASSERT(group);
61 *group_desc = group->private.group_desc;
63 return NT_STATUS_OK;
66 /* sam group set functions */
68 NTSTATUS sam_set_group_sid(SAM_GROUP_HANDLE *group, const DOM_SID *sid)
70 SAM_ASSERT(group);
72 if (!sid)
73 ZERO_STRUCT(group->private.sid);
74 else
75 sid_copy(&(group->private.sid), sid);
77 return NT_STATUS_OK;
80 NTSTATUS sam_set_group_group_ctrl(SAM_GROUP_HANDLE *group, uint32 group_ctrl)
82 SAM_ASSERT(group);
84 group->private.group_ctrl = group_ctrl;
86 return NT_STATUS_OK;
89 NTSTATUS sam_set_group_name(SAM_GROUP_HANDLE *group, const char *group_name)
91 SAM_ASSERT(group);
93 group->private.group_name = talloc_strdup(group->mem_ctx, group_name);
95 return NT_STATUS_OK;
98 NTSTATUS sam_set_group_description(SAM_GROUP_HANDLE *group, const char *group_desc)
100 SAM_ASSERT(group);
102 group->private.group_desc = talloc_strdup(group->mem_ctx, group_desc);
104 return NT_STATUS_OK;