+static int getaimdata(unsigned char *buf, int buflen, unsigned long offset)
+{
+ FILE *f;
+
+ if (!(f = fopen(aimbinarypath, "r"))) {
+ dperror("memrequest: fopen");
+ return -1;
+ }
+
+ if (fseek(f, offset, SEEK_SET) == -1) {
+ dperror("memrequest: fseek");
+ fclose(f);
+ return -1;
+ }
+
+ if (fread(buf, buflen, 1, f) != 1) {
+ dperror("memrequest: fread");
+ fclose(f);
+ return -1;
+ }
+
+ fclose(f);
+
+ return buflen;
+}
+
+/*
+ * This will get an offset and a length. The client should read this
+ * data out of whatever AIM.EXE binary the user has provided (hopefully
+ * it matches the client information thats sent at login) and pass a
+ * buffer back to libfaim so it can hash the data and send it to AOL for
+ * inspection by the client police.
+ */
+static int faimtest_memrequest(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ unsigned long offset, len;
+ unsigned char *buf;
+
+ va_start(ap, command);
+ offset = va_arg(ap, unsigned long);
+ len = va_arg(ap, unsigned long);
+ va_end(ap);
+
+ if (!(buf = malloc(len))) {
+ dperror("memrequest: malloc");
+ return 0;
+ }
+
+ if (aimbinarypath && (getaimdata(buf, len, offset) == len)) {
+
+ dvprintf("memrequest: sending %ld bytes from 0x%08lx in %s...\n", len, offset, aimbinarypath);
+
+ aim_sendmemblock(sess, command->conn, offset, len, buf);
+
+ } else {
+
+ dprintf("memrequest: unable to use AIM binary, sending defaults...\n");
+
+ aim_sendmemblock(sess, command->conn, offset, len, NULL);
+
+ }
+
+ free(buf);
+
+ return 1;
+}
+
+static int faimtest_parse_authresp(struct aim_session_t *sess, struct command_rx_struct *command, ...)