This file is indexed.

/usr/bin/sup-add is in sup-mail 0.12.1+git20120407.aaa852f-1+deb7u1.

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

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
#!/usr/bin/ruby1.9.1

require 'uri'
#require 'rubygems'
require 'highline/import'
require 'trollop'
require "sup"; Redwood::check_library_version_against "git"

$opts = Trollop::options do
  version "sup-add (sup #{Redwood::VERSION})"
  banner <<EOS
Adds a source to the Sup source list.

Usage:
  sup-add [options] <source uri>+

where <source uri>+ is one or more source URIs.

For mbox files on local disk, use the form:
    mbox:<path to mbox file>, or
    mbox://<path to mbox file>

For Maildir folders, use the form:
    maildir:<path to Maildir directory>; or
    maildir://<path to Maildir directory>

Options are:
EOS
  opt :archive, "Automatically archive all new messages from these sources."
  opt :unusual, "Do not automatically poll these sources for new messages."
  opt :labels, "A comma-separated set of labels to apply to all messages from this source", :type => String
  opt :force_new, "Create a new account for this source, even if one already exists."
  opt :force_account, "Reuse previously defined account user@hostname.", :type => String
end

Trollop::die "require one or more sources" if ARGV.empty?

## for sources that require login information, prompt the user for
## that. also provide a list of previously-defined login info to
## choose from, if any.
def get_login_info uri, sources
  uri = URI(uri)
  accounts = sources.map do |s|
    next unless s.respond_to?(:username)
    suri = URI(s.uri)
    [suri.host, s.username, s.password]
  end.compact.uniq.sort_by { |h, u, p| h == uri.host ? 0 : 1 }

  username, password = nil, nil
  unless accounts.empty? || $opts[:force_new]
    if $opts[:force_account]
      host, username, password = accounts.find { |h, u, p| $opts[:force_account] == "#{u}@#{h}" }
      unless username && password
        say "No previous account #{$opts[:force_account].inspect} found."
      end
    else
      say "Would you like to use the same account as for a previous source for #{uri}?"
      choose do |menu|
        accounts.each do |host, olduser, oldpw|
          menu.choice("Use the account info for #{olduser}@#{host}") { username, password = olduser, oldpw }
        end
        menu.choice("Use a new account") { }
        menu.prompt = "Account selection? "
      end
    end
  end

  unless username && password
    username = ask("Username for #{uri.host}: ");
    password = ask("Password for #{uri.host}: ") { |q| q.echo = false }
    puts # why?
  end

  [username, password]
end

$terminal.wrap_at = :auto
Redwood::start
index = Redwood::Index.init
index.load

index.lock_interactively or exit

begin
  Redwood::SourceManager.load_sources

  ARGV.each do |uri|
    labels = $opts[:labels] ? $opts[:labels].split(/\s*,\s*/).uniq : []

    if !$opts[:force_new] && Redwood::SourceManager.source_for(uri)
      say "Already know about #{uri}; skipping."
      next
    end

    parsed_uri = URI(uri)

    source =
      case parsed_uri.scheme
      when "maildir"
        Redwood::Maildir.new uri, !$opts[:unusual], $opts[:archive], nil, labels
      when "mbox"
        Redwood::MBox.new uri, !$opts[:unusual], $opts[:archive], nil, labels
      when nil
        Trollop::die "Sources must be specified with an URI"
      else
        Trollop::die "Unknown source type #{parsed_uri.scheme.inspect}"
      end
    say "Adding #{source}..."
    Redwood::SourceManager.add_source source
  end
ensure
  index.save
  index.unlock
  Redwood::finish
end