This file is indexed.

/usr/lib/nodejs/node-xmpp/xmpp/component.js is in libnode-node-xmpp 0.2.7-1.

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
var Connection = require('./connection');
var JID = require('./jid').JID;
var ltx = require('ltx');
var sys = require('sys');
var crypto = require('crypto');
var SRV = require('./srv');

var NS_COMPONENT = 'jabber:component:accept';

/**
 * params:
 *   jid: String (required)
 *   password: String (required)
 *   host: String (required)
 *   port: Number (required)
 */
function Component(params) {
    var self = this;
    Connection.Connection.call(this);

    if (typeof params.jid == 'string')
        this.jid = new JID(params.jid);
    else
        this.jid = params.jid;
    this.password = params.password;
    this.xmlns[''] = NS_COMPONENT;
    this.streamTo = this.jid.domain;

    this.addListener('streamStart', function(streamAttrs) {
        self.onStreamStart(streamAttrs);
    });
    this.addListener('rawStanza', function(stanza) {
        self.onRawStanza(stanza);
    });
    var attempt = SRV.connect(this.socket, [], params.host, params.port);
    attempt.addListener('connect', function() {
        self.startParser();
        self.startStream();
    });
    attempt.addListener('error', function(e) {
        self.emit('error', e);
    });
}

sys.inherits(Component, Connection.Connection);
exports.Component = Component;

Component.prototype.onStreamStart = function(streamAttrs) {
    var digest = sha1_hex(streamAttrs.id + this.password);
    this.send(new ltx.Element('handshake').t(digest));
};

Component.prototype.onRawStanza = function(stanza) {
    if (stanza.is('handshake', NS_COMPONENT)) {
        this.emit('online');
    } else {
        this.emit('stanza', stanza);
    }
};

function sha1_hex(s) {
    var hash = crypto.createHash('sha1');
    hash.update(s);
    return hash.digest('hex');
}