Code Monkey home page Code Monkey logo

libeav's People

Contributors

gh0stwizard avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aydanmuftu

libeav's Issues

An email address whose domain part contains `_` should be considered invalid

Following functions will both output 1, i.e valid emails

int try_rfc_6531() {
  eav_t eav;
  eav_init(&eav);
  eav.tld_check = false;
  eav.rfc = EAV_RFC_6531;
  eav_setup(&eav);
  const char eml[] = "abc@def_ghi.us";
  int len = sizeof(eml) - 1;
  int ret = eav_is_email(&eav, eml, len);
  eav_free(&eav);
  return ret;
}

int try_rfc_5321() {
  eav_t eav;
  eav_init(&eav);
  eav.tld_check = false;
  eav.rfc = EAV_RFC_5321;
  eav_setup(&eav);
  const char eml[] = "abc@def_ghi.us";
  int len = sizeof(eml) - 1;
  int ret = eav_is_email(&eav, eml, len);
  eav_free(&eav);
  return ret;
}

int main() {
    printf("rfc-6531 for underscore=%d\nrfc-5321 for underscore=%d",
    try_rfc_6531(), try_rfc_5321());
    return 0;
}

but as per RFC 5321, an email address's domain part cannot contain _ and this RFC particularly mentions this restriction:

To promote interoperability and consistent with long-standing
guidance about conservative use of the DNS in naming and applications
(e.g., see Section 2.3.1 of the base DNS document, RFC 1035 [2]),
characters outside the set of alphabetic characters, digits, and
hyphen MUST NOT appear in domain name labels for SMTP clients or
servers. In particular, the underscore character is not permitted.
SMTP servers that receive a command in which invalid character codes
have been employed, and for which there are no other reasons for
rejection, MUST reject that command with a 501 response (this rule,
like others, could be overridden by appropriate SMTP extensions).

So I think it may be an issue in current implemention.


By the way, thank you for your great library, it helped a lot :P

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.