}[https://travis-ci.org/ruby-ldap/ruby-net-ldap]
== Description
Net::LDAP for Ruby (also called net-ldap) implements client access for the
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for
accessing distributed directory services. Net::LDAP is written completely in
Ruby with no external dependencies. It supports most LDAP client features and a
subset of server features as well.
Net::LDAP has been tested against modern popular LDAP servers including
OpenLDAP and Active Directory. The current release is mostly compliant with
earlier versions of the IETF LDAP RFCs (2251–2256, 2829–2830, 3377, and 3771).
Our roadmap for Net::LDAP 1.0 is to gain full client compliance with
the most recent LDAP RFCs (4510–4519, plus portions of 4520–4532).
== Where
* {GitHub}[https://github.com/ruby-ldap/ruby-net-ldap]
* {ruby-ldap@googlegroups.com}[http://groups.google.com/group/ruby-ldap]
== Synopsis
See Net::LDAP for documentation and usage samples.
== Requirements
Net::LDAP requires a Ruby 2.0.0 compatible interpreter or better.
== Install
Net::LDAP is a pure Ruby library. It does not require any external libraries.
You can install the RubyGems version of Net::LDAP available from the usual
sources.
gem install net-ldap
Simply require either 'net-ldap' or 'net/ldap'.
== Extensions
This library focuses on the core LDAP RFCs referenced in the description.
However, we recognize there are commonly used extensions to the spec that are
useful. If there is another library which handles it, we list it here.
* {resolv-srv}[https://rubygems.org/gems/resolv-srv]: Support RFC2782 SRV record lookup and failover
== Develop
This task will run the test suite and the
{RuboCop}[https://github.com/bbatsov/rubocop] static code analyzer.
rake rubotest
CI takes too long? If your local box supports
{Vagrant}[https://www.vagrantup.com/], you can run most of the tests
in a VM on your local box. For more details and setup instructions, see
{test/support/vm/openldap/README.md}[https://github.com/ruby-ldap/ruby-net-ldap/tree/master/test/support/vm/openldap/README.md]
== Release
This section is for gem maintainers to cut a new version of the gem.
* Check out a new branch `release-VERSION`
* Update lib/net/ldap/version.rb to next version number X.X.X following {semver}(http://semver.org/).
* Update `History.rdoc`. Get latest changes with `script/changelog`
* Open a pull request with these changes for review
* After merging, on the master branch, run `script/release`
:include: Contributors.rdoc
:include: License.rdoc
ruby-net-ldap-0.16.1/Rakefile 0000664 0000000 0000000 00000001137 13176556204 0015742 0 ustar 00root root 0000000 0000000 # -*- ruby encoding: utf-8 -*-
# vim: syntax=ruby
require 'rake/testtask'
require 'rubocop/rake_task'
require 'bundler'
RuboCop::RakeTask.new
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/test_*.rb']
t.verbose = true
t.description = 'Run tests, set INTEGRATION=openldap to run integration tests, INTEGRATION_HOST and INTEGRATION_PORT are also supported'
end
desc 'Run tests and RuboCop (RuboCop runs on mri only)'
task ci: [:test]
desc 'Run tests and RuboCop'
task rubotest: [:test, :rubocop]
task default: Bundler.current_ruby.mri? ? [:test, :rubocop] : [:test]
ruby-net-ldap-0.16.1/lib/ 0000775 0000000 0000000 00000000000 13176556204 0015041 5 ustar 00root root 0000000 0000000 ruby-net-ldap-0.16.1/lib/net-ldap.rb 0000664 0000000 0000000 00000000062 13176556204 0017070 0 ustar 00root root 0000000 0000000 # -*- ruby encoding: utf-8 -*-
require 'net/ldap'
ruby-net-ldap-0.16.1/lib/net/ 0000775 0000000 0000000 00000000000 13176556204 0015627 5 ustar 00root root 0000000 0000000 ruby-net-ldap-0.16.1/lib/net/ber.rb 0000664 0000000 0000000 00000033305 13176556204 0016730 0 ustar 00root root 0000000 0000000 # -*- ruby encoding: utf-8 -*-
require 'net/ldap/version'
module Net # :nodoc:
##
# == Basic Encoding Rules (BER) Support Module
#
# Much of the text below is cribbed from Wikipedia:
# http://en.wikipedia.org/wiki/Basic_Encoding_Rules
#
# The ITU Specification is also worthwhile reading:
# http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
#
# The Basic Encoding Rules were the original rules laid out by the ASN.1
# standard for encoding abstract information into a concrete data stream.
# The rules, collectively referred to as a transfer syntax in ASN.1
# parlance, specify the exact octet sequences which are used to encode a
# given data item. The syntax defines such elements as: the
# representations for basic data types, the structure of length
# information, and the means for defining complex or compound types based
# on more primitive types. The BER syntax, along with two subsets of BER
# (the Canonical Encoding Rules and the Distinguished Encoding Rules), are
# defined by the ITU-T's X.690 standards document, which is part of the
# ASN.1 document series.
#
# == Encoding
# The BER format specifies a self-describing and self-delimiting format
# for encoding ASN.1 data structures. Each data element is encoded as a
# type identifier, a length description, the actual data elements, and
# where necessary, an end-of-content marker. This format allows a receiver
# to decode the ASN.1 information from an incomplete stream, without
# requiring any pre-knowledge of the size, content, or semantic meaning of
# the data.
#
# | Name | Primitive Constructed | Number |
|---|---|---|
| EOC (End-of-Content) | P | 0: 0 (0x0, 0b00000000) |
| BOOLEAN | P | 1: 1 (0x01, 0b00000001) |
| INTEGER | P | 2: 2 (0x02, 0b00000010) |
| BIT STRING | P | 3: 3 (0x03, 0b00000011) |
| BIT STRING | C | 3: 35 (0x23, 0b00100011) |
| OCTET STRING | P | 4: 4 (0x04, 0b00000100) |
| OCTET STRING | C | 4: 36 (0x24, 0b00100100) |
| NULL | P | 5: 5 (0x05, 0b00000101) |
| OBJECT IDENTIFIER | P | 6: 6 (0x06, 0b00000110) |
| Object Descriptor | P | 7: 7 (0x07, 0b00000111) |
| EXTERNAL | C | 8: 40 (0x28, 0b00101000) |
| REAL (float) | P | 9: 9 (0x09, 0b00001001) |
| ENUMERATED | P | 10: 10 (0x0a, 0b00001010) |
| EMBEDDED PDV | C | 11: 43 (0x2b, 0b00101011) |
| UTF8String | P | 12: 12 (0x0c, 0b00001100) |
| UTF8String | C | 12: 44 (0x2c, 0b00101100) |
| RELATIVE-OID | P | 13: 13 (0x0d, 0b00001101) |
| SEQUENCE and SEQUENCE OF | C | 16: 48 (0x30, 0b00110000) |
| SET and SET OF | C | 17: 49 (0x31, 0b00110001) |
| NumericString | P | 18: 18 (0x12, 0b00010010) |
| NumericString | C | 18: 50 (0x32, 0b00110010) |
| PrintableString | P | 19: 19 (0x13, 0b00010011) |
| PrintableString | C | 19: 51 (0x33, 0b00110011) |
| T61String | P | 20: 20 (0x14, 0b00010100) |
| T61String | C | 20: 52 (0x34, 0b00110100) |
| VideotexString | P | 21: 21 (0x15, 0b00010101) |
| VideotexString | C | 21: 53 (0x35, 0b00110101) |
| IA5String | P | 22: 22 (0x16, 0b00010110) |
| IA5String | C | 22: 54 (0x36, 0b00110110) |
| UTCTime | P | 23: 23 (0x17, 0b00010111) |
| UTCTime | C | 23: 55 (0x37, 0b00110111) |
| GeneralizedTime | P | 24: 24 (0x18, 0b00011000) |
| GeneralizedTime | C | 24: 56 (0x38, 0b00111000) |
| GraphicString | P | 25: 25 (0x19, 0b00011001) |
| GraphicString | C | 25: 57 (0x39, 0b00111001) |
| VisibleString | P | 26: 26 (0x1a, 0b00011010) |
| VisibleString | C | 26: 58 (0x3a, 0b00111010) |
| GeneralString | P | 27: 27 (0x1b, 0b00011011) |
| GeneralString | C | 27: 59 (0x3b, 0b00111011) |
| UniversalString | P | 28: 28 (0x1c, 0b00011100) |
| UniversalString | C | 28: 60 (0x3c, 0b00111100) |
| CHARACTER STRING | P | 29: 29 (0x1d, 0b00011101) |
| CHARACTER STRING | C | 29: 61 (0x3d, 0b00111101) |
| BMPString | P | 30: 30 (0x1e, 0b00011110) |
| BMPString | C | 30: 62 (0x3e, 0b00111110) |
| ExtendedResponse | C | 107: 139 (0x8b, 0b010001011) |
| Bitmask | Definition |
|---|---|
| 0b00______ | Universal (ASN.1 Native) Types |
| 0b01______ | Application Types |
| 0b10______ | Context-Specific Types |
| 0b11______ | Private Types |
| Bitmask | Definition |
|---|---|
| 0b__0_____ | Primitive |
| 0b__1_____ | Constructed |
| Range | #Length | #
|---|---|
| 0x00 -- 0x7f 0b00000000 -- 0b01111111 |
# 0 - 127 bytes | #
| 0x80 0b10000000 |
# Indeterminate (end-of-content marker required) | #
| 0x81 -- 0xfe 0b10000001 -- 0b11111110 |
# 1 - 126 bytes of length as an integer value | #
| 0xff 0b11111111 |
# Illegal (reserved for future expansion) | #