morhekil-ipcauthpipe 0.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ipcauthpipe.gemspec +3 -3
- data/lib/ipcauthpipe/handler/auth.rb +3 -1
- data/lib/ipcauthpipe/handler/pre.rb +1 -0
- data/lib/models/member.rb +11 -2
- data/test/config.yml +2 -2
- data/test/models/member_spec.rb +2 -2
- metadata +4 -3
data/ipcauthpipe.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "ipcauthpipe"
|
3
|
-
s.version = "0.2"
|
4
|
-
s.date = "
|
3
|
+
s.version = "0.2.1"
|
4
|
+
s.date = "2009-06-11"
|
5
5
|
s.summary = "Implementation of Courier's authpipe protocol over Invision Power Board / Converge."
|
6
6
|
s.description = "ipcauthpipe gem implements Courier's authpipe protocol to interface Courier POP/IMAP server with Invision Power Board / Converge members database."
|
7
7
|
s.has_rdoc = false
|
8
8
|
|
9
9
|
s.author = "Oleg Ivanov"
|
10
10
|
s.email = "morhekil@morhekil.net"
|
11
|
-
s.homepage = "http://
|
11
|
+
s.homepage = "http://morhekil.net"
|
12
12
|
|
13
13
|
s.files = ['lib/ipcauthpipe/handler/auth.rb',
|
14
14
|
'lib/ipcauthpipe/handler/enumerate.rb',
|
@@ -71,7 +71,9 @@ module IpcAuthpipe
|
|
71
71
|
# LOGIN type authentication handler
|
72
72
|
def validate_with_login(authdata)
|
73
73
|
Log.debug "Authenticating through type LOGIN with #{authdata.inspect}"
|
74
|
-
Member.find_by_name_and_password(authdata[:username], authdata[:password])
|
74
|
+
member = Member.find_by_name_and_password(authdata[:username], authdata[:password])
|
75
|
+
member.create_homedir # make sure that homedir is created
|
76
|
+
member.to_authpipe # and return the details
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
@@ -21,6 +21,7 @@ module IpcAuthpipe
|
|
21
21
|
# Finds member by his username and dumps his details, returns FAIL if not member were found
|
22
22
|
def user_details(request)
|
23
23
|
member = Member.find_by_name(request[:username])
|
24
|
+
member.create_homedir unless member.nil? # make sure the homedir exists
|
24
25
|
|
25
26
|
member.nil? ? "FAIL\n" : member.to_authpipe
|
26
27
|
end
|
data/lib/models/member.rb
CHANGED
@@ -11,14 +11,23 @@ class Member < ActiveRecord::Base
|
|
11
11
|
|
12
12
|
member
|
13
13
|
end
|
14
|
+
|
15
|
+
def homedir
|
16
|
+
IpcAuthpipe::config.mail['home_dir'] % "#{name[0..0]}/#{name}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Create user's home dir if it's not present
|
20
|
+
def create_homedir
|
21
|
+
FileUtils.mkdir(member.homedir, :mode => '0755') unless File.exists?(member.homedir)
|
22
|
+
end
|
14
23
|
|
15
24
|
def to_authpipe
|
16
25
|
IpcAuthpipe::Log.debug "Dumping authpipe string for member data #{inspect}"
|
17
26
|
stringdump = [
|
18
27
|
"UID=#{IpcAuthpipe::config.mail['owner_uid']}",
|
19
28
|
"GID=#{IpcAuthpipe::config.mail['owner_gid']}",
|
20
|
-
"HOME=#{
|
21
|
-
"MAILDIR=#{
|
29
|
+
"HOME=#{homedir}/",
|
30
|
+
"MAILDIR=#{homedir}/",
|
22
31
|
"ADDRESS=#{IpcAuthpipe::config.mail['address_format'] % name}",
|
23
32
|
"."
|
24
33
|
].join("\n")+"\n"
|
data/test/config.yml
CHANGED
data/test/models/member_spec.rb
CHANGED
@@ -47,8 +47,8 @@ describe 'Member' do
|
|
47
47
|
member.to_authpipe.should == [
|
48
48
|
"UID=#{IpcAuthpipe::config.mail['owner_uid']}",
|
49
49
|
"GID=#{IpcAuthpipe::config.mail['owner_gid']}",
|
50
|
-
"HOME=/home/vmail/tester/",
|
51
|
-
"MAILDIR=/home/vmail/tester/",
|
50
|
+
"HOME=/home/vmail/t/tester/",
|
51
|
+
"MAILDIR=/home/vmail/t/tester/",
|
52
52
|
"ADDRESS=tester@poker.ru",
|
53
53
|
"."
|
54
54
|
].join("\n") + "\n"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morhekil-ipcauthpipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Ivanov
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-06-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -46,7 +47,7 @@ files:
|
|
46
47
|
- README
|
47
48
|
- config.yml
|
48
49
|
has_rdoc: false
|
49
|
-
homepage: http://
|
50
|
+
homepage: http://morhekil.net
|
50
51
|
post_install_message:
|
51
52
|
rdoc_options: []
|
52
53
|
|