ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/src/s_user.c
(Generate patch)

Comparing branches/newio/src/s_user.c (file contents):
Revision 2418 by michael, Sun Jul 21 18:11:50 2013 UTC vs.
Revision 2419 by michael, Tue Jul 23 16:25:10 2013 UTC

# Line 56 | Line 56 | static char umode_buffer[IRCD_BUFSIZE];
56   static void user_welcome(struct Client *);
57   static void report_and_set_user_flags(struct Client *, const struct MaskItem *);
58   static int check_xline(struct Client *);
59 < static void introduce_client(struct Client *);
59 > static int introduce_client(struct Client *);
60   static const char *uid_get(void);
61  
62   /* Used for building up the isupport string,
# Line 272 | Line 272 | show_isupport(struct Client *source_p)
272   **         this is not fair. It should actually request another
273   **         nick from local user or kill him/her...
274   */
275 < void
275 > int
276   register_local_user(struct Client *source_p)
277   {
278    const char *id = NULL;
# Line 296 | Line 296 | register_local_user(struct Client *sourc
296        sendto_one(source_p, "PING :%u",
297                   source_p->localClient->random_ping);
298        SetPingSent(source_p);
299 <      return;
299 >      return 0;
300      }
301  
302      if (!HasPingCookie(source_p))
303 <      return;
303 >      return 0;
304    }
305  
306    source_p->localClient->last_privmsg = CurrentTime;
307  
308    if (!check_client(source_p))
309 <    return;
309 >    return CPTR_KILLED;
310  
311    if (!valid_hostname(source_p->host))
312    {
# Line 329 | Line 329 | register_local_user(struct Client *sourc
329        ++ServerStats.is_ref;
330        sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install "
331                   "identd to use this server", me.name, source_p->name);
332 <      exit_client(source_p, &me, "Install identd");
333 <      return;
332 >      return exit_client(source_p, source_p, &me, "Install identd");
333      }
334  
335      strlcpy(username, source_p->username, sizeof(username));
# Line 355 | Line 354 | register_local_user(struct Client *sourc
354        ++ServerStats.is_ref;
355        sendto_one(source_p, form_str(ERR_PASSWDMISMATCH),
356                   me.name, source_p->name);
357 <      exit_client(source_p, &me, "Bad Password");
359 <      return;
357 >      return exit_client(source_p, source_p, &me, "Bad Password");
358      }
359    }
360  
# Line 368 | Line 366 | register_local_user(struct Client *sourc
366    /* report if user has &^>= etc. and set flags as needed in source_p */
367    report_and_set_user_flags(source_p, conf);
368  
371  if (IsDead(source_p))
372    return;
373
369    /* Limit clients -
370     * We want to be able to have servers and F-line clients
371     * connect, so save room for "buffer" connections.
# Line 386 | Line 381 | register_local_user(struct Client *sourc
381                           "Too many clients, rejecting %s[%s].",
382                           source_p->name, source_p->host);
383      ++ServerStats.is_ref;
384 <    exit_client(source_p, &me, "Sorry, server is full - try later");
390 <    return;
384 >    return exit_client(source_p, source_p, &me, "Sorry, server is full - try later");
385    }
386  
387    /* valid user name check */
# Line 401 | Line 395 | register_local_user(struct Client *sourc
395      ++ServerStats.is_ref;
396      snprintf(tmpstr2, sizeof(tmpstr2), "Invalid username [%s]",
397               source_p->username);
398 <    exit_client(source_p, &me, tmpstr2);
405 <    return;
398 >    return exit_client(source_p, source_p, &me, tmpstr2);
399    }
400  
401    if (check_xline(source_p))
402 <    return;
402 >    return CPTR_KILLED;
403  
404    while (hash_find_id((id = uid_get())) != NULL)
405      ;
# Line 456 | Line 449 | register_local_user(struct Client *sourc
449    add_user_host(source_p->username, source_p->host, 0);
450    SetUserHost(source_p);
451  
452 <  introduce_client(source_p);
452 >  return introduce_client(source_p);
453   }
454  
455   /* register_remote_user()
# Line 470 | Line 463 | register_local_user(struct Client *sourc
463   * side effects - This function is called when a remote client
464   *                is introduced by a server.
465   */
466 < void
466 > int
467   register_remote_user(struct Client *source_p,
468                       const char *username, const char *host, const char *server,
469                       const char *realname)
470   {
471    struct Client *target_p = NULL;
472  
473 <  assert(source_p != NULL);
473 >  assert(source_p);
474    assert(source_p->username != username);
475  
476    strlcpy(source_p->host, host, sizeof(source_p->host));
# Line 502 | Line 495 | register_remote_user(struct Client *sour
495      kill_client(source_p->from, source_p, "%s (Server doesn't exist)", me.name);
496  
497      AddFlag(source_p, FLAGS_KILLED);
498 <    exit_client(source_p, &me, "Ghosted Client");
506 <    return;
498 >    return exit_client(source_p, source_p, &me, "Ghosted Client");
499    }
500  
501    if ((target_p = source_p->servptr) && target_p->from != source_p->from)
# Line 517 | Line 509 | register_remote_user(struct Client *sour
509                  "%s (NICK from wrong direction (%s != %s))",
510                  me.name, source_p->servptr->name, target_p->from->name);
511      AddFlag(source_p, FLAGS_KILLED);
512 <    exit_client(source_p, &me, "USER server wrong direction");
521 <    return;
512 >    return exit_client(source_p, source_p, &me, "USER server wrong direction");
513    }
514  
515    /*
# Line 544 | Line 535 | register_remote_user(struct Client *sour
535                           source_p->name, source_p->username, source_p->host,
536                           source_p->info, source_p->id);
537  
538 <  introduce_client(source_p);
538 >  return introduce_client(source_p);
539   }
540  
541   /* introduce_client()
# Line 555 | Line 546 | register_remote_user(struct Client *sour
546   *                of the net, either from a local client connect or
547   *                from a remote connect.
548   */
549 < static void
549 > static int
550   introduce_client(struct Client *source_p)
551   {
552    dlink_node *server_node = NULL;
# Line 623 | Line 614 | introduce_client(struct Client *source_p
614      if (!EmptyString(source_p->certfp))
615        sendto_one(server, ":%s CERTFP %s", ID(source_p), source_p->certfp);
616    }
617 +
618 +  return 0;
619   }
620  
621   /* valid_hostname()
# Line 1198 | Line 1191 | check_xline(struct Client *source_p)
1191                           source_p->sockhost);
1192  
1193      ++ServerStats.is_ref;
1194 <    exit_client(source_p, &me, "Bad user info");
1194 >    exit_client(source_p->from, source_p, &me, "Bad user info");
1195      return 1;
1196    }
1197  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines