Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#8570) Authentification should be compiled on defau
Home

[Freeciv-Dev] Re: (PR#8570) Authentification should be compiled on defau

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8570) Authentification should be compiled on default (Was: no auth for gtk2 client)
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 30 Aug 2004 09:02:28 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8570 >

On 2004-08-30 17:19:15, Per I. Mathisen wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8570 >
> 
> On Mon, 30 Aug 2004, Mike Kaufman wrote:
> > 2. It would require the user to compile things like
> server/userdb/lockfile.c
> > into their server all the time. That might be horrible. I haven't
> thought
> > about it a whole lot.
> 
> What is rarely compiled, quickly bitrots. What is often compiled, is
> quickly fixed.
> 
> I say put it in.
> 
>   - Per
I think this patch will make it.
./configure option is still called --enable-auth[=authdb].
(I don't know much about configure scripts)
--
mateusz


----------------------------------------------------------------------
Startuj z INTERIA.PL!!! >>> http://link.interia.pl/f1830

Index: m4/auth.m4
===================================================================
RCS file: /home/freeciv/CVS/freeciv/m4/auth.m4,v
retrieving revision 1.3
diff -u -r1.3 auth.m4
--- m4/auth.m4  27 Apr 2004 05:00:25 -0000      1.3
+++ m4/auth.m4  30 Aug 2004 16:00:01 -0000
@@ -5,23 +5,20 @@
 [  --enable-auth[[=lib]]     enable authentication 
                                  [[default userdb 
lib=server/userdb/libuserdb.a]]],
 [
-  auth=true
   user_db_lib=${enableval}
-  if test "x$user_db_lib" = "" || test "x$user_db_lib" = "xyes" ; then
+  if test "x$user_db_lib" = "x" || test "x$user_db_lib" = "xyes" ; then
      user_db_lib="userdb/libuserdb.a"
   fi
 ], [
-  auth=false
-  user_db_lib=""
+  user_db_lib="userdb/libuserdb.a"
 ])
-if test "x$auth" = "xtrue" ; then
-  AC_DEFINE(AUTHENTICATION_ENABLED, 1, [authentication support])
-  USER_DB_LIB=$user_db_lib
 
-  if test "x$user_db_lib" = "xuserdb/libuserdb.a" ; then
-    USER_DB_DEP=$user_db_lib
-  fi
+USER_DB_LIB=$user_db_lib
+
+if test "x$user_db_lib" = "xuserdb/libuserdb.a" ; then
+  USER_DB_DEP=$user_db_lib
 fi
+
 AC_SUBST(USER_DB_LIB)
 AC_SUBST(USER_DB_DEP)
 ])
Index: server/civserver.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/civserver.c,v
retrieving revision 1.220
diff -u -r1.220 civserver.c
--- server/civserver.c  21 Aug 2004 18:32:37 -0000      1.220
+++ server/civserver.c  30 Aug 2004 16:00:04 -0000
@@ -109,14 +109,12 @@
        showhelp = TRUE;
        break;
       }
-#ifdef AUTHENTICATION_ENABLED 
     } else if (is_option("--auth", argv[inx])) {
       srvarg.auth_enabled = TRUE;
     } else if (is_option("--Guests", argv[inx])) {
       srvarg.auth_allow_guests = TRUE;
     } else if (is_option("--Newusers", argv[inx])) {
       srvarg.auth_allow_newusers = TRUE;
-#endif
     } else if (is_option("--version", argv[inx]))
       showvers = TRUE;
     else {
@@ -137,11 +135,9 @@
 
   if (showhelp) {
     fprintf(stderr, _("Usage: %s [option ...]\nValid options are:\n"), 
argv[0]);
-#ifdef AUTHENTICATION_ENABLED 
     fprintf(stderr, _("  -a  --auth\t\tEnable server authentication.\n"));
     fprintf(stderr, _("  -G  --Guests\t\tAllow guests to login if auth is 
enabled.\n"));
     fprintf(stderr, _("  -N  --Newusers\tAllow new users to login if auth is 
enabled.\n"));
-#endif
     fprintf(stderr, _("  -b  --bind ADDR\tListen for clients on ADDR\n"));
 #ifdef DEBUG
     fprintf(stderr, _("  -d, --debug NUM\tSet debug log level (0 to 4,"
Index: server/connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.22
diff -u -r1.22 connecthand.c
--- server/connecthand.c        21 Aug 2004 18:32:37 -0000      1.22
+++ server/connecthand.c        30 Aug 2004 16:00:04 -0000
@@ -49,20 +49,16 @@
 
 #define MAX_AUTHENTICATION_TRIES 3
 
-#ifdef AUTHENTICATION_ENABLED 
 /* after each wrong guess for a password, the server waits this
  * many seconds to reply to the client */
 static const int auth_fail_period[] = { 1, 1, 2, 3 };
-#endif
 
 static void establish_new_connection(struct connection *pconn);
 static void reject_new_connection(const char *msg, struct connection *pconn);
 
-#ifdef AUTHENTICATION_ENABLED
 static bool is_guest_name(const char *name);
 static void get_unique_guest_name(char *name);
 static bool is_good_password(const char *password, char *msg);
-#endif
 
 /**************************************************************************
   This is used when a new player joins a server, before the game
@@ -277,7 +273,6 @@
     }
   } conn_list_iterate_end;
 
-#ifdef AUTHENTICATION_ENABLED 
   if (srvarg.auth_enabled) {
     /* assign the client a unique guest name/reject if guests aren't allowed */
     if (is_guest_name(req->username)) {
@@ -350,7 +345,6 @@
       return TRUE;
     }
   }
-#endif /* AUTHENTICATION_ENABLED */
 
   sz_strlcpy(pconn->username, req->username);
   establish_new_connection(pconn);
@@ -384,7 +378,6 @@
 **************************************************************************/
 bool handle_authentication_reply(struct connection *pconn, char *password)
 {
-#ifdef AUTHENTICATION_ENABLED 
   char msg[MAX_LEN_MSG];
 
   if (pconn->server.status == AS_REQUESTING_NEW_PASS) {
@@ -433,12 +426,8 @@
   }
 
   return TRUE;
-#else
-  return FALSE;
-#endif /* AUTHENTICATION_ENABLED */
 }
 
-#ifdef AUTHENTICATION_ENABLED
 /**************************************************************************
   see if the name qualifies as a guest login name
 **************************************************************************/
@@ -527,7 +516,6 @@
 
   return TRUE;
 }
-#endif /* AUTHENTICATION_ENABLED */
 
 /**************************************************************************
   High-level server stuff when connection to client is closed or lost.



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