summaryrefslogtreecommitdiff
path: root/source3/groupdb
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2013-06-18 16:30:31 +0200
committerMichael Adam <obnox@samba.org>2013-06-21 10:44:24 +0200
commit2d2d13ee6104f21fa4a3ec845f216084a24da0b2 (patch)
tree8c1dcd76fc0ab865db18672a533829e86fad0763 /source3/groupdb
parent212baedcd579aa584e31225932afe4a3a07c891e (diff)
downloadsamba-2d2d13ee6104f21fa4a3ec845f216084a24da0b2.tar.gz
s3:passdb add a gid argument to pdb_create_builtin_alias
make it possible to skip the allocation of a new gid from winbind by specifying the gid to be used Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/groupdb')
-rw-r--r--source3/groupdb/mapping.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index c6fcc8aa711..e3d52b70fb2 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -790,15 +790,19 @@ NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
return NT_STATUS_UNSUCCESSFUL;
}
-/********************************************************************
- Really just intended to be called by smbd
-********************************************************************/
-
-NTSTATUS pdb_create_builtin_alias(uint32 rid)
+/**
+* @brief Add a new group mapping
+*
+* @param[in] gid gid to use to store the mapping. If gid is 0,
+* new gid will be allocated from winbind
+*
+* @return Normal NTSTATUS return
+*/
+NTSTATUS pdb_create_builtin_alias(uint32 rid, gid_t gid)
{
struct dom_sid sid;
enum lsa_SidType type;
- gid_t gid;
+ gid_t gidformap;
GROUP_MAP *map;
NTSTATUS status;
const char *name = NULL;
@@ -820,15 +824,21 @@ NTSTATUS pdb_create_builtin_alias(uint32 rid)
goto done;
}
- if (!winbind_allocate_gid(&gid)) {
- DEBUG(3, ("pdb_create_builtin_alias: Could not get a gid out of winbind\n"));
- status = NT_STATUS_ACCESS_DENIED;
- goto done;
+ if (gid == 0) {
+ if (!winbind_allocate_gid(&gidformap)) {
+ DEBUG(3, ("pdb_create_builtin_alias: Could not get a "
+ "gid out of winbind\n"));
+ status = NT_STATUS_ACCESS_DENIED;
+ goto done;
+ }
+ } else {
+ gidformap = gid;
}
- DEBUG(10, ("Creating alias %s with gid %u\n", name, (unsigned)gid));
+ DEBUG(10, ("Creating alias %s with gid %u\n", name,
+ (unsigned) gidformap));
- map->gid = gid;
+ map->gid = gidformap;
sid_copy(&map->sid, &sid);
map->sid_name_use = SID_NAME_ALIAS;
map->nt_name = talloc_strdup(map, name);