Prev: Compiling
Next: "open" issue in a new defined namespace
From: Don Pich on 2 Mar 2010 12:49 Forgive the attempt, but is $filename ever defined? proc ReadUserList {filename} { variable BAS_list set filehandle [open $filename r] set contents [read $filehandle] close $filehandle set BAS_list [regexp -all -inline {\S+} $contents] } read_BAS_list /opt/CSCOar/scripts/radius/tcl/BASIP.list
From: Don Pich on 2 Mar 2010 12:54 When I removed the line.... read_BAS_list /opt/CSCOar/scripts/radius/tcl/BASIP.list It liked it and the radius started. How is that going to affect reading / opt/CSCOar/scripts/radius/tcl/BASIP.list?
From: Aric Bills on 2 Mar 2010 14:56 On 2 mar, 10:28, Don Pich <dp...(a)polartel.com> wrote: > Hello Aric, > > I have had a chance to add this to my Cisco radius server. What I have > done is added two seperate tcl files instead of just one. It seems to be > having a problem with the reading the list. > > --> reload > > Reloading Server 'Radius'... > 310 Command failed > Server 'Radius' failed to start > The server wrote the following errors to the log file: > Configuration Error evaluating Tcl file /opt/CSCOar/scripts/radius/ > tcl/ReadUserList.tcl > > --> > > [root(a)rad-a tcl]# cat ReadUserList.tcl > proc ReadUserList {filename} { > variable BAS_list > set filehandle [open $filename r] > set contents [read $filehandle] > close $filehandle > set BAS_list [regexp -all -inline {\S+} $contents] > > } > > read_BAS_list /opt/CSCOar/scripts/radius/tcl/BASIP.list > [root(a)rad-a tcl]# > > I'm wondering if there is another method to incorporate the data stored > in BASIP.list instead of this method. I don't know exactly what Cisco's > AR is having fits about. Don, if the above is copied directly from your code, you define proc [ReadUserList] but call proc [read_BAS_list], which presumably doesn't exist. That's going to create problems for you.
From: Don Pich on 2 Mar 2010 15:11 Hello Aric, I have made the proc and the "call" the same. This time, it liked it. I really appreciate your help!! Thanks for the great advice. Don
From: Don Pich on 10 Mar 2010 14:00
Thanks to everyone that helped with this problem. Here is my final tcl script that gave me my desired results: proc BASCleaner {request response environ} { set fp [open "/opt/CSCOar/scripts/radius/tcl/BASIP.list" r] set file_data [read $fp] close $fp set userName [ $request get User-Name ] set str1926 [string range $userName 18 25] set boolMatch 0 if {[lsearch $file_data $str1926]>-1} {set boolMatch 1} if {$boolMatch == 1} {set newusername [string range $userName 0 end-8] $environ put User-Name $newusername } } |