/usr/bin/iordump is in tcl-combat 0.8.1-1.
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | #!/usr/bin/tclsh
# $Id: iordump,v 1.1 2008-11-14 02:12:35 Owner Exp $ \
#
# ----------------------------------------------------------------------
# IOR Decoder using some Combat internals.
# ----------------------------------------------------------------------
#
set myDir [file normalize [file dirname [info script]]]
set parentDir [file dirname $myDir]
set orbDir [file join $parentDir orb]
if {[file exists $orbDir] && [file isdirectory $orbDir]} {
lappend auto_path $orbDir
}
if {[catch {package require combat} oops]} {
puts stderr "Error: Failed to find the required \"combat\" package."
exit 1
}
proc usage {argv0} {
puts stderr "usage: $argv0 ?ior-string-or-file?"
puts stderr ""
puts stderr " Prints the contents of a CORBA object reference."
puts stderr ""
puts stderr " If a parameter is supplied, and if that parameter does not begin with"
puts stderr " \"IOR:\", it is interpreted as a file name to read an object reference"
puts stderr " from."
puts stderr ""
puts stderr " When called without parameters, or if the file name is \"-\", an object"
puts stderr " reference is read from standard input."
puts stderr ""
exit 1
}
if {$argc > 1} {
usage $argv0
} elseif {!$argc || [set arg [lindex $argv 0]] == "-"} {
#
# Read object reference from standard input.
#
set ref [gets stdin]
} elseif {[string range $arg 0 0] == "-"} {
usage $argv0
} elseif {[string range $arg 0 3] != "IOR:"} {
#
# Read object reference from file.
#
if {[catch {set file [open $arg]} res]} {
puts "error: cannot open $arg: $res"
exit 1
}
set ref [read $file]
close $file
} else {
#
# Use object reference on command line.
#
set ref $arg
}
set ref [string trim $ref]
#
# ----------------------------------------------------------------------
# Some helpers.
# ----------------------------------------------------------------------
#
proc GetCodeSetName {cs} {
if {[info exists ::Combat::CONV_FRAME::codesets($cs)]} {
return [lindex $::Combat::CONV_FRAME::codesets($cs) 1]
}
return [format "0x%08x" $cs]
}
proc dumpORBTypeComponent {component} {
set buf [::Combat::CDR::ReadBuffer \#auto [$component cget -component_data]]
$buf configure -byteorder [$buf boolean]
set orb_type [$buf ulong]
puts "ORB Type Tag"
puts [format " ORB Type: 0x%08x" $orb_type]
itcl::delete object $buf
}
proc dumpCodeSetsComponent {component} {
puts "Codesets Tag"
set i 0
puts " Native char CS: [GetCodeSetName [$component cget -char_native_code_set]]"
foreach ncs [$component cget -char_conversion_code_sets] {
if {[incr i] == 1} {
puts " Accepted char CS: [GetCodeSetName $ncs]"
} else {
puts " [GetCodeSetName $ncs]"
}
}
set i 0
puts " Native wchar CS: [GetCodeSetName [$component cget -wchar_native_code_set]]"
foreach ncs [$component cget -wchar_conversion_code_sets] {
if {[incr i] == 1} {
puts " Accepted wchar CS: [GetCodeSetName $ncs]"
} else {
puts " [GetCodeSetName $ncs]"
}
}
}
proc dumpAlternateIIOPAddressComponent {component} {
set buf [::Combat::CDR::ReadBuffer \#auto [$component cget -component_data]]
$buf configure -byteorder [$buf boolean]
set host [$buf string]
set port [$buf ushort]
puts "Alternate IIOP Address Tag"
puts " Addr: $host:$port"
itcl::delete object $buf
}
proc dumpTaggedComponent {component} {
set tag [$component cget -tag]
switch -- $tag {
0 { # TAG_ORB_TYPE
dumpORBTypeComponent $component
}
1 { # TAG_CODE_SETS
dumpCodeSetsComponent $component
}
3 { # TAG_ALTERNATE_IIOP_ADDRESS
dumpAlternateIIOPAddressComponent $component
}
default {
puts "Unknown Tagged Component, ComponentId = $tag"
::Combat::DumpOctets "Data:" [$component cget -component_data]
}
}
}
proc dumpMultipleComponentsProfile {profile} {
puts "Multiple Components:"
foreach component [$profile cget -components] {
puts ""
dumpTaggedComponent $component
}
}
proc dumpIIOPProfile {profile} {
puts "IIOP Profile"
set major [$profile cget -major_version]
set minor [$profile cget -minor_version]
puts " Version: $major.$minor"
puts " Address: [$profile cget -host]:[$profile cget -port]"
::Combat::DumpOctets "Key:" [$profile cget -object_key]
foreach component [$profile cget -components] {
puts ""
dumpTaggedComponent $component
}
}
proc dumpIor {ior} {
set type_id [$ior cget -type_id]
puts ""
if {$type_id != ""} {
puts " Repo Id: $type_id"
} else {
puts " Repo Id: <unknown>"
}
puts ""
foreach profile [$ior cget -profiles] {
set tag [$profile cget -tag]
switch -- $tag {
0 { # TAG_INTERNET_IOP
dumpIIOPProfile $profile
}
1 { # TAG_MULTIPLE_COMPONENTS
dumpMultipleComponentsProfile $profile
}
default {
puts "Unknown Profile, ProfileId = $tag"
::Combat::DumpOctets "Data:" [$profile cget -profile_data]
}
}
puts ""
}
}
#
# ----------------------------------------------------------------------
# Main
# ----------------------------------------------------------------------
#
if {[catch {set ior [::Combat::IOP::DestringifyIOR $ref]} oops]} {
puts "error: $oops"
exit 1
}
dumpIor $ior
itcl::delete object $ior
|