Skip to content

Commit ee488f9

Browse files
author
blackhedd
committed
Changed LDAP#add, LDAP#modify and LDAP#delete to return
T/F instead of a numeric LDAP code.
1 parent f8649bc commit ee488f9

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/net/ldap.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,16 @@ def bind_as
256256
#
257257
def add args
258258
if @open_connection
259-
@open_connection.add( args )
259+
@result = @open_connection.add( args )
260260
else
261-
result_code = 0
261+
@result = 0
262262
conn = Connection.new( :host => @host, :port => @port )
263-
if (result_code = conn.bind( args[:auth] || @auth )) == 0
264-
result_code = conn.add( args )
263+
if (@result = conn.bind( args[:auth] || @auth )) == 0
264+
@result = conn.add( args )
265265
end
266266
conn.close
267-
result_code
268267
end
268+
@result == 0
269269
end
270270

271271

@@ -275,16 +275,16 @@ def add args
275275
#
276276
def modify args
277277
if @open_connection
278-
@open_connection.modify( args )
278+
@result = @open_connection.modify( args )
279279
else
280-
result_code = 0
280+
@result = 0
281281
conn = Connection.new( :host => @host, :port => @port )
282-
if (result_code = conn.bind( args[:auth] || @auth )) == 0
283-
result_code = conn.modify( args )
282+
if (@result = conn.bind( args[:auth] || @auth )) == 0
283+
@result = conn.modify( args )
284284
end
285285
conn.close
286-
result_code
287286
end
287+
@result == 0
288288
end
289289

290290
#
@@ -293,16 +293,16 @@ def modify args
293293
#
294294
def rename args
295295
if @open_connection
296-
@open_connection.rename( args )
296+
@result = @open_connection.rename( args )
297297
else
298-
result_code = 0
298+
@result = 0
299299
conn = Connection.new( :host => @host, :port => @port )
300-
if (result_code = conn.bind( args[:auth] || @auth )) == 0
301-
result_code = conn.rename( args )
300+
if (@result = conn.bind( args[:auth] || @auth )) == 0
301+
@result = conn.rename( args )
302302
end
303303
conn.close
304-
result_code
305304
end
305+
@result == 0
306306
end
307307

308308
end # class LDAP

0 commit comments

Comments
 (0)