Commit 3bc02e6b authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! TB 40933: Add tor-launcher functionality

TB 44991: Improve the no-authentication handling on the control port.
parent 245609f0
Loading
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -672,6 +672,8 @@ export class TorController {
  /**
   * Authenticate to the tor daemon.
   * Notice that a failure in the authentication makes the connection close.
   * This function tolerates empty and false-ish passwords because a client
   * needs to authenticate even when all authentication methods are disabled.
   *
   * @param {Uint8Array} password The password for the control port, as an array
   * of bytes
@@ -680,7 +682,11 @@ export class TorController {
    const passwordString = Array.from(password ?? [], b =>
      b.toString(16).padStart(2, "0")
    ).join("");
    await this.#sendCommandSimple(`authenticate ${passwordString}`);
    let command = "AUTHENTICATE";
    if (passwordString) {
      command += ` ${passwordString}`;
    }
    await this.#sendCommandSimple(command);
  }

  // Information
+3 −0
Original line number Diff line number Diff line
@@ -834,6 +834,9 @@ export class TorProvider extends TorProviderBase {
          this.#controlPortSettings.cookieFilePath
        );
      }
      // As per the spec, we must always authenticate to the control port, even
      // when all authentication methods are disabled.
      // https://spec.torproject.org/control-spec/commands.html#authenticate
      await controlPort.authenticate(password);
    } catch (e) {
      try {