]> andersk Git - libfaim.git/commitdiff
- Fri Jun 30 00:04:47 UTC 2000
authormid <mid>
Fri, 30 Jun 2000 00:13:23 +0000 (00:13 +0000)
committermid <mid>
Fri, 30 Jun 2000 00:13:23 +0000 (00:13 +0000)
   - Removed the forceful ICQ-related warnings, just in case they're wrong
   - Added three new fields to the client info.
      - **REQUIRES CLIENT CHANGES -- see faimtest for new initializer
   - Cleaned up aim_send_login()
   - Put in a nice hidious fix for AOL's latest bit of the drama.  See
      aim_readtlvchain() for the details.

CHANGES
aim_login.c
aim_tlv.c
faim/aim.h
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index dd976bc42ddc8af6d31bc0905a35b30049d61bfe..a9573276192468f2ad88446e26ecaadaee48b3fc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,14 @@
 
 No release numbers
 ------------------
+ - Fri Jun 30 00:04:47 UTC 2000
+   - Removed the forceful ICQ-related warnings, just in case they're wrong
+   - Added three new fields to the client info.  
+      - **REQUIRES CLIENT CHANGES -- see faimtest for new initializer
+   - Cleaned up aim_send_login()
+   - Put in a nice hidious fix for AOL's latest bit of the drama.  See
+      aim_readtlvchain() for the details.
+
  - Mon Jun 26 07:53:02 UTC 2000
    - Added utils/aimdebugd for playing with things -- see the README
    - Added aim_im.c::aim_parse_outgoing_im().  Probably not useful
index 8b3b925b7f47f3297ab501139f35c9034a6fc114..1af14201000fd65a269483884a0ef5ef9f4cc9f9 100644 (file)
@@ -98,11 +98,9 @@ int aim_send_login (struct aim_session_t *sess,
     icqmode = 1; /* needs a different password encoding */
     if (clientinfo && (clientinfo->major < 4)) {
       printf("faim: icq: version must be at least 4.30.3141 for ICQ OSCAR login\n");
-      return -1;
     }
     if (strlen(password) > 8) {
       printf("faim: icq: password too long (8 char max)\n");
-      return -1;
     }
   }
 
@@ -135,60 +133,48 @@ int aim_send_login (struct aim_session_t *sess,
   curbyte+= aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015);
 #else
   
-  newpacket->commandlen = 4 + 4 + strlen(sn) + 4+strlen(password) + 6;
-  newpacket->commandlen += 8; /* tlv 0x0014 */
-
-  if (clientinfo) {
-    if (strlen(clientinfo->clientstring))
-      newpacket->commandlen += 4+strlen(clientinfo->clientstring);
-    newpacket->commandlen += 6+6+6+6;
-    if (strlen(clientinfo->country))
-      newpacket->commandlen += 4+strlen(clientinfo->country);
-    if (strlen(clientinfo->lang))
-      newpacket->commandlen += 4+strlen(clientinfo->lang);
-  }
-
   newpacket->lock = 1;
   newpacket->hdr.oscar.type = 0x01;
 
+  /*
+   * These four bytes are actually the FLAP version information.
+   * They're sent here for convenience.  I suppose they could
+   * be seperated out into a seperate FLAP, but this is where
+   * everyone else sends them.
+   */
   curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
   curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-  curbyte += aimutil_put16(newpacket->data+curbyte, strlen(sn));
-  curbyte += aimutil_putstr(newpacket->data+curbyte, sn, strlen(sn));
 
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
-  curbyte += aimutil_put16(newpacket->data+curbyte, strlen(password));
+  curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn);
+
   password_encoded = (char *) malloc(strlen(password));
   aim_encode_password(password, password_encoded);
-  curbyte += aimutil_putstr(newpacket->data+curbyte, password_encoded, strlen(password));
+  curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0002, strlen(password), password_encoded);
   free(password_encoded);
   
-  if (strlen(clientinfo->clientstring)) {
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003);
-    curbyte += aimutil_put16(newpacket->data+curbyte, strlen(clientinfo->clientstring));
-    curbyte += aimutil_putstr(newpacket->data+curbyte, clientinfo->clientstring, strlen(clientinfo->clientstring));
-  }
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, /*0x010a*/ 0x0004);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, clientinfo->major /*0x0001*/);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, clientinfo->minor /*0x0001*/);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, 0x0001);
-  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, clientinfo->build /*0x0013*/);
-
-  curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x00000055);
-
-  if (strlen(clientinfo->country)) {
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x000e);
-    curbyte += aimutil_put16(newpacket->data+curbyte, strlen(clientinfo->country));
-    curbyte += aimutil_putstr(newpacket->data+curbyte, clientinfo->country, strlen(clientinfo->country));
-  }
-  if (strlen(clientinfo->lang)) {
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x000f);
-    curbyte += aimutil_put16(newpacket->data+curbyte, strlen(clientinfo->lang));
-    curbyte += aimutil_putstr(newpacket->data+curbyte, clientinfo->lang, strlen(clientinfo->lang));
-  }
+  /* XXX is clientstring required by oscar? */
+  if (strlen(clientinfo->clientstring))
+    curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring);
+
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, clientinfo->major2);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, clientinfo->major);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, clientinfo->minor);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, clientinfo->minor2);
+  curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, clientinfo->build);
+
+  curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown);
 
+  if (strlen(clientinfo->country))
+    curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, strlen(clientinfo->country), clientinfo->country);
+  else
+    curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, 2, "us");
+
+  if (strlen(clientinfo->lang))
+    curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, strlen(clientinfo->lang), clientinfo->lang);
+  else
+    curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, 2, "en");
+  
+  newpacket->commandlen = curbyte;
 #endif
 
   newpacket->lock = 0;
@@ -440,11 +426,7 @@ unsigned long aim_sendredirect(struct aim_session_t *sess,
 
   tx->lock = 1;
 
-  i += aimutil_put16(tx->data+i, 0x0001);
-  i += aimutil_put16(tx->data+i, 0x0005);
-  i += aimutil_put16(tx->data+i, 0x0000);
-  i += aimutil_put16(tx->data+i, 0x0000);
-  i += aimutil_put16(tx->data+i, 0x0000);
+  i += aim_putsnac(tx->data+i, 0x0001, 0x0005, 0x0000, 0x00000000);
   
   aim_addtlvtochain16(&tlvlist, 0x000d, servid);
   aim_addtlvtochain_str(&tlvlist, 0x0005, ip, strlen(ip));
index 42d36027ecb00e30990ff0c74a87a9a9bd6056d3..1058b22ea90539a8cd93d15df3a5c4e5b83cb523 100644 (file)
--- a/aim_tlv.c
+++ b/aim_tlv.c
@@ -28,18 +28,30 @@ struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen)
          
          if ((pos+length) <= maxlen)
            {
-             cur = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
-             memset(cur, 0x00, sizeof(struct aim_tlvlist_t));
-
-             cur->tlv = aim_createtlv();       
-             cur->tlv->type = type;
-             cur->tlv->length = length;
-             cur->tlv->value = (u_char *)malloc(length*sizeof(u_char));
-             memcpy(cur->tlv->value, buf+pos, length);
-             
-             cur->next = list;
-             list = cur;
+             /*
+              * Okay, so now AOL has decided that any TLV of
+              * type 0x0013 can only be two bytes, despite
+              * what the actual given length is.  So here 
+              * we dump any invalid TLVs of that sort.  Hopefully
+              * theres no special cases to this special case.
+              *   - mid (30jun2000)
+              */
+             if ((type == 0x0013) && (length != 0x0002)) {
+               printf("faim: skipping TLV t(0013) with invalid length (0x%04x)\n", length);
+               length = 0x0002;
+             } else {
+               cur = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
+               memset(cur, 0x00, sizeof(struct aim_tlvlist_t));
+
+               cur->tlv = aim_createtlv();     
+               cur->tlv->type = type;
+               cur->tlv->length = length;
+               cur->tlv->value = (u_char *)malloc(length*sizeof(u_char));
+               memcpy(cur->tlv->value, buf+pos, length);
              
+               cur->next = list;
+               list = cur;
+             }
              pos += length;
            }
        }
index dce12e49b9d8895d2558bc8b8c3ba831c3a807a5..63b1a1d9c2d071f858e908b1623a45c04e42a2b5 100644 (file)
@@ -149,6 +149,9 @@ struct client_info_s {
   int build;
   char country[3];
   char lang[3];
+  int major2;
+  int minor2;
+  long unknown;
 };
 
 #ifndef TRUE
index fc00748c02233e4ac61de9f15d0db3c0c3b0a91e..7b3c07add566eb2a3bee3490392e7d2f83037b26 100644 (file)
@@ -84,13 +84,8 @@ int main(void)
   struct aim_conn_t *authconn = NULL, *waitingconn = NULL;
   int keepgoing = 1;
 
-#if 0
-  /* Use something like this for AIM */
-  struct client_info_s info = {"Boo", 2, 1, 0, "us", "en"};
-#else
-  /* or something exactly like this for ICQ and AIM */
-  struct client_info_s info = {"Random String (libfaim)", 4, 30, 3141, "us", "en"};
-#endif
+  struct client_info_s info = {"FAIMtest (Hi guys!)", 4, 3, 3141, "us", "en", 0x0004, 0x0001, 0x00000055};
+
   int selstat = 0;
 
   if ( !(screenname = getenv("SCREENNAME")) ||
This page took 0.051735 seconds and 5 git commands to generate.