[sr-dev] k/auth_radius module based on s/auth module

Juha Heinanen jh at tutpro.com
Fri Jul 2 21:43:40 CEST 2010


> My guess is that it would be easy. The differences are mainly in
> exported callbacks and some missing or extra script functions.
> k version has the *challenge() functions (which were removed from ser,
> but could be re-added easily) and some pv stuff.

andrei,

i tried to add k compatible www_challenge/proxy_challenge functions to
modules_s/auth and it is not easy (at least for me).  i created function

static inline int build_hf(struct sip_msg* msg, int stale, str* realm,
			    str* nonce, str* algorithm, int hftype, str* hf)

that just builds the hf str and then using it, it is easy to implement
current build_challenge_hf function:

int build_challenge_hf(struct sip_msg* msg, int stale, str* realm, str* nonce,
		       str* algorithm, int hftype)
{
    str hf;
    avp_value_t val;
    
    if (build_hf(msg, stale, realm, nonce, algorithm, hftype, &hf)) {
	val.s = hf;
	if (add_avp(challenge_avpid.flags | AVP_VAL_STR, challenge_avpid.name,
		    val) < 0) {
	    ERR("auth: Error while creating attribute\n");
	    pkg_free(hf.s);
	    return -1;
	}
	pkg_free(hf.s);
	return 0;
    } else {
	return -1;
    }
}

but when i tried to implement k *_challenge functions using it, i was
not able to figure out how to create nonce parameter.  also, qop is
module param in s auth.

-- juha



More information about the sr-dev mailing list