Sorry the format did not come out right using chegg text editor. Will not give a
ID: 3537379 • Letter: S
Question
Sorry the format did not come out right using chegg text editor. Will not give anyone points since it did not come out right :(
Unless you can figure it out....
Can anyone help me rewrite the BNF location and time language. I have went ahead and wrote down the original language use to express location and time. Thanks!
The The little languages presented in Section 29.3.2.3 have ambiguous semantics. For example, in the location language, does %u201Cnot host1 or host2%u201D mean %u201Cnot at host1 and not at host2%u201D or %u201Cnot at host1, or at host2%u201D?
A. Rewrite the BNF of the location language to make the semantics reflect the second meaning. Are the semantics unambiguous now? Why or why not?
(help me re-write this in the not at host1, or at host2)
The BNF Location language:
Location::= %u2018(%u2018 location %u2018)%u2019| %u2018not%u2019 location| location %u2018or%u2019 location | basic
Basic::= *any*%u2019 |%u2019*local*%u2019| %u2018.%u2019 domain |host
B. Rewrite the BNF of the time language to make the semantics reflect the second meaning. Are the semantics unambiguous now? Why or why not?
(help me re-write this in the not at host1, or at host2)
BNF time language:
Time::= %u2018(%u2018time %u2018)%u2019 %u2018| %u2018not%u2019 time | time %u2018or%u2019 | time time | time %u2018-%u2018 time | basic
basic::= day_of_year day_of_week time_of_day | %u2018*any*%u2019
day_of_year:: =month [day] [%u2018,%u2019 year] |nmonth %u2018/%u2019 [day %u2018/%u2019 ] year / empty
day_of_week::=%u2019Sunday%u2019 |%u2026| %u2018Saturday%u2019 | %u2018Weekend%u2019 | %u2018Weekday%u2019 | empty
time_of_day::=hour [%u2018:%u2019 min] [%u2018:%u2019sec] [%u2018AM%u2019 | %u2018PM%u2019] | special / empty
special::= %u2018noon%u2019 | %u2018midnight%u2019 | %u2018morning%u2019 | %u2018afternoon%u2019 | %u2018evening%u2019
empty::=%u2019 %u2019
Explanation / Answer
In BNF form, the language used to express location is
location ::= '('
location ')' | 'not'
location |
location 'or'
location |
basic
basic ::= '*any*' | '*local*' | '.'
domain |
host
where
domain and
host are domain names and host names, respectively. The strings in single quotation marks are literals. The parentheses are grouping operators, the 'not' complements the associated locations, and the 'or' allows either location.
EXAMPLE: A user is allowed to assume a role only when logged into the local system, the system "control.fixit.com", and the domain "watchu.edu". The appropriate entry would be
A similar question arises for times. Ignoring how times are expressed, how do we indicate when users may access the role account? Considerations similar to those above lead us to the following language, in which the keyword
*any* (allow access at any time)
allows access at any time. In BNF form, the language used to express time is
time ::= '('
time ')' | 'not'
time |
time 'or'
time |
time time |
time '-'
time |
basic
basic ::=
day_of_year day_of_week time_of_day | '*any*' |
day_of_year ::=
month [
day ] [','
year ] |
nmonth '/' [
day '/' ]
year | empty
day_of_week ::= 'Sunday' | ... | 'Saturday' | 'Weekend' | 'Weekday' |
empty
time_of_day ::=
hour [':'
min ] [ ':'
sec ] [ 'AM' | 'PM' ] |
special | empty
special ::= 'noon' | 'midnight' | 'morning' | 'afternoon' | 'evening'
empty ::= ''
where
month is a string naming the month,
nmonth is an integer naming the month,
day is an integer naming the day of the month, and
year is an integer specifying the year. Similarly,
hour,
min, and
sec are integers specifying the hour, minute, and second. If
basic is empty, it is treated as not allowing access.
EXAMPLE: A user is allowed to assume a role between the hours of 9 o'clock in the morning and 5 o'clock in the evening on Monday through Thursday. An appropriate entry would be
MondayThursday 9
A.M.5
P.M.
This is different than saying
Monday 9
A.M.Thursday 5
P.M.
because the latter allows access on Moday at 10
P.M., whereas the former does not.
Finally, the users field of the record has a similar structure.
*any* (match any user)
In BNF form, the language used to express the set of users who may access a role is
userlist ::= '('
userlist ')' | 'not'
userlist |
userlist ','
userlist |
user
where
user is the name of a user on the system.
These "little languages" are straightforward and simple (but incomplete; see Exercise 4). Various implementation details, such as allowing abbreviations for day and month names, can be added, as can an option to change the American expression of days of the year to an international one. These points must be considered in light of where the program is to be used. Whatever changes are made, the administrators must be able to configure times and places quickly and easily, and in a manner that a reader of the access control file can understand quickly.
The listing of commands requires some thought about how to represent arguments. If no arguments are listed, is the command to be run without arguments, or should it allow any set of arguments? Conversely, if arguments are listed, should the command be run only with those arguments? Our approach is to force the administrator to indicate how arguments are to be treated.
Each command line contains a command followed by zero or more arguments. If the first word after the command is an asterisk ("*"), then the command may be run with any arguments. Otherwise, the command must be run with the exact arguments provided.
EXAMPLE: Charles is allowed to run the
install command when he accesses the
bin role. He may supply any arguments. The line in the access control file is
He may also copy the file
log from the current working directory to the directory
/var/install. The line for this is
Finally, he may run the
id command to ensure that he is working as
bin. He may not supply other arguments to the command, however. This would be expressed by
The user must type the command as given in the access control file. The full path names are present to prevent the user from accidentally executing the command
id with
bin privileges when
id is a command in the local directory, rather than the system
id command.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.