]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: README.Coding fixes
authorRalph Boehme <slow@samba.org>
Sat, 13 Jul 2019 14:10:53 +0000 (16:10 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 11 Sep 2019 19:59:34 +0000 (19:59 +0000)
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/uid.c

index d0dcfefb31d9c6b249b6e617d54c3b91049c299e..554bd4d544cafff0b5671a6ad7cd853c501cde26 100644 (file)
@@ -466,9 +466,9 @@ bool change_to_user_and_service(connection_struct *conn, uint64_t vuid)
        struct user_struct *vuser;
        int snum = SNUM(conn);
 
-       if (!conn) {
-               DEBUG(2,("Connection not open\n"));
-               return(False);
+       if (conn == NULL) {
+               DBG_WARNING("Connection not open\n");
+               return false;
        }
 
        vuser = get_valid_user_struct(conn->sconn, vuid);
@@ -670,18 +670,23 @@ void smbd_unbecome_root(void)
 
 bool become_user(connection_struct *conn, uint64_t vuid)
 {
-       if (!push_sec_ctx())
-               return False;
+       bool ok;
+
+       ok = push_sec_ctx();
+       if (!ok) {
+               return false;
+       }
 
        push_conn_ctx();
 
-       if (!change_to_user_and_service(conn, vuid)) {
+       ok = change_to_user_and_service(conn, vuid);
+       if (!ok) {
                pop_sec_ctx();
                pop_conn_ctx();
-               return False;
+               return false;
        }
 
-       return True;
+       return true;
 }
 
 bool become_user_by_fsp(struct files_struct *fsp)
@@ -692,12 +697,17 @@ bool become_user_by_fsp(struct files_struct *fsp)
 bool become_user_by_session(connection_struct *conn,
                            const struct auth_session_info *session_info)
 {
-       if (!push_sec_ctx())
+       bool ok;
+
+       ok = push_sec_ctx();
+       if (!ok) {
                return false;
+       }
 
        push_conn_ctx();
 
-       if (!change_to_user_by_session(conn, session_info)) {
+       ok = change_to_user_by_session(conn, session_info);
+       if (!ok) {
                pop_sec_ctx();
                pop_conn_ctx();
                return false;