RIP BOOL. Convert BOOL -> bool. I found a few interesting
[nivanova/samba-autobuild/.git] / source3 / passdb / lookup_sid.c
index f6aacd17675353fe207a5be048af1e2fe5655a0b..e832779f3b2c0dd7803b74e479e49f0d49483b0e 100644 (file)
@@ -7,7 +7,7 @@
    
    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
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -30,7 +29,7 @@
  to do guesswork.
 *****************************************************************/  
 
-BOOL lookup_name(TALLOC_CTX *mem_ctx,
+bool lookup_name(TALLOC_CTX *mem_ctx,
                 const char *full_name, int flags,
                 const char **ret_domain, const char **ret_name,
                 DOM_SID *ret_sid, enum lsa_SidType *ret_type)
@@ -328,7 +327,7 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx,
  and then "Unix Users"\foo (or "Unix Groups"\foo).
 ************************************************************************/
 
-BOOL lookup_name_smbconf(TALLOC_CTX *mem_ctx,
+bool lookup_name_smbconf(TALLOC_CTX *mem_ctx,
                 const char *full_name, int flags,
                 const char **ret_domain, const char **ret_name,
                 DOM_SID *ret_sid, enum lsa_SidType *ret_type)
@@ -388,7 +387,7 @@ BOOL lookup_name_smbconf(TALLOC_CTX *mem_ctx,
                                ret_sid, ret_type);
 }
 
-static BOOL wb_lookup_rids(TALLOC_CTX *mem_ctx,
+static bool wb_lookup_rids(TALLOC_CTX *mem_ctx,
                           const DOM_SID *domain_sid,
                           int num_rids, uint32 *rids,
                           const char **domain_name,
@@ -439,7 +438,7 @@ static BOOL wb_lookup_rids(TALLOC_CTX *mem_ctx,
        return True;
 }
 
-static BOOL lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid,
+static bool lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid,
                        int num_rids, uint32_t *rids,
                        const char **domain_name,
                        const char ***names, enum lsa_SidType **types)
@@ -557,7 +556,7 @@ static BOOL lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid,
  * Is the SID a domain as such? If yes, lookup its name.
  */
 
-static BOOL lookup_as_domain(const DOM_SID *sid, TALLOC_CTX *mem_ctx,
+static bool lookup_as_domain(const DOM_SID *sid, TALLOC_CTX *mem_ctx,
                             const char **name)
 {
        const char *tmp;
@@ -635,7 +634,7 @@ static BOOL lookup_as_domain(const DOM_SID *sid, TALLOC_CTX *mem_ctx,
  * Level 6: Like 4
  */
 
-static BOOL check_dom_sid_to_level(const DOM_SID *sid, int level)
+static bool check_dom_sid_to_level(const DOM_SID *sid, int level)
 {
        int ret = False;
 
@@ -894,14 +893,14 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
  *THE CANONICAL* convert SID to name function.
 *****************************************************************/  
 
-BOOL lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
+bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
                const char **ret_domain, const char **ret_name,
                enum lsa_SidType *ret_type)
 {
        struct lsa_dom_info *domain;
        struct lsa_name_info *name;
        TALLOC_CTX *tmp_ctx;
-       BOOL ret = False;
+       bool ret = False;
 
        if (!(tmp_ctx = talloc_new(mem_ctx))) {
                DEBUG(0, ("talloc_new failed\n"));
@@ -980,7 +979,7 @@ static struct gid_sid_cache {
   Find a SID given a uid.
 *****************************************************************/  
 
-static BOOL fetch_sid_from_uid_cache(DOM_SID *psid, uid_t uid)
+static bool fetch_sid_from_uid_cache(DOM_SID *psid, uid_t uid)
 {
        struct uid_sid_cache *pc;
 
@@ -1000,7 +999,7 @@ static BOOL fetch_sid_from_uid_cache(DOM_SID *psid, uid_t uid)
   Find a uid given a SID.
 *****************************************************************/  
 
-static BOOL fetch_uid_from_cache( uid_t *puid, const DOM_SID *psid )
+static bool fetch_uid_from_cache( uid_t *puid, const DOM_SID *psid )
 {
        struct uid_sid_cache *pc;
 
@@ -1057,7 +1056,7 @@ void store_uid_sid_cache(const DOM_SID *psid, uid_t uid)
   Find a SID given a gid.
 *****************************************************************/  
 
-static BOOL fetch_sid_from_gid_cache(DOM_SID *psid, gid_t gid)
+static bool fetch_sid_from_gid_cache(DOM_SID *psid, gid_t gid)
 {
        struct gid_sid_cache *pc;
 
@@ -1077,7 +1076,7 @@ static BOOL fetch_sid_from_gid_cache(DOM_SID *psid, gid_t gid)
   Find a gid given a SID.
 *****************************************************************/  
 
-static BOOL fetch_gid_from_cache(gid_t *pgid, const DOM_SID *psid)
+static bool fetch_gid_from_cache(gid_t *pgid, const DOM_SID *psid)
 {
        struct gid_sid_cache *pc;
 
@@ -1141,7 +1140,7 @@ void store_gid_sid_cache(const DOM_SID *psid, gid_t gid)
 static void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
 {
        uint32 rid;
-       BOOL ret;
+       bool ret;
 
        ZERO_STRUCTP(psid);
 
@@ -1174,7 +1173,7 @@ static void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
 
 static void legacy_gid_to_sid(DOM_SID *psid, gid_t gid)
 {
-       BOOL ret;
+       bool ret;
 
        ZERO_STRUCTP(psid);
 
@@ -1203,14 +1202,14 @@ static void legacy_gid_to_sid(DOM_SID *psid, gid_t gid)
  *THE LEGACY* convert SID to uid function.
 *****************************************************************/  
 
-static BOOL legacy_sid_to_uid(const DOM_SID *psid, uid_t *puid)
+static bool legacy_sid_to_uid(const DOM_SID *psid, uid_t *puid)
 {
        enum lsa_SidType type;
        uint32 rid;
 
        if (sid_peek_check_rid(get_global_sam_sid(), psid, &rid)) {
                union unid_t id;
-               BOOL ret;
+               bool ret;
 
                become_root();
                ret = pdb_sid_to_id(psid, &id, &type);
@@ -1246,7 +1245,7 @@ done:
  Group mapping is used for gids that maps to Wellknown SIDs
 *****************************************************************/  
 
-static BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
+static bool legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 {
        uint32 rid;
        GROUP_MAP map;
@@ -1255,7 +1254,7 @@ static BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 
        if ((sid_check_is_in_builtin(psid) ||
             sid_check_is_in_wellknown_domain(psid))) {
-               BOOL ret;
+               bool ret;
 
                become_root();
                ret = pdb_getgrsid(&map, *psid);
@@ -1270,7 +1269,7 @@ static BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
        }
 
        if (sid_peek_check_rid(get_global_sam_sid(), psid, &rid)) {
-               BOOL ret;
+               bool ret;
 
                become_root();
                ret = pdb_sid_to_id(psid, &id, &type);
@@ -1365,7 +1364,7 @@ void gid_to_sid(DOM_SID *psid, gid_t gid)
  *THE CANONICAL* convert SID to uid function.
 *****************************************************************/  
 
-BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid)
+bool sid_to_uid(const DOM_SID *psid, uid_t *puid)
 {
        uint32 rid;
        gid_t gid;
@@ -1414,7 +1413,7 @@ BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid)
  Group mapping is used for gids that maps to Wellknown SIDs
 *****************************************************************/  
 
-BOOL sid_to_gid(const DOM_SID *psid, gid_t *pgid)
+bool sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 {
        uint32 rid;
        uid_t uid;