osd/ClassHandler.cc: move stat into error handling
There is no security advantage to check if the class file
exists before opening it but the file could be removed or
exchanged between the stat and open. Instead directly open
it and fail. Check if the file was missing afterwards
for debug messages and error codes.
Make sure cls->status is set if the class open call fails.
To solve Coverity issue:
CID 743419 (#1 of 1): Time of check time of use (TOCTOU)
fs_check_call: Calling function stat to perform check on fname.
743419 Time of check time of use
An attacker could change the filename's file association or
other attributes between the check and use.
In ClassHandler::_load_class(ClassHandler::ClassData *): A check
occurs on a file's attributes before the file is used in a
privileged operation, but things may have changed (CWE-367)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>