- sessionidt other;
- int count = 10;
-
- // Normal User
- p.log(2, 0, 0, s->tunnel, "Release user %s (%s) from walled garden\n", s->user, p.inet_toa(ntohl(s->ip)));
- // 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 ungardened");
- }
- /* Clean up counters */
- s->cin = s->cout = 0;
- s->pin = s->pout = 0;
-
- snprintf(cmd, 2048, "iptables -t nat -D garden_users -s %s -j garden", p.inet_toa(ntohl(s->ip)));
- p.log(3, 0, 0, s->tunnel, "%s\n", cmd);
- while (--count)
- {
- int status = system(cmd);
- if (WEXITSTATUS(status) != 0) break;
- }
-
- s->walled_garden = 0;
-
- if (!s->die) {
- /* OK, we're up! */
- u8 r = p.radiusnew(p.get_id_by_session(s));
- p.radiussend(r, RADIUSSTART);
- }