int increment_client_count()

in tacacs-F4.0.4.28/client_count.c [82:97]


int increment_client_count(char* client_ip)
{
  int count = get_client_count(client_ip);
  /* create a new hash entry add it to the hash table */
  CLIENT *nc = (CLIENT *)tac_malloc(sizeof(CLIENT));
  memset(nc, 0, sizeof(CLIENT));
  nc->name = tac_strdup(client_ip);
  nc->hash = NULL;
  nc->con_count = count + 1;
  if (count) {
    /* the hash does not support update, so we need to delete + add */
    remove_client_entry(client_ip);
  }
  hash_add_entry(client_table, (void *)nc);
  return nc->con_count;
}