Authen-SASL-XS
view release on metacpan or search on metacpan
int rc;
unsigned outlen;
STRLEN inlen;
#ifdef SASL2
const char *outstring = NULL;
#else
char *outstring = NULL;
const char *error =NULL;
#endif
PPCODE:
_DEBUG("serverstart mech: %s",sasl->mech);
if (sasl->error_code)
XSRETURN_UNDEF;
if (instring != NULL)
SvPV(ST(1),inlen);
else
inlen = 0;
PREINIT:
int rc;
unsigned outlen;
#ifdef SASL2
const char *outstring;
#else
char *outstring;
#endif
const char *mech;
PPCODE:
if (sasl->error_code != SASL_OK)
XSRETURN_UNDEF;
_DEBUG("mech: %s",sasl->mech);
#ifdef SASL2
rc = sasl_client_start(sasl->conn, sasl->mech, NULL, &outstring, &outlen, &mech);
#else
rc = sasl_client_start(sasl->conn, sasl->mech, NULL, NULL, &outstring, &outlen, &mech);
#endif
_DEBUG("client_start. error %x, len: %d",rc,outlen);
PREINIT:
#ifdef SASL2
const char *outstring=NULL;
#else
char *outstring=NULL;
const char *error=NULL;
#endif
int rc;
unsigned int outlen=0;
STRLEN inlen;
PPCODE:
if (sasl->error_code != SASL_CONTINUE)
XSRETURN_UNDEF;
SvPV(ST(1),inlen);
_DEBUG("Server step: %s %d", instring,inlen);
#ifdef SASL2
rc = sasl_server_step(sasl->conn,instring,inlen,&outstring,&outlen);
#else
rc = sasl_server_step(sasl->conn,instring,inlen,&outstring,&outlen,NULL);
#endif
=item
=cut
char *
client_step(sasl, instring)
Authen_SASL_XS sasl
char *instring
PPCODE:
{
#ifdef SASL2
const char *outstring=NULL;
#else
char *outstring=NULL;
#endif
int rc;
unsigned int outlen=0;
STRLEN inlen;
and END is the token which will be put at the end of returned string.
=cut
char *
listmech(sasl,start="",separator="|",end="")
Authen_SASL_XS sasl;
const char* start;
const char* separator;
const char* end;
PPCODE:
{
int rc;
#ifdef SASL2
const char *mechs;
#else
char *mechs;
#endif
int mechcount;
unsigned mechlen;
int
setpass(sasl, user, pass, oldpass, flags=0)
Authen_SASL_XS sasl;
const char *user;
const char *pass;
const char *oldpass;
int flags;
PREINIT:
int rc;
PPCODE:
_DEBUG("setpass: %s,%s,%s,%d",user,pass,oldpass,flags);
rc = sasl_setpass (sasl->conn,user,
pass,strlen(pass),
oldpass,strlen(oldpass),
flags);
XPUSHi(rc);
int checkpass(sasl,user,pass)
Authen_SASL_XS sasl;
const char *user;
const char *pass;
PREINIT:
int rc;
PPCODE:
_DEBUG("checkpass: %s,%s",user,pass);
rc = sasl_checkpass (sasl->conn,
user, strlen(user),
pass, strlen(pass));
XPUSHi(rc);
=pod
=item global_listmech ( )
=cut
void
global_listmech(sasl)
Authen_SASL_XS sasl
PREINIT:
int i;
const char **mechs;
PPCODE:
if (sasl->error_code)
XSRETURN_UNDEF;
mechs = sasl_global_listmech();
if (mechs)
for (i = 0; mechs[i]; i++)
XPUSHs(sv_2mortal(newSVpv(mechs[i],0)));
else
XSRETURN_UNDEF;
#endif
C<decode> returns the decrypted string generated from STRING.
It depends on the used mechanism how secure the encryption will be.
=cut
char *
encode(sasl, instring)
Authen_SASL_XS sasl
char *instring
PPCODE:
{
#ifdef SASL2
const char *outstring=NULL;
#else
char *outstring=NULL;
#endif
int rc;
unsigned int outlen=0;
STRLEN inlen;
if (sasl->error_code)
XPUSHp(outstring, outlen);
}
char *
decode(sasl, instring)
Authen_SASL_XS sasl
char *instring
PPCODE:
{
#ifdef SASL2
const char *outstring=NULL;
#else
char *outstring=NULL;
#endif
int rc;
unsigned int outlen=0;
STRLEN inlen;
is given back. Additionally the special Authen::SASL::XS advise is
returned if set.
After calling the C<error> function, the error code and the special advice
are thrown away.
=cut
char *
error(sasl)
Authen_SASL_XS sasl
PPCODE:
{
_DEBUG("Current Error %x",sasl->error_code);
XPUSHs(newSVpv((char *)sasl_errstring(sasl->error_code,NULL,NULL),0));
#ifdef SASL2
XPUSHs(newSVpv((char *)sasl_errdetail(sasl->conn),0));
#endif
if (sasl->additional_errormsg != NULL)
XPUSHs(newSVpv(sasl->additional_errormsg,0));
Authen_SASL_XS sasl;
CODE:
RETVAL = sasl->error_code == SASL_CONTINUE;
OUTPUT:
RETVAL
int
property(sasl, ...)
Authen_SASL_XS sasl
PPCODE:
{
#ifdef SASL2
const void *value=NULL;
#else
void *value=NULL;
#endif
char *name;
int rc, x, propnum=-1;
SV *prop;
( run in 1.471 second using v1.01-cache-2.11-cpan-71847e10f99 )