Authen-SASL-XS
view release on metacpan or search on metacpan
C<mechanism> returns the current used authentication mechanism.
=cut
char *
mechanism(sasl)
Authen_SASL_XS sasl
CODE:
RETVAL = sasl->mech;
OUTPUT:
RETVAL
char *
host(sasl, ...)
Authen_SASL_XS sasl
CODE:
if (items > 1) {
if (sasl->server) free(sasl->server);
sasl->server = strdup(SvPV_nolen(ST(1)));
}
RETVAL = sasl->server;
OUTPUT:
RETVAL
char *
user(sasl, ...)
Authen_SASL_XS sasl
CODE:
if (items > 1) {
if (sasl->user) free(sasl->user);
sasl->user = strdup(SvPV_nolen(ST(1)));
}
RETVAL = sasl->user;
OUTPUT:
RETVAL
char *
service(sasl, ...)
Authen_SASL_XS sasl
CODE:
if (items > 1) {
if (sasl->service) free(sasl->service);
sasl->service = strdup(SvPV_nolen(ST(1)));
}
RETVAL = sasl->service;
OUTPUT:
RETVAL
=pod
=item need_step ( )
C<need_step> returns true if another step is need by the SASL library. Otherwise
false is returned. You can also use C<code == 1> but it looks smarter I think.
That's why we all using perl, eh?
=cut
int
need_step(sasl)
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;
RETVAL = SASL_OK;
if (!sasl->conn) {
#ifdef SASL2
SetSaslError(sasl,SASL_NOTINIT,"property failed, init missed.");
RETVAL = SASL_NOTINIT;
#else
SetSaslError(sasl,SASL_FAIL,"property failed, init missed.");
RETVAL = SASL_FAIL;
#endif
items = 0;
}
/* Querying the value of a property */
if (items == 2) {
name = SvPV_nolen(ST(1));
propnum = PropertyNumber(name);
rc = sasl_getprop(sasl->conn, propnum, &value);
if (value == NULL || rc != SASL_OK)
XSRETURN_UNDEF;
switch(propnum){
case SASL_USERNAME:
#ifdef SASL2
case SASL_DEFUSERREALM:
#else
case SASL_REALM:
#endif
XPUSHp( (char *)value, strlen((char *)value));
break;
case SASL_SSF:
case SASL_MAXOUTBUF:
XPUSHi((long int)value);
( run in 3.356 seconds using v1.01-cache-2.11-cpan-13bb782fe5a )