Diff for /libaitcli/src/telnet.c between versions 1.2 and 1.3

version 1.2, 2011/05/29 22:49:25 version 1.3, 2012/07/22 22:37:08
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 137  cli_telnetRecv(int sock, struct telnetAttrs **attr, in Line 137  cli_telnetRecv(int sock, struct telnetAttrs **attr, in
                                 ta.ta_cmd = buf[i];                                  ta.ta_cmd = buf[i];
                         if (SB > ta.ta_cmd) {                          if (SB > ta.ta_cmd) {
                                 (*nAttr)++;                                  (*nAttr)++;
                                *attr = realloc(*attr, sizeof(struct telnetAttrs) * *nAttr);                                *attr = io_realloc(*attr, sizeof(struct telnetAttrs) * *nAttr);
                                 if (!*attr) {                                  if (!*attr) {
                                         LOGERR;                                          LOGERR;
                                         return -1;                                          return -1;
Line 167  cmd_exit: Line 167  cmd_exit:
                                 ta.ta_opt = buf[i];                                  ta.ta_opt = buf[i];
                         if (SB != ta.ta_cmd) {                          if (SB != ta.ta_cmd) {
                                 (*nAttr)++;                                  (*nAttr)++;
                                *attr = realloc(*attr, sizeof(struct telnetAttrs) * *nAttr);                                *attr = io_realloc(*attr, sizeof(struct telnetAttrs) * *nAttr);
                                 if (!*attr) {                                  if (!*attr) {
                                         LOGERR;                                          LOGERR;
                                         return -1;                                          return -1;
Line 192  opt_exit: Line 192  opt_exit:
                                         ta.ta_sub[ta.ta_sublen] = 0;                                          ta.ta_sub[ta.ta_sublen] = 0;
   
                                         (*nAttr)++;                                          (*nAttr)++;
                                        *attr = realloc(*attr, sizeof(struct telnetAttrs) * *nAttr);                                        *attr = io_realloc(*attr, sizeof(struct telnetAttrs) * *nAttr);
                                         if (!*attr) {                                          if (!*attr) {
                                                 LOGERR;                                                  LOGERR;
                                                 return -1;                                                  return -1;
Line 203  opt_exit: Line 203  opt_exit:
                                         ta.ta_sub[ta.ta_sublen++] = buf[i];                                          ta.ta_sub[ta.ta_sublen++] = buf[i];
                         } else {                          } else {
                                 cli_SetErr(EPROTONOSUPPORT, "Protocol limitation in sub-option to %d!", MAX_SUB_LEN);                                  cli_SetErr(EPROTONOSUPPORT, "Protocol limitation in sub-option to %d!", MAX_SUB_LEN);
                                free(*attr);                                io_free(*attr);
                                 *nAttr = 0;                                  *nAttr = 0;
                                 return -1;                                  return -1;
                         }                          }
Line 266  cli_telnetSend(int sock, struct telnetAttrs *attr, int Line 266  cli_telnetSend(int sock, struct telnetAttrs *attr, int
                                 }                                  }
                         }                          }
   
                        buf = realloc(buf, pos + len);                        buf = io_realloc(buf, pos + len);
                         if (!buf) {                          if (!buf) {
                                 LOGERR;                                  LOGERR;
                                 return -1;                                  return -1;
Line 290  cli_telnetSend(int sock, struct telnetAttrs *attr, int Line 290  cli_telnetSend(int sock, struct telnetAttrs *attr, int
         /* add data */          /* add data */
   
         if (data && datLen) {          if (data && datLen) {
                buf = realloc(buf, pos + datLen);                buf = io_realloc(buf, pos + datLen);
                 if (!buf) {                  if (!buf) {
                         LOGERR;                          LOGERR;
                         return -1;                          return -1;
Line 303  cli_telnetSend(int sock, struct telnetAttrs *attr, int Line 303  cli_telnetSend(int sock, struct telnetAttrs *attr, int
         /* add GA after end of all */          /* add GA after end of all */
   
         if (Term) {          if (Term) {
                buf = realloc(buf, pos + 2);                buf = io_realloc(buf, pos + 2);
                 if (!buf) {                  if (!buf) {
                         LOGERR;                          LOGERR;
                         return -1;                          return -1;
Line 318  cli_telnetSend(int sock, struct telnetAttrs *attr, int Line 318  cli_telnetSend(int sock, struct telnetAttrs *attr, int
                 LOGERR;                  LOGERR;
   
         if (buf)          if (buf)
                free(buf);                io_free(buf);
         return writeLen;          return writeLen;
 }  }
   
Line 485  cli_telnet_SetCmd(struct telnetAttrs *attr, u_char cmd Line 485  cli_telnet_SetCmd(struct telnetAttrs *attr, u_char cmd
  * @nCaps = number of capability options   * @nCaps = number of capability options
  * @attr = input attribute   * @attr = input attribute
  * @nAttr = number of input attributes   * @nAttr = number of input attributes
 * @ans = output answered attributes, must be free() after use * @ans = output answered attributes, must be io_free() after use
  * @Ans = number of output answered attributes   * @Ans = number of output answered attributes
  * return: -1 can`t answer; !=-1 ok   * return: -1 can`t answer; !=-1 ok
 */  */
Line 521  cli_telnet_Answer(u_char *caps, int nCaps, struct teln Line 521  cli_telnet_Answer(u_char *caps, int nCaps, struct teln
                 // make attribute ...                  // make attribute ...
                 if (flg > -1) {                  if (flg > -1) {
                         (*Ans)++;                          (*Ans)++;
                        *ans = realloc(*ans, sizeof(struct telnetAttrs) * *Ans);                        *ans = io_realloc(*ans, sizeof(struct telnetAttrs) * *Ans);
                         if (!*ans) {                          if (!*ans) {
                                 LOGERR;                                  LOGERR;
                                 return -1;                                  return -1;

Removed from v.1.2  
changed lines
  Added in v.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>