-#include "squid.h"
+/*
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation
*
* RFCNB Utility Routines ...
*
* Copyright (C) Richard Sharpe 1996
- *
*/
/*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "rfcnb/rfcnb.h"
-#include "rfcnb/std-includes.h"
+#include "squid.h"
+#include "rfcnb/rfcnb-io.h"
#include "rfcnb/rfcnb-priv.h"
#include "rfcnb/rfcnb-util.h"
-#include "rfcnb/rfcnb-io.h"
+#include "rfcnb/rfcnb.h"
+#include "rfcnb/std-includes.h"
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
/* Disconnect the TCP connection to the server */
int
-RFCNB_Close(int socket)
+RFCNB_Close(int fd)
{
- close(socket);
+ close(fd);
/* If we want to do error recovery, here is where we put it */
char resp[16];
int len;
struct RFCNB_Pkt *pkt, res_pkt;
+ int result = 0;
/* We build and send the session request, then read the response */
#endif
if ((len = RFCNB_Put_Pkt(con, pkt, RFCNB_Pkt_Sess_Len)) < 0) {
-
+ RFCNB_Free_Pkt(pkt);
return (RFCNBE_Bad); /* Should be able to write that lot ... */
}
res_pkt.next = NULL;
if ((len = RFCNB_Get_Pkt(con, &res_pkt, sizeof(resp))) < 0) {
-
+ RFCNB_Free_Pkt(pkt);
return (RFCNBE_Bad);
}
break;
}
- return (RFCNBE_Bad);
+ result = (RFCNBE_Bad);
break;
case RFCNB_SESSION_ACK: /* Got what we wanted ... */
- return (0);
+ result = (0);
break;
case RFCNB_SESSION_RETARGET: /* Go elsewhere */
memcpy(Dest_IP, (resp + RFCNB_Pkt_IP_Offset), sizeof(struct in_addr));
*port = SVAL(resp, RFCNB_Pkt_Port_Offset);
- return (0);
+ result = (0);
break;
default: /* A protocol error */
RFCNB_errno = RFCNBE_ProtErr;
- return (RFCNBE_Bad);
+ result = (RFCNBE_Bad);
break;
}
+
+ RFCNB_Free_Pkt(pkt);
+ return result;
}
+