]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Move admin user check into a helper function.
authorAndrew Bartlett <abartlet@samba.org>
Fri, 17 Aug 2001 08:12:33 +0000 (08:12 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 17 Aug 2001 08:12:33 +0000 (08:12 +0000)
Formatting fixes.

source/smbd/service.c

index 5bb535f884834fbc8c8bdb43c1bf019ee4a3be08..3e29c8cf58cf287e8f74a7994a2fe058081c0aab 100644 (file)
@@ -285,6 +285,37 @@ static void set_read_only(connection_struct *conn)
 }
 
 
+/****************************************************************************
+  admin user check
+****************************************************************************/
+static void set_admin_user(connection_struct *conn) 
+{
+       /* admin user check */
+       
+       /* JRA - original code denied admin user if the share was
+          marked read_only. Changed as I don't think this is needed,
+          but old code left in case there is a problem here.
+       */
+       if (user_in_list(conn->user,lp_admin_users(conn->service)) 
+#if 0
+           && !conn->read_only
+#endif
+           ) {
+               conn->admin_user = True;
+               DEBUG(0,("%s logged in as admin user (root privileges)\n",conn->user));
+       } else {
+               conn->admin_user = False;
+       }
+
+#if 0 /* This done later, for now */    
+       /* admin users always run as uid=0 */
+       if (conn->admin_user) {
+               conn->uid = 0;
+       }
+#endif
+}
+
+
 /****************************************************************************
   make a connection to a service
 ****************************************************************************/
@@ -381,7 +412,8 @@ connection_struct *make_connection(char *service,char *user,char *password, int
        conn->vuid = vuid;
        conn->uid = pass->pw_uid;
        conn->gid = pass->pw_gid;
-       safe_strcpy(conn->client_address, client_addr(), sizeof(conn->client_address)-1);
+       safe_strcpy(conn->client_address, client_addr(), 
+                   sizeof(conn->client_address)-1);
        conn->num_files_open = 0;
        conn->lastused = time(NULL);
        conn->service = snum;
@@ -398,23 +430,8 @@ connection_struct *make_connection(char *service,char *user,char *password, int
        
        set_read_only(conn);
 
-       /* admin user check */
-       
-       /* JRA - original code denied admin user if the share was
-          marked read_only. Changed as I don't think this is needed,
-          but old code left in case there is a problem here.
-       */
-       if (user_in_list(user, lp_admin_users(snum)) 
-#if 0
-           && !conn->read_only
-#endif
-           ) {
-               conn->admin_user = True;
-               DEBUG(0,("%s logged in as admin user (root privileges)\n",user));
-       } else {
-               conn->admin_user = False;
-       }
-    
+       set_admin_user(conn);
+
        /*
         * If force user is true, then store the
         * given userid and also the primary groupid