Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   file server/ reading struct from a file (http://www.go4expert.com/forums/file-server-reading-struct-file-t8242/)

engine_er21 14Jan2008 02:10

file server/ reading struct from a file
hi, I m studying on a file server project. It won t be a real file server project but it will behave like a real file server. It will be written in c. Let me explain it:
there are two kind of users: supervisor and normal user. there will be commands like login, dir, delete,....with their parameters but commands will be written in c. no system commands will be used. There are some restrictions about users. For example a normal user won t be able to open a file for changing or deleting...It s a little long and it s in turkish. Can you just give me an idea about this project?
My second question, I tried to create a file and put my user information(as struct) into that. but when opening file it s failed. For example when I m trying to login even if username exists it says "no such username!", I m doing that by using the same struct, I read it with fread and put my information in my struct then search it in struct, but it fails. I tried to write on screen it works but writess meaningless information like 7848736828. Can you help me, thanks

engine_er21 14Jan2008 03:47

Re: file server/ reading struct from a file
I translated the full project into english it s urgent please help!
a file server which serves to several users will be created in this project.
in this system the processes will run under SERVER directory. SERVER directory s struct shown
I___ public
I___ system
I___ user
I I___george
I I .
I I .
I I___ mary
I___ spool
I___ george
I .
I .
I___ mary
the properties and contents of directories under SERVER will be like shown below
public: basic commands like dir,copy,delete and logout which every users have permission to access
will be under that directory.
system: Programs to create a new user which only authorized users can access will be under that
user: when a new user created under sysadmin program, for this user, a new directory will be opened
with the same name(username)
spool: with sendf command a file which a user send file to another user, the file will be copied under
another user in the spool directory, receiver-user will be able to take the file to its own directory. The
received file must be deleted
Users with supervisor authority will be able to these operations:
Creating a User
a user with the same authorith with supervisor will be able to create a new user. sysadmin program will
be used to create a user, change user informations, delete user or see a existing user information.
when program is ran for change, the user informations as shown below will be saved in a table, as the
questions and corresponding answers.
unauthorized users only can view the user information below
User Name :
Account Restrictions :
Account Disabled : (Yes/No)
Expiration Date : (MM/DD/YY)
Allow User to Change Password : (Yes/No)
Require Password : (Yes/No)
Minimum Password Length :
Limit Grace Logins : (Yes/No)
Grace Logins Allowed : max password you can enter
Remaining Grace Logins : in every error password enter, it will decrement by 1
Security Equivalence : 0(Supervisor authority), 1(Normal user authority)
Change Password : new Password
Full Name : user's full name
Last Login : user's last login.
Disk Space In Use : it will change whenever use different space size
Total Disk Space : user's total disk space
when these questions answered a new directory(username) will be created under the user and spool
Deleting users:the deleted user's information will be deleted from the user table.
3.User Commands
login: user must use login command to work in his/her workspace.
format: login username
dir: if the given argument is refer to a accesible path it views the list under this path
format: dir filename
copy: if a user is authorized it is used to copy a file
format: copy soucefileName destionationfileName
delete: if the user is authorized it deletes the file
format: delete sourcefileName
sendf: it is used to send a file from a file to another user
format: sendf filename to userid
readlist: it is used to view the list of files onder his/her spool workspace
format: rl
receive: it s used to receive the files in his/here spool workspace
format: receive filename
setpass: it can be used by users who can change their password. when the command run, the current
password of the user asked, if right the new password requested, if the entered password is enough
long the process is successful,
whoami: when this command run the active user will be shown
logout: active user will log out

All times are GMT +5.5. The time now is 02:26.