-#include "config.h"
+/*
+ * Copyright (C) 1996-2021 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
*
* Session Routines ...
*
* Copyright (C) Richard Sharpe 1996
- *
*/
/*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "squid.h"
+
int RFCNB_errno = 0;
int RFCNB_saved_errno = 0;
#define RFCNB_ERRNO
#include "rfcnb/std-includes.h"
#include <netinet/tcp.h>
-#include "rfcnb/rfcnb.h"
-#include "rfcnb/rfcnb-priv.h"
#include "rfcnb/rfcnb-io.h"
+#include "rfcnb/rfcnb-priv.h"
#include "rfcnb/rfcnb-util.h"
+#include "rfcnb/rfcnb.h"
#if HAVE_STRING_H
#include <string.h>
int RFCNB_Stats[RFCNB_MAX_STATS];
-typedef void RFCNB_Prot_Print_Routine(FILE * fd, int dir, struct RFCNB_Pkt *pkt, int header, int payload);
RFCNB_Prot_Print_Routine *Prot_Print_Routine = NULL; /* Pointer to protocol print routine */
-int RFCNB_Get_Last_Errno(void);
-int RFCNB_Get_Error_Msg(int code, char *msg_buf, int len);
-void RFCNB_Register_Print_Routine(RFCNB_Prot_Print_Routine * fn);
-
/* Set up a session with a remote name. We are passed Called_Name as a
* string which we convert to a NetBIOS name, ie space terminated, up to
* 16 characters only if we need to. If Called_Address is not empty, then
con->errn = 0; /* no error yet */
con->timeout = 0; /* no timeout */
con->redirects = 0;
+ con->redirect_list = con->last_addr = NULL;
/* Resolve that name into an IP address */
Service_Address = Called_Name;
- if (strcmp(Called_Address, "") != 0) { /* If the Called Address = "" */
+ if (strlen(Called_Address) != 0) { /* If the Called Address = "" */
Service_Address = Called_Address;
}
if ((errno = RFCNB_Name_To_IP(Service_Address, &Dest_IP)) < 0) { /* Error */
/* No need to change RFCNB_errno as it was done by put_pkt ... */
+ RFCNB_Free_Pkt(pkt);
return (RFCNBE_Bad); /* Should be able to write that lot ... */
}
#ifdef RFCNB_DEBUG
fprintf(stderr, "Bad packet return in RFCNB_Recv... \n");
#endif
-
+ RFCNB_Free_Pkt(pkt);
return (RFCNBE_Bad);
}
return (RFCNB_errno);
}
-/* Pick up saved errno as well */
-int
-RFCNB_Get_Last_Errno()
-{
- return (RFCNB_saved_errno);
-}
-
-/* Pick up the last error response and return in string ... */
-int
-RFCNB_Get_Error_Msg(int code, char *msg_buf, int len)
-{
- return (strncpy(msg_buf, RFCNB_Error_Strings[abs(code)], len) != NULL);
-}
-
-/* Register a higher level protocol print routine */
-void
-RFCNB_Register_Print_Routine(RFCNB_Prot_Print_Routine * fn)
-{
- Prot_Print_Routine = fn;
-}