packages: redmine/redmine.spec, redmine/redmine-ldap.patch (NEW) - replace ...
baggins
baggins at pld-linux.org
Sun Mar 7 23:32:11 CET 2010
Author: baggins Date: Sun Mar 7 22:32:11 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- replace ruby-net-ldap with ruby-ldap (net-ldap is quite dead
and incompatible with ruby 1.9)
---- Files affected:
packages/redmine:
redmine.spec (1.17 -> 1.18) , redmine-ldap.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/redmine/redmine.spec
diff -u packages/redmine/redmine.spec:1.17 packages/redmine/redmine.spec:1.18
--- packages/redmine/redmine.spec:1.17 Sun Mar 7 12:04:09 2010
+++ packages/redmine/redmine.spec Sun Mar 7 23:32:06 2010
@@ -14,6 +14,7 @@
# Source0-md5: 5a95eec4d26ec3819ffeff42137d5023
Source1: %{name}.conf
Patch0: %{name}-pld.patch
+Patch1: %{name}-ldap.patch
URL: http://www.redmine.org/
BuildRequires: dos2unix
BuildRequires: rpmbuild(macros) >= 1.202
@@ -21,6 +22,7 @@
Requires(postun): /usr/sbin/userdel
Requires(pre): /bin/id
Requires(pre): /usr/sbin/useradd
+Requires: apache(mod_rails)
Requires: ruby-RMagic
Requires: ruby-SyslogLogger
Requires: ruby-coderay
@@ -34,7 +36,7 @@
Suggests: mercurial
Suggests: ruby-mocha
Suggests: ruby-mysql
-Suggests: ruby-net-ldap
+Suggests: ruby-ldap
Suggests: ruby-openid >= 2.1.4
Suggests: subversion >= 1.3
Provides: user(redmine)
@@ -103,6 +105,7 @@
find -type f -print0 | xargs -0 dos2unix -k -q
%patch0 -p1
+%patch1 -p1
find -type f -print0 | \
xargs -0 %{__sed} -i -e 's,/usr/bin/env ruby,%{__ruby},' \
@@ -244,6 +247,10 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.18 2010/03/07 22:32:06 baggins
+- replace ruby-net-ldap with ruby-ldap (net-ldap is quite dead
+ and incompatible with ruby 1.9)
+
Revision 1.17 2010/03/07 11:04:09 baggins
- TODO
- added post
================================================================
Index: packages/redmine/redmine-ldap.patch
diff -u /dev/null packages/redmine/redmine-ldap.patch:1.1
--- /dev/null Sun Mar 7 23:32:11 2010
+++ packages/redmine/redmine-ldap.patch Sun Mar 7 23:32:06 2010
@@ -0,0 +1,93 @@
+diff -ur redmine-0.9.3/app/models/auth_source_ldap.rb redmine-0.9.3-ldap/app/models/auth_source_ldap.rb
+--- redmine-0.9.3/app/models/auth_source_ldap.rb 2010-03-07 23:29:20.233868713 +0100
++++ redmine-0.9.3-ldap/app/models/auth_source_ldap.rb 2010-03-07 23:28:36.000000000 +0100
+@@ -16,9 +16,9 @@
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ begin
+- require 'net/ldap'
++ require 'ldap'
+ rescue LoadError
+- # NET::LDAP is not available
++ # LDAP is not available
+ end
+
+ require 'iconv'
+@@ -40,14 +40,13 @@
+ return nil if login.blank? || password.blank?
+ attrs = []
+ # get user's DN
+- ldap_con = initialize_ldap_con(self.account, self.account_password)
+- login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
+- object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
++ ldap_con = initialize_ldap_con
++ ldap_con.bind(self.account, self.account_password)
+ dn = String.new
+- ldap_con.search( :base => self.base_dn,
+- :filter => object_filter & login_filter,
++ ldap_con.search( self.base_dn, LDAP::LDAP_SCOPE_SUBTREE,
++ "(&(objectClass=*)(#{self.attr_login}=#{login}))",
+ # only ask for the DN if on-the-fly registration is disabled
+- :attributes=> (onthefly_register? ? ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail] : ['dn'])) do |entry|
++ (onthefly_register? ? ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail] : ['dn'])) do |entry|
+ dn = entry.dn
+ attrs = [:firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),
+ :lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),
+@@ -56,22 +55,26 @@
+ end
+ return nil if dn.empty?
+ logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?
++ ldap_con.unbind
+ # authenticate user
+- ldap_con = initialize_ldap_con(dn, password)
+- return nil unless ldap_con.bind
++ ldap_con = initialize_ldap_con
++ ldap_con.bind(dn, password)
++ ldap_con.unbind
+ # return user's attributes
+ logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
+- attrs
+- rescue Net::LDAP::LdapError => text
+- raise "LdapError: " + text
++ attrs
++ rescue LDAP::ResultError => error
++ logger.fatal "Authentication failure for '#{login}' (#{error})" if logger && logger.fatal?
++ return nil
+ end
+
+ # test the connection to the LDAP
+ def test_connection
+- ldap_con = initialize_ldap_con(self.account, self.account_password)
+- ldap_con.open { }
+- rescue Net::LDAP::LdapError => text
+- raise "LdapError: " + text
++ ldap_con = initialize_ldap_con
++ ldap_con.bind(self.account, self.account_password)
++ ldap_con.unbind
++ rescue LDAP::ResultError => error
++ raise error
+ end
+
+ def auth_method_name
+@@ -86,13 +89,14 @@
+ end
+ end
+
+- def initialize_ldap_con(ldap_user, ldap_password)
+- options = { :host => self.host,
+- :port => self.port,
+- :encryption => (self.tls ? :simple_tls : nil)
+- }
+- options.merge!(:auth => { :method => :simple, :username => ldap_user, :password => ldap_password }) unless ldap_user.blank? && ldap_password.blank?
+- Net::LDAP.new options
++ def initialize_ldap_con
++ if self.tls?
++ conn = LDAP::SSLConn.new(self.host, self.port)
++ else
++ conn = LDAP::Conn.new(self.host, self.port)
++ end
++ conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
++ conn
+ end
+
+ def self.get_attr(entry, attr_name)
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/redmine/redmine.spec?r1=1.17&r2=1.18&f=u
More information about the pld-cvs-commit
mailing list