summaryrefslogtreecommitdiff
path: root/source3/sam
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2003-07-01 10:01:57 +0000
committerVolker Lendecke <vlendec@samba.org>2003-07-01 10:01:57 +0000
commitf5156c68a5c8f36c682f2a2d7be2c8f6af5e7c62 (patch)
tree24916f7a66ff39566bd90bf813cdec3eccaaf0b7 /source3/sam
parent7c23573a5016f65ac0ea8049a158a4a8cefa4814 (diff)
downloadsamba-f5156c68a5c8f36c682f2a2d7be2c8f6af5e7c62.tar.gz
samba-f5156c68a5c8f36c682f2a2d7be2c8f6af5e7c62.tar.bz2
samba-f5156c68a5c8f36c682f2a2d7be2c8f6af5e7c62.zip
Don't set a mapping that is already there.
Volker (This used to be commit 9d317fb533c5236bef1701d322abd537beea02d5)
Diffstat (limited to 'source3/sam')
-rw-r--r--source3/sam/idmap.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/sam/idmap.c b/source3/sam/idmap.c
index 29fcb89067..a8c47ab9ae 100644
--- a/source3/sam/idmap.c
+++ b/source3/sam/idmap.c
@@ -151,6 +151,21 @@ BOOL idmap_init(const char *remote_backend)
NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type)
{
struct idmap_methods *map = remote_map;
+ DOM_SID tmp_sid;
+
+ DEBUG(10, ("idmap_set_mapping: Set %s to %s %d\n",
+ sid_string_static(sid),
+ ((id_type & ID_TYPEMASK) == ID_USERID) ? "UID" : "GID",
+ ((id_type & ID_TYPEMASK) == ID_USERID) ? id.uid : id.gid));
+
+ if ( (NT_STATUS_IS_OK(cache_map->
+ get_sid_from_id(&tmp_sid, id,
+ id_type | ID_QUERY_ONLY))) &&
+ sid_equal(sid, &tmp_sid) ) {
+ /* Nothing to do, we already have that mapping */
+ DEBUG(10, ("idmap_set_mapping: Mapping already there\n"));
+ return NT_STATUS_OK;
+ }
if (map == NULL) {
/* Ok, we don't have a authoritative remote