From: Stephan Bosch Date: Fri, 13 Sep 2019 20:31:37 +0000 (+0200) Subject: lib-smtp: smtp-address - Add smtp_address_is_broken(). X-Git-Tag: 2.3.9~121 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3df63927dc6b19cc9036d3fb320e8f813c83bb0c;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: smtp-address - Add smtp_address_is_broken(). --- diff --git a/src/lib-smtp/smtp-address.h b/src/lib-smtp/smtp-address.h index f5e391d99f..3d20d2a390 100644 --- a/src/lib-smtp/smtp-address.h +++ b/src/lib-smtp/smtp-address.h @@ -196,4 +196,12 @@ smtp_address_isnull(const struct smtp_address *address) *address->localpart == '\0'); } +static inline bool ATTR_NULL(1) ATTR_PURE +smtp_address_is_broken(const struct smtp_address *address) +{ + return (address != NULL && + (address->localpart == NULL || *address->localpart == '\0') && + (address->raw != NULL && *address->raw != '\0')); +} + #endif