Globally replace 'global_sam_sid' with get_global_sam_sid(), a self
[kai/samba.git] / source3 / passdb / util_sam_sid.c
index a9cec5c5cae0efd657becaa8788f650a715fdf09..2c574f4a61e7d681917ca59a54c2875892830a3f 100644 (file)
 
 #include "includes.h"
 
-DOM_SID global_sam_sid;
 extern pstring global_myname;
 extern fstring global_myworkgroup;
 
-/* NOTE! the global_sam_sid is the SID of our local SAM. This is only
-   equal to the domain SID when we are a DC, otherwise its our
-   workstation SID */
-
 #define MAX_SID_NAMES  7
 
 typedef struct _known_sid_users {
@@ -99,17 +94,17 @@ static void init_sid_name_map (void)
        generate_wellknown_sids();
 
        if ((lp_security() == SEC_USER) && lp_domain_logons()) {
-               sid_name_map[i].sid = &global_sam_sid;
+               sid_name_map[i].sid = get_global_sam_sid();
                sid_name_map[i].name = global_myworkgroup;
                sid_name_map[i].known_users = NULL;
                i++;
-               sid_name_map[i].sid = &global_sam_sid;
+               sid_name_map[i].sid = get_global_sam_sid();
                sid_name_map[i].name = global_myname;
                sid_name_map[i].known_users = NULL;
                i++;
        }
        else {
-               sid_name_map[i].sid = &global_sam_sid;
+               sid_name_map[i].sid = get_global_sam_sid();
                sid_name_map[i].name = global_myname;
                sid_name_map[i].known_users = NULL;
                i++;
@@ -224,14 +219,14 @@ BOOL map_domain_name_to_sid(DOM_SID *sid, char *nt_domain)
 
        if (nt_domain == NULL) {
                DEBUG(5,("map_domain_name_to_sid: mapping NULL domain to our SID.\n"));
-               sid_copy(sid, &global_sam_sid);
+               sid_copy(sid, get_global_sam_sid());
                return True;
        }
 
        if (nt_domain[0] == 0) {
                fstrcpy(nt_domain, global_myname);
                DEBUG(5,("map_domain_name_to_sid: overriding blank name to %s\n", nt_domain));
-               sid_copy(sid, &global_sam_sid);
+               sid_copy(sid, get_global_sam_sid());
                return True;
        }
 
@@ -261,7 +256,7 @@ BOOL map_domain_name_to_sid(DOM_SID *sid, char *nt_domain)
 *****************************************************************/  
 BOOL sid_check_is_domain(const DOM_SID *sid)
 {
-       return sid_equal(sid, &global_sam_sid);
+       return sid_equal(sid, get_global_sam_sid());
 }
 
 /*****************************************************************
@@ -275,6 +270,6 @@ BOOL sid_check_is_in_our_domain(const DOM_SID *sid)
        sid_copy(&dom_sid, sid);
        sid_split_rid(&dom_sid, &rid);
        
-       return sid_equal(&dom_sid, &global_sam_sid);
+       return sid_equal(&dom_sid, get_global_sam_sid());
 }