Use sec_initial_uid() in the places where being root doesn't matter,
authorJeremy Allison <jra@samba.org>
Sat, 13 Feb 2010 07:18:53 +0000 (23:18 -0800)
committerJeremy Allison <jra@samba.org>
Sat, 13 Feb 2010 07:18:53 +0000 (23:18 -0800)
and 0 in the places where it does.

Jeremy

source3/lib/afs_settoken.c
source3/lib/debug.c
source3/lib/fault.c
source3/printing/printing_db.c
source3/smbd/service.c

index 6421c0a55b47454ad0c86a1f9854cdce1c346ef7..80eed13e522d1b17fc29e0a424890e83b7e86a4e 100644 (file)
@@ -236,7 +236,7 @@ bool afs_settoken_str(const char *token_string)
        if (!afs_decode_token(token_string, &cell, &ticket, &ct))
                return False;
 
-       if (geteuid() != 0)
+       if (geteuid() != sec_initial_uid())
                ct.ViceId = getuid();
 
        result = afs_settoken(cell, &ct, ticket);
index 80b8310ab20bd4482cbb63325a7164bf0aa85a78..83211dd5e6e2e7ef46f9f6a55198c9f35907ab4c 100644 (file)
@@ -738,7 +738,7 @@ void check_log_size( void )
         *  loop check do a new check as root.
         */
 
-       if( geteuid() != 0 )
+       if( geteuid() != sec_initial_uid() )
                return;
 
        if(log_overflow || !need_to_check_log_size() )
index bf61bb26c43ca8fa7e0bf3b4ba12b6c41872d8a6..50fa2b83700e49811171263b61dc07029667f3de 100644 (file)
@@ -304,7 +304,7 @@ void dump_core_setup(const char *progname)
        /* If we're running as non root we might not be able to dump the core
         * file to the corepath.  There must not be an unbecome_root() before
         * we call abort(). */
-       if (geteuid() != 0) {
+       if (geteuid() != sec_initial_uid()) {
                become_root();
        }
 
index 746e768e4854730b3c445005897cdcdd3270092d..762b418bb1ebd4d5f18a18475b15239d3e0ab7c0 100644 (file)
@@ -98,7 +98,7 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
                return NULL;
        }
 
-       if (geteuid() != 0) {
+       if (geteuid() != sec_initial_uid()) {
                become_root();
                done_become_root = True;
        }
index b3e833ea1debed65cdcc3b6ac379446eb67fab6b..f908819d33f34f07e332043d02271528a6691e2d 100644 (file)
@@ -1083,7 +1083,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
   err_root_exit:
        TALLOC_FREE(smb_fname_cpath);
        /* We must exit this function as root. */
-       if (geteuid() != sec_initial_uid()) {
+       if (geteuid() != 0) {
                change_to_root_user();
        }
        if (on_err_call_dis_hook) {