From: rfransix on 6 May 2010 14:50 On May 6, 1:37 pm, rfransix <rfran...(a)comcast.net> wrote: > On May 6, 1:26 pm, rfransix <rfran...(a)comcast.net> wrote: > > > > > > > On May 6, 1:15 pm, rfransix <rfran...(a)comcast.net> wrote: > > > > On May 6, 12:20 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> > > > wrote: > > > > > On May 6, 6:48 pm, rfransix <rfran...(a)comcast.net> wrote: > > > > > > On May 6, 11:28 am, rfransix <rfran...(a)comcast.net> wrote: > > > > > > > On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote: > > > > > > > > On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote: > > > > > > > > > On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote: > > > > > > > > > > So it fills in the spaces with pound signs, what's up with that?- Hide quoted text - > > > > > > > > > > - Show quoted text - > > > > > > > > > What version of Tcl are you using, and on what platform? > > > > > > > > > Here's what I see with Tcl 8.5.4: > > > > > > > > > $ cat tst.tcl > > > > > > > > #! /usr/tcl85/bin/tclsh8.5 > > > > > > > > > set rh_file(abce) "" > > > > > > > > > set tmp > > > > > > > > {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > > > > > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}} > > > > > > > > > puts "lindex $tmp 1 is [lindex $tmp 1]" > > > > > > > > > set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)] > > > > > > > > > puts "Encountered $rh_file(abce), rc = $rc" > > > > > > > > $ ./tst.tcl > > > > > > > > lindex > > > > > > > > uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > > > > > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp} 1 is > > > > > > > > Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp > > > > > > > > Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1 > > > > > > > > > Notice that I got into $tmp differently than your previous code - > > > > > > > > perhaps your real life data requires the double lindex, but the same > > > > > > > > you provided didn't require going that deep. > > > > > > > > > Note that I tried my script against Tcl 8.6 and it worked the same > > > > > > > > there as well. > > > > > > > > > I recommend using a small coherent example script to work out the > > > > > > > > details of what you are trying to do. This allows you to tweak the > > > > > > > > data to make it follow your live data closely without violating > > > > > > > > privacy concerns. Once you have the exact data, and a small amount of > > > > > > > > Tcl code that demonstrates the issue, including the same script allows > > > > > > > > others on the same platform, or alternative platforms, to see if the > > > > > > > > problem is common or unique to your site. > > > > > > > > Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text - > > > > > > > > - Show quoted text - > > > > > > > When I run the tcl script with set rh_file(abce) "", it returns an > > > > > > error, or with $rh_file(abdc) "" > > > > > > > wrong # args: should be "set varName ?newValue?" > > > > > > while compiling > > > > > > "set $rh_file(manager) to """- Hide quoted text - > > > > > > > - Show quoted text - > > > > > > my mistake, should be just: set rh_file(abce) "" > > > > > and that works as expected, thank you. > > > > > > the single lindex fails in my script. > > > > > > The double lindex works great, except for changing the spaces to > > > > > pounds. here's what I'm working on, which is not working: > > > > > > if { [regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)] > > > > > == 0 } then { > > > > > regsub -all "#" $rh_file(abce) " " -> rh_file(abce)} else { > > > > > > set rh_file(abce) "" > > > > > > } > > > > > You got it reversed; [regexp] returns 0 when there has been no match. > > > > > -Alex- Hide quoted text - > > > > > - Show quoted text - > > > > While the tcl script (v8.3 on windows server) runs to completion with > > > this code, between the point $tmp is created and after regexp is run, > > > these pound signs are getting substituted for spaces. This if > > > statement is not (re)substituted spaces for pound signs, any ideas? > > > > if { [regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)] > > > == 1 } then { > > > regsub -all "#" $rh_file(abce) " " -> rh_file(abce)} else { > > > > set rh_file(abce) "" > > > > } > > > > $tmp: > > > uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}} > > > > $rh_file(manager): > > > CN=Buggs\\, Bunny D.,OU=Users,OU=Corporate,DC=corp- Hide quoted text - > > > > - Show quoted text - > > > I haven't tried ldap::search commands, I don't believe they are > > supported in our version. But I'll test drive your suggestion. > > > I have the results from this command: > > set rc [regexp ..........rh_file(abce)] > > puts "Encountered $rh_file(abce), rc = $rc" > > > And, it placed the correctly parsed value, without the pound signs, in > > the trace output file: > > > Encountered Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc > > = 1 > > > So, that means, it is NOT regexp doing the # to space substitution. > > > Stay tuned, looking for the answer.- Hide quoted text - > > > - Show quoted text - > > Does this make sense to anyone? The next step we take is to build a > changetype data input file for an ldapmodify to an AD server: like > this, here is where the pound signs are substituted, will AD accept > this file as valid? > > changetype:modify > department:00111 - > description:Status: Active > ADsPath:LDAP://myadserver/DC=corp/OU=Corporate/OU=Users/CN=Buggs\, > Bunny D. > userAccountControl:111 > givenName:Buggs > postalCode:92510 > sn:Bunny > streetAddress:Warner Brothers Avenue > telephoneNumber:555-555-5555 > title:Cartoon Character > msExchHideFromAddressLists:0 > manager:CN=Warner\,#Brothers#A.,OU=Users,OU=Corporate,DC=corp- Hide quoted text - > > - Show quoted text - I setup the tcl script to send a manager value without the pound signs and it successfully updated the records in AD. So the pound signs are a problem, sorry for the confusion. Here's the error we get: LDAP_NO_SUCH_OBJECT AD actually hides the manager attribute in the record until a valid value is restored.
From: rfransix on 6 May 2010 15:03 On May 6, 1:49 pm, Bruce <Bruce_do_not_...(a)example.com> wrote: > rfransix wrote: > > On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote: > >> On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote: > > >>> On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote: > >>>> So it fills in the spaces with pound signs, what's up with that?- Hide quoted text - > >>>> - Show quoted text - > >>> What version of Tcl are you using, and on what platform? > >>> Here's what I see with Tcl 8.5.4: > >>> $ cat tst.tcl > >>> #! /usr/tcl85/bin/tclsh8.5 > >>> set rh_file(abce) "" > >>> set tmp > >>> {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > >>> {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}} > >>> puts "lindex $tmp 1 is [lindex $tmp 1]" > >>> set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)] > >>> puts "Encountered $rh_file(abce), rc = $rc" > >>> $ ./tst.tcl > >>> lindex > >>> uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > >>> {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp} 1 is > >>> Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp > >>> Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1 > >>> Notice that I got into $tmp differently than your previous code - > >>> perhaps your real life data requires the double lindex, but the same > >>> you provided didn't require going that deep. > >>> Note that I tried my script against Tcl 8.6 and it worked the same > >>> there as well. > >>> I recommend using a small coherent example script to work out the > >>> details of what you are trying to do. This allows you to tweak the > >>> data to make it follow your live data closely without violating > >>> privacy concerns. Once you have the exact data, and a small amount of > >>> Tcl code that demonstrates the issue, including the same script allows > >>> others on the same platform, or alternative platforms, to see if the > >>> problem is common or unique to your site. > >> Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text - > > >> - Show quoted text - > > > When I run the tcl script with set rh_file(abce) "", it returns an > > error, or with $rh_file(abdc) "" > > > wrong # args: should be "set varName ?newValue?" > > while compiling > > "set $rh_file(manager) to """ > > remove the $- Hide quoted text - > > - Show quoted text - not sure, which $
From: rfransix on 6 May 2010 15:06 On May 6, 1:49 pm, Bruce <Bruce_do_not_...(a)example.com> wrote: > rfransix wrote: > > On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote: > >> On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote: > > >>> On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote: > >>>> So it fills in the spaces with pound signs, what's up with that?- Hide quoted text - > >>>> - Show quoted text - > >>> What version of Tcl are you using, and on what platform? > >>> Here's what I see with Tcl 8.5.4: > >>> $ cat tst.tcl > >>> #! /usr/tcl85/bin/tclsh8.5 > >>> set rh_file(abce) "" > >>> set tmp > >>> {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > >>> {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}} > >>> puts "lindex $tmp 1 is [lindex $tmp 1]" > >>> set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)] > >>> puts "Encountered $rh_file(abce), rc = $rc" > >>> $ ./tst.tcl > >>> lindex > >>> uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > >>> {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp} 1 is > >>> Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp > >>> Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1 > >>> Notice that I got into $tmp differently than your previous code - > >>> perhaps your real life data requires the double lindex, but the same > >>> you provided didn't require going that deep. > >>> Note that I tried my script against Tcl 8.6 and it worked the same > >>> there as well. > >>> I recommend using a small coherent example script to work out the > >>> details of what you are trying to do. This allows you to tweak the > >>> data to make it follow your live data closely without violating > >>> privacy concerns. Once you have the exact data, and a small amount of > >>> Tcl code that demonstrates the issue, including the same script allows > >>> others on the same platform, or alternative platforms, to see if the > >>> problem is common or unique to your site. > >> Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text - > > >> - Show quoted text - > > > When I run the tcl script with set rh_file(abce) "", it returns an > > error, or with $rh_file(abdc) "" > > > wrong # args: should be "set varName ?newValue?" > > while compiling > > "set $rh_file(manager) to """ > > remove the $- Hide quoted text - > > - Show quoted text - not sure, which $ I've written this tcl code to try to handle the spaces, it does not work, any help? regsub -all " " $rh_ldap(Name) "%%" mgrTemp regsub -all "{|}" $mgrTemp "" mgrTemp set mgrTemp [split $mgrTemp $] set mgrTemp [llist [lindex $mgrTemp 0]] regsub -all "%%" $mgrTemp " " mgrTemp if {$mgrTemp == ""} then { set rh_file(abce) "{ }" } else { regexp {^Name=(.*)} [lindex [lindex $tmpmanager 0] 1] -> rh_file(abce) } this also returns the manager value with pound signs for spaces.
From: rfransix on 7 May 2010 11:47 On May 6, 2:06 pm, rfransix <rfran...(a)comcast.net> wrote: > On May 6, 1:49 pm, Bruce <Bruce_do_not_...(a)example.com> wrote: > > > > > > > rfransix wrote: > > > On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote: > > >> On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote: > > > >>> On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote: > > >>>> So it fills in the spaces with pound signs, what's up with that?- Hide quoted text - > > >>>> - Show quoted text - > > >>> What version of Tcl are you using, and on what platform? > > >>> Here's what I see with Tcl 8.5.4: > > >>> $ cat tst.tcl > > >>> #! /usr/tcl85/bin/tclsh8.5 > > >>> set rh_file(abce) "" > > >>> set tmp > > >>> {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > > >>> {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}} > > >>> puts "lindex $tmp 1 is [lindex $tmp 1]" > > >>> set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)] > > >>> puts "Encountered $rh_file(abce), rc = $rc" > > >>> $ ./tst.tcl > > >>> lindex > > >>> uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef > > >>> {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp} 1 is > > >>> Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp > > >>> Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1 > > >>> Notice that I got into $tmp differently than your previous code - > > >>> perhaps your real life data requires the double lindex, but the same > > >>> you provided didn't require going that deep. > > >>> Note that I tried my script against Tcl 8.6 and it worked the same > > >>> there as well. > > >>> I recommend using a small coherent example script to work out the > > >>> details of what you are trying to do. This allows you to tweak the > > >>> data to make it follow your live data closely without violating > > >>> privacy concerns. Once you have the exact data, and a small amount of > > >>> Tcl code that demonstrates the issue, including the same script allows > > >>> others on the same platform, or alternative platforms, to see if the > > >>> problem is common or unique to your site. > > >> Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text - > > > >> - Show quoted text - > > > > When I run the tcl script with set rh_file(abce) "", it returns an > > > error, or with $rh_file(abdc) "" > > > > wrong # args: should be "set varName ?newValue?" > > > while compiling > > > "set $rh_file(manager) to """ > > > remove the $- Hide quoted text - > > > - Show quoted text - > > not sure, which $ > > I've written this tcl code to try to handle the spaces, it does not > work, any help? > > regsub -all " " $rh_ldap(Name) "%%" mgrTemp > regsub -all "{|}" $mgrTemp "" mgrTemp > set mgrTemp [split $mgrTemp $] > set mgrTemp [llist [lindex $mgrTemp 0]] > regsub -all "%%" $mgrTemp " " mgrTemp > if {$mgrTemp == ""} then { > set rh_file(abce) "{ }"} else { > > regexp {^Name=(.*)} [lindex [lindex $tmpmanager 0] 1] -> > rh_file(abce) > > } > > this also returns the manager value with pound signs for spaces.- Hide quoted text - > > - Show quoted text - RESOLVED: The # signs were getting added from multi-value attribute setting that I changed to \040 (octal for space) :) The entire exercise is resolved with this code, hope it helps everyone. Thanks all. Where tmp contains: {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef {Name=CN=Buggs\\, Bunny D.,OU=Users,OU=Corporate,DC=corp}} mapping.tcl contains: global tmp_bindid bind -protocol LDAPv3 -address {myldapserver:389} -user {cn=Admin,cn=abcdef} -password {1010101} -authentication SIMPLE - bindid tmp_bindid set rh_file(abce) "" set cmd "search ou=People -subtree -fi ID=$ldap(mgr) -attribute Name - bindid tmp_bindid" catch "$cmd" tmp puts $tmp regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce) unbind -bindid tmp_bindid This set the manager attribute like this: manager:CN=Buggs\, Bunny D.,OU=Users,OU=Corporate,DC=corp
First
|
Prev
|
Pages: 1 2 3 4 5 6 Prev: Problem with Expect/netcat/telnet Next: clock microseconds with resolution in milliseconds |