fix: pkg upgrades and small fixes

This commit is contained in:
simon
2021-05-28 12:33:26 +02:00
parent 4af6eded3d
commit 5290ac37c0
5 changed files with 2407 additions and 4538 deletions

View File

@@ -29,7 +29,9 @@ const { argv } = yargs
.alias('s', 'secret')
.describe('secret', 'RADIUS secret')
.number('port')
.string(['secret', 'authentication']);
.string(['secret', 'authentication']) as {
argv: { port?: number; secret?: string; authentication?: string; authenticationOptions?: any };
};
console.log(`Listener Port: ${argv.port || 1812}`);
console.log(`RADIUS Secret: ${argv.secret}`);

View File

@@ -49,7 +49,7 @@ export class SMTPAuth implements IAuthentication {
tlsOptions: {
servername: this.host, // SNI (needs to be set for gmail)
},
});
} as any); // secure is currently not part of type def..but it is available: https://www.npmjs.com/package/smtp-client
let success = false;
try {

View File

@@ -14,7 +14,12 @@ export class UserPasswordPacketHandler implements IPacketHandler {
async handlePacket(packet: IPacket): Promise<IPacketHandlerResult> {
const username = packet.attributes['User-Name'];
const password = packet.attributes['User-Password'];
let password = packet.attributes['User-Password'];
if (typeof password !== 'string' && password.indexOf(0x00) > 0) {
// check if there is a 0x00 in it, and trim it from there
password = password.slice(0, password.indexOf(0x00));
}
if (!username || !password) {
// params missing, this handler cannot continue...