This file is indexed.

/usr/include/msn/util.h is in libmsn-dev 4.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#ifndef __msn_util_h__
#define __msn_util_h__

/*
 * util.h
 * libmsn
 *
 * Created by Mark Rowe on Mon Mar 22 2004.
 * Refactored by Tiago Salem Herrmann on 08/2007.
 * Copyright (c) 2004 Mark Rowe. All rights reserved.
 * Copyright (c) 2007 Tiago Salem Herrmann. All rights reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/des.h>

#include <string>
#include <sstream>
#include <map>
#include <vector>
#include <stdexcept>
#include <string>

#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif

// this is for CHL command
#define szClientID "PROD0114ES4Z%Q5W"
#define szClientCode "PK}_A_0N_K%O?A9S"

#ifndef U8
#define U8 unsigned char
#endif
#ifndef U16
#define U16 unsigned short
#endif
#ifndef U32
#define U32 unsigned int
#endif
#define FB_UNI 0xFFFd

// for libsiren
#define RIFF_ID 0x46464952
#define WAVE_ID 0x45564157
#define FMT_ID 0x20746d66
#define DATA_ID 0x61746164
#define FACT_ID 0x74636166

typedef struct
{
    unsigned int chunk_id;
    unsigned int chunk_size;
} wav_data;

typedef struct
{
    unsigned int chunk_id;
    unsigned int chunk_size;
    unsigned int type_id;
} riff_data;

typedef struct
{
    unsigned short format;
    unsigned short channels;
    unsigned int sample_rate;
    unsigned int byte_rate;
    unsigned short block_align;
    unsigned short bits_per_sample;
} fmt_chunk;

typedef struct
{
    fmt_chunk fmt;
    unsigned short extra_size;
    unsigned char *extra_content;
} fmt_chunk_ex;

#define IDX(val, i) ((unsigned int) ((unsigned char *) &val)[i])

#define GUINT16_FROM_LE(val) ((unsigned short) (IDX (val, 0) + (unsigned short) IDX (val, 1) * 256))
#define GUINT32_FROM_LE(val) ((unsigned int) (IDX (val, 0) + IDX (val, 1) * 256 + \
                                              IDX (val, 2) * 65536 + IDX (val, 3) * 16777216))

namespace MSN 
{
    /** URL-encode a string
     *
     * @param  s  The string to encode.
     * @return    A string with all non-alphanumeric characters replaced by their
     *            URL-encoded equivalent.
     */
    std::string encodeURL(const std::string & s);
    
    /** URL-decode a string
     *
     * @param  s  The URL-encoded string to decode.
     * @return    A string with all URL-encoded sequences replaced by their
     *            @c ASCII equivalent.
     */
    std::string decodeURL(const std::string & s);
    
    /** Split a string containing a hostname and port number into its respective parts.
     *
     * @param  address       A string in the form "hostname:port".
     * @param  default_port  A port number to return in the event that ":port" is omitted from @a address.
     * @return               A pair containing the hostname and port number.
     */
    std::pair<std::string, int> splitServerAddress(const std::string & address, int default_port=1863);
    
    /** Compare two strings in a case insensitive fashion
     */
    int nocase_cmp(const std::string & s1, const std::string & s2);
    
    /** Split @a string at each occurence of @a separator.
     */
    std::vector<std::string> splitString(const std::string & string, const std::string & separator, bool suppressBlanks=true);
    
    std::string toStr(int var);
    std::string unsignedToStr(unsigned int var);
    /** Convert a string, @a s, that contains decimal digits into an unsigned int.
     */
    unsigned int decimalFromString(const std::string & s) throw (std::logic_error);

    U32 _ucs2_utf8(U8 *dst, U8 *src, U32 nchar);
    U32 _utf8_ucs2(U8 *dst, U8 *src);

    /** represents a contact pesonal message */
    struct personalInfo
    {
        std::string PSM; /**< personal status message */
        std::string mediaApp; /**< iTunes, Winamp or keep it empty */
        std::string mediaType; /**<  'Music', 'Games' or 'Office' */
        bool mediaIsEnabled; /**<  enable/disable the Current Media setting */
        std::string mediaFormat; /**< for example, "{0} - {1}" */
        std::vector<std::string> mediaLines; /**<  index 0 will be {0}, etc.. */

        personalInfo() {
            mediaIsEnabled = false;
        }
    };

    struct hotmailInfo
    {
        std::string rru;
        std::string url;
        std::string id;
        std::string sl;
        std::string kv;
        std::string sid;
        std::string MSPAuth;
        std::string creds;
    };

    /** Represents the lists present on server side */
    typedef enum
    {
        LST_AB = 1,        /**< Address book */
        LST_AL = 2,        /**< Allow */
        LST_BL = 4,        /**< Block */
        LST_RL = 8,        /**< Reverse */
        LST_PL = 16        /**< Pending */
    }ContactList;
 
    struct tagMSGRUSRKEY
    {
         unsigned int uStructHeaderSize; // 28. Does not count data
         unsigned int uCryptMode; // CRYPT_MODE_CBC (1)
         unsigned int uCipherType; // TripleDES (0x6603)
         unsigned int uHashType; // SHA1 (0x8004)
         unsigned int uIVLen;    // 8
         unsigned int uHashLen;  // 20
         unsigned int uCipherLen; // 72
         // Data
         unsigned char aIVBytes[8];
         unsigned char aHashBytes[20];
         unsigned char aCipherBytes[72];
    };

    /** represents an offline message */
    typedef struct 
    {
         std::string from; /**< sender passport */
         std::string fromFN; /**< sender nickname */
         std::string id; /**< ID of this offline message */
    } eachOIM;

    std::string new_branch();
    std::string generate_soap_auth(std::string user, std::string pass, std::string ticket);
    std::string mdi_encrypt(std::string key, std::string nonce);
    std::string b64_decode(const char *input);
    std::string b64_encode(const char *input, int size);

    unsigned int little2big_endian(unsigned int i);
    int FileSize(const char* sFileName);
    void DoMSNP11Challenge(const char *szChallenge, char *szOutput);

    // stolen from kopete
    /** List of possible capabilities for a contact */
    typedef enum
    {
        WindowsMobile = 0x1,
        InkGifSupport = 0x4,
        InkIsfSupport = 0x8,
        SupportWebcam = 0x10,
        SupportMultiPacketMessaging = 0x20,
        MSNMobileDevice = 0x40,
        MSNDirectDevice = 0x80,
        WebMessenger = 0x100,
        OtherSideWebMessenger = 0x200,
        InternalMicrosoftClient = 0x800, //Internal Microsoft client and/or Microsoft Office Live client.
        MSNSpace = 0x1000,
        WinXPMediaCenter = 0x2000, // This means you are using Windows XP Media Center Edition.
        SupportDirectIM =  0x4000,
        SupportWinks = 0x8000,
        MSNSearch = 0x10000,
        VoiceClips = 0x40000,
        SecureChannel = 0x80000,
        SIPInvitations = 0x100000,
        SharingFolders = 0x400000,
        MSNC1 = 0x10000000,
        MSNC2 = 0x20000000,
        MSNC3 = 0x30000000,
        MSNC4 = 0x40000000,
        MSNC5 = 0x50000000,
        MSNC6 = 0x60000000,
        MSNC7 = 0x70000000
    } MSNClientInformationFields;

    /** Defines the file transfer type */
    enum fileTransferType
    {
        FILE_TRANSFER_WITH_PREVIEW = 0x0, /**< With preview */
        FILE_TRANSFER_WITHOUT_PREVIEW = 0x1, /**< Without preview */
        FILE_TRANSFER_BACKGROUND_SHARING = 0x4, /**< Transfer of a sharing background */
        // it is not a simple jpg file, there is a cab file inside it
        FILE_TRANSFER_BACKGROUND_SHARING_CUSTOM = 0xC /**< Custom and not supported by libmsn yet */ 
    };

    /** Type of the error when a file transfer fails */
    enum fileTransferError
    {
        FILE_TRANSFER_ERROR_USER_CANCELED, /**< The other user canceled */
        FILE_TRANSFER_ERROR_UNKNOWN /**< Unknown error */
    };

    /** Represents a file transfer request */
    typedef struct 
    {
        int type;                 /**< 0 = no preview, 1 = has preview, 4 = background sharing */
        unsigned int sessionId;   /**< Id of this session */
        std::string userPassport; /**< passport of the origin or the destination */
        std::string filename;     /**< name the file to receive, or the path of the file to send */
        std::string friendlyname; /**< suggested name <- required when sending a file */
        std::string preview;      /**< base64 encoded 96x96 png file, if applicable */
        unsigned long long filesize; /**< size of the file to send or receive */
    } fileTransferInvite;
    
    void libmsn_Siren7_DecodeVoiceClip(std::string input_file);
    void libmsn_Siren7_EncodeVoiceClip(std::string input_file);
}
#endif