-/*
- Copyright (C) 2001-2006 Kern Sibbald
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as amended with additional clauses defined in the
- file LICENSE in the main source directory.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- the file LICENSE for additional details.
-
- */
/*
Derived from a SMTPclient:
Version $Id$
*/
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2001-2006 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+
#include "bacula.h"
#include "jcr.h"
exit(1);
}
+#if defined(HAVE_WIN32)
+ _setmode(0, _O_BINARY);
+#endif
+
/*
* Determine SMTP server
*/
Dmsg0(20, "Connected\n");
#if defined(HAVE_WIN32)
- int fdSocket = _open_osfhandle(s, _O_RDWR);
+ int fdSocket = _open_osfhandle(s, _O_RDWR | _O_BINARY);
if (fdSocket == -1) {
Pmsg1(0, _("Fatal _open_osfhandle error: ERR=%s\n"), strerror(errno));
exit(1);
(void)localtime_r(&now, &tm);
#if defined(HAVE_WIN32)
#if defined(HAVE_MINGW)
-__MINGW_IMPORT long _dstbias;
+__MINGW_IMPORT long _dstbias;
#endif
long tzoffset = 0;
Dmsg1(20, "skip line because of maxlines limit: %lu\n", maxlines);
break;
}
- buf[strlen(buf)-1] = 0;
- if (strcmp(buf, ".") == 0) { /* quote lone dots */
- fprintf(sfp, "..\r\n");
+ buf[sizeof(buf)-1] = '\0';
+ buf[strlen(buf)-1] = '\0';
+ if (buf[0] == '.' && buf[1] == '\0') { /* quote lone dots */
+ fputs("..\r\n", sfp);
} else { /* pass body through unchanged */
- fprintf(sfp, "%s\r\n", buf);
+ fputs(buf, sfp);
+ fputs("\r\n", sfp);
}
}