lib/auth.js
function parseAuth(xdr) {
    assert.object(xdr, 'xdr');

    var msg = {};
    var type = xdr.readInt();
    var len = xdr.readInt();

    switch (type) {
    case 0: // null auth
        msg.type = 'null';
        // length is normally 0 for null auth, but that's not required
        xdr.xdr_offset += len;
        break;

    case 1: // unix
        msg.type = 'unix';
        msg.stamp = xdr.readInt();
        msg.machinename = xdr.readString();
        msg.uid = xdr.readInt();
        msg.gid = xdr.readInt();
        msg.gids = xdr.readIntArray();
        break;

    case 2: // TODO
    case 3: // TODO
    default:
        throw new Error('invalid auth type: ' + type);
    }

    return (msg);
}
function parseAuth(xdr) {
    assert.object(xdr, 'xdr');

    var msg = {};
    var type = xdr.readInt();
    var len = xdr.readInt();

    switch (type) {
    case 0: // null auth
        msg.type = 'null';
        // length is normally 0 for null auth, but that's not required
        xdr.xdr_offset += len;
        break;

    case 1: // unix
        msg.type = 'unix';
        msg.stamp = xdr.readInt();
        msg.machinename = xdr.readString();
        msg.uid = xdr.readInt();
        msg.gid = xdr.readInt();
        msg.gids = xdr.readIntArray();
        break;

    case 2: // TODO
    case 3: // TODO
    default:
        throw new Error('invalid auth type: ' + type);
    }

    return (msg);
}
function parseAuth ( xdr ) { assert . object ( xdr , 'xdr' ) ; var msg = { } ; var type = xdr . readInt ( ) ; var len = xdr . readInt ( ) ; switch ( type ) { case 0 : // null auth msg . type = 'null' ; // length is normally 0 for null auth, but that's not required xdr . xdr_offset += len ; break ; case 1 : // unix msg . type = 'unix' ; msg . stamp = xdr . readInt ( ) ; msg . machinename = xdr . readString ( ) ; msg . uid = xdr . readInt ( ) ; msg . gid = xdr . readInt ( ) ; msg . gids = xdr . readIntArray ( ) ; break ; case 2 : // TODO case 3 : // TODO default : throw new Error ( 'invalid auth type: ' + type ) ; } return ( msg ) ; }
/--- API
/ --- API