* Version $Id$
*/
/*
- Copyright (C) 2000-2004 Kern Sibbald
+ Copyright (C) 2000-2005 Kern Sibbald
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+ 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 ammended with additional clauses defined in the
+ file LICENSE in the main source directory.
- This library is distributed in the hope that it will be useful,
+ 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
bsock->tls = NULL;
return 0;
}
+#else
+int bnet_tls_server(TLS_CONTEXT *ctx, BSOCK * bsock, alist *verify_list)
+{
+ Jmsg(bsock->jcr, M_ABORT, 0, _("TLS not configured.\n"));
+ return 0;
+}
+int bnet_tls_client(TLS_CONTEXT *ctx, BSOCK * bsock)
+{
+ Jmsg(bsock->jcr, M_ABORT, 0, _("TLS not configured.\n"));
+ return 0;
+}
#endif /* HAVE_TLS */
/*
FD_SET((unsigned)bsock->fd, &fdset);
tv.tv_sec = sec;
tv.tv_usec = 0;
- for (;;) {
- switch (select(bsock->fd + 1, &fdset, NULL, NULL, &tv)) {
- case 0: /* timeout */
- bsock->b_errno = 0;
- return 0;
- case -1:
- bsock->b_errno = errno;
- return -1; /* error return */
- default:
- bsock->b_errno = 0;
- return 1;
- }
+ switch (select(bsock->fd + 1, &fdset, NULL, NULL, &tv)) {
+ case 0: /* timeout */
+ bsock->b_errno = 0;
+ return 0;
+ case -1:
+ bsock->b_errno = errno;
+ return -1; /* error return */
+ default:
+ bsock->b_errno = 0;
}
+ return 1;
}
#ifndef NETDB_INTERNAL
static const char *gethost_strerror()
{
const char *msg;
+ berrno be;
switch (h_errno) {
case NETDB_INTERNAL:
- msg = strerror(errno);
+ msg = be.strerror();
break;
case NETDB_SUCCESS:
msg = "No problem.";
Qmsg1(bs->jcr, M_ERROR, 0, _("sockopt error: %s\n"), be.strerror());
dbuf_size -= TAPE_BSIZE;
}
- Dmsg1(200, "set network buffer size=%d\n", dbuf_size);
+ Dmsg1(900, "set network buffer size=%d\n", dbuf_size);
if (dbuf_size != start_size) {
Qmsg1(bs->jcr, M_WARNING, 0,
_("Warning network buffer = %d bytes not max size.\n"), dbuf_size);
/* Get current flags */
if((oflags = fcntl(bsock->fd, F_GETFL, 0)) < 0) {
- Emsg1(M_ABORT, 0, "fcntl F_GETFL error. ERR=%s\n", strerror(errno));
+ berrno be;
+ Emsg1(M_ABORT, 0, "fcntl F_GETFL error. ERR=%s\n", be.strerror());
}
/* Set O_NONBLOCK flag */
if((fcntl(bsock->fd, F_SETFL, oflags|O_NONBLOCK)) < 0) {
- Emsg1(M_ABORT, 0, "fcntl F_SETFL error. ERR=%s\n", strerror(errno));
+ berrno be;
+ Emsg1(M_ABORT, 0, "fcntl F_SETFL error. ERR=%s\n", be.strerror());
}
bsock->blocking = 0;
int oflags;
/* Get current flags */
if((oflags = fcntl(bsock->fd, F_GETFL, 0)) < 0) {
- Emsg1(M_ABORT, 0, "fcntl F_GETFL error. ERR=%s\n", strerror(errno));
+ berrno be;
+ Emsg1(M_ABORT, 0, "fcntl F_GETFL error. ERR=%s\n", be.strerror());
}
/* Set O_NONBLOCK flag */
if((fcntl(bsock->fd, F_SETFL, oflags & ~O_NONBLOCK)) < 0) {
- Emsg1(M_ABORT, 0, "fcntl F_SETFL error. ERR=%s\n", strerror(errno));
+ berrno be;
+ Emsg1(M_ABORT, 0, "fcntl F_SETFL error. ERR=%s\n", be.strerror());
}
bsock->blocking = 1;
void bnet_restore_blocking (BSOCK *bsock, int flags) {
#ifndef WIN32
if((fcntl(bsock->fd, F_SETFL, flags)) < 0) {
- Emsg1(M_ABORT, 0, "fcntl F_SETFL error. ERR=%s\n", strerror(errno));
+ berrno be;
+ Emsg1(M_ABORT, 0, "fcntl F_SETFL error. ERR=%s\n", be.strerror());
}
bsock->blocking = (flags & O_NONBLOCK);