File: sample-client.pl

package info (click to toggle)
libauthen-sasl-cyrus-perl 0.02-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 76 kB
  • ctags: 13
  • sloc: perl: 163; makefile: 55
file content (26 lines) | stat: -rwxr-xr-x 712 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl -I../blib/lib -I../blib/arch

use Authen::SASL::Cyrus;
use MIME::Base64;

$conn=Authen::SASL::Cyrus::init_connection("ldap",
					     "loki.dcs.ed.ac.uk",
					     "sxw");

$mesg=Authen::SASL::Cyrus::start($conn,"PLAIN GSSAPI ANONYMOUS");
print "C: ",encode_base64("GSSAPI\0".$mesg,""),"\n";

while (Authen::SASL::Cyrus::error()==
	Authen::SASL::Cyrus::SASL_CONTINUE) {
  $inmsg=<STDIN>;
  $inmsg=~s/^S: //;
  $inmsg=decode_base64($inmsg);
  $mesg=Authen::SASL::Cyrus::respond($conn,$inmsg);
  print "C: ",encode_base64($mesg,""),"\n";
}

if (Authen::SASL::Cyrus::error()!=Authen::SASL::Cyrus::SASL_OK) {
  print "Failed: ",Authen::SASL::Cyrus::error(),"\n";
} else {
  print "Succeeded!\n";
}