ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/client.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/client.c (file contents):
Revision 5347 by michael, Sun Jan 11 12:42:20 2015 UTC vs.
Revision 5590 by michael, Tue Feb 17 17:55:01 2015 UTC

# Line 87 | Line 87 | make_client(struct Client *from)
87  
88    if (!from)
89    {
90 <    client_p->from                      = client_p; /* 'from' of local client is self! */
91 <    client_p->connection               = mp_pool_get(connection_pool);
92 <    client_p->connection->since        = CurrentTime;
93 <    client_p->connection->lasttime     = CurrentTime;
94 <    client_p->connection->firsttime    = CurrentTime;
90 >    client_p->from = client_p;  /* 'from' of local client is self! */
91 >    client_p->connection = mp_pool_get(connection_pool);
92 >    client_p->connection->since = CurrentTime;
93 >    client_p->connection->lasttime = CurrentTime;
94 >    client_p->connection->firsttime = CurrentTime;
95      client_p->connection->registration = REG_INIT;
96  
97      /* as good a place as any... */
98      dlinkAdd(client_p, &client_p->connection->lclient_node, &unknown_list);
99    }
100    else
101 <    client_p->from = from; /* 'from' of local client is self! */
101 >    client_p->from = from;
102  
103    client_p->idhnext = client_p;
104 <  client_p->hnext  = client_p;
104 >  client_p->hnext = client_p;
105    SetUnknown(client_p);
106    strcpy(client_p->username, "unknown");
107    strcpy(client_p->account, "0");
# Line 125 | Line 125 | free_client(struct Client *client_p)
125    assert(client_p->channel.head == NULL);
126    assert(dlink_list_length(&client_p->channel) == 0);
127    assert(dlink_list_length(&client_p->whowas) == 0);
128 <  assert(!IsServer(client_p) || client_p->serv);
128 >  assert(dlink_list_length(&client_p->svstags) == 0);
129  
130    MyFree(client_p->serv);
131    MyFree(client_p->certfp);
# Line 138 | Line 138 | free_client(struct Client *client_p)
138      assert(IsClosing(client_p) && IsDead(client_p));
139  
140      MyFree(client_p->connection->challenge_response);
141    MyFree(client_p->connection->challenge_operator);
141      client_p->connection->challenge_response = NULL;
142 +    MyFree(client_p->connection->challenge_operator);
143      client_p->connection->challenge_operator = NULL;
144  
145      /*
146 <     * Clean up extra sockets from listen{} blocks which have been discarded.
146 >     * Clean up extra sockets from listen {} blocks which have been discarded.
147       */
148      if (client_p->connection->listener)
149      {
# Line 160 | Line 160 | free_client(struct Client *client_p)
160    mp_pool_release(client_p);
161   }
162  
163 + void
164 + client_attach_svstag(struct Client *client_p, unsigned int numeric,
165 +                     const char *umodes, const char *const tag)
166 + {
167 +  struct ServicesTag *svstag = NULL;
168 +  const struct user_modes *tab = NULL;
169 +
170 +  if (numeric >= ERR_LAST_ERR_MSG || *umodes != '+')
171 +    return;
172 +
173 +  svstag = MyCalloc(sizeof(*svstag));
174 +  svstag->numeric = numeric;
175 +  svstag->tag = xstrdup(tag);
176 +
177 +  for (const char *m = umodes + 1; *m; ++m)
178 +    if ((tab = umode_map[(unsigned char)*m]))
179 +      svstag->umodes |= tab->flag;
180 +
181 +  if (numeric != RPL_WHOISOPERATOR)
182 +    dlinkAddTail(svstag, &svstag->node, &client_p->svstags);
183 +  else
184 +    dlinkAdd(svstag, &svstag->node, &client_p->svstags);
185 + }
186 +
187 + void
188 + client_clear_svstags(struct Client *client_p)
189 + {
190 +  dlink_node *node = NULL, *node_next = NULL;
191 +
192 +  DLINK_FOREACH_SAFE(node, node_next, client_p->svstags.head)
193 +  {
194 +    struct ServicesTag *svstag = node->data;
195 +
196 +    dlinkDelete(&svstag->node, &client_p->svstags);
197 +    MyFree(svstag->tag);
198 +    MyFree(svstag);
199 +  }
200 + }
201 +
202   /* check_pings_list()
203   *
204   * inputs       - pointer to list to check
# Line 744 | Line 783 | exit_client(struct Client *source_p, con
783          free_list_task(source_p);
784  
785        watch_del_watch_list(source_p);
786 +      client_clear_svstags(source_p);
787 +
788        sendto_realops_flags(UMODE_CCONN, L_ALL, SEND_NOTICE,
789                             "Client exiting: %s (%s@%s) [%s] [%s]",
790                             source_p->name, source_p->username, source_p->host, comment,
# Line 794 | Line 835 | exit_client(struct Client *source_p, con
835    {
836      char splitstr[HOSTLEN + HOSTLEN + 2] = "";
837  
838 <    /* This shouldn't ever happen */
839 <    assert(source_p->serv && source_p->servptr);
838 >    assert(source_p->serv);
839 >    assert(source_p->servptr);
840  
841      if (ConfigServerHide.hide_servers)
842        /*
# Line 825 | Line 866 | exit_client(struct Client *source_p, con
866                             source_p->connection->recv.bytes >> 10);
867        ilog(LOG_TYPE_IRCD, "%s was connected for %d day%s, %2d:%02d:%02d. %llu/%llu sendK/recvK.",
868             source_p->name, connected/86400, (connected/86400 == 1) ? "" : "s",
869 <          (connected % 86400) / 3600, (connected % 3600) / 60, connected % 60,
870 <          source_p->connection->send.bytes >> 10,
871 <          source_p->connection->recv.bytes >> 10);
869 >           (connected % 86400) / 3600, (connected % 3600) / 60, connected % 60,
870 >           source_p->connection->send.bytes >> 10,
871 >           source_p->connection->recv.bytes >> 10);
872      }
873    }
874    else if (IsClient(source_p) && !HasFlag(source_p, FLAGS_KILLED))
# Line 1019 | Line 1060 | accept_message(struct Client *source,
1060   {
1061    dlink_node *node = NULL;
1062  
1063 +  if (HasFlag(source, FLAGS_SERVICE) ||
1064 +      (HasUMode(source, UMODE_OPER) && ConfigGeneral.opers_bypass_callerid))
1065 +    return 1;
1066 +
1067    if (source == target || find_accept(source->name, source->username,
1068                                        source->host, target, match))
1069      return 1;
# Line 1047 | Line 1092 | del_all_accepts(struct Client *client_p)
1092   }
1093  
1094   unsigned int
1095 < idle_time_get(const struct Client *source_p, const struct Client *target_p)
1095 > client_get_idle_time(const struct Client *source_p,
1096 >                     const struct Client *target_p)
1097   {
1098    unsigned int idle = 0;
1099    unsigned int min_idle = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)