summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-04-13 09:35:52 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-04-13 09:35:52 +0000
commit163a855d26106ac9c6eaf945a31a6495204de990 (patch)
tree508aa6282dac19468cd16635758e82ee98b32810 /source3/lib
parentcc60b069836cbc355e828675e6f089b6ef22b32e (diff)
downloadsamba-163a855d26106ac9c6eaf945a31a6495204de990.tar.gz
samba-163a855d26106ac9c6eaf945a31a6495204de990.tar.bz2
samba-163a855d26106ac9c6eaf945a31a6495204de990.zip
Better handling of uid/gid -> RID and RID -> uid/gid code.
All uids and gids must create valid RIDs, becouse other code expects this, and can't handle the failure case. (ACL code in particular) Allow admins to adjust the base of the RID algorithm, so avoid clashes with users brought in from NT (for example). Put all the algorithm code back in one place, so that this change is global. Better coping with NULL sid pointers - but it still breaks a lot of stuff. BONUS: manpage entry for new paramater :-) counter based rids for normal users in tdbsam is disabled for the timebeing, idra and I will work out some things here soon I hope. Andrew Bartlett (This used to be commit 5275c94cdf0c64f347d4282f47088d084b1a7ea5)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_sid.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index cd7b64bb70..100324a047 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -197,7 +197,7 @@ void generate_wellknown_sids(void)
Turns a domain SID into a name, returned in the nt_domain argument.
***************************************************************************/
-BOOL map_domain_sid_to_name(DOM_SID *sid, char *nt_domain)
+BOOL map_domain_sid_to_name(DOM_SID *sid, fstring nt_domain)
{
fstring sid_str;
int i = 0;
@@ -344,11 +344,18 @@ char *sid_to_string(fstring sidstr_out, DOM_SID *sid)
{
char subauth[16];
int i;
+ uint32 ia;
+
+ if (!sid) {
+ fstrcpy(sidstr_out, "(NULL SID)");
+ return sidstr_out;
+ }
+
/* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */
- uint32 ia = (sid->id_auth[5]) +
- (sid->id_auth[4] << 8 ) +
- (sid->id_auth[3] << 16) +
- (sid->id_auth[2] << 24);
+ ia = (sid->id_auth[5]) +
+ (sid->id_auth[4] << 8 ) +
+ (sid->id_auth[3] << 16) +
+ (sid->id_auth[2] << 24);
slprintf(sidstr_out, sizeof(fstring) - 1, "S-%u-%lu", (unsigned int)sid->sid_rev_num, (unsigned long)ia);