s3-smbd: vuser and session_info cannot be NULL here
authorAndrew Bartlett <abartlet@samba.org>
Sun, 4 Mar 2012 20:47:50 +0000 (07:47 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 4 Mar 2012 22:33:05 +0000 (23:33 +0100)
The callers always supply it. (this is a hold-over from the
security=share removal).

Andrew Bartlett

source3/smbd/service.c

index c53323381ead741880e1d219b79a3877eedbee91..3b14634b6c1e3fb62e5fcaaf40421cca4e51f73a 100644 (file)
@@ -383,49 +383,43 @@ static NTSTATUS create_connection_session_info(struct smbd_server_connection *sc
                                               struct auth_session_info *session_info,
                                               struct auth_session_info **presult)
 {
+       struct auth_session_info *result;
+
         if (lp_guest_only(snum)) {
                 return make_session_info_guest(mem_ctx, presult);
         }
 
-        if (session_info != NULL) {
-
-               struct auth_session_info *result;
-
-                /*
-                 * This is the normal security != share case where we have a
-                 * valid vuid from the session setup.                 */
-
-               if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
-                      if (!lp_guest_ok(snum)) {
-                                DEBUG(2, ("guest user (from session setup) "
-                                          "not permitted to access this share "
-                                          "(%s)\n", lp_servicename(snum)));
-                                return NT_STATUS_ACCESS_DENIED;
-                        }
-                } else {
-                        if (!user_ok_token(session_info->unix_info->unix_name,
-                                          session_info->info->domain_name,
-                                           session_info->security_token, snum)) {
-                                DEBUG(2, ("user '%s' (from session setup) not "
-                                          "permitted to access this share "
-                                          "(%s)\n",
-                                          session_info->unix_info->unix_name,
-                                          lp_servicename(snum)));
-                                return NT_STATUS_ACCESS_DENIED;
-                        }
-                }
-
-                result = copy_session_info(mem_ctx, session_info);
-               if (result == NULL) {
-                       return NT_STATUS_NO_MEMORY;
+       /*
+        * This is the normal security != share case where we have a
+        * valid vuid from the session setup.                 */
+
+       if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
+               if (!lp_guest_ok(snum)) {
+                       DEBUG(2, ("guest user (from session setup) "
+                                 "not permitted to access this share "
+                                 "(%s)\n", lp_servicename(snum)));
+                       return NT_STATUS_ACCESS_DENIED;
+               }
+       } else {
+               if (!user_ok_token(session_info->unix_info->unix_name,
+                                  session_info->info->domain_name,
+                                  session_info->security_token, snum)) {
+                       DEBUG(2, ("user '%s' (from session setup) not "
+                                 "permitted to access this share "
+                                 "(%s)\n",
+                                 session_info->unix_info->unix_name,
+                                 lp_servicename(snum)));
+                       return NT_STATUS_ACCESS_DENIED;
                }
+       }
 
-               *presult = result;
-               return NT_STATUS_OK;
-        }
+       result = copy_session_info(mem_ctx, session_info);
+       if (result == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
-       DEBUG(0, ("invalid VUID (vuser)\n"));
-       return NT_STATUS_ACCESS_DENIED;
+       *presult = result;
+       return NT_STATUS_OK;
 }
 
 /****************************************************************************
@@ -558,7 +552,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
        conn->params->service = snum;
 
        status = create_connection_session_info(sconn,
-               conn, snum, vuser ? vuser->session_info : NULL,
+               conn, snum, vuser->session_info,
                &conn->session_info);
 
        if (!NT_STATUS_IS_OK(status)) {