How to obtain username and User-Password in a module
Hi, I'm coding a basic authorization module for FreeRadius, and i have a problem. When FreeRadius tries to authenticate says that: rlm_digest: Configuration item "User-Password" is required for authentication. Here is the function that do athorization in the module: static int xml_rpc_auth(void *instance, REQUEST *request) { int result; VALUE_PAIR **input_pairs, **output_pairs; VALUE_PAIR *answer, *check_pairs; rlm_xml_rpc_t *inst = (rlm_xml_rpc_t *) instance; int accept; const char username[1000], password[1000], realm[1000]; char cadena[1000]; char usrn[1000], pw[1000], rm[1000]; VALUE_PAIR *vpr, *vpd; DICT_ATTR *dict_attr; result = vp_prints(cadena, 1000, request->config_items); if ( result ) radlog(L_ERR, "En vp_prints config_items: %s", cadena); if ( request->config_items->next != NULL ) result = vp_prints(cadena, 1000, request->config_items->next); if ( result ) radlog(L_ERR, "En vp_prints config_items->next: %s", cadena); radlog(L_ERR, "En vp_prints_value request->packet->code: %d", request->packet->code); strcpy(username, request->username->strvalue); radlog(L_ERR, "En vp_prints_value username: %s", username); if ( request->password ){ strcpy(password, request->password->strvalue); radlog(L_ERR, "En vp_prints_value password: %s", password); //result = vp_prints_value(password, 1000, request->password, 254); } radlog(L_ERR, "Atribute del password: %s", request->password->name); /* * We require access to the plain-text password. */ if( request->packet->vps ){ vpr = pairfind(request->packet->vps, PW_DIGEST_REALM); if (!vpr) { radlog(L_AUTH, "rlm_xml_rpc: Configuration item\"Realm\" is required for" "authentication."); } } if ( vpr ){ strcpy(realm, vpr->strvalue); radlog(L_ERR, "rlm_xml_rpc: XML-RPC %d %p %p %p\n",accept, username, password, realm); result = xml_rpc_call(inst, request, &accept, username, password, realm, usrn, pw, rm); radlog(L_ERR, "rlm_xml_rpc: XML-RPC %d %s %s %s\n",accept, username, password, realm); radlog(L_ERR, "PW segun xml_rpc_call es %s\n", pw); vpr = rad_malloc(sizeof(VALUE_PAIR)); dict_attr = rad_malloc(sizeof(DICT_ATTR)); if(vpr && dict_attr){ dict_attr = dict_attrbyname("User-Password"); strcpy(vpr->name, "User-Password"); vpr->attribute = dict_attr->attr; vpr->type = dict_attr->type; vpr->length = strlen(pw); strcpy(vpr->strvalue, pw); vpr->flags = dict_attr->flags; vpr->operator = T_OP_EQ; radlog(L_ERR, "rlm_xml_rpc: creando el VALUE_PAIR con el password para meterlo en request->config" "y requerido para la authenticacion" "vpr->name = %s\n" "vpr->attribute = %d\n" "vpr->type = %d\n" "vpr->length = %d\n" "vpr->strvalue = %s\n", vpr->name, vpr->attribute, vpr->type, vpr->length, vpr->strvalue); } radlog(L_ERR, "rlm_xml_rpc: qué hay? %s %s %s", username, password, realm); if ( accept ) request->config_items = vpr; return RLM_MODULE_OK; } }
Juan Luis Perez Perez <jperez@telecomsolutions.es> wrote:
I'm coding a basic authorization module for FreeRadius, and i have a problem. When FreeRadius tries to authenticate says that:
rlm_digest: Configuration item "User-Password" is required for authentication.
That message isn't in the code you posted, so it's a result of your local configuration. And I *won't* debug the code you posted. Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
participants (2)
-
Alan DeKok -
Juan Luis Perez Perez