changeset 446:6d78b988b479

[gaim-migrate @ 456] Can log into Oscar again. Thank god. I hate toc. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 30 Jun 2000 02:35:56 +0000
parents e4c34ca88d9b
children 5db3734a1fe6
files libfaim/CHANGES libfaim/CHANGES.gaim libfaim/aim_login.c libfaim/aim_rxhandlers.c libfaim/aim_tlv.c libfaim/faim/aim.h src/oscar.c
diffstat 7 files changed, 137 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Thu Jun 29 20:40:28 2000 +0000
+++ b/libfaim/CHANGES	Fri Jun 30 02:35:56 2000 +0000
@@ -1,6 +1,72 @@
 
 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
+      unless you're writing a server or something (or hacking aimdebugd).
+   - aim_send_im() now sends the same data as AIM4 does (three more bytes)
+   - Added aim_debugconn_sendconnect() for aimdebugd-enablement.
+
+ - Sat Jun 24 02:14:07 UTC 2000
+   - Added fakelocks for platforms without pthreads or that have no
+      use for them.
+   - Added workaround for MSG_WAITALL for people with the very broken
+      libc that comes with earlier Red Hat's.
+
+ - Sat Jun 24 00:44:24 UTC 2000
+   - Support zero-type TLVs in aim_extractinfo()
+     - AOL now ocassionally throws extra zeros in so in order to break
+         clients.  Aparently zero-type TLVs are a special case -- if the
+         type is zero, then _there is no length_ field.  AOL are geniuses.
+     - Note that you only get these if you send a bad client string, such
+         as the top one in faimtest.  If you #if 0 that one out and use the
+         second one, you'll be fine.  (Unless you just want to see the message
+         for yourself.  Its nifty. (FREE!))
+   - ICBM parser now uses aim_extractuserinfo() so that it can benefit
+       from the above changes, as well as clean up the whole "is it the 
+       first or the second one of this type?" issue
+     - This also fixes the changes AOL made in away messages.
+   = Fixed a possible buffer overflow when AOL changes the max sn length
+   - Increased MAXSNLEN to 32 (they appear to be valid)
+     - If you start getting messages from someone called "AOL Instant
+        Messenger", see comment one, paragraph two.
+   - aim_select() now returns a -1 if there are no connections open
+   - Connections are now killed completely if there is a major error on them
+   - faimtest now calls aim_logoff() on connection error
+
+ - Fri Jun 23 22:38:47 UTC 2000
+   - Adds start of adverts support
+   - Adds aim_bos_nop().  You may want to send this occassionally
+   - Fixes aim_rxhandlers.c to work for people with three-letter
+       screen names
+
+ - The week prior to Fri Jun 16 19:37:09 UTC 2000
+   - Rethought the rendezvous stuff.  DEFINIT WORK IN PROGRESS
+     - Do not bother trying to use this.  This will probably break
+         your clients.  You may or may not want to fix them, since 
+         I may change it again soon.  
+     - I REPEAT: This really is a developer-only version.  It barely
+         compiles.  I'm just committing it so I don't have so many
+         trees floating around.
+   - Added stuff to support OFT as well as OSCAR protocols
+   - Added aim_send_im_direct() for directim ("IM Image")
+   - Added caps getting/putting routines 
+   - Added more aim_login fixes to avoid more AOL stupidity
+     - This is the same as went to libfaim-devel yesterday, so don't upgrade
+       just to get these changes.
+   - Removed aimicq_encode_password -- now use the same table
+       for both ICQ and AIM
+   - Added AUTHORS
+
  - Tue Jun  6 01:36:48 UTC 2000
    - Inverted gethostbyname2() check.  Not sure how that ended up 
        in that state.
--- a/libfaim/CHANGES.gaim	Thu Jun 29 20:40:28 2000 +0000
+++ b/libfaim/CHANGES.gaim	Fri Jun 30 02:35:56 2000 +0000
@@ -1,3 +1,15 @@
+
+Fri Jun 30 02:29:40 UTC 2000 EWarmenhoven
+	- AOL is trying to prevent us from using Oscar. Fortunately, Adam's
+	  been able to figure out what's going on, and so we can sign on
+	  again.
+	- faimconfig.h used to only USEPTHREADS if we were using Linux, but
+	  now it fakes it otherwise (which is kinda stupid since other systems
+	  have pthreads too), but it should make everything still work fine,
+	  so that's back to what's in libfaim's CVS.
+	- Made those 'bleck' printf's that I had made faimdprintf's back to
+	  printf's, just because I don't like having things be very different
+	  from the main libfaim tree.
 
 Wed Jun 21 19:38:18 UTC 2000 EWarmenhoven
 	- Wow, long time since I've been here. Anyway, libfaim is now
--- a/libfaim/aim_login.c	Thu Jun 29 20:40:28 2000 +0000
+++ b/libfaim/aim_login.c	Fri Jun 30 02:35:56 2000 +0000
@@ -98,11 +98,9 @@
     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 @@
   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*/);
+  /* 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);
 
-  curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x00000055);
+  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->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));
-  }
-
+  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 @@
 
   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));
--- a/libfaim/aim_rxhandlers.c	Thu Jun 29 20:40:28 2000 +0000
+++ b/libfaim/aim_rxhandlers.c	Fri Jun 30 02:35:56 2000 +0000
@@ -5,9 +5,6 @@
  * with aim_rxdispatch(), the Rx dispatcher.  Queue/list management is
  * actually done in aim_rxqueue.c.
  *
- * Changes by EWarmenhoven, Wed May 24 09:33:38 UTC 2000:
- * - there were some "bleck" printf's i changed to faimdprintf's.
- *
  */
 
 #include <faim/aim.h>
@@ -177,9 +174,9 @@
   subtype= aimutil_get16(workingPtr->data+2);
 
   if((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL))
-    faimdprintf("bleck: null handler for %04x/%04x (%s)\n", family, subtype, literals[family][subtype+1]);
+    printf("bleck: null handler for %04x/%04x (%s)\n", family, subtype, literals[family][subtype+1]);
   else
-    faimdprintf("bleck: null handler for %04x/%04x (no literal)\n",family,subtype);
+    printf("bleck: null handler for %04x/%04x (no literal)\n",family,subtype);
 
   return 1;
 }
--- a/libfaim/aim_tlv.c	Thu Jun 29 20:40:28 2000 +0000
+++ b/libfaim/aim_tlv.c	Fri Jun 30 02:35:56 2000 +0000
@@ -28,18 +28,30 @@
 	  
 	  if ((pos+length) <= maxlen)
 	    {
-	      cur = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
-	      memset(cur, 0x00, sizeof(struct aim_tlvlist_t));
+	      /*
+	       * 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->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;
-	      
+		cur->next = list;
+		list = cur;
+	      }
 	      pos += length;
 	    }
 	}
--- a/libfaim/faim/aim.h	Thu Jun 29 20:40:28 2000 +0000
+++ b/libfaim/faim/aim.h	Fri Jun 30 02:35:56 2000 +0000
@@ -149,6 +149,9 @@
   int build;
   char country[3];
   char lang[3];
+  int major2;
+  int minor2;
+  long unknown;
 };
 
 #ifndef TRUE
--- a/src/oscar.c	Thu Jun 29 20:40:28 2000 +0000
+++ b/src/oscar.c	Fri Jun 30 02:35:56 2000 +0000
@@ -114,7 +114,7 @@
 int oscar_login(char *username, char *password) {
 	struct aim_session_t *sess;
 	struct aim_conn_t *conn;
-	struct client_info_s info = {"AOL Instant Messenger (TM), version 2.1.1187/WIN32", 4, 31, 3141, "us", "en"};
+	struct client_info_s info = {"AOL Instant Messenger (TM), version 2.1.1187/WIN32", 4, 31, 3141, "us", "en", 0x0004, 0x0001, 0x055};
 	struct aim_user *u;
 	char buf[256];