Global cosmetic changes.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 5 Jul 2000 06:12:05 +0000 (06:12 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 5 Jul 2000 06:12:05 +0000 (06:12 +0000)
apps/silc/client.c
apps/silc/clientconfig.c
apps/silc/command.c
apps/silc/protocol.c
apps/silc/screen.c

index e4f79fd9ce4c057bd69589082f5533a275d6ba84..b64b6ac1a7c3b4ac07e256a0e4a434ba77a1438e 100644 (file)
@@ -20,6 +20,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.4  2000/07/05 06:12:05  priikone
+ *     Global cosmetic changes.
+ *
  * Revision 1.3  2000/07/04 08:29:12  priikone
  *     Added support for PING command. The ping times are calculated
  *     and showed to the user.
@@ -28,7 +31,7 @@
  *     Implemented LEAVE command.  Minor bug fixes.
  *
  * Revision 1.1.1.1  2000/06/27 11:36:56  priikone
- *     Importet from internal CVS/Added Log headers.
+ *     Imported from internal CVS/Added Log headers.
  *
  *
  */
@@ -73,11 +76,6 @@ int silc_client_alloc(SilcClient *new_client)
 {
 
   *new_client = silc_calloc(1, sizeof(**new_client));
-  if (*new_client == NULL) {
-    SILC_LOG_ERROR(("Could not allocate new client object"));
-    return FALSE;
-  }
-
   (*new_client)->input_buffer = NULL;
   (*new_client)->screen = NULL;
   (*new_client)->windows = NULL;
@@ -127,63 +125,9 @@ int silc_client_init(SilcClient client)
   silc_rng_init(client->rng);
   silc_math_primegen_init(); /* XXX */
 
-#if 0
-  {
-    SilcCipher twofish;
-    unsigned char *src, *dst, *dec;
-    SilcBuffer packet;
-    int payload_len;
-
-    payload_len = 4 + strlen("pekka riikonen");
-    packet = silc_buffer_alloc(payload_len);
-    silc_buffer_pull_tail(packet, SILC_BUFFER_END(packet));
-    silc_buffer_format(packet,
-                      SILC_STR_UI_SHORT(payload_len),
-                      SILC_STR_UI_SHORT(SILC_SOCKET_TYPE_CLIENT),
-                      SILC_STR_UI_XNSTRING("pekka riikonen", 
-                                           strlen("pekka riikonen")),
-                      SILC_STR_END);
-
-    silc_cipher_alloc("twofish", &twofish);
-    twofish->cipher->set_key(twofish->context, "1234567890123456", 16);
-    twofish->set_iv(twofish, "6543210987654321");
-    SILC_LOG_HEXDUMP(("source: len %d", packet->len), 
-                    packet->data, packet->len );
-    silc_packet_encrypt(twofish, packet, packet->len);
-    SILC_LOG_HEXDUMP(("encrypted"), packet->data, packet->len);
-    silc_packet_decrypt(twofish, packet, packet->len);
-    SILC_LOG_HEXDUMP(("decrypted"), packet->data, packet->len);
-
-  }
-
-  {
-    SilcCipher cipher1, cipher2;
-    unsigned char *src, *dst, *dec;
-    int len = strlen("12345678901234561234567890123456123456789012345612345678901234561234567890123456");
-
-    src = silc_calloc(len + 1, sizeof(unsigned char));
-    dst = silc_calloc(len + 1, sizeof(unsigned char));
-    dec = silc_calloc(len + 1, sizeof(unsigned char));
-
-    memcpy(src, "12345678901234561234567890123456123456789012345612345678901234561234567890123456", len);
-    
-    silc_cipher_alloc("twofish", &cipher1);
-    cipher1->cipher->set_key(cipher1->context, "1234567890123456", 128);
-    cipher1->set_iv(cipher1, "6543210987654321");
-
-    silc_cipher_alloc("twofish", &cipher2);
-    cipher2->cipher->set_key(cipher2->context, "1234567890123456", 128);
-    cipher2->set_iv(cipher2, "6543210987654321");
-
-    SILC_LOG_HEXDUMP(("source: %d", len), src, len);
-    cipher1->cipher->encrypt(cipher1->context, src, src, len, cipher1->iv);
-    SILC_LOG_HEXDUMP(("encrypted"), src, len);
-    cipher2->set_iv(cipher2, "6543210987654321");
-    cipher2->cipher->decrypt(cipher2->context, src, src, len, cipher2->iv);
-    SILC_LOG_HEXDUMP(("decrypted"), src, len);
-
-  }
-#endif
+  /* Load public and private key */
+  if (silc_client_load_keys(client) == FALSE)
+    goto err0;
 
   /* Register the task queues. In SILC we have by default three task queues. 
      One task queue for non-timeout tasks which perform different kind of 
@@ -300,10 +244,6 @@ SilcClientWindow silc_client_create_main_window(SilcClient client)
   assert(client->screen != NULL);
 
   win = silc_calloc(1, sizeof(*win));
-  if (win == NULL) {
-    SILC_LOG_ERROR(("Could not allocate new window"));
-    return NULL;
-  }
 
   client->screen->u_stat_line.program_name = silc_name;
   client->screen->u_stat_line.program_version = silc_version;
@@ -351,10 +291,6 @@ SilcClientWindow silc_client_add_window(SilcClient client,
   assert(client->screen != NULL);
 
   win = silc_calloc(1, sizeof(*win));
-  if (win == NULL) {
-    SILC_LOG_ERROR(("Could not allocate new window"));
-    return NULL;
-  }
 
   /* Add the pointers */
   win->screen = silc_screen_add_output_window(client->screen);
@@ -2096,8 +2032,6 @@ void silc_client_close_connection(SilcClient client,
       silc_cipher_free(win->send_key);
     if (win->receive_key)
       silc_cipher_free(win->receive_key);
-    if (win->public_key)
-      silc_pkcs_free(win->public_key);
     if (win->hmac)
       silc_hmac_free(win->hmac);
     if (win->hmac_key) {
@@ -2110,7 +2044,6 @@ void silc_client_close_connection(SilcClient client,
     win->remote_type = 0;
     win->send_key = NULL;
     win->receive_key = NULL;
-    win->public_key = NULL;
     win->hmac = NULL;
     win->hmac_key = NULL;
     win->hmac_key_len = 0;
index d98933e218e3ec03141bf8dc1bf6ea953099c4de..af12288ffb6d0b03629800fdf0d3bf9aeeaaa9cb 100644 (file)
 /*
  * $Id$
  * $Log$
+ * Revision 1.3  2000/07/05 06:12:05  priikone
+ *     Global cosmetic changes.
+ *
  * Revision 1.2  2000/07/03 05:49:11  priikone
  *     Remove ':' from the end of line when in commands section.  Command
  *     execution should work now from config file ok.
  *
  * Revision 1.1.1.1  2000/06/27 11:36:56  priikone
- *     Importet from internal CVS/Added Log headers.
+ *     Imported from internal CVS/Added Log headers.
  *
  *
  */
@@ -64,11 +67,6 @@ SilcClientConfig silc_client_config_alloc(char *filename)
   SILC_LOG_DEBUG(("Allocating new configuration object"));
 
   new = silc_calloc(1, sizeof(*new));
-  if (!new) {
-    fprintf(stderr, "Could not allocate new configuration object");
-    return NULL;
-  }
-
   new->filename = filename;
 
   /* Open configuration file and parse it */
@@ -159,7 +157,7 @@ int silc_client_config_parse(SilcClientConfig config, SilcBuffer buffer,
       
       /* Check for matching sections */
       for (cptr = silc_client_config_sections; cptr->section; cptr++)
-       if (!strcmp(cp, cptr->section))
+       if (!strncasecmp(cp, cptr->section, strlen(cptr->section)))
          break;
 
       if (!cptr->section) {
index 60de1b54e3af8c754d955feb4e23a46813969f64..dad802e0af040ccb454f767129d9b14d56e6218a 100644 (file)
@@ -20,6 +20,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.5  2000/07/05 06:12:05  priikone
+ *     Global cosmetic changes.
+ *
  * Revision 1.4  2000/07/04 08:28:03  priikone
  *     Added INVITE, PING and NAMES command.
  *
@@ -30,7 +33,7 @@
  *     Added missing goto flag.
  *
  * Revision 1.1.1.1  2000/06/27 11:36:56  priikone
- *     Importet from internal CVS/Added Log headers.
+ *     Imported from internal CVS/Added Log headers.
  *
  *
  */
index bfbb2aa81a102af2c87495d562719647adfa7602..c5e48b482fd9a72db7c244c0abdf2d57dc6f03d9 100644 (file)
 /*
  * $Id$
  * $Log$
- * Revision 1.1  2000/06/27 11:36:56  priikone
- * Initial revision
+ * Revision 1.2  2000/07/05 06:12:05  priikone
+ *     Global cosmetic changes.
+ *
+ * Revision 1.1.1.1  2000/06/27 11:36:56  priikone
+ *     Imported from internal CVS/Added Log headers.
  *
  *
  */
index 10a52f068cc07e08262496b3d67a17fb7e47cedf..43bcd29cb160f779ccc54c0ca1f7647bfcf02976 100644 (file)
 /*
  * $Id$
  * $Log$
- * Revision 1.1  2000/06/27 11:36:56  priikone
- * Initial revision
+ * Revision 1.2  2000/07/05 06:12:05  priikone
+ *     Global cosmetic changes.
+ *
+ * Revision 1.1.1.1  2000/06/27 11:36:56  priikone
+ *     Imported from internal CVS/Added Log headers.
  *
  *
  */
@@ -39,11 +42,6 @@ SilcScreen silc_screen_init()
   SilcScreen new;
 
   new = silc_malloc(sizeof(*new));
-  if (new == NULL) {
-    SILC_LOG_ERROR(("Could not create new screen object"));
-    return NULL;
-  }
-
   new->output_win_count = 0;
   new->input_pos = 0;
   new->cursor_pos = 0;