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

Comparing ircd-hybrid-7.3/src/s_user.c (file contents):
Revision 1080 by michael, Wed Mar 10 23:09:36 2010 UTC vs.
Revision 1126 by michael, Sun Feb 20 14:30:12 2011 UTC

# Line 281 | Line 281 | show_isupport(struct Client *source_p)
281   void
282   register_local_user(struct Client *source_p)
283   {
284 +  const char *id = NULL;
285    const struct AccessItem *aconf = NULL;
286    dlink_node *ptr = NULL;
286  dlink_node *m = NULL;
287  
288    assert(source_p != NULL);
289    assert(source_p == source_p->from);
# Line 408 | Line 408 | register_local_user(struct Client *sourc
408      sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)",
409                           source_p->name, source_p->username, source_p->host);
410      ++ServerStats.is_ref;
411 <    ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username);
411 >    snprintf(tmpstr2, sizeof(tmpstr2), "Invalid username [%s]",
412 >             source_p->username);
413      exit_client(source_p, &me, tmpstr2);
414      return;
415    }
# Line 416 | Line 417 | register_local_user(struct Client *sourc
417    if (check_xline(source_p))
418      return;
419  
420 <  if (me.id[0])
421 <  {
421 <    const char *id = NULL;
422 <
423 <    while (hash_find_id((id = uid_get())) != NULL)
424 <      ;
420 >  while (hash_find_id((id = uid_get())) != NULL)
421 >    ;
422  
423 <    strlcpy(source_p->id, id, sizeof(source_p->id));
424 <    hash_add_id(source_p);
428 <  }
423 >  strlcpy(source_p->id, id, sizeof(source_p->id));
424 >  hash_add_id(source_p);
425  
426    sendto_realops_flags(UMODE_CCONN, L_ALL,
427                         "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
# Line 442 | Line 438 | register_local_user(struct Client *sourc
438                         "255.255.255.255" : source_p->sockhost,
439                         get_client_class(source_p),
440                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
441 <                           "<hidden>" : source_p->client_host,
441 >                           "<hidden>" : source_p->localClient->client_host,
442                         ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ?
443 <                           "<hidden>" : source_p->client_server,
443 >                           "<hidden>" : source_p->localClient->client_server,
444                         source_p->info);
445  
446  
# Line 474 | Line 470 | register_local_user(struct Client *sourc
470  
471    source_p->localClient->allow_read = MAX_FLOOD_BURST;
472  
473 <  assert(dlinkFindDelete(&unknown_list, source_p));
473 >  assert(dlinkFind(&unknown_list, source_p));
474  
475 <  if ((m = dlinkFindDelete(&unknown_list, source_p)) != NULL)
476 <  {
481 <    free_dlink_node(m);
482 <    dlinkAdd(source_p, &source_p->localClient->lclient_node, &local_client_list);
483 <  }
475 >  dlink_move_node(&source_p->localClient->lclient_node,
476 >                  &unknown_list, &local_client_list);
477  
478    user_welcome(source_p);
479    add_user_host(source_p->username, source_p->host, 0);
# Line 756 | Line 749 | report_and_set_user_flags(struct Client
749    }
750   }
751  
759 /* do_local_user()
760 *
761 * inputs       -
762 * output       - NONE
763 * side effects -
764 */
765 void
766 do_local_user(struct Client *source_p,
767              const char *username, const char *host, const char *server,
768              const char *realname)
769 {
770  assert(source_p != NULL);
771  assert(source_p->username != username);
772  assert(IsUnknown(source_p));
773
774  source_p->localClient->registration &= ~REG_NEED_USER;
775
776  /*
777   * don't take the clients word for it, ever
778   */
779  source_p->servptr = &me;
780
781  strlcpy(source_p->info, realname, sizeof(source_p->info));
782
783  /* stash for later */
784  strlcpy(source_p->client_host, host, sizeof(source_p->client_host));
785  strlcpy(source_p->client_server, server, sizeof(source_p->client_server));
786
787  if (!IsGotId(source_p))
788    strlcpy(source_p->username, username, sizeof(source_p->username));
789
790  if (!source_p->localClient->registration)
791    register_local_user(source_p);
792 }
793
752   /* change_simple_umode()
753   *
754   * this callback can be hooked to allow special handling of
# Line 850 | Line 808 | set_user_mode(struct Client *client_p, s
808       return;
809    }
810  
811 <  if (source_p != target_p || target_p->from != source_p->from)
811 >  if (source_p != target_p)
812    {
813       sendto_one(source_p, form_str(ERR_USERSDONTMATCH),
814                  me.name, source_p->name);
# Line 908 | Line 866 | set_user_mode(struct Client *client_p, s
866                break;
867  
868              ClearOper(source_p);
911            source_p->umodes &= ~ConfigFileEntry.oper_only_umodes;
869              Count.oper--;
870  
871              if (MyConnect(source_p))
# Line 917 | Line 874 | set_user_mode(struct Client *client_p, s
874  
875                detach_conf(source_p, OPER_TYPE);
876                ClearOperFlags(source_p);
877 +              source_p->umodes &= ~ConfigFileEntry.oper_only_umodes;
878  
879                if ((dm = dlinkFindDelete(&oper_list, source_p)) != NULL)
880                  free_dlink_node(dm);
# Line 1125 | Line 1083 | user_welcome(struct Client *source_p)
1083  
1084    if (ConfigFileEntry.short_motd)
1085    {
1086 <    sendto_one(source_p, "NOTICE %s :*** Notice -- motd was last changed at %s",
1087 <               source_p->name, ConfigFileEntry.motd.lastChangedDate);
1086 >    sendto_one(source_p, ":%s NOTICE %s :*** Notice -- motd was last changed at %s",
1087 >               me.name, source_p->name, ConfigFileEntry.motd.lastChangedDate);
1088      sendto_one(source_p,
1089 <               "NOTICE %s :*** Notice -- Please read the motd if you haven't "
1090 <               "read it", source_p->name);
1089 >               ":%s NOTICE %s :*** Notice -- Please read the motd if you haven't "
1090 >               "read it", me.name, source_p->name);
1091      sendto_one(source_p, form_str(RPL_MOTDSTART),
1092                 me.name, source_p->name, me.name);
1093      sendto_one(source_p, form_str(RPL_MOTD),
# Line 1248 | Line 1206 | static char new_uid[TOTALSIDUID + 1];
1206   int
1207   valid_sid(const char *sid)
1208   {
1251
1209    if (strlen(sid) == IRC_MAXSID)
1210      if (IsDigit(*sid))
1211        if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2)))
# Line 1273 | Line 1230 | init_uid(void)
1230  
1231    memset(new_uid, 0, sizeof(new_uid));
1232  
1233 <  if (ServerInfo.sid != NULL)
1277 <  {
1233 >  if (!EmptyString(ServerInfo.sid))
1234      strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid));
1279    strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
1280
1281    hash_add_id(&me);
1282  }
1235  
1236 <  for (i = 0; i < IRC_MAXSID; i++)
1236 >  for (i = 0; i < IRC_MAXSID; ++i)
1237      if (new_uid[i] == '\0')
1238        new_uid[i] = 'A';
1239  

Diff Legend

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