summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2004-07-30 21:09:55 +0000
committerAlexey Shchepin <alexey@process-one.net>2004-07-30 21:09:55 +0000
commit6cd02b971457219aa239d5f76dfb98c8e7fa397f (patch)
treec41fd747d55b8825d8e88f10aba0afa7a4723d98 /examples
parent* src/tls/tls_drv.c: Added freeing of SSL stuff (diff)
* examples/extauth/check_pass_null.pl: A reference "null"
implementation of external authentification script (thanks to Leif Johansson) * src/extauth.erl: Support for external authentification (thanks to Leif Johansson) * src/ejabberd_auth.erl: Likewise * src/mod_vcard_ldap.erl: A drop-in replacement for mod_vcard.erl which uses ldap for JUD and vCard (thanks to Leif Johansson) SVN Revision: 251
Diffstat (limited to 'examples')
-rw-r--r--examples/extauth/check_pass_null.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/extauth/check_pass_null.pl b/examples/extauth/check_pass_null.pl
new file mode 100644
index 00000000..7291abf0
--- /dev/null
+++ b/examples/extauth/check_pass_null.pl
@@ -0,0 +1,50 @@
+#!/usr/local/bin/perl
+
+use Unix::Syslog qw(:macros :subs);
+
+my $domain = $ARGV[0] || "example.com";
+
+while(1)
+ {
+ # my $rin = '',$rout;
+ # vec($rin,fileno(STDIN),1) = 1;
+ # $ein = $rin;
+ # my $nfound = select($rout=$rin,undef,undef,undef);
+
+ my $buf = "";
+ syslog LOG_INFO,"waiting for packet";
+ my $nread = sysread STDIN,$buf,2;
+ do { syslog LOG_INFO,"port closed"; exit; } unless $nread == 2;
+ my $len = unpack "n",$buf;
+ my $nread = sysread STDIN,$buf,$len;
+
+ my ($op,$user,$password) = split /:/,$buf;
+ #$user =~ s/\./\//og;
+ my $jid = "$user\@$domain";
+ my $result;
+
+ syslog(LOG_INFO,"request (%s)", $op);
+
+ SWITCH:
+ {
+ $op eq 'auth' and do
+ {
+ $result = 1;
+ },last SWITCH;
+
+ $op eq 'setpass' and do
+ {
+ $result = 1;
+ },last SWITCH;
+
+ $op eq 'isuser' and do
+ {
+ # password is null. Return 1 if the user $user\@$domain exitst.
+ $result = 1;
+ },last SWITCH;
+ };
+ my $out = pack "nn",2,$result ? 1 : 0;
+ syswrite STDOUT,$out;
+ }
+
+closelog;