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

Comparing ircd-hybrid-7.2/src/s_user.c (file contents):
Revision 386 by adx, Tue Jan 31 12:40:56 2006 UTC vs.
Revision 589 by michael, Mon May 8 18:40:00 2006 UTC

# Line 294 | Line 294 | register_local_user(struct Client *clien
294    assert(source_p != NULL);
295    assert(MyConnect(source_p));
296    assert(source_p->username != username);
297 +  assert(!source_p->localClient->registration);
298 +
299 +  ClearCap(client_p, CAP_TS6);
300  
301    if (ConfigFileEntry.ping_cookie)
302    {
# Line 422 | Line 425 | register_local_user(struct Client *clien
425    if (IsDead(client_p))
426      return;
427  
428 <  if (source_p->id[0] == '\0' && me.id[0])
428 >  if (me.id[0])
429    {
430 <    char *id = (char *)execute_callback(uid_get_cb, source_p);
430 >    const char *id = execute_callback(uid_get_cb, source_p);
431 >
432      while (hash_find_id(id) != NULL)
433        id = uid_get(NULL);
434  
# Line 514 | Line 518 | register_remote_user(struct Client *clie
518    strlcpy(source_p->info, realname, sizeof(source_p->info));
519    strlcpy(source_p->username, username, sizeof(source_p->username));
520  
517  /* Increment our total user count here */
518  if (++Count.total > Count.max_tot)
519    Count.max_tot = Count.total;
520
521  source_p->from->serv->dep_users++;
522
521    /*
522     * coming from another server, take the servers word for it
523     */
# Line 537 | Line 535 | register_remote_user(struct Client *clie
535                           source_p->host, source_p->from->name);
536      kill_client(client_p, source_p, "%s (Server doesn't exist)", me.name);
537  
540    /* XXX */
538      SetKilled(source_p);
539      exit_client(source_p, &me, "Ghosted Client");
540      return;
# Line 558 | Line 555 | register_remote_user(struct Client *clie
555      return;
556    }
557  
558 +  /* Increment our total user count here */
559 +  if (++Count.total > Count.max_tot)
560 +    Count.max_tot = Count.total;
561 +
562 +  ++source_p->from->serv->dep_users;
563 +
564    SetClient(source_p);
565    dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users);
566    add_user_host(source_p->username, source_p->host, 1);
# Line 607 | Line 610 | introduce_client(struct Client *client_p
610     * -davidt
611     * rewritten to cope with SIDs .. eww eww eww --is
612     */
610
611  /* XXX THESE NEED A PREFIX!?!?!? */
613    if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL) &&
614        client_p != uplink)
615    {
# Line 830 | Line 831 | do_local_user(const char *nick, struct C
831      return;
832    }
833  
834 <  source_p->flags |= FLAGS_GOTUSER;
834 >  source_p->localClient->registration &= ~REG_NEED_USER;
835  
836    /*
837     * don't take the clients word for it, ever
# Line 847 | Line 848 | do_local_user(const char *nick, struct C
848      strlcpy(source_p->username, username, sizeof(source_p->username));
849    }
850  
851 <  if (source_p->name[0])
851 <  {
851 >  if (!source_p->localClient->registration)
852      /* NICK already received, now I have USER... */
853      register_local_user(client_p, source_p, source_p->name, username);
854  }
854   }
855  
856   /* change_simple_umode()
# Line 1102 | Line 1101 | send_umode(struct Client *client_p, stru
1101    *m = '\0';
1102  
1103    if (*umode_buf && client_p)
1104 <    sendto_one(client_p, ":%s MODE %s :%s",
1105 <               source_p->name, source_p->name, umode_buf);
1104 >    sendto_one(client_p, ":%s!%s@%s MODE %s :%s",
1105 >               source_p->name, source_p->username,
1106 >               source_p->host, source_p->name, umode_buf);
1107   }
1108  
1109   /* send_umode_out()
# Line 1116 | Line 1116 | void
1116   send_umode_out(struct Client *client_p, struct Client *source_p,
1117                 unsigned int old)
1118   {
1119 <  char buf[IRCD_BUFSIZE];
1119 >  char buf[IRCD_BUFSIZE] = { '\0' };
1120    dlink_node *ptr = NULL;
1121  
1122    send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ?
1123               SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf);
1124  
1125 <  if (*buf)
1125 >  if (buf[0])
1126    {
1127      DLINK_FOREACH(ptr, serv_list.head)
1128      {
# Line 1328 | Line 1328 | oper_up(struct Client *source_p)
1328    send_message_file(source_p, &ConfigFileEntry.opermotd);
1329   }
1330  
1331 < /*
1332 < * Quick and dirty UID code for new proposed SID on EFnet
1333 < *
1334 < */
1331 > static char new_uid[TOTALSIDUID + 1];     /* allow for \0 */
1332 >
1333 > int
1334 > valid_sid(const char *sid)
1335 > {
1336 >
1337 >  if (strlen(sid) == IRC_MAXSID)
1338 >    if (IsDigit(*sid))
1339 >      if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2)))
1340 >        return 1;
1341  
1342 < static char new_uid[TOTALSIDUID+1];     /* allow for \0 */
1343 < static void add_one_to_uid(int i);
1342 >  return 0;
1343 > }
1344  
1345   /*
1346   * init_uid()
# Line 1354 | Line 1360 | init_uid(void)
1360  
1361    if (ServerInfo.sid != NULL)
1362    {
1363 <    memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid),
1364 <                                             IRC_MAXSID));
1365 <    memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid),
1360 <                                            IRC_MAXSID));
1363 >    strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid));
1364 >    strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
1365 >
1366      hash_add_id(&me);
1367    }
1368  
# Line 1365 | Line 1370 | init_uid(void)
1370      if (new_uid[i] == '\0')
1371        new_uid[i] = 'A';
1372  
1373 <  /* XXX if IRC_MAXUID != 6, this will have to be rewritten */
1373 >  /* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */
1374    /* Yes nenolod, I have known it was off by one ever since I wrote it
1375     * But *JUST* for you, though, it really doesn't look as *pretty*
1376     * -Dianora
1377     */
1378 <  memcpy(new_uid+IRC_MAXSID, "AAAAA@", IRC_MAXUID);
1378 >  memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID);
1379  
1380    entering_umode_cb = register_callback("entering_umode", NULL);
1381    umode_cb = register_callback("changing_umode", change_simple_umode);
# Line 1378 | Line 1383 | init_uid(void)
1383   }
1384  
1385   /*
1381 * uid_get
1382 *
1383 * inputs       - struct Client *
1384 * output       - new UID is returned to caller
1385 * side effects - new_uid is incremented by one.
1386 */
1387 static void *
1388 uid_get(va_list args)
1389 {
1390  add_one_to_uid(TOTALSIDUID-1);    /* index from 0 */
1391  return ((void *) new_uid);
1392 }
1393
1394 /*
1386   * add_one_to_uid
1387   *
1388   * inputs       - index number into new_uid
# Line 1411 | Line 1402 | add_one_to_uid(int i)
1402        new_uid[i] = 'A';
1403        add_one_to_uid(i-1);
1404      }
1405 <    else new_uid[i] = new_uid[i] + 1;
1405 >    else
1406 >      ++new_uid[i];
1407    }
1408    else
1409    {
1410 <    /* XXX if IRC_MAXUID != 6, this will have to be rewritten */
1410 >    /* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */
1411      if (new_uid[i] == 'Z')
1412 <      memcpy(new_uid+IRC_MAXSID, "AAAAAA", IRC_MAXUID);
1412 >      memcpy(new_uid + IRC_MAXSID, "AAAAAA", IRC_MAXUID);
1413      else
1414 <      new_uid[i] = new_uid[i] + 1;
1414 >      ++new_uid[i];
1415    }
1416   }
1417  
1418   /*
1419 + * uid_get
1420 + *
1421 + * inputs       - struct Client *
1422 + * output       - new UID is returned to caller
1423 + * side effects - new_uid is incremented by one.
1424 + */
1425 + static void *
1426 + uid_get(va_list args)
1427 + {
1428 +  add_one_to_uid(TOTALSIDUID - 1);    /* index from 0 */
1429 +  return new_uid;
1430 + }
1431 +
1432 + /*
1433   * init_isupport()
1434   *
1435   * input        - NONE

Diff Legend

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