Write a password protected console-based application which


Your assignment is organised into two parts:

Stage 1

In order to guide you through the design and implementation of the required application, perform the following steps including:

1. Write a password protected console-based application, which enables you to create user accounts and specify the name of the file or directory to be shared with other users.

2. Write a simple console-based (ie text-based) menu system to enable the users to select from a set of functions provided by your system including:

a. Create a new user

b. Create a database file, where the implementation requirements for this are defined in bullet point 3 (below).

c. Exit the program

3. Write a function that enables you to create a struct data structure for each file contained in your shared directory. Where each file signature record is stored in a struct of the following form:

struct FileSig {
char name[256]; // File or directory name int mode; // protection and file type int user_id; // User ID of owner
int group_id; // Group ID of owner int size; // file size in bytes
char time_last_mod[50]; // modify time as a string
};

4. Add to your main() function relevant statement(s) to create an instance of the FileSig struct called fileSig. Also use in your main function relevant code to initialise your fileSig struct for two filenames of your choice. Hint: when initialising the fileSig struct ask the user to enter file information/detail rather than by interfacing the Filesystem.


Please note:

For the Stage 1 submission you are not required to do any file I/O for instance to store your file details and/or directory listing. But this will come in Stage 2.

Stage 2:

In order to guide you through the implementation of the new functionality, please follow the following steps including:

Part 1

Extend your program by writing a new C function, which will store and save the logging information into a text file called config.txt. Thus, you will need to amend your code to validate the username and password details entered by a user against those stored on file. Consequently, your system should allow access if users have a valid username and password.

Part 2

Extend your program by writing a new C function to take as input a file containing a list of file names (fully qualified path names; one per line) and produce a database file consisting of file signature records. It is upto you to decide how to generate this file - either manually using the ls command, or by other means. In this file each file signature record is stored in a struct of the following form:

typedef struct {
char name[256]; /*File or directory name*/ u_short mode; /*protection and file type*/ short user_id; /*User ID of owner*/
short group_id; /*Group ID of owner*/
off_t size; /*file size in bytes*/
char time_last_mod[50]; /*modify time as a string*/
} fileSig;
Hint: All needed information to perform this task can be found in the inode. To modify time, use function ctime to convert to a human readable string. The function prototype can be as follows:

void mkSigData(, );

where is the name of the file that contains the list of files to get information about. The is the name of the file (your program will create) that will contain the selected inode information for all the files. This database file will contain a series of structs of type fileSig (outlined above), one for each file listed in the fileList.

There must be no other output apart from standard error output associated with system call and function call errors.

Part 3

Extend your program by writing a new C function that will take as input the database file generated in Part 2. The function should simply print to screen the details of each fileSig stored.

Solution Preview :

Prepared by a verified Expert
Database Management System: Write a password protected console-based application which
Reference No:- TGS0664133

Now Priced at $40 (50% Discount)

Recommended (91%)

Rated (4.3/5)