- sessionidt other;
- int count = 40;
-
- // Normal User
- p->log(2, sess, s->tunnel, "Un-Garden user %s (%s)\n", s->user, p->fmtaddr(htonl(s->ip), 0));
- if (newuser)
- {
- snprintf(s->user, MAXUSER, "%s", newuser);
- p->log(2, sess, s->tunnel, " Setting username to %s\n", s->user);
- }
-
- // Kick off any duplicate usernames
- // but make sure not to kick off ourself
- if (s->ip && !s->die && (other = p->get_session_by_username(s->user)) && s != p->get_session_by_id(other)) {
- p->sessionkill(other, "Duplicate session when user released from walled garden");
- }
- /* Clean up counters */
- s->cin = s->cout = 0;
- s->pin = s->pout = 0;
-
- snprintf(cmd, sizeof(cmd), "iptables -t nat -D garden_users -s %s -j garden", p->fmtaddr(htonl(s->ip), 0));
- p->log(3, sess, s->tunnel, "%s\n", cmd);
- while (--count)
- {
- int status = system(cmd);
- if (WEXITSTATUS(status) != 0) break;
- }
-
- s->walled_garden = 0;
-
- if (flag != F_CLEANUP)
- {
- /* OK, we're up! */
- uint16_t r = p->radiusnew(p->get_id_by_session(s));
- p->radiussend(r, RADIUSSTART);
- }