int got, slot;
int got;
radius_Authenticate(struct radius *r, struct authinfo *authp, const char *name,                    const char *key, int klen, const char *challenge, int clen){  struct ttyent *ttyp;  struct timeval tv;  int got, slot;  char hostname[MAXHOSTNAMELEN];  struct hostent *hp;  struct in_addr hostaddr;  if (!*r->cfg.file)    return;  if (r->cx.fd != -1)    /*     * We assume that our name/key/challenge is the same as last time,     * and just continue to wait for the RADIUS server(s).     */    return;  radius_Destroy(r);  if ((r->cx.rad = rad_auth_open()) == NULL) {    log_Printf(LogERROR, "rad_auth_open: %s\n", strerror(errno));    return;  }  if (rad_config(r->cx.rad, r->cfg.file) != 0) {    log_Printf(LogERROR, "rad_config: %s\n", rad_strerror(r->cx.rad));    rad_close(r->cx.rad);    return;  }  if (rad_create_request(r->cx.rad, RAD_ACCESS_REQUEST) != 0) {    log_Printf(LogERROR, "rad_create_request: %s\n", rad_strerror(r->cx.rad));    rad_close(r->cx.rad);    return;  }  if (rad_put_string(r->cx.rad, RAD_USER_NAME, name) != 0 ||      rad_put_int(r->cx.rad, RAD_SERVICE_TYPE, RAD_FRAMED) != 0 ||      rad_put_int(r->cx.rad, RAD_FRAMED_PROTOCOL, RAD_PPP) != 0) {    log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad));    rad_close(r->cx.rad);    return;  }  if (challenge != NULL) {    /* We're talking CHAP */    if (rad_put_attr(r->cx.rad, RAD_CHAP_PASSWORD, key, klen) != 0 ||        rad_put_attr(r->cx.rad, RAD_CHAP_CHALLENGE, challenge, clen) != 0) {      log_Printf(LogERROR, "CHAP: rad_put_string: %s\n",                 rad_strerror(r->cx.rad));      rad_close(r->cx.rad);      return;    }  } else if (rad_put_attr(r->cx.rad, RAD_USER_PASSWORD, key, klen) != 0) {    /* We're talking PAP */    log_Printf(LogERROR, "PAP: rad_put_string: %s\n", rad_strerror(r->cx.rad));    rad_close(r->cx.rad);    return;  }  if (gethostname(hostname, sizeof hostname) != 0)    log_Printf(LogERROR, "rad_put: gethostname(): %s\n", strerror(errno));  else {    if ((hp = gethostbyname(hostname)) != NULL) {      hostaddr.s_addr = *(u_long *)hp->h_addr;      if (rad_put_addr(r->cx.rad, RAD_NAS_IP_ADDRESS, hostaddr) != 0) {        log_Printf(LogERROR, "rad_put: rad_put_string: %s\n",                   rad_strerror(r->cx.rad));        rad_close(r->cx.rad);        return;      }    }    if (rad_put_string(r->cx.rad, RAD_NAS_IDENTIFIER, hostname) != 0) {      log_Printf(LogERROR, "rad_put: rad_put_string: %s\n",                 rad_strerror(r->cx.rad));      rad_close(r->cx.rad);      return;    }  }  if (authp->physical->handler &&      authp->physical->handler->type == TTY_DEVICE) {    setttyent();    for (slot = 1; (ttyp = getttyent()); ++slot)      if (!strcmp(ttyp->ty_name, authp->physical->name.base)) {        if(rad_put_int(r->cx.rad, RAD_NAS_PORT, slot) != 0) {          log_Printf(LogERROR, "rad_put: rad_put_string: %s\n",                      rad_strerror(r->cx.rad));          rad_close(r->cx.rad);          endttyent();          return;        }        break;      }    endttyent();  }  r->cx.auth = authp;  if ((got = rad_init_send_request(r->cx.rad, &r->cx.fd, &tv)))    radius_Process(r, got);  else {    log_Printf(LogPHASE, "Radius: Request sent\n");    log_Printf(LogDEBUG, "Using radius_Timeout [%p]\n", radius_Timeout);    r->cx.timer.load = tv.tv_usec / TICKUNIT + tv.tv_sec * SECTICKS;    r->cx.timer.func = radius_Timeout;    r->cx.timer.name = "radius auth";    r->cx.timer.arg = r;    timer_Start(&r->cx.timer);  }}