summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-06-13 14:06:08 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-06-13 14:06:08 +0000
commitbad738e6536e983064eee7647229354bc9028183 (patch)
treea3f36ff7035d676e28d60c0249dfdbf37cac6317 /source3/lib
parent2154ebce84c6cf376e7183e8c5f7ad0e17aead97 (diff)
downloadsamba-bad738e6536e983064eee7647229354bc9028183.tar.gz
samba-bad738e6536e983064eee7647229354bc9028183.tar.bz2
samba-bad738e6536e983064eee7647229354bc9028183.zip
Latest patch from metze <metze@metzemix.de> to move most of samba across
to using SIDs instead of RIDs. The new funciton sid_peek_check_rid() takes an 'expected domain sid' argument. The idea here is to prevent mistakes where the SID is implict, but isn't the same one that we have in the struct. Andrew Bartlett (This used to be commit 04f9a8ff4c7982f6597c0f6748f85d66d4784901)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_sid.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 21ef9e081b..3ad9e909d8 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -1,10 +1,11 @@
/*
Unix SMB/CIFS implementation.
Samba utility functions
- Copyright (C) Andrew Tridgell 1992-1998
- Copyright (C) Luke Kenneth Caseson Leighton 1998-1999
- Copyright (C) Jeremy Allison 1999
-
+ Copyright (C) Andrew Tridgell 1992-1998
+ Copyright (C) Luke Kenneth Caseson Leighton 1998-1999
+ Copyright (C) Jeremy Allison 1999
+ Copyright (C) Stefan (metze) Metzmacher 2002
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -253,6 +254,9 @@ BOOL sid_split_rid(DOM_SID *sid, uint32 *rid)
BOOL sid_peek_rid(DOM_SID *sid, uint32 *rid)
{
+ if (!sid || !rid)
+ return False;
+
if (sid->num_auths > 0) {
*rid = sid->sub_auths[sid->num_auths - 1];
return True;
@@ -261,6 +265,25 @@ BOOL sid_peek_rid(DOM_SID *sid, uint32 *rid)
}
/*****************************************************************
+ Return the last rid from the end of a sid
+ and check the sid against the exp_dom_sid
+*****************************************************************/
+
+BOOL sid_peek_check_rid(DOM_SID *exp_dom_sid,DOM_SID *sid, uint32 *rid)
+{
+ if (!exp_dom_sid || !sid || !rid)
+ return False;
+
+
+ if (sid_compare_domain(exp_dom_sid, sid)!=0){
+ *rid=(-1);
+ return False;
+ }
+
+ return sid_peek_rid(sid,rid);
+}
+
+/*****************************************************************
Copies a sid
*****************************************************************/