pike.git / lib / modules / Sql.pmod / tds.pike

version» Context lines:

pike.git/lib/modules/Sql.pmod/tds.pike:1:   /* -  * $Id: tds.pike,v 1.1 2006/02/09 17:18:30 grubba Exp $ +  * $Id: tds.pike,v 1.2 2006/02/10 09:54:33 grubba Exp $    *    * A Pike implementation of the TDS protocol.    *    * Henrik Grubbström 2006-02-08.    */      #define TDS_DEBUG      #ifdef TDS_DEBUG   #define TDS_WERROR(X...) werror("TDS:" + X)
pike.git/lib/modules/Sql.pmod/tds.pike:26:    array(array(int)) halves = (array(array(int)))((line + ("\0"*16))/8);    lines[i] = sprintf("%04x:%{ %02x%}:%{%02x %} %s:%s\n",    off, halves[0], halves[1],    (string)map(halves[0], filter_noprint),    (string)map(halves[1], filter_noprint));    off += 16;    }    return lines * "";   }    + #if (__REAL_MAJOR__ > 7) || ((__REAL_MAJOR__ == 7) && (__REAL_MINOR__ >= 6)) + // Static blocks affect nested classes in Pike 7.4. + // We don't want that...   static { -  + #endif /* Pike 7.6 or later */    constant DEF_MAJOR = 8;    constant DEF_MINOR = 0;    constant DEF_PORT = 1433;    constant DEF_DOMAIN = "";    constant DEFAULT_CAPABILITIES =    "\x01\x09\x00\x00\x06\x6d\x7f\xff"    "\xff\xff\xfe\x02\x09\x00\x00\x00"    "\x00\x0a\x68\x00\x00\x00";    constant TDS8VERSION = "\x01\x00\x00\x71";    constant CLIENTVERSION = "\x06\x83\xf2\xf8";
pike.git/lib/modules/Sql.pmod/tds.pike:479:    p->put_string("");    }    p->put_string("");       TDS_WERROR("Sending login packet.\n");    send_packet(p, 0x10, 1);    }       string ecb_encrypt(string data, string key)    { + #if constant(Crypto.DES)    Crypto.DES des = Crypto.DES();    des->set_encrypt_key(des->fix_parity(key)); -  + #else +  Crypto.des des = Crypto.des(); +  des->set_encrypt_key(Crypto.des_parity(key)); + #endif    return des->crypt(data);    }       string encrypt_answer(string hash, string nonce)    {    return ecb_encrypt(nonce, hash[..6]) +    ecb_encrypt(nonce, hash[7..13]) +    ecb_encrypt(nonce, hash[14..]);    }   
pike.git/lib/modules/Sql.pmod/tds.pike:506:    passwd = upper_case((passwd + "\0"*14)[..13]);    string hash =    ecb_encrypt(magic, passwd[..6]) +    ecb_encrypt(magic, passwd[7..]);    return encrypt_answer(hash, nonce);    }       string answer_nt_challenge(string passwd, string nonce)    {    string nt_passwd = string_to_utf16(passwd); + #if constant(Crypto.MD4)    Crypto.MD4 md4 = Crypto.MD4(); -  + #else +  Crypto.md4 md4 = Crypto.md4(); + #endif    md4->update(nt_passwd);    return encrypt_answer(md4->digest() + "\0"*16, nonce);    }       static void send_auth(string nonce)    {    int out_flag = 0x11;    Packet p = Packet();    p->put_raw("NTLMSSP\0", 8);    p->put_int(3); /* sequence 3 */
pike.git/lib/modules/Sql.pmod/tds.pike:888:    }    }    TDS_WERROR("==> TDS_ROWFMT_RESULT\n");    return TDS_ROWFMT_RESULT;    case TDS_ROW_TOKEN:    TDS_WERROR("==> TDS_ROW_RESULT\n");    return TDS_ROW_RESULT;    default:    get_byte();    TDS_WERROR("==> FIXME: process_result_tokens\n"); +  process_default_tokens(token_type);    return 0; /***** FIXME:::::: *****/    break;    }    }    }       static string|int get_data(mapping(string:mixed) info, int col)    {    TDS_WERROR("get_data for column %d info:%O\n", col, info);    mapping blobinfo;
pike.git/lib/modules/Sql.pmod/tds.pike:1271:    default:    TDS_WERROR("res_type: %d\n", res_type);    break;    }    }    // populate_ird    switch(res_type) {    //case TDS_NO_MORE_RESULTS:    }    } + #if (__REAL_MAJOR__ > 7) || ((__REAL_MAJOR__ == 7) && (__REAL_MINOR__ >= 6))   }; -  + #endif /* Pike 7.6 or later */      class compile_query   {    int n_param;    array(string) splitted_query;       array(mixed) params;       void parse_prepared_query()    {   Newline at end of file added.