Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: FIO33 compliance

...

Code Block
bgColor#FFCCCC
void incorrect_password(char const *user) {
  /* user names are restricted to 256 characters or less */
  static char const *msg_format
    = "%s cannot be authenticated.\n";
  size_t len = strlen(user) + sizeof(msg_format);
  char *msg = (char *) malloc(len);
  if (!msg) {
    /* handle error condition */
  }
  int ret = snprintf(msg, len, msg_format, user);
  if (ret < 0 || ret >= len) {\
    /* Handle Error */
  }
  fprintf(stderr, msg);
  free(msg);
  msg = NULL;
}

...

Code Block
bgColor#ccccff
void incorrect_password(char const *user) {
  /* user names are restricted to 256 characters or less */
  static char const *msg_format
    = "%s cannot be authenticated.\n";
  size_t len = strlen(user) + sizeof(msg_format);
  char *msg = (char *) malloc(len);
  if (!msg) {
    /* handle error condition */
  }
  int ret = snprintf(msg, len, msg_format, user);
  if (ret < 0 || ret >= len) {\
    /* Handle Error */
  }
  if (fputs(msg, stderr) == EOF) {
    /* Handle Error */
  }
  free(msg);
  msg = NULL;
}

...

Code Block
bgColor#FFCCCC
void incorrect_password(char const *user) {
  /* user names are restricted to 256 characters or less */
  static char const *msg_format
    = "%s cannot be authenticated.\n";
  size_t len = strlen(user) + sizeof(msg_format);
  char *msg = (char *) malloc(len);
  if (!msg) {
    /* handle error condition */
  }
  int ret = snprintf(msg, len, msg_format, user);
  if (ret < 0 || ret >= len) {\
    /* Handle Error */
  }
  syslog(LOG_INFO, msg);
  free(msg);
  msg = NULL;
}

...