1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nataly_w [17]
2 years ago
13

Consider the following general code for allowing access to a resource:

Computers and Technology
1 answer:
Margaret [11]2 years ago
6 0

Answer:

a) The code allows access even when  IsAccessAllowed(...) method fails.

b) Either use If

(dwRet = ACCESS_ALLOWED)

or use

if (dwRet == NO_ERROR)

to avoid flaw

Explanation:

Lets first see what the code chunk does:

DWORD dwRet = IsAccessAllowed(...);

if (dwRet == ERROR_ACCESS_DENIED) {

// Security check failed.

// Inform user that access is denied.

} else {

// Security check OK.

}

In the given code, DWORD is basically a data type for double word type integers and this is defined in windows.h

So there is DWORD type variable dwRet that is assigned a method calls.

The method is IsAccessAllowed() which checks if the access is allowed to user.

if (dwRet == ERROR_ACCESS_DENIED) condition basically checks if the value of DWORD type variable dwRet is equal to ERROR_ACCESS_DENIED

If this condition evaluates to true then the security checks fails and user is informed via some message or action that the access is denied.  But when the if condition evaluates to false then the else part executes which allows access.

So basically this chunk of code checks if the error ERROR_ACCESS_DENIED is returned.

Now the flaw in this program is what if the method IsAccessAllowed() by any reason. The reasons can be system failure or the memory failure. In memory failure case for example, the system returns out of memory error. So this means that the error is not  ERROR_ACCESS_DENIED. Instead it is out of memory error. So in such a case the user is allowed access as the if condition evaluates to false and else part executes. So if any other error is produced due to some reason like mentioned above, then user has unrestricted access.

This shows that the doe should not check for the failure or rely on checking ERROR_ACCESS_DENIED to allow access but instead it should check for success. Code should only give access privilege if access is allowed successfully or no error is produced.

So to avoid this flaw the code is altered as:

DWORD dwRet = IsAccessAllowed(...);

If (dwRet = ACCESS_ALLOWED) {

//Security check OK.

} else {

//Security check failed.

//Inform user that access is denied.

}

This will only allow access if ACCESS_ALLOWED evaluates to true and success is checked instead of failure here

You can also alter the if condition as:

If (dwRet = No_Error)

or

If (dwRet = 0)

The above if conditions checks if the access is allowed or if no error is produced. Only then it will allowed access otherwise not. So the access check is a success is checked first and failure (for any reason). The user is allowed access only if there is no error otherwise user is not allowed access.

You might be interested in
analyze the ethical issues in the use of information technology in Multinational company (MNC) and support you answer with one e
LekaFEV [45]

Answer:

Explanation:

Multinational Companies tend to have millions of users from all over the globe who use their services and in doing so provide their information. This information gets saved on the databases of these companies. It is then up to the company on how they will use this information. This is where ethicality comes into play. A company can act ethically and protect the information that has been entrusted to them by their user, or they can act unethically and use the users' personal data to make profits. It has recently come to light that some companies have been using users' private data and would sell it to other companies for profit. These buying companies would then use the data for a variety of things such as ad targeting and statistics. These companies profited massively and the actual owners of the data did not, which makes this incredibly unethical.

8 0
3 years ago
Help with this robotics hw pls
enyata [817]
Hard to see, if you make it normal size I might b able to help
8 0
3 years ago
In ____, data can move in both directions at the same time, such as with a telephone.
gtnhenbr [62]

The answer is d. full-duplex transmission. This communication setup allows for simultaneous transmit and receive for both parties. As signals are able to be transmitted at the same time two way for both parties, for both directions along the same data carrier medium.

4 0
3 years ago
Call of duty vanguard, war zone , fornite, gta what’s your favorite
tia_tia [17]
Warzone easily but gta a close second
8 0
2 years ago
You can view the existing Access Control Lists for a set of folders on a Windows system by right-clicking the folder you want to
NikAS [45]

Answer:

And clicking the security tab option.

Explanation:

Lets explain what an object's ACL is. I will use an example to best explain this. Let's suppose that user Bob would want to access a folder in a Windows environment. What supposedly will happen is that Windows will need to determine whether Bob has rights to access the folder or not. In order to do this, an ACE with the security identity of John will be created. These ACEs are the ones that grant John access to the folder and the ACLs of this particular folder that John is trying to access is a list of permissions of everyone who is allowed to access this folder. What this folder will do is the to compare the security identity of John with the folders ACL and determine whether John has Full control of the folder or not.

By right clicking the folder and selecting the security tab, John will be in a position to see a list of the permissions (ACLs) granted to him by the folder.

3 0
2 years ago
Other questions:
  • In your presentation you added a text box to?
    5·1 answer
  • You send a report to your boss for feedback and she returns it to you with her edits noted in the electronic file. This Word fea
    11·1 answer
  • Match these items. 1 . Naturalization Act stated that a foreigner had to live in the United States fourteen years to become a ci
    5·1 answer
  • All of the following are organization habits except:
    10·1 answer
  • Suppose the ESPN website uses 8-bit unsigned integers to store how many points a team has scored in
    12·1 answer
  • _____ is the practice of using the internet to provide healthcare without going to a doctor’s office or hospital.
    15·2 answers
  • Will mark Brainliest!! What is the best memory to use on a computer? Why?
    9·1 answer
  • Any correct answers will be helpful.
    13·1 answer
  • Put simply, what tasks do algorithms help computers perform?
    13·1 answer
  • Two types of storage memory​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!