mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-14 20:33:48 +00:00
Fixed crash on password reminder with invalid SMTP server
SVN revision: 1541
This commit is contained in:
parent
71c55a715e
commit
02af62d1f8
10
src/elogd.c
10
src/elogd.c
@ -1653,14 +1653,14 @@ INT sendmail(LOGBOOK * lbs, char *smtp_host, char *from, char *to,
|
|||||||
phe = gethostbyname(smtp_host);
|
phe = gethostbyname(smtp_host);
|
||||||
if (phe == NULL) {
|
if (phe == NULL) {
|
||||||
strcpy(error, loc("Cannot lookup server name"));
|
strcpy(error, loc("Cannot lookup server name"));
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy((char *) &(bind_addr.sin_addr), phe->h_addr, phe->h_length);
|
memcpy((char *) &(bind_addr.sin_addr), phe->h_addr, phe->h_length);
|
||||||
|
|
||||||
if (connect(s, (void *) &bind_addr, sizeof(bind_addr)) < 0) {
|
if (connect(s, (void *) &bind_addr, sizeof(bind_addr)) < 0) {
|
||||||
closesocket(s);
|
closesocket(s);
|
||||||
strcpy(error, loc("Cannot connect to server"));
|
strcpy(error, loc("Cannot connect to server"));
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strsize = TEXT_SIZE + 1000;
|
strsize = TEXT_SIZE + 1000;
|
||||||
@ -10938,7 +10938,7 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
|
|||||||
int i;
|
int i;
|
||||||
char str[1000], login_name[256], full_name[256], user_email[256],
|
char str[1000], login_name[256], full_name[256], user_email[256],
|
||||||
name[256], pwd[256], redir[256], pwd_encrypted[256], smtp_host[256],
|
name[256], pwd[256], redir[256], pwd_encrypted[256], smtp_host[256],
|
||||||
mail_from[256], subject[256], mail_text[1000], url[1000];
|
mail_from[256], subject[256], mail_text[1000], url[1000], error[1000];
|
||||||
|
|
||||||
if (isparam("login_name")) {
|
if (isparam("login_name")) {
|
||||||
/* seach in pwd file */
|
/* seach in pwd file */
|
||||||
@ -11018,7 +11018,7 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
|
|||||||
sprintf(mail_text + strlen(mail_text), "ELOG Version %s\r\n", VERSION);
|
sprintf(mail_text + strlen(mail_text), "ELOG Version %s\r\n", VERSION);
|
||||||
|
|
||||||
if (sendmail(lbs, smtp_host, mail_from, user_email, subject, mail_text, TRUE,
|
if (sendmail(lbs, smtp_host, mail_from, user_email, subject, mail_text, TRUE,
|
||||||
url, "text/plain", NULL, NULL, 0)
|
url, "text/plain", NULL, error, 0)
|
||||||
!= -1) {
|
!= -1) {
|
||||||
/* save new password */
|
/* save new password */
|
||||||
change_pwd(lbs, login_name, pwd_encrypted);
|
change_pwd(lbs, login_name, pwd_encrypted);
|
||||||
@ -11040,6 +11040,8 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
sprintf(str, loc("Error sending Email via <i>\"%s\"</i>"), smtp_host);
|
sprintf(str, loc("Error sending Email via <i>\"%s\"</i>"), smtp_host);
|
||||||
|
strlcat(str, ": ", sizeof(str));
|
||||||
|
strlcat(str, error, sizeof(str));
|
||||||
show_error(str);
|
show_error(str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user