updates.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 14 Mar 2001 14:45:11 +0000 (14:45 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 14 Mar 2001 14:45:11 +0000 (14:45 +0000)
CHANGES
apps/silcd/serverconfig.c
apps/silcd/serverconfig.h
doc/draft-riikonen-silc-spec-01.nroff
doc/example_silcd.conf

diff --git a/CHANGES b/CHANGES
index 454faa112b0e31d0ed6161866f8e2d48bed0f480..03d80a67fe93851365915e16e81d83d240d4f4da 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,13 @@
+Wed Mar 14 16:10:30 EET 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+       * Changed the format of AdminConnection configuration section
+         in the server.  Added username of the admin to the format.
+         Affected files silcd/serverconfig.[ch].
+
+         Added silc_server_config_find_admin into silcd/serverconfig.[ch]
+         to return admin configuration data by host, username and/or
+         nickname.
+
 Wed Mar 14 13:18:16 EET 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Implemented WHOWAS command to the server.  Added the functions:
index 485c261a7ae5f6789862f11ed636c980bfa0871b..cc51b89b0dab976c7dec9605abfd5a5d12bb55de 100644 (file)
@@ -864,6 +864,22 @@ int silc_server_config_parse_lines(SilcServerConfig config,
        /* Any host */
        config->admins->host = strdup("*");
 
+      /* Get username */
+      ret = silc_config_get_token(line, &config->admins->username);
+      if (ret < 0)
+       break;
+      if (ret == 0)
+       /* Any username */
+       config->admins->username = strdup("*");
+
+      /* Get nickname */
+      ret = silc_config_get_token(line, &config->admins->nickname);
+      if (ret < 0)
+       break;
+      if (ret == 0)
+       /* Any nickname */
+       config->admins->nickname = strdup("*");
+
       /* Get authentication method */
       ret = silc_config_get_token(line, &tmp);
       if (ret < 0)
@@ -890,20 +906,6 @@ int silc_server_config_parse_lines(SilcServerConfig config,
       if (ret < 0)
        break;
 
-      /* Get nickname */
-      ret = silc_config_get_token(line, &config->admins->nickname);
-      if (ret < 0)
-       break;
-
-      /* Get class number */
-      ret = silc_config_get_token(line, &tmp);
-      if (ret < 0)
-       break;
-      if (ret) {
-       config->admins->class = atoi(tmp);
-       silc_free(tmp);
-      }
-
       check = TRUE;
       checkmask |= (1L << pc->section->type);
       break;
@@ -1384,6 +1386,42 @@ silc_server_config_find_router_conn(SilcServerConfig config,
   return serv;
 }
 
+/* Returns Admin connection configuration by host, username and/or 
+   nickname. */
+
+SilcServerConfigSectionAdminConnection *
+silc_server_config_find_admin(SilcServerConfig config,
+                             char *host, char *username, char *nickname)
+{
+  SilcServerConfigSectionAdminConnection *admin = NULL;
+  int i;
+
+  if (!config->admins)
+    return NULL;
+
+  if (!host)
+    host = "*";
+  if (!username)
+    username = "*";
+  if (nickname)
+    nickname = "*";
+
+  admin = config->admins;
+  for (i = 0; admin; i++) {
+    if (silc_string_compare(admin->host, host) &&
+       silc_string_compare(admin->username, username) &&
+       silc_string_compare(admin->nickname, nickname))
+      break;
+
+    admin = admin->next;
+  }
+
+  if (!admin)
+    return NULL;
+
+  return admin;
+}
+
 /* Prints out example configuration file with default built in
    configuration values. */
 
index 1d33597d8528ab6ea5829be365a9af10d3f8a984..3e911eac4556d26e6e80588e25124017a70aad1c 100644 (file)
@@ -106,10 +106,10 @@ typedef struct SilcServerConfigSectionClientConnectionStruct {
 /* Hols all server's administrators authentication data from config file */
 typedef struct SilcServerConfigSectionAdminConnectionStruct {
   char *host;
+  char *username;
+  char *nickname;
   int auth_meth;
   char *auth_data;
-  char *nickname;
-  unsigned int class;
   struct SilcServerConfigSectionAdminConnectionStruct *next;
   struct SilcServerConfigSectionAdminConnectionStruct *prev;
 } SilcServerConfigSectionAdminConnection;
@@ -266,6 +266,9 @@ silc_server_config_find_server_conn(SilcServerConfig config,
 SilcServerConfigSectionServerConnection *
 silc_server_config_find_router_conn(SilcServerConfig config, 
                                    char *host, int port);
+SilcServerConfigSectionAdminConnection *
+silc_server_config_find_admin(SilcServerConfig config,
+                             char *host, char *username, char *nickname);
 void silc_server_config_print();
 
 #endif
index 1cb7cb4e3d1c479e6306217764c46b4281a34f18..f36990e456381ba5584dd9db658349f9de811b19 100644 (file)
@@ -1115,7 +1115,8 @@ o Authentication Data (variable length) - Authentication
 
 If the authentication method is password based, the Authentication
 Data field includes the plaintext password.  It is safe to send
-plaintext password since the entire payload is encrypted.
+plaintext password since the entire payload is encrypted.  In this
+case the Public Data Lenght is set to zero (0).
 
 If the authentication method is public key based (or certificate)
 the Authentication Data is computed as follows:
index 8d4bcf59bba644b9e6b0b4a6fa35a28fb412d578..ece466f2f7dd9fe61ae1674025632031439515a2 100644 (file)
@@ -120,16 +120,22 @@ infologfile:silcd.log:10000
 #
 # Format: <remote host>:<auth method>:<auth data>:<port>:<class>
 #
+# The <auth data> is either passphrase or file path to the public key
+# file.
+#
 [ClientConnection]
 :::1333:1
 
 #
 # Configured server administrator connections
 #
-# Format: <host>:<auth method>:<auth data>:<nickname hash>:<class>
+# Format: <host>:<username>:<nickname>:<auth method>:<auth data>
+#
+# The <auth data> is either passphrase or file path to the public key
+# file.
 #
 [AdminConnection]
-10.2.1.199:passwd:veryscret:XXX:1
+10.2.1.199:priikone:pekka:passwd:veryscret
 
 #
 # Configured server connections.
@@ -141,6 +147,9 @@ infologfile:silcd.log:10000
 #
 # Format: <remote host>:<auth method>:<auth data>:<port>:<version ID>:<vlass>
 #
+# The <auth data> is either passphrase or file path to the public key
+# file.
+#
 [ServerConnection]
 10.2.1.7:passwd:veryscret:706:1:1
 
@@ -154,6 +163,9 @@ infologfile:silcd.log:10000
 #
 # Format: <remote host>:<auth method>:<auth data>:<port>:<version ID>:<class>:<initiator>
 #
+# The <auth data> is either passphrase or file path to the public key
+# file.
+#
 [RouterConnection]
 #10.2.1.100:passwd:veryverysecret:706:1:1:1