Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2003:
[Freeciv-Dev] Re: client/server authentication (PR#1767)
Home

[Freeciv-Dev] Re: client/server authentication (PR#1767)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: client/server authentication (PR#1767)
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 4 May 2003 20:51:33 -0700
Reply-to: rt@xxxxxxxxxxxxxx

> I don't like the misc directory. IMHO this is a server-thing. So it
> should go under server/.

it is now under server/userdb

> The user DB should and hopefully will be used for more than just
> storing the password. Examples are: if someone logged in or tried to
> login this should be recorded. Also the DB should support the user
> history to calculate the ranking of the players. So just username and
> password is too little. A struct is needed.

there is now a user struct in server/userdb/user.h only name and password
are currently there.
 
> The user DB shouldn't check the passwd. The "common" code should do
> this. There should be only two functions:

the server code (in connecthand) now does this. There are now two
functions.

>   // user->name filled out here by the caller
>   enum status user_db_load(struct user *user);
> and
>   enum status user_db_save(struct user *user);

actually it's void user_db_* since we need to return the status elsewhere.
 
> Also the caller can't and shouldn't differ between USER_DB_NOT_FOUND,
> USER_DB_BAD_INPUT and USER_DB_ERROR. So this gives: 
> 
> enum userdb_status
> {
>   USER_DB_ERROR = 1,
>   USER_DB_SUCCESS,
>   USER_DB_NOT_FOUND
> };

USER_DB_SAVE_SUCCESS and USER_DB_LOAD_SUCCESS need to be differentiated.
Now there are only four statuses.

> The last is only returned by user_db_load. The caller (the server in
> this case) should probably quit/assert(0) if it gets USER_DB_ERROR
> because this shows a configuration error.

hmm, I don't know about this. Say the load on the server is really high
and the lookup times out. This will return an error, but it is not
configuration related. For now, this is not done.

In addition, I moved the gui signals [mostly] past the dialog popup
functions. This should fix Chris' slow dialog problem. Also, I found the
problem that was causing the crashes (the problem was that a new user was
getting his connection established twice). Thanks Chris.

I also combined the patches, so that the gui code is there as well as the
server code. If you want to apply these separately, I can probably arrange
it.

Unfortunately, with the interrogation of the password in the server, the
toy db code is obsolete, and furthermore, will probably require a more
sophisticated socket mechanism to pass the user struct back to the server.
Someone else can do this.

-mike

Attachment: auth4-6c.diff.gz
Description: auth4-6c.diff.gz


[Prev in Thread] Current Thread [Next in Thread]