diff --git a/src/common.c b/src/common.c index 9595fac..2e670cb 100644 --- a/src/common.c +++ b/src/common.c @@ -587,6 +587,9 @@ int parsehostname(char *hostname, struct clientparam *param, uint16_t port){ port = atoi(sp+1); *sp = ':'; } + /* A port alone overrides the port of a host already set; without + one it names no destination to connect to. */ + if(!param->hostname || !*param->hostname) return 1; *SAPORT(¶m->req) = htons(port); return 0; } diff --git a/src/smtpp.c b/src/smtpp.c index 3905bf0..25d5fa6 100644 --- a/src/smtpp.c +++ b/src/smtpp.c @@ -195,6 +195,10 @@ void * smtppchild(struct clientparam* param) { } } + /* A login has to end with a host to connect to: what follows reads the + host name, and without one there is nowhere to go. */ + if(!param->hostname || !param->extusername){RETURN(669);} + #ifndef WITHMAIN { int action, reqbufsize, reqsize;