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/trunk/src/user.c (file contents):
Revision 5809 by michael, Wed Apr 22 20:28:18 2015 UTC vs.
Revision 7049 by michael, Sun Jan 10 12:41:01 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2015 ircd-hybrid development team
4 > *  Copyright (c) 1997-2016 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 31 | Line 31
31   #include "channel_mode.h"
32   #include "client.h"
33   #include "hash.h"
34 + #include "id.h"
35   #include "irc_string.h"
36   #include "ircd.h"
37   #include "listener.h"
# Line 47 | Line 48
48   #include "misc.h"
49   #include "parse.h"
50   #include "watch.h"
51 + #include "isupport.h"
52  
53   static char umode_buffer[IRCD_BUFSIZE];
52 static const char *uid_get(void);
53
54 /* Used for building up the isupport string,
55 * used with init_isupport, add_isupport, delete_isupport
56 */
57 struct Isupport
58 {
59  dlink_node node;
60  char *name;
61  char *options;
62  int number;
63 };
64
65 static dlink_list support_list;
66 static dlink_list support_list_lines;
54  
55   const struct user_modes *umode_map[256];
56   const struct user_modes  umode_tab[] =
# Line 100 | Line 87 | const struct user_modes  umode_tab[] =
87   };
88  
89   void
90 < user_usermodes_init(void)
90 > user_modes_init(void)
91   {
92    char *umode_buffer_ptr = umode_buffer;
93  
# Line 162 | Line 149 | show_lusers(struct Client *source_p)
149      Count.max_loc_con = Count.local + Count.myserver;
150   }
151  
165 /* show_isupport()
166 *
167 * inputs       - pointer to client
168 * output       - NONE
169 * side effects - display to client what we support (for them)
170 */
171 void
172 show_isupport(struct Client *source_p)
173 {
174  const dlink_node *node = NULL;
175
176  DLINK_FOREACH(node, support_list_lines.head)
177    sendto_one_numeric(source_p, &me, RPL_ISUPPORT, node->data);
178 }
179
180
152   /* report_and_set_user_flags()
153   *
154   * inputs       - pointer to source_p
# Line 191 | Line 162 | report_and_set_user_flags(struct Client
162   {
163    /* If this user is being spoofed, tell them so */
164    if (IsConfDoSpoofIp(conf))
165 <    sendto_one_notice(source_p, &me, ":*** Spoofing your IP. Congrats.");
165 >    sendto_one_notice(source_p, &me, ":*** Spoofing your IP");
166  
167    /* If this user is in the exception class, set it "E lined" */
168    if (IsConfExemptKline(conf))
169    {
170 <    SetExemptKline(source_p);
171 <    sendto_one_notice(source_p, &me, ":*** You are exempt from K/D lines. Congrats.");
170 >    AddFlag(source_p, FLAGS_EXEMPTKLINE);
171 >    sendto_one_notice(source_p, &me, ":*** You are exempt from K/D lines");
172 >  }
173 >
174 >  if (IsConfExemptXline(conf))
175 >  {
176 >    AddFlag(source_p, FLAGS_EXEMPTXLINE);
177 >    sendto_one_notice(source_p, &me, ":*** You are exempt from X lines");
178    }
179  
180    if (IsConfExemptResv(conf))
181    {
182 <    SetExemptResv(source_p);
183 <    sendto_one_notice(source_p, &me, ":*** You are exempt from resvs. Congrats.");
182 >    AddFlag(source_p, FLAGS_EXEMPTRESV);
183 >    sendto_one_notice(source_p, &me, ":*** You are exempt from resvs");
184    }
185  
186    /* If this user is exempt from user limits set it "F lined" */
187    if (IsConfExemptLimits(conf))
188    {
189 <    SetExemptLimits(source_p);
190 <    sendto_one_notice(source_p, &me, ":*** You are exempt from user limits. Congrats.");
189 >    AddFlag(source_p, FLAGS_NOLIMIT);
190 >    sendto_one_notice(source_p, &me, ":*** You are exempt from user limits");
191    }
192  
193    if (IsConfCanFlood(conf))
194    {
195 <    SetCanFlood(source_p);
196 <    sendto_one_notice(source_p, &me, ":*** You are exempt from flood "
220 <                      "protection, aren't you fearsome.");
195 >    AddFlag(source_p, FLAGS_CANFLOOD);
196 >    sendto_one_notice(source_p, &me, ":*** You are exempt from flood protection");
197    }
198   }
199  
# Line 235 | Line 211 | introduce_client(struct Client *source_p
211    dlink_node *node = NULL;
212    char ubuf[IRCD_BUFSIZE] = "";
213  
214 <  if (MyClient(source_p))
214 >  if (MyConnect(source_p))
215      send_umode(source_p, source_p, 0, ubuf);
216    else
217      send_umode(NULL, source_p, 0, ubuf);
# Line 255 | Line 231 | introduce_client(struct Client *source_p
231      if (server == source_p->from)
232        continue;
233  
234 <    if (IsCapable(server, CAP_SVS))
235 <      sendto_one(server, ":%s UID %s %u %lu %s %s %s %s %s %s :%s",
236 <                 source_p->servptr->id,
237 <                 source_p->name, source_p->hopcount+1,
238 <                 (unsigned long)source_p->tsinfo,
239 <                 ubuf, source_p->username, source_p->host,
240 <                 source_p->sockhost, source_p->id,
241 <                 source_p->account,
266 <                 source_p->info);
267 <    else
268 <      sendto_one(server, ":%s UID %s %u %lu %s %s %s %s %s :%s",
269 <                 source_p->servptr->id,
270 <                 source_p->name, source_p->hopcount+1,
271 <                 (unsigned long)source_p->tsinfo,
272 <                 ubuf, source_p->username, source_p->host,
273 <                 source_p->sockhost, source_p->id, source_p->info);
234 >    sendto_one(server, ":%s UID %s %u %ju %s %s %s %s %s %s :%s",
235 >               source_p->servptr->id,
236 >               source_p->name, source_p->hopcount+1,
237 >               source_p->tsinfo,
238 >               ubuf, source_p->username, source_p->host,
239 >               source_p->sockhost, source_p->id,
240 >               source_p->account,
241 >               source_p->info);
242  
243      if (!EmptyString(source_p->certfp))
244        sendto_one(server, ":%s CERTFP %s", source_p->id, source_p->certfp);
# Line 286 | Line 254 | introduce_client(struct Client *source_p
254   static void
255   user_welcome(struct Client *source_p)
256   {
289 #if defined(__TIME__) && defined(__DATE__)
257    static const char built_date[] = __DATE__ " at " __TIME__;
291 #else
292  static const char built_date[] = "unknown";
293 #endif
258  
259   #ifdef HAVE_LIBCRYPTO
260    if (HasFlag(source_p, FLAGS_SSL))
# Line 304 | Line 268 | user_welcome(struct Client *source_p)
268    sendto_one_numeric(source_p, &me, RPL_WELCOME, ConfigServerInfo.network_name,
269                       source_p->name);
270    sendto_one_numeric(source_p, &me, RPL_YOURHOST,
271 <                     get_listener_name(source_p->connection->listener), ircd_version);
271 >                     listener_get_name(source_p->connection->listener), ircd_version);
272    sendto_one_numeric(source_p, &me, RPL_CREATED, built_date);
273    sendto_one_numeric(source_p, &me, RPL_MYINFO, me.name, ircd_version, umode_buffer);
310  show_isupport(source_p);
311  sendto_one_numeric(source_p, &me, RPL_YOURID, source_p->id);
274  
275 +  isupport_show(source_p);
276    show_lusers(source_p);
277    motd_signon(source_p);
278   }
# Line 325 | Line 288 | check_xline(struct Client *source_p)
288   {
289    struct MaskItem *conf = NULL;
290  
291 +  if (HasFlag(source_p, FLAGS_EXEMPTXLINE))
292 +    return 0;
293 +
294    if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0)))
295    {
296      ++conf->count;
# Line 360 | Line 326 | register_local_user(struct Client *sourc
326  
327    if (ConfigGeneral.ping_cookie)
328    {
329 <    if (!IsPingSent(source_p) && !source_p->connection->random_ping)
329 >    if (!HasFlag(source_p, FLAGS_PINGSENT) && !source_p->connection->random_ping)
330      {
331        do
332          source_p->connection->random_ping = genrand_int32();
333        while (!source_p->connection->random_ping);
334  
335        sendto_one(source_p, "PING :%u", source_p->connection->random_ping);
336 <      SetPingSent(source_p);
336 >      AddFlag(source_p, FLAGS_PINGSENT);
337        return;
338      }
339  
340 <    if (!HasPingCookie(source_p))
340 >    if (!HasFlag(source_p, FLAGS_PING_COOKIE))
341        return;
342    }
343  
# Line 391 | Line 357 | register_local_user(struct Client *sourc
357  
358    conf = source_p->connection->confs.head->data;
359  
360 <  if (!IsGotId(source_p))
360 >  if (!HasFlag(source_p, FLAGS_GOTID))
361    {
362      char username[USERLEN + 1] = "";
397    const char *p = username;
363      unsigned int i = 0;
364  
365      if (IsNeedIdentd(conf))
# Line 411 | Line 376 | register_local_user(struct Client *sourc
376      if (!IsNoTilde(conf))
377        source_p->username[i++] = '~';
378  
379 <    for (; *p && i < USERLEN; ++p)
379 >    for (const char *p = username; *p && i < USERLEN; ++p)
380        source_p->username[i++] = *p;
381  
382      source_p->username[i] = '\0';
# Line 453 | Line 418 | register_local_user(struct Client *sourc
418     *   -Taner
419     */
420    if ((Count.local >= GlobalSetOptions.maxclients + MAX_BUFFER) ||
421 <      (Count.local >= GlobalSetOptions.maxclients && !IsExemptLimits(source_p)))
421 >      (Count.local >= GlobalSetOptions.maxclients && !HasFlag(source_p, FLAGS_NOLIMIT)))
422    {
423      sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
424                           "Too many clients, rejecting %s[%s].",
# Line 503 | Line 468 | register_local_user(struct Client *sourc
468      Count.max_loc = Count.local;
469  
470      if (!(Count.max_loc % 10))
471 <      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
471 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
472                             "New maximum local client connections: %u",
473                             Count.max_loc);
474    }
# Line 523 | Line 488 | register_local_user(struct Client *sourc
488                    &unknown_list, &local_client_list);
489  
490    user_welcome(source_p);
491 <  add_user_host(source_p->username, source_p->host, 0);
492 <  SetUserHost(source_p);
491 >  userhost_add(source_p->username, source_p->host, 0);
492 >  AddFlag(source_p, FLAGS_USERHOST);
493  
494    introduce_client(source_p);
495   }
# Line 574 | Line 539 | register_remote_user(struct Client *sour
539    SetClient(source_p);
540    dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list);
541    dlinkAdd(source_p, &source_p->node, &global_client_list);
542 <  add_user_host(source_p->username, source_p->host, 1);
543 <  SetUserHost(source_p);
542 >  userhost_add(source_p->username, source_p->host, 1);
543 >  AddFlag(source_p, FLAGS_USERHOST);
544  
545    if (HasFlag(source_p->servptr, FLAGS_EOB))
546      sendto_realops_flags(UMODE_FARCONNECT, L_ALL, SEND_NOTICE,
# Line 627 | Line 592 | valid_hostname(const char *hostname)
592   int
593   valid_username(const char *username, const int local)
594   {
630  unsigned int dots = 0;
595    const char *p = username;
596  
597    assert(p);
# Line 645 | Line 609 | valid_username(const char *username, con
609  
610    if (local)
611    {
612 +    unsigned int dots = 0;
613 +
614      while (*++p)
615      {
616        if (*p == '.' && ConfigGeneral.dots_in_ident)
# Line 702 | Line 668 | valid_nickname(const char *nickname, con
668   * inputs       - client_p
669   *              - source_p
670   *              - int old
705 *              - sendmask mask of modes to send
671   *              - suplied umode_buf
672   * output       - NONE
673   */
# Line 789 | Line 754 | user_set_hostmask(struct Client *target_
754    }
755  
756    if (ConfigGeneral.cycle_on_host_change)
757 <    sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname",
757 >    sendto_common_channels_local(target_p, 0, 0, CAP_CHGHOST, ":%s!%s@%s QUIT :Changing hostname",
758                                   target_p->name, target_p->username, target_p->host);
759  
760 <  if (IsUserHostIp(target_p))
761 <    delete_user_host(target_p->username, target_p->host, !MyConnect(target_p));
760 >  sendto_common_channels_local(target_p, 0, CAP_CHGHOST, 0, ":%s!%s@%s CHGHOST %s %s",
761 >                               target_p->name, target_p->username,
762 >                               target_p->host, target_p->username, hostname);
763 >
764 >  if (HasFlag(target_p, FLAGS_USERHOST))
765 >    userhost_del(target_p->username, target_p->host, !MyConnect(target_p));
766  
767    strlcpy(target_p->host, hostname, sizeof(target_p->host));
768  
769 <  add_user_host(target_p->username, target_p->host, !MyConnect(target_p));
770 <  SetUserHost(target_p);
769 >  userhost_add(target_p->username, target_p->host, !MyConnect(target_p));
770 >  AddFlag(target_p, FLAGS_USERHOST);
771  
772 <  if (MyClient(target_p))
772 >  if (MyConnect(target_p))
773    {
774      sendto_one_numeric(target_p, &me, RPL_VISIBLEHOST, target_p->host);
775      clear_ban_cache_client(target_p);
# Line 811 | Line 780 | user_set_hostmask(struct Client *target_
780  
781    DLINK_FOREACH(node, target_p->channel.head)
782    {
783 <    char modebuf[4], nickbuf[NICKLEN * 3 + 3] = "";
783 >    char modebuf[CMEMBER_STATUS_FLAGS_LEN + 1];
784 >    char nickbuf[CMEMBER_STATUS_FLAGS_LEN * NICKLEN + CMEMBER_STATUS_FLAGS_LEN] = "";
785      char *p = modebuf;
786      int len = 0;
787      const struct Membership *member = node->data;
# Line 836 | Line 806 | user_set_hostmask(struct Client *target_
806  
807      *p = '\0';
808  
809 <
810 <    sendto_channel_local_butone(target_p, CAP_EXTENDED_JOIN, 0, member->chptr, ":%s!%s@%s JOIN %s %s :%s",
811 <                                target_p->name, target_p->username,
812 <                                target_p->host, member->chptr->name,
813 <                                (!IsDigit(target_p->account[0]) && target_p->account[0] != '*') ? target_p->account : "*",
814 <                                target_p->info);
815 <    sendto_channel_local_butone(target_p, 0, CAP_EXTENDED_JOIN, member->chptr, ":%s!%s@%s JOIN :%s",
846 <                                target_p->name, target_p->username,
847 <                                target_p->host, member->chptr->name);
809 >    sendto_channel_local(target_p, member->chptr, 0, CAP_EXTENDED_JOIN, CAP_CHGHOST, ":%s!%s@%s JOIN %s %s :%s",
810 >                         target_p->name, target_p->username,
811 >                         target_p->host, member->chptr->name,
812 >                         target_p->account, target_p->info);
813 >    sendto_channel_local(target_p, member->chptr, 0, 0, CAP_EXTENDED_JOIN | CAP_CHGHOST, ":%s!%s@%s JOIN :%s",
814 >                         target_p->name, target_p->username,
815 >                         target_p->host, member->chptr->name);
816  
817      if (nickbuf[0])
818 <      sendto_channel_local_butone(target_p, 0, 0, member->chptr, ":%s MODE %s +%s %s",
819 <                                  target_p->servptr->name, member->chptr->name,
820 <                                  modebuf, nickbuf);
853 <
818 >      sendto_channel_local(target_p, member->chptr, 0, 0, CAP_CHGHOST, ":%s MODE %s +%s %s",
819 >                           target_p->servptr->name, member->chptr->name,
820 >                           modebuf, nickbuf);
821    }
822  
823    if (target_p->away[0])
824 <    sendto_common_channels_local(target_p, 0, CAP_AWAY_NOTIFY,
824 >    sendto_common_channels_local(target_p, 0, CAP_AWAY_NOTIFY, CAP_CHGHOST,
825                                   ":%s!%s@%s AWAY :%s",
826                                   target_p->name, target_p->username,
827                                   target_p->host, target_p->away);
828   }
862
863 /*! \brief Blindly opers up given source_p, using conf info.
864 *         All checks on passwords have already been done.
865 * \param source_p Pointer to given client to oper
866 */
867 void
868 oper_up(struct Client *source_p)
869 {
870  const unsigned int old = source_p->umodes;
871  const struct MaskItem *const conf = source_p->connection->confs.head->data;
872
873  assert(source_p->connection->confs.head);
874
875  ++Count.oper;
876  SetOper(source_p);
877
878  if (conf->modes)
879    AddUMode(source_p, conf->modes);
880  else if (ConfigGeneral.oper_umodes)
881    AddUMode(source_p, ConfigGeneral.oper_umodes);
882
883  if (!(old & UMODE_INVISIBLE) && HasUMode(source_p, UMODE_INVISIBLE))
884    ++Count.invisi;
885  if ((old & UMODE_INVISIBLE) && !HasUMode(source_p, UMODE_INVISIBLE))
886    --Count.invisi;
887
888  assert(dlinkFind(&oper_list, source_p) == NULL);
889  dlinkAdd(source_p, make_dlink_node(), &oper_list);
890
891  AddOFlag(source_p, conf->port);
892
893  if (HasOFlag(source_p, OPER_FLAG_ADMIN))
894    AddUMode(source_p, UMODE_ADMIN);
895
896  if (!EmptyString(conf->whois))
897  {
898    client_attach_svstag(source_p, RPL_WHOISOPERATOR, "+", conf->whois);
899    sendto_server(source_p, 0, 0, ":%s SVSTAG %s %lu %u + :%s",
900                  me.id, source_p->id, (unsigned long)source_p->tsinfo,
901                  RPL_WHOISOPERATOR, conf->whois);
902  }
903
904  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s is now an operator",
905                       get_oper_name(source_p));
906  sendto_server(NULL, 0, 0, ":%s GLOBOPS :%s is now an operator",
907                me.id, get_oper_name(source_p));
908  send_umode_out(source_p, old);
909  sendto_one_numeric(source_p, &me, RPL_YOUREOPER);
910 }
911
912 static char new_uid[TOTALSIDUID + 1];  /* Allow for \0 */
913
914 int
915 valid_sid(const char *sid)
916 {
917  if (strlen(sid) == IRC_MAXSID)
918    if (IsDigit(*sid))
919      if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2)))
920        return 1;
921
922  return 0;
923 }
924
925 /*
926 * init_uid()
927 *
928 * inputs       - NONE
929 * output       - NONE
930 * side effects - new_uid is filled in with server id portion (sid)
931 *                (first 3 bytes). Rest is filled in with '9'.
932 *
933 * NOTE: this function assumes that 'ConfigServerInfo.sid' has been set to a proper value
934 */
935 void
936 init_uid(void)
937 {
938  snprintf(new_uid, sizeof(new_uid), "%s999999", ConfigServerInfo.sid);
939 }
940
941 /*
942 * add_one_to_uid
943 *
944 * inputs       - index number into new_uid
945 * output       - NONE
946 * side effects - new_uid is incremented by one
947 *                note this is a recursive function
948 */
949 static void
950 add_one_to_uid(unsigned int i)
951 {
952  if (i < IRC_MAXSID)
953    return;
954
955  if (new_uid[i] == 'Z')
956    new_uid[i] = '0';
957  else if (new_uid[i] == '9')
958  {
959    new_uid[i] = 'A';
960    add_one_to_uid(i - 1);
961  }
962  else
963    ++new_uid[i];
964 }
965
966 /*
967 * uid_get
968 *
969 * inputs       - struct Client *
970 * output       - new UID is returned to caller
971 * side effects - new_uid is incremented by one.
972 */
973 static const char *
974 uid_get(void)
975 {
976  add_one_to_uid(TOTALSIDUID - 1);  /* Index from 0 */
977  return new_uid;
978 }
979
980 /*
981 * init_isupport()
982 *
983 * input        - NONE
984 * output       - NONE
985 * side effects - Must be called before isupport is enabled
986 */
987 void
988 init_isupport(void)
989 {
990  add_isupport("CALLERID", NULL, -1);
991  add_isupport("CASEMAPPING", "rfc1459", -1);
992  add_isupport("DEAF", "D", -1);
993  add_isupport("KICKLEN", NULL, KICKLEN);
994  add_isupport("MODES", NULL, MAXMODEPARAMS);
995  add_isupport("PREFIX", "(ohv)@%+", -1);
996  add_isupport("STATUSMSG", "@%+", -1);
997  add_isupport("EXCEPTS", NULL, -1);
998  add_isupport("INVEX", NULL, -1);
999 }
1000
1001 /*
1002 * add_isupport()
1003 *
1004 * input        - name of supported function
1005 *              - options if any
1006 *              - number if any
1007 * output       - NONE
1008 * side effects - Each supported item must call this when activated
1009 */
1010 void
1011 add_isupport(const char *name, const char *options, int n)
1012 {
1013  dlink_node *node = NULL;
1014  struct Isupport *support = NULL;
1015
1016  DLINK_FOREACH(node, support_list.head)
1017  {
1018    support = node->data;
1019    if (irccmp(support->name, name) == 0)
1020    {
1021      MyFree(support->name);
1022      MyFree(support->options);
1023      break;
1024    }
1025  }
1026
1027  if (node == NULL)
1028  {
1029    support = MyCalloc(sizeof(*support));
1030    dlinkAddTail(support, &support->node, &support_list);
1031  }
1032
1033  support->name = xstrdup(name);
1034  if (options)
1035    support->options = xstrdup(options);
1036  support->number = n;
1037
1038  rebuild_isupport_message_line();
1039 }
1040
1041 /*
1042 * delete_isupport()
1043 *
1044 * input        - name of supported function
1045 * output       - NONE
1046 * side effects - Each supported item must call this when deactivated
1047 */
1048 void
1049 delete_isupport(const char *name)
1050 {
1051  dlink_node *node = NULL;
1052
1053  DLINK_FOREACH(node, support_list.head)
1054  {
1055    struct Isupport *support = node->data;
1056
1057    if (irccmp(support->name, name) == 0)
1058    {
1059      dlinkDelete(node, &support_list);
1060      MyFree(support->name);
1061      MyFree(support->options);
1062      MyFree(support);
1063      break;
1064    }
1065  }
1066
1067  rebuild_isupport_message_line();
1068 }
1069
1070 /*
1071 * rebuild_isupport_message_line
1072 *
1073 * input        - NONE
1074 * output       - NONE
1075 * side effects - Destroy the isupport MessageFile lines, and rebuild.
1076 */
1077 void
1078 rebuild_isupport_message_line(void)
1079 {
1080  char isupportbuffer[IRCD_BUFSIZE];
1081  char *p = isupportbuffer;
1082  dlink_node *node = NULL, *node_next = NULL;
1083  int n = 0;
1084  int tokens = 0;
1085  size_t len = 0;
1086  size_t reserve = strlen(me.name) + HOSTLEN + strlen(numeric_form(RPL_ISUPPORT));
1087
1088  DLINK_FOREACH_SAFE(node, node_next, support_list_lines.head)
1089  {
1090    dlinkDelete(node, &support_list_lines);
1091    MyFree(node->data);
1092    free_dlink_node(node);
1093  }
1094
1095  DLINK_FOREACH(node, support_list.head)
1096  {
1097    struct Isupport *support = node->data;
1098
1099    p += (n = sprintf(p, "%s", support->name));
1100    len += n;
1101
1102    if (support->options)
1103    {
1104      p += (n = sprintf(p, "=%s", support->options));
1105      len += n;
1106    }
1107
1108    if (support->number > 0)
1109    {
1110      p += (n = sprintf(p, "=%d", support->number));
1111      len += n;
1112    }
1113
1114    *p++ = ' ';
1115    len++;
1116    *p = '\0';
1117
1118    if (++tokens == (MAXPARA-2) || len >= (sizeof(isupportbuffer)-reserve))
1119    { /* arbritrary for now */
1120      if (*--p == ' ')
1121        *p = '\0';
1122
1123      dlinkAddTail(xstrdup(isupportbuffer), make_dlink_node(), &support_list_lines);
1124      p = isupportbuffer;
1125      len = 0;
1126      n = tokens = 0;
1127    }
1128  }
1129
1130  if (len)
1131  {
1132    if (*--p == ' ')
1133      *p = '\0';
1134    dlinkAddTail(xstrdup(isupportbuffer), make_dlink_node(), &support_list_lines);
1135  }
1136 }

Diff Legend

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