--- ldap.tcl.orig	2004-12-09 07:30:46.000000000 -0500
+++ ldap.tcl	2004-12-09 07:42:36.000000000 -0500
@@ -55,7 +55,7 @@
 #-----------------------------------------------------------------------------
 
 
-package provide ldap 1.2
+package provide ldap 1.3
 
 
 namespace eval ldap {
@@ -359,7 +359,7 @@
 #               dn1 { attr1 val1 attr2 val2 ... } dn2 { a1 v1 } ....
 #
 #-----------------------------------------------------------------------------
-proc ldap::search { handle baseObject filterString attributes } {
+proc ldap::search { handle baseObject filterString attributes args} {
 
     upvar $handle conn
 
@@ -369,6 +369,19 @@
     set timeLimit    0
     set attrsOnly    0
 
+    foreach {key value} $args {
+        switch -- $key {
+            -scope {
+                switch -- $value {
+                    base { set scope 0 }
+                    one - onelevel { set scope 1 }
+                    sub - subtree { set scope 2 }
+                    default { set scope $value }
+                }
+            }
+        }
+    }
+
     #----------------------------------------------------------
     #   marshal filter and attributes parameter
     #----------------------------------------------------------
