changeset 1839:109cacf1ff97

[gaim-migrate @ 1849] now we don't require a hash server anymore. but it still has the ability to use one. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 11 May 2001 21:54:27 +0000
parents bee2239f5952
children 00aef397a1fe
files libfaim/CHANGES libfaim/admin.c libfaim/aim.h libfaim/aim_internal.h libfaim/auth.c libfaim/bos.c libfaim/buddylist.c libfaim/chat.c libfaim/chatnav.c libfaim/conn.c libfaim/ft.c libfaim/im.c libfaim/info.c libfaim/login.c libfaim/misc.c libfaim/rxhandlers.c libfaim/search.c libfaim/stats.c src/oscar.c
diffstat 19 files changed, 91 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/CHANGES	Fri May 11 21:54:27 2001 +0000
@@ -1,6 +1,21 @@
 
 No release numbers
 ------------------
+ - Thu May 10 17:37:23 PDT 2001
+  - I haven't had lunch yet.  What should I have?
+
+ - Wed May  9 15:21:51 PDT 2001
+  - I had pizza for lunch.
+
+ - Mon May  7 15:19:55 PDT 2001
+  - Rename rxhandler_t to aim_rxhandler_t.  This has been 
+     bugging me for a while.
+
+ - Thu May  3 15:47:23 PDT 2001
+  - Clean up getcap/putcaps
+  - Add GAMES2 and SENDBUDDYLIST caps (the latter is new in winaim 4.7beta)
+  - Update hash to latest value
+
  - Wed Apr 25 11:51:39 PDT 2001
   - I think this was a bug.
 
--- a/libfaim/admin.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/admin.c	Fri May 11 21:54:27 2001 +0000
@@ -24,7 +24,7 @@
     i += 2;
 
     while (tlvcount) {
-      rxcallback_t userfunc;
+      aim_rxcallback_t userfunc;
       struct aim_tlv_t *tlv;
       int str = 0;
 
@@ -58,7 +58,7 @@
 
 static int accountconfirm(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int status;
 
   status = aimutil_get16(data);
--- a/libfaim/aim.h	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/aim.h	Fri May 11 21:54:27 2001 +0000
@@ -474,7 +474,7 @@
 faim_export void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn);
 #endif /* ndef FAIM_INTERNAL */
 
-typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...);
+typedef int (*aim_rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...);
 
 /* aim_login.c */
 faim_export int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn);
@@ -498,14 +498,14 @@
 struct aim_rxcblist_t {
   u_short family;
   u_short type;
-  rxcallback_t handler;
+  aim_rxcallback_t handler;
   u_short flags;
   struct aim_rxcblist_t *next;
 };
 
 faim_export int aim_conn_setlatency(struct aim_conn_t *conn, int newval);
 
-faim_export int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, rxcallback_t newhandler, u_short flags);
+faim_export int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags);
 faim_export int aim_clearhandlers(struct aim_conn_t *conn);
 
 faim_export void aim_conn_close(struct aim_conn_t *deadconn);
--- a/libfaim/aim_internal.h	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/aim_internal.h	Fri May 11 21:54:27 2001 +0000
@@ -60,7 +60,7 @@
 faim_internal int aim_tx_printqueue(struct aim_session_t *);
 faim_internal int aim_tx_cleanqueue(struct aim_session_t *, struct aim_conn_t *);
 
-faim_internal rxcallback_t aim_callhandler(struct aim_session_t *sess, struct aim_conn_t *conn, u_short family, u_short type);
+faim_internal aim_rxcallback_t aim_callhandler(struct aim_session_t *sess, struct aim_conn_t *conn, u_short family, u_short type);
 
 /*
  * Generic SNAC structure.  Rarely if ever used.
--- a/libfaim/auth.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/auth.c	Fri May 11 21:54:27 2001 +0000
@@ -43,7 +43,7 @@
 {
   struct aim_tlvlist_t *tlvlist;
   int ret = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL;
   unsigned char *cookie = NULL;
   int errorcode = 0, regstatus = 0;
@@ -184,7 +184,7 @@
   unsigned char *key;
   int keylen;
   int ret = 1;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
 
   keylen = aimutil_get16(data);
   if (!(key = malloc(keylen+1)))
--- a/libfaim/bos.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/bos.c	Fri May 11 21:54:27 2001 +0000
@@ -21,7 +21,7 @@
 
 static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int ret = 0;
   struct aim_tlvlist_t *tlvlist;
   unsigned short maxpermits = 0, maxdenies = 0;
--- a/libfaim/buddylist.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/buddylist.c	Fri May 11 21:54:27 2001 +0000
@@ -14,7 +14,7 @@
 static int buddychange(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   struct aim_userinfo_s userinfo;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
 
   aim_extractuserinfo(sess, data, &userinfo);
 
@@ -26,7 +26,7 @@
 
 static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_tlvlist_t *tlvlist;
   unsigned short maxbuddies = 0, maxwatchers = 0;
   int ret = 0;
--- a/libfaim/chat.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/chat.c	Fri May 11 21:54:27 2001 +0000
@@ -402,7 +402,7 @@
 static int infoupdate(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   struct aim_userinfo_s *userinfo = NULL;
-  rxcallback_t userfunc=NULL;	
+  aim_rxcallback_t userfunc=NULL;	
   int ret = 0, i = 0;
   int usercount = 0;
   unsigned char detaillevel = 0;
@@ -530,7 +530,7 @@
 static int userlistchange(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   struct aim_userinfo_s *userinfo = NULL;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int i = 0, curcount = 0, ret = 0;
 
   while (i < datalen) {
@@ -573,7 +573,7 @@
 static int incomingmsg(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   struct aim_userinfo_s userinfo;
-  rxcallback_t userfunc=NULL;	
+  aim_rxcallback_t userfunc=NULL;	
   int ret = 0, i = 0;
   unsigned char cookie[8];
   int channel;
--- a/libfaim/chatnav.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/chatnav.c	Fri May 11 21:54:27 2001 +0000
@@ -94,7 +94,7 @@
 
 static int parseinfo_perms(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen, struct aim_snac_t *snac2)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int ret = 0;
   struct aim_tlvlist_t *tlvlist;
   struct aim_chat_exchangeinfo *exchanges = NULL;
@@ -258,7 +258,7 @@
 
 static int parseinfo_create(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen, struct aim_snac_t *snac2)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_tlvlist_t *tlvlist, *innerlist;
   char *ck = NULL, *fqcn = NULL, *name = NULL;
   unsigned short exchange = 0, instance = 0, unknown = 0, flags = 0, maxmsglen = 0, maxoccupancy = 0;
--- a/libfaim/conn.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/conn.c	Fri May 11 21:54:27 2001 +0000
@@ -848,7 +848,7 @@
   fd_set fds, wfds;
   struct timeval tv;
   int res, error = ETIMEDOUT;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
 
   if (!conn || (conn->fd == -1))
     return -1;
--- a/libfaim/ft.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/ft.c	Fri May 11 21:54:27 2001 +0000
@@ -37,7 +37,7 @@
 faim_export int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur)
 { 
   int acceptfd = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct sockaddr cliaddr;
   int clilen = sizeof(cliaddr);
   int ret = 0;
@@ -824,7 +824,7 @@
   unsigned char *hdr = NULL;
   int hdrlen, hdrtype;
   int flags = 0;
-  rxcallback_t userfunc = NULL;
+  aim_rxcallback_t userfunc = NULL;
   
   if (!sess || !conn || !conn->priv)
     return -1;
--- a/libfaim/im.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/im.c	Fri May 11 21:54:27 2001 +0000
@@ -188,7 +188,7 @@
 static int outgoingim(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   unsigned int i, ret = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   unsigned char cookie[8];
   int channel;
   struct aim_tlvlist_t *tlvlist;
@@ -252,7 +252,7 @@
 
 static int incomingim_ch1(struct aim_session_t *sess, aim_module_t *mod,  struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned short channel, struct aim_userinfo_s *userinfo, struct aim_tlvlist_t *tlvlist, unsigned char *cookie)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int i, j = 0, y = 0, z = 0, ret = 0;
   char *msg = NULL;
   unsigned long icbmflags = 0;
@@ -353,7 +353,7 @@
 
 static int incomingim_ch2(struct aim_session_t *sess, aim_module_t *mod,  struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned short channel, struct aim_userinfo_s *userinfo, struct aim_tlvlist_t *tlvlist, unsigned char *cookie)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_tlv_t *block1;
   struct aim_tlvlist_t *list2;
   unsigned short reqclass = 0;
@@ -804,7 +804,7 @@
 {
   unsigned long defflags, minmsginterval;
   unsigned short maxicbmlen, maxsenderwarn, maxrecverwarn, maxchannel;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int i = 0;
 
   maxchannel = aimutil_get16(data+i);
@@ -834,7 +834,7 @@
 static int missedcall(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   int i = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   unsigned short channel, nummissed, reason;
   struct aim_userinfo_s userinfo;
  
@@ -868,7 +868,7 @@
 
 static int msgack(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   char sn[MAXSNLEN];
   unsigned char ck[8];
   unsigned short type;
--- a/libfaim/info.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/info.c	Fri May 11 21:54:27 2001 +0000
@@ -542,7 +542,7 @@
 static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   struct aim_tlvlist_t *tlvlist;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int ret = 0;
 
   tlvlist = aim_readtlvchain(data, datalen);
@@ -561,7 +561,7 @@
   char *text_encoding = NULL;
   char *text = NULL;
   int i = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_tlvlist_t *tlvlist;
   struct aim_snac_t *origsnac = NULL;
   struct aim_priv_inforeq *inforeq;
--- a/libfaim/login.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/login.c	Fri May 11 21:54:27 2001 +0000
@@ -430,7 +430,7 @@
 
 static int hostonline(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int ret = 0;
   unsigned short *families;
   int famcount, i;
@@ -456,7 +456,7 @@
   int serviceid;
   unsigned char *cookie;
   char *ip;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_tlvlist_t *tlvlist;
   char *chathack = NULL;
   int chathackex = 0;
@@ -551,7 +551,7 @@
 /* XXX parse this */
 static int rateresp(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
 
   if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
     return userfunc(sess, rx);
@@ -561,7 +561,7 @@
 
 static int ratechange(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int i = 0, code;
   unsigned long currentavg, maxavg;
   unsigned long rateclass, windowsize, clear, alert, limit, disconnect;
@@ -596,7 +596,7 @@
 /* XXX parse this */
 static int selfinfo(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
 
   if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
     return userfunc(sess, rx);
@@ -606,7 +606,7 @@
 
 static int evilnotify(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc = NULL;
+  aim_rxcallback_t userfunc = NULL;
   int i = 0;
   unsigned short newevil;
   struct aim_userinfo_s userinfo;
@@ -627,7 +627,7 @@
 
 static int motd(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   char *msg = NULL;
   int ret = 0;
   struct aim_tlvlist_t *tlvlist;
@@ -663,7 +663,7 @@
 
 static int hostversions(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   int vercount;
 
   vercount = datalen/4;
@@ -713,7 +713,7 @@
  */
 static int memrequest(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   unsigned long offset, len;
   int i = 0;
   struct aim_tlvlist_t *list;
@@ -813,19 +813,17 @@
       faimdprintf(sess, 0, "sendmemblock: WARNING: sending bad hash... you will be disconnected soon...\n");
 
     /* 
-     * This data is correct for AIM 3.5.1670, offset 0x1000, length 0 
+     * This data is correct for AIM 3.5.1670, offset 0x03ffffff, 
+     * length 0x03ffffff (invalid).
      *
      * Using this block is as close to "legal" as you can get without
      * using an AIM binary.
      *
-     * For the moment, this is the MD5 hash of nothing.  Yes, that's
-     * right.  Nothing.  AOL is smart.
-     *
      */
-    i += aimutil_put32(tx->data+i, 0xd41d8cd9);
-    i += aimutil_put32(tx->data+i, 0x8f00b204);
-    i += aimutil_put32(tx->data+i, 0xe9800998);
-    i += aimutil_put32(tx->data+i, 0xecf8427e);
+    i += aimutil_put32(tx->data+i, 0x1df8cbae);
+    i += aimutil_put32(tx->data+i, 0x5523b839);
+    i += aimutil_put32(tx->data+i, 0xa0e10db3);
+    i += aimutil_put32(tx->data+i, 0xa46d3b39);
 
   }
 
--- a/libfaim/misc.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/misc.c	Fri May 11 21:54:27 2001 +0000
@@ -830,7 +830,7 @@
 {
   int ret = 0;
   int error = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_snac_t *snac2;
 
   snac2 = aim_remsnac(sess, snac->id);
@@ -854,7 +854,7 @@
   if (snac->subtype == 0x0001)
     return generror(sess, mod, rx, snac, data, datalen);
   else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) {
-    rxcallback_t userfunc;
+    aim_rxcallback_t userfunc;
 
     if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
       return userfunc(sess, rx);
--- a/libfaim/rxhandlers.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/rxhandlers.c	Fri May 11 21:54:27 2001 +0000
@@ -295,11 +295,11 @@
 }
 
 faim_export int aim_conn_addhandler(struct aim_session_t *sess,
-			struct aim_conn_t *conn,
-			u_short family,
-			u_short type,
-			rxcallback_t newhandler,
-			u_short flags)
+				    struct aim_conn_t *conn,
+				    u_short family,
+				    u_short type,
+				    aim_rxcallback_t newhandler,
+				    u_short flags)
 {
   struct aim_rxcblist_t *newcb;
 
@@ -353,10 +353,10 @@
  return 0;
 }
 
-faim_internal rxcallback_t aim_callhandler(struct aim_session_t *sess,
-					   struct aim_conn_t *conn,
-					   unsigned short family,
-					   unsigned short type)
+faim_internal aim_rxcallback_t aim_callhandler(struct aim_session_t *sess,
+					       struct aim_conn_t *conn,
+					       unsigned short family,
+					       unsigned short type)
 {
   struct aim_rxcblist_t *cur;
 
@@ -386,7 +386,7 @@
 					  u_short type,
 					  struct command_rx_struct *ptr)
 {
-  rxcallback_t userfunc = NULL;
+  aim_rxcallback_t userfunc = NULL;
   userfunc = aim_callhandler(sess, conn, family, type);
   if (userfunc)
     return userfunc(sess, ptr);
@@ -541,7 +541,7 @@
   struct aim_tlvlist_t *tlvlist;
   char *msg = NULL;
   unsigned short code = 0;
-  rxcallback_t userfunc = NULL;
+  aim_rxcallback_t userfunc = NULL;
   int ret = 1;
 
   /* Used only by the older login protocol */
--- a/libfaim/search.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/search.c	Fri May 11 21:54:27 2001 +0000
@@ -38,7 +38,7 @@
 static int error(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   int ret = 0;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_snac_t *snac2;
 
   /* XXX the modules interface should have already retrieved this for us */
@@ -65,7 +65,7 @@
   unsigned int j, m, ret = 0;
   struct aim_tlvlist_t *tlvlist;
   char *cur = NULL, *buf = NULL;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
   struct aim_snac_t *snac2;
 
   if (!(snac2 = aim_remsnac(sess, snac->id))) {
--- a/libfaim/stats.c	Fri May 11 08:20:00 2001 +0000
+++ b/libfaim/stats.c	Fri May 11 21:54:27 2001 +0000
@@ -5,7 +5,7 @@
 static int reportinterval(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
 {
   unsigned short interval;
-  rxcallback_t userfunc;
+  aim_rxcallback_t userfunc;
 
   interval = aimutil_get16(data);
 
--- a/src/oscar.c	Fri May 11 08:20:00 2001 +0000
+++ b/src/oscar.c	Fri May 11 21:54:27 2001 +0000
@@ -681,6 +681,9 @@
 	g_free(pos);
 }
 
+/* size of icbmui.ocm, the largest module in AIM 3.5 */
+#define AIM_MAX_FILE_SIZE 98304
+
 int gaim_memrequest(struct aim_session_t *sess,
 		    struct command_rx_struct *command, ...) {
 	va_list ap;
@@ -695,10 +698,25 @@
 	va_end(ap);
 
 	if (len == 0) {
+		debug_printf("len is 0, hashing NULL\n");
 		aim_sendmemblock(sess, command->conn, offset, len, NULL,
 				AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
 		return 1;
 	}
+	if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
+		char buf[8];
+		buf[0] = offset & 0xff;
+		buf[1] = (offset >> 8) & 0xff;
+		buf[2] = (offset >> 16) & 0xff;
+		buf[3] = (offset >> 24) & 0xff;
+		buf[4] = len & 0xff;
+		buf[5] = (len >> 8) & 0xff;
+		buf[6] = (len >> 16) & 0xff;
+		buf[7] = (len >> 24) & 0xff;
+		debug_printf("len + offset is invalid, hashing request\n");
+		aim_sendmemblock(sess, command->conn, offset, 8, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
+		return 1;
+	}
 
 	pos = g_new0(struct pieceofcrap, 1);
 	pos->gc = sess->aux_data;