| 1 | /* REXX Function Library for RPC calls */
|
|---|
| 2 |
|
|---|
| 3 | /* Currently implemented functions: */
|
|---|
| 4 | /* _rpcenumdomgroups(server,username,password) */
|
|---|
| 5 | /* _rpcenumdomusers(server,username,password) */
|
|---|
| 6 | /* _rpcenumprinters(server,username,password) */
|
|---|
| 7 | /* _rpcnetshareenum(server,username,password) */
|
|---|
| 8 | /* _rpcnetsharegetinfo(server,username,password,share) */
|
|---|
| 9 | /* _rpcquerygroupmem(server,username,password,grouprid) */
|
|---|
| 10 | /* _rpcqueryuser(server,username,password,userrid) */
|
|---|
| 11 | /* _rpcsrvinfo(server,username,password) */
|
|---|
| 12 |
|
|---|
| 13 | /*:VRX _rpcenumdomgroups
|
|---|
| 14 | */
|
|---|
| 15 | _rpcenumdomgroups: procedure expose rpc. samba. options. debuglevel
|
|---|
| 16 | IF options.!debug == 1 THEN SAY time()" _rpcenumdomgroups() started"
|
|---|
| 17 | server = arg(1)
|
|---|
| 18 | username = arg(2)
|
|---|
| 19 | password = arg(3)
|
|---|
| 20 |
|
|---|
| 21 | say ' 'samba.!rpcclientexe' 'server' --user='username'%'password' --command="enumdomgroups" 'debuglevel' '
|
|---|
| 22 | address cmd samba.!rpcclientexe' 'server' --user='username'%'password' --command="enumdomgroups" 'debuglevel' >'samba.!msg
|
|---|
| 23 |
|
|---|
| 24 | rpc.enumdomgroups. = ""
|
|---|
| 25 |
|
|---|
| 26 | Failure = 0
|
|---|
| 27 |
|
|---|
| 28 | count = 0
|
|---|
| 29 | do until lines(samba.!msg) = 0
|
|---|
| 30 | rpcline = linein(samba.!msg)
|
|---|
| 31 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 32 |
|
|---|
| 33 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 34 | Failure = 1
|
|---|
| 35 | leave
|
|---|
| 36 | end
|
|---|
| 37 | parse var rpcline 'group:['tuser'] rid:['trid']'
|
|---|
| 38 |
|
|---|
| 39 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 40 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 41 | count = count + 1
|
|---|
| 42 |
|
|---|
| 43 | dyn = 'rpc.enumdomgroups.'count'.GROUP = "'Tuser'"'
|
|---|
| 44 | say " "dyn
|
|---|
| 45 | interpret dyn
|
|---|
| 46 |
|
|---|
| 47 | dyn = 'rpc.enumdomgroups.'count'.RID = "'Trid'"'
|
|---|
| 48 | say " "dyn
|
|---|
| 49 | interpret dyn
|
|---|
| 50 |
|
|---|
| 51 | end
|
|---|
| 52 | ok = stream(samba.!msg,'c','close')
|
|---|
| 53 | ok = SysFileDelete(samba.!msg)
|
|---|
| 54 | rpc.enumdomgroups.0 = count
|
|---|
| 55 |
|
|---|
| 56 | if Failure = 0 then do
|
|---|
| 57 | retval = 1
|
|---|
| 58 | rpc.enumdomgroups.LOGONSTATUS="OK"
|
|---|
| 59 | end
|
|---|
| 60 | else do
|
|---|
| 61 | retval = 0
|
|---|
| 62 | rpc.enumdomgroups.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 63 | end
|
|---|
| 64 | IF options.!debug == 1 THEN SAY time()" _rpcenumdomgroups() done, "retval" "rpc.enumdomgroups.LOGONSTATUS
|
|---|
| 65 | return retval
|
|---|
| 66 |
|
|---|
| 67 | /*:VRX _rpcenumdomusers
|
|---|
| 68 | */
|
|---|
| 69 | _rpcenumdomusers: procedure expose rpc. samba. options. debuglevel
|
|---|
| 70 | IF options.!debug == 1 THEN SAY time()" _rpcenumdomusers() started"
|
|---|
| 71 | server = arg(1)
|
|---|
| 72 | username = arg(2)
|
|---|
| 73 | password = arg(3)
|
|---|
| 74 |
|
|---|
| 75 | say ' 'samba.!rpcclientexe' 'server' --user='username'%'password' --command="enumdomusers" 'debuglevel' '
|
|---|
| 76 | address cmd samba.!rpcclientexe' 'server' --user='username'%'password' --command="enumdomusers" 'debuglevel' >'samba.!msg
|
|---|
| 77 |
|
|---|
| 78 | rpc.enumdomusers. = ""
|
|---|
| 79 |
|
|---|
| 80 | Failure = 0
|
|---|
| 81 |
|
|---|
| 82 | count = 0
|
|---|
| 83 | do until lines(samba.!msg) = 0
|
|---|
| 84 | rpcline = linein(samba.!msg)
|
|---|
| 85 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 86 |
|
|---|
| 87 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 88 | Failure = 1
|
|---|
| 89 | leave
|
|---|
| 90 | end
|
|---|
| 91 | parse var rpcline 'user:['tuser'] rid:['trid']'
|
|---|
| 92 |
|
|---|
| 93 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 94 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 95 | count = count + 1
|
|---|
| 96 |
|
|---|
| 97 | dyn = 'rpc.enumdomusers.'count'.USER = "'Tuser'"'
|
|---|
| 98 | say " "dyn
|
|---|
| 99 | interpret dyn
|
|---|
| 100 |
|
|---|
| 101 | dyn = 'rpc.enumdomusers.'count'.RID = "'Trid'"'
|
|---|
| 102 | say " "dyn
|
|---|
| 103 | interpret dyn
|
|---|
| 104 |
|
|---|
| 105 | end
|
|---|
| 106 | ok = stream(samba.!msg,'c','close')
|
|---|
| 107 | ok = SysFileDelete(samba.!msg)
|
|---|
| 108 | rpc.enumdomusers.0 = count
|
|---|
| 109 |
|
|---|
| 110 | if Failure = 0 then do
|
|---|
| 111 | retval = 1
|
|---|
| 112 | rpc.enumdomusers.LOGONSTATUS="OK"
|
|---|
| 113 | end
|
|---|
| 114 | else do
|
|---|
| 115 | retval = 0
|
|---|
| 116 | rpc.enumdomusers.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 117 | end
|
|---|
| 118 | IF options.!debug == 1 THEN SAY time()" _rpcenumdomusers() done, "retval" "rpc.enumdomusers.LOGONSTATUS
|
|---|
| 119 | return retval
|
|---|
| 120 |
|
|---|
| 121 | /*:VRX _rpcenumprinters
|
|---|
| 122 | */
|
|---|
| 123 | _rpcenumprinters: procedure expose rpc. samba. options. debuglevel
|
|---|
| 124 | IF options.!debug == 1 THEN SAY time()" _rpcenumprinters() started"
|
|---|
| 125 | server = arg(1)
|
|---|
| 126 | username = arg(2)
|
|---|
| 127 | password = arg(3)
|
|---|
| 128 |
|
|---|
| 129 | usercred = '--user='username'%'password
|
|---|
| 130 |
|
|---|
| 131 | say ' 'samba.!rpcclientexe' 'server' 'usercred' --command="enumprinters" 'debuglevel' '
|
|---|
| 132 | address cmd samba.!rpcclientexe' 'server' 'usercred' --command="enumprinters" 'debuglevel' >'samba.!msg
|
|---|
| 133 |
|
|---|
| 134 | rpc.enumprinters. = ""
|
|---|
| 135 |
|
|---|
| 136 | Failure = 0
|
|---|
| 137 |
|
|---|
| 138 | count = 0
|
|---|
| 139 | do until lines(samba.!msg) = 0
|
|---|
| 140 | rpcline = linein(samba.!msg)
|
|---|
| 141 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 142 |
|
|---|
| 143 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 144 | Failure = 1
|
|---|
| 145 | leave
|
|---|
| 146 | end
|
|---|
| 147 | parse var rpcline token ':[' tvalue']' .
|
|---|
| 148 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 149 | if Token = "FLAGS" then count = count + 1
|
|---|
| 150 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 151 | if pos('[',Token) = 0 & pos('TABLE',Token) = 0 & Token <> "" then do
|
|---|
| 152 | dyn = 'rpc.enumprinters.'count'.'Token' = "'Tvalue'"'
|
|---|
| 153 | say " "dyn
|
|---|
| 154 | interpret dyn
|
|---|
| 155 | end
|
|---|
| 156 | end
|
|---|
| 157 | ok = stream(samba.!msg,'c','close')
|
|---|
| 158 | ok = SysFileDelete(samba.!msg)
|
|---|
| 159 | rpc.enumprinters.0 = count
|
|---|
| 160 |
|
|---|
| 161 | if Failure = 0 then do
|
|---|
| 162 | retval = 1
|
|---|
| 163 | rpc.enumprinters.LOGONSTATUS="OK"
|
|---|
| 164 | end
|
|---|
| 165 | else do
|
|---|
| 166 | retval = 0
|
|---|
| 167 | rpc.enumprinters.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 168 | end
|
|---|
| 169 | IF options.!debug == 1 THEN SAY time()" _rpcenumprinters() done, "retval" "rpc.enumprinters.LOGONSTATUS
|
|---|
| 170 | return retval
|
|---|
| 171 | /*:VRX _rpcnetshareenum
|
|---|
| 172 | */
|
|---|
| 173 | _rpcnetshareenum: procedure expose rpc. samba. options. debuglevel
|
|---|
| 174 | IF options.!debug == 1 THEN SAY time()" _rpcnetshareenum() started"
|
|---|
| 175 | server = arg(1)
|
|---|
| 176 | username = arg(2)
|
|---|
| 177 | password = arg(3)
|
|---|
| 178 |
|
|---|
| 179 | say ' 'samba.!rpcclientexe' 'server' --user='username'%'password' --command="netshareenum" 'debuglevel' '
|
|---|
| 180 | address cmd samba.!rpcclientexe' 'server' --user='username'%'password' --command="netshareenum" 'debuglevel' >'samba.!msg
|
|---|
| 181 |
|
|---|
| 182 | rpc.netshareenum. = ""
|
|---|
| 183 |
|
|---|
| 184 | Failure = 0
|
|---|
| 185 |
|
|---|
| 186 | count = 0
|
|---|
| 187 | do until lines(samba.!msg) = 0
|
|---|
| 188 | rpcline = linein(samba.!msg)
|
|---|
| 189 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 190 |
|
|---|
| 191 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 192 | Failure = 1
|
|---|
| 193 | leave
|
|---|
| 194 | end
|
|---|
| 195 | parse var rpcline token ':' tvalue
|
|---|
| 196 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 197 | if Token = "NETNAME" then count = count + 1
|
|---|
| 198 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 199 | if pos('[',Token) = 0 & pos('TABLE',Token) = 0 & Token <> "" then do
|
|---|
| 200 | dyn = 'rpc.netshareenum.'count'.'Token' = "'Tvalue'"'
|
|---|
| 201 | say " "dyn
|
|---|
| 202 | interpret dyn
|
|---|
| 203 | end
|
|---|
| 204 | end
|
|---|
| 205 | ok = stream(samba.!msg,'c','close')
|
|---|
| 206 | ok = SysFileDelete(samba.!msg)
|
|---|
| 207 | rpc.netshareenum.0 = count
|
|---|
| 208 |
|
|---|
| 209 | if Failure = 0 then do
|
|---|
| 210 | retval = 1
|
|---|
| 211 | rpc.netshareenum.LOGONSTATUS="OK"
|
|---|
| 212 | end
|
|---|
| 213 | else do
|
|---|
| 214 | retval = 0
|
|---|
| 215 | rpc.netshareenum.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 216 | end
|
|---|
| 217 | IF options.!debug == 1 THEN SAY time()" _rpcnetshareenum() done, "retval" "rpc.netshareenum.LOGONSTATUS
|
|---|
| 218 | return retval
|
|---|
| 219 |
|
|---|
| 220 | /*:VRX _rpcnetsharegetinfo
|
|---|
| 221 | */
|
|---|
| 222 | _rpcnetsharegetinfo: procedure expose rpc. samba. options. debuglevel
|
|---|
| 223 | IF options.!debug == 1 THEN SAY time()" _rpcnetsharegetinfo() started"
|
|---|
| 224 | server = arg(1)
|
|---|
| 225 | username = arg(2)
|
|---|
| 226 | password = arg(3)
|
|---|
| 227 | share = arg(4)
|
|---|
| 228 |
|
|---|
| 229 | say ' 'samba.!rpcclientexe' 'server' --user='username'%'password' --command="netsharegetinfo 'share'" 'debuglevel' '
|
|---|
| 230 | address cmd samba.!rpcclientexe' 'server' --user='username'%'password' --command="netsharegetinfo 'share'" 'debuglevel' >'samba.!msg
|
|---|
| 231 |
|
|---|
| 232 | rpc.netsharegetinfo. = ""
|
|---|
| 233 |
|
|---|
| 234 | Failure = 0
|
|---|
| 235 |
|
|---|
| 236 | do until lines(samba.!msg) = 0
|
|---|
| 237 | rpcline = linein(samba.!msg)
|
|---|
| 238 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 239 |
|
|---|
| 240 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 241 | Failure = 1
|
|---|
| 242 | leave
|
|---|
| 243 | end
|
|---|
| 244 | parse var rpcline token ':' tvalue
|
|---|
| 245 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 246 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 247 | if pos('ACL',Token) = 0 & pos('ACE',Token) = 0 & pos('---',Token) = 0 & Token <> "" then do
|
|---|
| 248 |
|
|---|
| 249 | if Token = "TYPE" & left(Tvalue,2) = "0x" & length(Tvalue) = 3 then Token = "SHARETYPE"
|
|---|
| 250 | if Token = "TYPE" & pos("SEC",Tvalue) > 1 then Token = "SECTYPE"
|
|---|
| 251 |
|
|---|
| 252 | dyn = 'rpc.netsharegetinfo.'Token' = "'Tvalue'"'
|
|---|
| 253 | say " "dyn
|
|---|
| 254 | interpret dyn
|
|---|
| 255 | end
|
|---|
| 256 | end
|
|---|
| 257 | ok = stream(samba.!msg,'c','close')
|
|---|
| 258 | ok = SysFileDelete(samba.!msg)
|
|---|
| 259 |
|
|---|
| 260 | if Failure = 0 then do
|
|---|
| 261 | retval = '1'
|
|---|
| 262 | rpc.netsharegetinfo.LOGONSTATUS="OK"
|
|---|
| 263 | end
|
|---|
| 264 | else do
|
|---|
| 265 | retval = '0 '
|
|---|
| 266 | rpc.netsharegetinfo.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 267 | end
|
|---|
| 268 | IF options.!debug == 1 THEN SAY time()" _rpcnetsharegetinfo() done, "retval" "rpc.netsharegetinfo.LOGONSTATUS
|
|---|
| 269 | return retval
|
|---|
| 270 |
|
|---|
| 271 | /*:VRX _rpcquerygroupmem
|
|---|
| 272 | */
|
|---|
| 273 | _rpcquerygroupmem: procedure expose rpc. samba. options. debuglevel
|
|---|
| 274 | IF options.!debug == 1 THEN SAY time()" _rpcquerygroupmem() started"
|
|---|
| 275 | server = arg(1)
|
|---|
| 276 | username = arg(2)
|
|---|
| 277 | password = arg(3)
|
|---|
| 278 | grouprid = arg(4)
|
|---|
| 279 |
|
|---|
| 280 | say ' 'samba.!rpcclientexe' 'server' --user='username'%'password' --command="querygroupmem 'grouprid'" 'debuglevel' '
|
|---|
| 281 | address cmd samba.!rpcclientexe' 'server' --user='username'%'password' --command="querygroupmem 'grouprid'" 'debuglevel' >'samba.!msg
|
|---|
| 282 |
|
|---|
| 283 | rpc.querygroupmem. = ""
|
|---|
| 284 |
|
|---|
| 285 | Failure = 0
|
|---|
| 286 |
|
|---|
| 287 | count = 0
|
|---|
| 288 | do until lines(samba.!msg) = 0
|
|---|
| 289 | rpcline = linein(samba.!msg)
|
|---|
| 290 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 291 |
|
|---|
| 292 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 293 | Failure = 1
|
|---|
| 294 | leave
|
|---|
| 295 | end
|
|---|
| 296 | parse var rpcline 'rid:['trid'] attr:['tattr']'
|
|---|
| 297 |
|
|---|
| 298 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 299 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 300 | count = count + 1
|
|---|
| 301 |
|
|---|
| 302 | dyn = 'rpc.querygroupmem.'count'.RID = "'Trid'"'
|
|---|
| 303 | say " "dyn
|
|---|
| 304 | interpret dyn
|
|---|
| 305 |
|
|---|
| 306 | dyn = 'rpc.querygroupmem.'count'.ATTR = "'Tattr'"'
|
|---|
| 307 | say " "dyn
|
|---|
| 308 | interpret dyn
|
|---|
| 309 |
|
|---|
| 310 | end
|
|---|
| 311 | ok = stream(samba.!msg,'c','close')
|
|---|
| 312 | ok = SysFileDelete(samba.!msg)
|
|---|
| 313 | rpc.querygroupmem.0 = count
|
|---|
| 314 |
|
|---|
| 315 | if Failure = 0 then do
|
|---|
| 316 | retval = 1
|
|---|
| 317 | rpc.querygroupmem.LOGONSTATUS="OK"
|
|---|
| 318 | end
|
|---|
| 319 | else do
|
|---|
| 320 | retval = 0
|
|---|
| 321 | rpc.querygroupmem.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 322 | end
|
|---|
| 323 | IF options.!debug == 1 THEN SAY time()" _rpcquerygroupmem() done, "retval" "rpc.querygroupmem.LOGONSTATUS
|
|---|
| 324 | return retval
|
|---|
| 325 | /*:VRX _rpcqueryuser
|
|---|
| 326 | */
|
|---|
| 327 | _rpcqueryuser: procedure expose rpc. samba. options. debuglevel
|
|---|
| 328 | IF options.!debug == 1 THEN SAY time()" _rpcqueryuser() started"
|
|---|
| 329 | server = arg(1)
|
|---|
| 330 | username = arg(2)
|
|---|
| 331 | password = arg(3)
|
|---|
| 332 | userrid = arg(4)
|
|---|
| 333 |
|
|---|
| 334 | say ' 'samba.!rpcclientexe' 'server' --user='username'%'password' --command="queryuser 'userrid'" 'debuglevel' '
|
|---|
| 335 | address cmd samba.!rpcclientexe' 'server' --user='username'%'password' --command="queryuser 'userrid'" 'debuglevel' >'samba.!msg
|
|---|
| 336 |
|
|---|
| 337 | rpc.queryuser. = ""
|
|---|
| 338 |
|
|---|
| 339 | Failure = 0
|
|---|
| 340 |
|
|---|
| 341 | do until lines(samba.!msg) = 0
|
|---|
| 342 | rpcline = linein(samba.!msg)
|
|---|
| 343 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 344 |
|
|---|
| 345 | if pos("NT_STATUS", rpcline) > 0 then do
|
|---|
| 346 | Failure = 1
|
|---|
| 347 | leave
|
|---|
| 348 | end
|
|---|
| 349 | if pos("TDB(", translate(rpcline)) > 0 then do
|
|---|
| 350 | Failure = 1
|
|---|
| 351 | /* provide a fake NT_STATUS */
|
|---|
| 352 | rpcline = 'NT_STATUS_TDBERROR 'rpcline
|
|---|
| 353 | leave
|
|---|
| 354 | end
|
|---|
| 355 |
|
|---|
| 356 | parse var rpcline token ':' tvalue
|
|---|
| 357 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 358 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 359 | if pos('[',Token) = 0 & pos('TABLE',Token) = 0 & Token <> "" then do
|
|---|
| 360 | dyn = 'rpc.queryuser.'Token' = "'Tvalue'"'
|
|---|
| 361 | say " "dyn
|
|---|
| 362 | interpret dyn
|
|---|
| 363 | end
|
|---|
| 364 | end
|
|---|
| 365 | ok = stream(samba.!msg,'c','close')
|
|---|
| 366 | ok = SysFileDelete(samba.!msg)
|
|---|
| 367 |
|
|---|
| 368 | if Failure = 0 then do
|
|---|
| 369 | retval = 1
|
|---|
| 370 | rpc.queryuser.LOGONSTATUS="OK"
|
|---|
| 371 | end
|
|---|
| 372 | else do
|
|---|
| 373 | retval = '0 '
|
|---|
| 374 | rpc.queryuser.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 375 | end
|
|---|
| 376 | IF options.!debug == 1 THEN SAY time()" _rpcqueryuser() done, "retval" "rpc.queryuser.LOGONSTATUS
|
|---|
| 377 | return retval
|
|---|
| 378 | /*:VRX _rpcsrvinfo
|
|---|
| 379 | */
|
|---|
| 380 | _rpcsrvinfo: procedure expose rpc. samba. options. debuglevel
|
|---|
| 381 | IF options.!debug == 1 THEN SAY time()" _rpcsrvinfo() started"
|
|---|
| 382 | server = arg(1)
|
|---|
| 383 | username = arg(2)
|
|---|
| 384 | password = arg(3)
|
|---|
| 385 |
|
|---|
| 386 | usercred = '--user='username'%'password
|
|---|
| 387 | if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
|
|---|
| 388 |
|
|---|
| 389 | say ' 'samba.!rpcclientexe' 'server' 'usercred' --command="srvinfo" 'debuglevel' >'samba.!msg
|
|---|
| 390 | address cmd samba.!rpcclientexe' 'server' 'usercred' --command="srvinfo" 'debuglevel' >'samba.!msg
|
|---|
| 391 |
|
|---|
| 392 | rpc.srvinfo. = ""
|
|---|
| 393 |
|
|---|
| 394 | Failure = 0
|
|---|
| 395 |
|
|---|
| 396 | do until lines(samba.!msg) = 0
|
|---|
| 397 | rpcline = linein(samba.!msg)
|
|---|
| 398 | if pos("creating default valid table",rpcline) <> 0 then iterate
|
|---|
| 399 |
|
|---|
| 400 | if pos("LOGON_FAILURE", rpcline) > 0 then do
|
|---|
| 401 | Failure = 1
|
|---|
| 402 | leave
|
|---|
| 403 | end
|
|---|
| 404 | if pos(':',rpcline) <> 0 then do
|
|---|
| 405 | parse var rpcline token ':' tvalue
|
|---|
| 406 | token = translate(strip(strip(translate(token),'L','09'x)),'_',' ')
|
|---|
| 407 | tvalue= strip(strip(tvalue,'L','09'x))
|
|---|
| 408 | dyn = 'rpc.srvinfo.'Token' = "'Tvalue'"'
|
|---|
| 409 | say " "dyn
|
|---|
| 410 | interpret dyn
|
|---|
| 411 | end
|
|---|
| 412 | else do
|
|---|
| 413 | parse var rpcline '09'x rpc.srvinfo.NETBIOSNAME' 'rpc.srvinfo.SERVERSTRING
|
|---|
| 414 | rpc.srvinfo.SERVERSTRING = strip(rpc.srvinfo.SERVERSTRING)
|
|---|
| 415 | say ' rpc.srvinfo.NETBIOSNAME = "'rpc.srvinfo.NETBIOSNAME'"'
|
|---|
| 416 | rpc.srvinfo.CAPABILITIES = ""
|
|---|
| 417 | do I = 1 to words(rpc.srvinfo.SERVERSTRING)
|
|---|
| 418 | if length(word(rpc.srvinfo.SERVERSTRING,I)) >=4 then leave
|
|---|
| 419 | if length(word(rpc.srvinfo.SERVERSTRING,I)) = 2 | length(word(rpc.srvinfo.SERVERSTRING,I)) = 3 then do
|
|---|
| 420 | rpc.srvinfo.CAPABILITIES = rpc.srvinfo.CAPABILITIES||word(rpc.srvinfo.SERVERSTRING,I)||' '
|
|---|
| 421 | end
|
|---|
| 422 | end
|
|---|
| 423 | rpc.srvinfo.SERVERSTRING = strip(substr(rpc.srvinfo.SERVERSTRING,length(rpc.srvinfo.CAPABILITIES),))
|
|---|
| 424 | rpc.srvinfo.CAPABILITIES = strip(rpc.srvinfo.CAPABILITIES)
|
|---|
| 425 | say ' rpc.srvinfo.CAPABILITIES = "'rpc.srvinfo.CAPABILITIES'"'
|
|---|
| 426 | say ' rpc.srvinfo.SERVERSTRING = "'rpc.srvinfo.SERVERSTRING'"'
|
|---|
| 427 | end
|
|---|
| 428 | end
|
|---|
| 429 | ok = stream(samba.!msg,'c','close')
|
|---|
| 430 | ok = SysFileDelete(samba.!msg)
|
|---|
| 431 |
|
|---|
| 432 | if Failure = 0 then do
|
|---|
| 433 | retval = 1
|
|---|
| 434 | rpc.srvinfo.LOGONSTATUS="OK"
|
|---|
| 435 | end
|
|---|
| 436 | else do
|
|---|
| 437 | retval = 0
|
|---|
| 438 | rpc.srvinfo.LOGONSTATUS=substr(rpcline,pos("NT_STATUS",rpcline),)
|
|---|
| 439 | end
|
|---|
| 440 | say ' rpc.srvinfo.LOGONSTATUS = "'rpc.srvinfo.LOGONSTATUS'"'
|
|---|
| 441 | IF options.!debug == 1 THEN SAY time()" _rpcsrvinfo() done, "retval
|
|---|
| 442 | return retval
|
|---|