}
static int
-sock_write(JRADIUS * inst, JRSOCK *jrsock, char *b, size_t blen) {
+sock_write(JRADIUS * inst, JRSOCK *jrsock, uint8_t *b, size_t blen) {
int fd = jrsock->con.sock;
int timeout = inst->write_timeout;
struct timeval tv;
for (vp = vps; vp != NULL; vp = vp->next) {
- radlog(L_DBG, LOG_PREFIX "packing attribute %s (type: %d; len: %d)", vp->name, vp->attribute, vp->length);
+ radlog(L_DBG, LOG_PREFIX "packing attribute %s (type: %d; len: %u)", vp->name, vp->attribute, (unsigned int) vp->length);
i = vp->attribute; /* element is int, not uint32_t */
if (pack_uint32(ba, i) == -1) return -1;
/*
* Create new attribute
*/
- vp = paircreate(atype, -1);
+ vp = paircreate(atype, 0, -1);
vp->operator = aop;
if (vp->type == -1) {
}
/*
+ * WiMAX combo-ip address
+ * paircreate() cannot recognize the real type of the address.
+ * ..ugly code...
+ */
+ if (vp->type==PW_TYPE_COMBO_IP) {
+ switch (alen) {
+ case 4:
+ vp->type = PW_TYPE_IPADDR;
+ break;
+ case 16:
+ vp->type = PW_TYPE_IPV6ADDR;
+ break;
+ }
+ }
+
+ /*
* Fill in the attribute value based on type
*/
switch (vp->type) {
static int rlm_jradius_call(char func, void *instance, REQUEST *req, int isproxy)
{
JRADIUS * inst = instance;
- RADIUS_PACKET * request = isproxy ? req->proxy : req->packet;
- RADIUS_PACKET * reply = isproxy ? req->proxy_reply : req->reply;
+ RADIUS_PACKET * request = req->packet;
+ RADIUS_PACKET * reply = req->reply;
JRSOCK * jrsock = 0;
JRSOCK sjrsock;
#define W_ERR(s) { err=s; goto packerror; }
#define R_ERR(s) { err=s; goto parseerror; }
+#ifdef WITH_PROXY
+ if (isproxy) {
+ request = req->proxy;
+ reply = req->proxy_reply;
+ }
+#endif
+
if (inst->keepalive) {
jrsock = get_socket(inst);
if (!jrsock) return exitstatus;
* we need to reconfigure a few pointers in the REQUEST object
*/
if (req->username) {
- req->username = pairfind(request->vps, PW_USER_NAME);
+ req->username = pairfind(request->vps, PW_USER_NAME, 0);
}
if (req->password) {
- req->password = pairfind(request->vps, PW_PASSWORD);
- if (!req->password) req->password = pairfind(request->vps, PW_CHAP_PASSWORD);
+ req->password = pairfind(request->vps, PW_PASSWORD, 0);
+ if (!req->password) req->password = pairfind(request->vps, PW_CHAP_PASSWORD, 0);
}
/*