Revision 0df6346a
Added by Marc Dequènes about 15 years ago
- ID 0df6346aea93b5cf58ff4bc82053d57e6cafc608
bin/shadowwalker | ||
---|---|---|
opt.on("-d", "--debug", "Output debug info without being formated") {|t| $program_options[:debug] = true }
|
||
opt.on("-e", "--expert", "Output extra info for expert users") {|t| $program_options[:expert] = true }
|
||
opt.on("-H", "--handles", "Output with handles (objects/field/... keys used for manipulations)") {|t| $program_options[:handles] = true }
|
||
opt.on("-s SHADOW", "--shadow SHADOW", "Choose shadow to travel through") {|t| $program_options[:shadow_name] = t }
|
||
end
|
||
|
||
cmdparser.add_command(CmdParse::HelpCommand.new)
|
||
cmdparser.add_command(CmdParse::VersionCommand.new)
|
||
|
||
|
||
$ldapctl = Controller.new
|
||
begin
|
||
$ldapctl.load_shadow()
|
||
rescue ActiveLdap::Error => e
|
||
STDERR.puts _("LDAP connection error: %s") % e.to_s
|
||
exit 2
|
||
rescue
|
||
STDERR.puts _("Cannot load shadow configuration")
|
||
exit 2
|
||
end
|
||
|
||
|
||
class Command < CmdParse::Command
|
||
attr_accessor :usages_params
|
||
|
||
... | ... | |
end
|
||
end
|
||
|
||
def execute(args)
|
||
$ldapctl = Controller.new
|
||
begin
|
||
$ldapctl.load_shadow($program_options[:shadow_name])
|
||
rescue ActiveLdap::Error => e
|
||
STDERR.puts _("LDAP connection error: %s") % e.to_s
|
||
exit 2
|
||
rescue
|
||
STDERR.puts _("Shadow initialization failed: %s") % $!
|
||
exit 2
|
||
end
|
||
end
|
||
|
||
protected
|
||
|
||
def params_shift_location(args)
|
||
... | ... | |
]
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
raise SyntaxError, _("no object name given") if args.empty?
|
||
|
||
obj_hdl = args.shift.downcase.singularize
|
||
... | ... | |
end
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
obj_klass = params_shift_object(args)
|
||
item = params_shift_item(obj_klass, args)
|
||
|
||
... | ... | |
end
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
puts "Tree:"
|
||
|
||
search_base = nil
|
||
... | ... | |
end
|
||
else
|
||
dn_list = []
|
||
gconfig = $ldapctl.get_global_config()
|
||
sconfig = $ldapctl.get_shadow_config()
|
||
|
||
(gconfig[:tree_objects] || []).each do |obj_hdl|
|
||
(sconfig[:tree_objects] || []).each do |obj_hdl|
|
||
obj_klass = $ldapctl.find_klass(obj_hdl.downcase)
|
||
unless obj_klass
|
||
raise PreProcessingError, _("Location object '%s' not defined") % obj_hdl
|
||
... | ... | |
]
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
obj_klass = params_shift_object(args)
|
||
item = params_shift_item(obj_klass, args)
|
||
|
||
... | ... | |
end
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
obj_klass = params_shift_object(args)
|
||
item = params_shift_item(obj_klass, args)
|
||
|
||
... | ... | |
]
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
obj_klass = params_shift_object(args)
|
||
|
||
raise SyntaxError, _("no item name given") if args.empty?
|
||
... | ... | |
]
|
||
end
|
||
|
||
def execute (args)
|
||
def execute(args)
|
||
super
|
||
|
||
raise SyntaxError, _("no search arguments") if args.empty?
|
||
|
||
res = LdapObject.items_find_from_strings(args)
|
Also available in: Unified diff
[evol] improve config #8 (shadow selection support)