ejabberd_auth_pam and offline message

Orginal ejabberd_auth_pam don't support offline message because is_user_exists always return false. I write simple patch:

Quote:

--- ejabberd_auth_pam.erl.org 2007-01-13 19:14:59.000000000 +0100
+++ ejabberd_auth_pam.erl.new 2007-01-13 19:16:41.000000000 +0100
@@ -69,7 +69,19 @@
[].

is_user_exists( _User, _Server ) ->
- false.
+ {ok,FileBin}=file:read_file("/etc/passwd"),
+ Tmp=binary_to_list(FileBin),
+ FileStr=string:concat("\n", Tmp),
+
+ Tmp2=string:concat("\n", _User),
+ RegExp=string:concat(Tmp2, ":"),
+
+ case regexp:match(FileStr, RegExp) of
+ {match, _, _} ->
+ true;
+ _ ->
+ false
+ end.

get_password( _User, _Server ) ->
false.

It search user in /etc/passwd and if find it return true and allow storage offline message for this user.

Thanks, I've updated the

Thanks, I've updated the patch with your code.

ok, thanks :-)

ok, thanks :-)

STOP!!! Do not use patch!!!

STOP!!! Do not use patch!!! this'is not try pam way... for search exsist user!!!

I know it isn't PAM way and

I know it isn't PAM way and it is possible to think of PAM way or ejabberd way (only after first xmpp login offline message work), but this is little better than disable for all pam users offline message.

Hm... don't care... find

Hm... don't care... find user only in "/etc/passwd"... this is bed realization pam_unix lib...
Need use "pam_acct_mgmt" in pam api!... i can fix you problem... coming soon

Syndicate content