[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

net::ldap - add_attribute

Rcmn Rcmn

2/2/2007 9:23:00 PM

i'm trying to add a workstation "monnomdemachine" to a group "mygroup"

but i get "#<OpenStruct message="Unwilling to perform", code=53>"


require 'net/ldap'

# look up Machine to ProdWindowsXPWorkstations
ldap = Net::LDAP.new :host => '11111111',
:port => 389,
:auth => {
:method => :simple,
:username =>
"cn=user,ou=ou0,ou=ou1,ou=ou3,dc=dc,dc=dc1,dc=net",
:password => "pass"
}

filter = Net::LDAP::Filter.eq( "cn", "monnomdemachine" )
treebase = "dc=dc,dc=dc1,dc=net"

ldap.search( :base => treebase, :filter => filter ) do |entry|
$dnwks = "DN: #{entry.dn}"
end

gr = "CN=mygoupe,OU=uu2,OU=uu1,OU=uu,dc=dc,dc=dc1,dc=net"
ldap.add_attribute gr, :member, $dnwks

p ldap.get_operation_result

--
Posted via http://www.ruby-....

5 Answers

Rcmn Rcmn

2/3/2007 12:40:00 AM

0


> Looks like you gave the parameters to Net::LDAP#add_attribute in the
> wrong
> order.
>

are we talking about
> ldap.add_attribute gr, :member, $dnwks

or

> ldap.search( :base => treebase, :filter => filter ) do |entry|

search seems to work fine since i'm able to return entry but i have
trouble add_attribute .i followed the rdoc but maybe i don't use it
properly.

--
Posted via http://www.ruby-....

Rcmn Rcmn

2/3/2007 8:20:00 PM

0

Francis Cianfrocca wrote:
> On 2/2/07, Rcmn 73 <rcmn73@gmail.com> wrote:
>>
>>
>> are we talking about
>> > ldap.add_attribute gr, :member, $dnwks
>
>
>
> Yes. Re-read the rdoc. The DN which specifies the entry to which you are
> adding the attribute is the first parameter.

i think i'm using it properly.
> ldap.add_attribute gr, :member, $dnwks

"gr" is the group to which i want to add an entry.
":member" is the attribute.So i will add the member $dnwks to gr.
"$dnwks" is the object i want to add.

also it tried various combination but it get worst.


--
Posted via http://www.ruby-....

Rcmn Rcmn

2/5/2007 4:46:00 PM

0

I finally found my mistake and fixed it that way.
thank you for the help.

require 'net/ldap'

# look up Machine to ProdWindowsXPWorkstations
ldap = Net::LDAP.new :host => '11111111',
:port => 389,
:auth => {
:method => :simple,
:username =>
"cn=user,ou=ou0,ou=ou1,ou=ou3,dc=dc,dc=dc1,dc=net",
:password => "pass"
}

filter = Net::LDAP::Filter.eq( "cn", "monnomdemachine" )
treebase = "dc=dc,dc=dc1,dc=net"

ldap.search( :base => treebase, :filter => filter ) do |entry|
dnwks = "DN: #{entry.dn}"


dn = "CN=mygoupe,OU=uu2,OU=uu1,OU=uu,dc=dc,dc=dc1,dc=net"
ldap.add_attribute dn, :member, dnwks
end
p ldap.get_operation_result

--
Posted via http://www.ruby-....

Rcmn Rcmn

2/5/2007 7:43:00 PM

0

Francis Cianfrocca wrote:
> On 2/5/07, Rcmn 73 <rcmn73@gmail.com> wrote:
>> :method => :simple,
>>
>>
>> dn = "CN=mygoupe,OU=uu2,OU=uu1,OU=uu,dc=dc,dc=dc1,dc=net"
>> ldap.add_attribute dn, :member, dnwks
>> end
>> p ldap.get_operation_result
>>
>> --
>> Posted via http://www.ruby-....
>>
>>
>
> Ah. Sounds like the problem was a schema violation all along, then. That
> also is consistent with a 53 error code.

yes it was.thx.

I had 2 other questions the first one is related to this post
http://www.ruby-...topic/82437#144516 and i was wondering if
other people asked for it and if so ;do you think it might be supported?
if not what would be a good work around ?

--
Posted via http://www.ruby-....

Rcmn Rcmn

2/5/2007 8:00:00 PM

0

Rcmn 73 wrote:
> Francis Cianfrocca wrote:
>> On 2/5/07, Rcmn 73 <rcmn73@gmail.com> wrote:
>> :method => :simple,

> I had 2 other questions the first one is related to this post
> http://www.ruby-...topic/82... and i was wondering if
> other people asked for it and if so ;do you think it might be supported?
> if not what would be a good work around ?

and i forgot my 2nd question.would ldap.modify be faster than
ldap.add_attribute ?

--
Posted via http://www.ruby-....