From: hno <> Date: Sun, 23 Jun 2002 17:28:43 +0000 (+0000) Subject: A bit of cleanups to make GCC happy, and removed some unused code. X-Git-Tag: SQUID_3_0_PRE1~961 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c06f9773560ffee68bc5244403df191acee4bbfa;p=thirdparty%2Fsquid.git A bit of cleanups to make GCC happy, and removed some unused code. --- diff --git a/helpers/basic_auth/MSNT/allowusers.c b/helpers/basic_auth/MSNT/allowusers.c index 863e060046..33ec88c0a7 100644 --- a/helpers/basic_auth/MSNT/allowusers.c +++ b/helpers/basic_auth/MSNT/allowusers.c @@ -13,7 +13,9 @@ #include #include #include +#include #include "usersfile.h" +#include "msntauth.h" static usersfile AllowUsers; static int init = 0; diff --git a/helpers/basic_auth/MSNT/denyusers.c b/helpers/basic_auth/MSNT/denyusers.c index 8e15251b26..661f5a7eb5 100644 --- a/helpers/basic_auth/MSNT/denyusers.c +++ b/helpers/basic_auth/MSNT/denyusers.c @@ -14,10 +14,9 @@ #include #include #include +#include #include "usersfile.h" - -extern int Check_ifuserallowed(const char *); -extern void Check_forallowchange(void); +#include "msntauth.h" static usersfile DenyUsers; static int init = 0; @@ -35,7 +34,7 @@ Read_denyusers(void) return Read_usersfile(Denyuserpath, &DenyUsers); } -void +static void Check_fordenychange(void) { Check_forfilechange(&DenyUsers); @@ -47,7 +46,7 @@ Check_fordenychange(void) * user list. Returns 0 if the user was not found, and 1 if they were. */ -int +static int Check_ifuserdenied(char *ConnectingUser) { /* If user string is empty, deny */ @@ -86,7 +85,7 @@ Check_user(char *ConnectingUser) */ void -Check_forchange() +Check_forchange(int signal) { Check_fordenychange(); Check_forallowchange(); @@ -110,7 +109,7 @@ Checktimer() if (difftime(Currenttime, Lasttime) < 60) return; else { - Check_forchange(); + Check_forchange(-1); Lasttime = Currenttime; } } diff --git a/helpers/basic_auth/MSNT/md4.c b/helpers/basic_auth/MSNT/md4.c index 7a62e55544..b9793cd62d 100644 --- a/helpers/basic_auth/MSNT/md4.c +++ b/helpers/basic_auth/MSNT/md4.c @@ -20,6 +20,7 @@ */ #include +#include "md4.h" /* NOTE: This code makes no attempt to be fast! * diff --git a/helpers/basic_auth/MSNT/md4.h b/helpers/basic_auth/MSNT/md4.h new file mode 100644 index 0000000000..b9c6a78089 --- /dev/null +++ b/helpers/basic_auth/MSNT/md4.h @@ -0,0 +1,2 @@ +/* md4.c */ +void mdfour(unsigned char *out, unsigned char *in, int n); diff --git a/helpers/basic_auth/MSNT/msntauth.c b/helpers/basic_auth/MSNT/msntauth.c index 5cb9ffacd7..8b939eb206 100644 --- a/helpers/basic_auth/MSNT/msntauth.c +++ b/helpers/basic_auth/MSNT/msntauth.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include "msntauth.h" diff --git a/helpers/basic_auth/MSNT/msntauth.h b/helpers/basic_auth/MSNT/msntauth.h index 4a2c48a7b2..dd33cb77f2 100644 --- a/helpers/basic_auth/MSNT/msntauth.h +++ b/helpers/basic_auth/MSNT/msntauth.h @@ -1,8 +1,11 @@ extern int OpenConfigFile(void); extern int QueryServers(char *, char *); extern void Checktimer(void); -extern void Check_forchange(); +extern void Check_forchange(int); extern int Read_denyusers(void); extern int Read_allowusers(void); extern int Check_user(char *); extern int QueryServers(char *, char *); +extern int Check_ifuserallowed(char *ConnectingUser); +extern void Check_forallowchange(void); + diff --git a/helpers/basic_auth/MSNT/rfcnb-error.h b/helpers/basic_auth/MSNT/rfcnb-error.h index 6dd46820e6..77ca769ec2 100644 --- a/helpers/basic_auth/MSNT/rfcnb-error.h +++ b/helpers/basic_auth/MSNT/rfcnb-error.h @@ -52,6 +52,6 @@ /* Text strings for the error responses */ -extern char *RFCNB_Error_Strings[]; +extern const char *RFCNB_Error_Strings[]; #endif /* _RFCNB_ERROR_H_ */ diff --git a/helpers/basic_auth/MSNT/rfcnb-io.c b/helpers/basic_auth/MSNT/rfcnb-io.c index bac6f2c44e..53c5be5c9e 100644 --- a/helpers/basic_auth/MSNT/rfcnb-io.c +++ b/helpers/basic_auth/MSNT/rfcnb-io.c @@ -36,15 +36,18 @@ int RFCNB_Timeout = 0; /* Timeout in seconds ... */ -void +#ifdef NOT_USED +static void rfcnb_alarm(int sig) { syslog(LOG_ERR, "%s:%d: IO Timed out ...\n", __FILE__, __LINE__); } +#endif /* Set timeout value and setup signal handling */ -int +#ifdef NOT_USED +static int RFCNB_Set_Timeout(int seconds) { #ifdef SA_RESTART @@ -69,6 +72,7 @@ RFCNB_Set_Timeout(int seconds) } return 0; } +#endif /* @@ -76,7 +80,7 @@ RFCNB_Set_Timeout(int seconds) * in the buffer we allocated or were passed ... */ -int +static int RFCNB_Discard_Rest(struct RFCNB_Con *con, int len) { char temp[100]; /* Read into here */ diff --git a/helpers/basic_auth/MSNT/rfcnb-util.c b/helpers/basic_auth/MSNT/rfcnb-util.c index 01b157051c..9753da86f4 100644 --- a/helpers/basic_auth/MSNT/rfcnb-util.c +++ b/helpers/basic_auth/MSNT/rfcnb-util.c @@ -36,7 +36,7 @@ #include #include -char *RFCNB_Error_Strings[] = +const char *RFCNB_Error_Strings[] = { "RFCNBE_OK: Routine completed successfully.", @@ -59,7 +59,9 @@ char *RFCNB_Error_Strings[] = }; +#ifdef RFCNB_DEBUG extern void (*Prot_Print_Routine) (); /* Pointer to protocol print routine */ +#endif /* Convert name and pad to 16 chars as needed */ /* Name 1 is a C string with null termination, name 2 may not be */ diff --git a/helpers/basic_auth/MSNT/rfcnb.h b/helpers/basic_auth/MSNT/rfcnb.h index d1ebde427d..112ac648da 100644 --- a/helpers/basic_auth/MSNT/rfcnb.h +++ b/helpers/basic_auth/MSNT/rfcnb.h @@ -34,15 +34,19 @@ /* Definition of routines we define */ +struct RFCNB_Con; + void *RFCNB_Call(char *Called_Name, char *Calling_Name, char *Called_Address, int port); -int RFCNB_Send(void *Con_Handle, struct RFCNB_Pkt *Data, int Length); - -int RFCNB_Recv(void *Con_Handle, struct RFCNB_Pkt *Data, int Length); +int RFCNB_Send(struct RFCNB_Con *Con_Handle, struct RFCNB_Pkt *Data, int Length); -int RFCNB_Hangup(void *con_Handle); +int RFCNB_Recv(struct RFCNB_Con *Con_Handle, struct RFCNB_Pkt *Data, int Length); -void *RFCNB_Listen(); +int RFCNB_Hangup(struct RFCNB_Con *Con_Handle); void RFCNB_Get_Error(char *buffer, int buf_len); +int RFCNB_Get_Last_Error(void); +int RFCNB_Get_Last_Errno(void); +void RFCNB_Get_Error_Msg(int code, char *msg_buf, int len); + diff --git a/helpers/basic_auth/MSNT/session.c b/helpers/basic_auth/MSNT/session.c index 76eb81a568..a1c33bfd1d 100644 --- a/helpers/basic_auth/MSNT/session.c +++ b/helpers/basic_auth/MSNT/session.c @@ -32,6 +32,7 @@ int RFCNB_saved_errno = 0; #include "rfcnb-priv.h" #include "rfcnb-util.h" #include "rfcnb-io.h" +#include "rfcnb.h" #include #include @@ -39,7 +40,9 @@ int RFCNB_saved_errno = 0; int RFCNB_Stats[RFCNB_MAX_STATS]; +#ifdef RFCNB_DEBUG void (*Prot_Print_Routine) () = NULL; /* Pointer to print routine */ +#endif /* 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 @@ -223,7 +226,7 @@ RFCNB_Send(struct RFCNB_Con *Con_Handle, struct RFCNB_Pkt *udata, int Length) * non-message packets ... */ int -RFCNB_Recv(void *con_Handle, struct RFCNB_Pkt *Data, int Length) +RFCNB_Recv(struct RFCNB_Con *con_Handle, struct RFCNB_Pkt *Data, int Length) { struct RFCNB_Pkt *pkt; int ret_len; @@ -283,27 +286,6 @@ RFCNB_Hangup(struct RFCNB_Con *con_Handle) return 0; -} - -/* Set TCP_NODELAY on the socket */ - -int -RFCNB_Set_Sock_NoDelay(struct RFCNB_Con *con_Handle, BOOL yn) -{ - - return (setsockopt(con_Handle->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &yn, sizeof(yn))); - -} - - -/* Listen for a connection on a port???, when */ -/* the connection comes in, we return with the connection */ - -void -RFCNB_Listen() -{ - } /* Pick up the last error response as a string, hmmm, this routine should */ @@ -325,7 +307,7 @@ RFCNB_Get_Error(char *buffer, int buf_len) /* Pick up the last error response and returns as a code */ int -RFCNB_Get_Last_Error() +RFCNB_Get_Last_Error(void) { return (RFCNB_errno); @@ -335,7 +317,7 @@ RFCNB_Get_Last_Error() /* Pick up saved errno as well */ int -RFCNB_Get_Last_Errno() +RFCNB_Get_Last_Errno(void) { return (RFCNB_saved_errno); @@ -354,6 +336,7 @@ RFCNB_Get_Error_Msg(int code, char *msg_buf, int len) /* Register a higher level protocol print routine */ +#ifdef RFCNB_DEBUG void RFCNB_Register_Print_Routine(void (*fn) ()) { @@ -361,3 +344,4 @@ RFCNB_Register_Print_Routine(void (*fn) ()) Prot_Print_Routine = fn; } +#endif diff --git a/helpers/basic_auth/MSNT/smbdes.c b/helpers/basic_auth/MSNT/smbdes.c index a9ac145c1e..b933cc3d11 100644 --- a/helpers/basic_auth/MSNT/smbdes.c +++ b/helpers/basic_auth/MSNT/smbdes.c @@ -45,7 +45,7 @@ * up with a different answer to the one above) */ - +#include "smbdes.h" static int perm1[56] = {57, 49, 41, 33, 25, 17, 9, diff --git a/helpers/basic_auth/MSNT/smbdes.h b/helpers/basic_auth/MSNT/smbdes.h new file mode 100644 index 0000000000..20c7da1e86 --- /dev/null +++ b/helpers/basic_auth/MSNT/smbdes.h @@ -0,0 +1,5 @@ +/* smbdes.c */ +void E_P16(unsigned char *p14, unsigned char *p16); +void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24); +void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key); +void cred_hash2(unsigned char *out, unsigned char *in, unsigned char *key); diff --git a/helpers/basic_auth/MSNT/smbencrypt.c b/helpers/basic_auth/MSNT/smbencrypt.c index 5d341c0a85..9bd4bd333c 100644 --- a/helpers/basic_auth/MSNT/smbencrypt.c +++ b/helpers/basic_auth/MSNT/smbencrypt.c @@ -40,12 +40,13 @@ extern int DEBUGLEVEL; #include "byteorder.h" -char *StrnCpy(char *dest, char *src, int n); -void strupper(char *s); -extern void E_P16(unsigned char *, unsigned char *); -extern void E_P24(unsigned char *, unsigned char *, unsigned char *); -extern void mdfour(unsigned char *, unsigned char *, int); +#include "md4.h" +#include "smbdes.h" +#include "smbencrypt.h" +static void E_md4hash(unsigned char *passwd, unsigned char *p16); +static char *StrnCpy(char *dest, char *src, int n); +static void strupper(char *s); /* * This implements the X/Open SMB password encryption diff --git a/helpers/basic_auth/MSNT/smbencrypt.h b/helpers/basic_auth/MSNT/smbencrypt.h new file mode 100644 index 0000000000..d35e4c4a1f --- /dev/null +++ b/helpers/basic_auth/MSNT/smbencrypt.h @@ -0,0 +1,4 @@ +/* smbencrypt.c */ +void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); +void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); +void nt_lm_owf_gen(char *pwd, char *nt_p16, char *p16); diff --git a/helpers/basic_auth/MSNT/smblib-priv.h b/helpers/basic_auth/MSNT/smblib-priv.h index 7caff4f4b0..f112c5a7db 100644 --- a/helpers/basic_auth/MSNT/smblib-priv.h +++ b/helpers/basic_auth/MSNT/smblib-priv.h @@ -499,7 +499,7 @@ typedef enum { /* We must make it possible for callers to specify these ... */ -extern char *SMB_Prots[]; +extern const char *SMB_Prots[]; extern int SMB_Types[]; typedef struct SMB_Status { diff --git a/helpers/basic_auth/MSNT/smblib-util.c b/helpers/basic_auth/MSNT/smblib-util.c index dc30fa63a0..298b6b21d0 100644 --- a/helpers/basic_auth/MSNT/smblib-util.c +++ b/helpers/basic_auth/MSNT/smblib-util.c @@ -24,6 +24,7 @@ */ #include "smblib-priv.h" +#include "smblib.h" #include "rfcnb.h" #include "rfcnb-priv.h" @@ -33,7 +34,7 @@ #include #include -char *SMB_Prots[] = +const char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", "MICROSOFT NETWORKS 1.03", "MICROSOFT NETWORKS 3.0", @@ -63,139 +64,12 @@ int SMB_Types[] = SMB_P_NT1, -1}; -/* Print out an SMB pkt in all its gory detail ... */ - -void -SMB_Print_Pkt(FILE fd, RFCNB_Pkt * pkt, BOOL command, int Offset, int Len) -{ - - /* Well, just how do we do this ... print it I suppose */ - - /* Print out the SMB header ... */ - - /* Print the command */ - - /* Print the other bits in the header */ - - - /* etc */ - -} - -/* Convert a DOS Date_Time to a local host type date time for printing */ - -char * -SMB_DOSTimToStr(int DOS_time) -{ - static char SMB_Time_Temp[48]; - int DOS_sec, DOS_min, DOS_hour, DOS_day, DOS_month, DOS_year; - - SMB_Time_Temp[0] = 0; - - DOS_sec = (DOS_time & 0x001F) * 2; - DOS_min = (DOS_time & 0x07E0) >> 5; - DOS_hour = ((DOS_time & 0xF800) >> 11); - - DOS_day = (DOS_time & 0x001F0000) >> 16; - DOS_month = (DOS_time & 0x01E00000) >> 21; - DOS_year = ((DOS_time & 0xFE000000) >> 25) + 80; - - sprintf(SMB_Time_Temp, "%2d/%02d/%2d %2d:%02d:%02d", DOS_day, DOS_month, - DOS_year, DOS_hour, DOS_min, DOS_sec); - - return (SMB_Time_Temp); - -} - -/* Convert an attribute byte/word etc to a string ... We return a pointer - * to a static string which we guarantee is long enough. If verbose is - * true, we print out long form of strings ... */ - -char * -SMB_AtrToStr(int attribs, BOOL verbose) -{ - static char SMB_Attrib_Temp[128]; - - SMB_Attrib_Temp[0] = 0; - - if (attribs & SMB_FA_ROF) - strcat(SMB_Attrib_Temp, (verbose ? "Read Only " : "R")); - - if (attribs & SMB_FA_HID) - strcat(SMB_Attrib_Temp, (verbose ? "Hidden " : "H")); - - if (attribs & SMB_FA_SYS) - strcat(SMB_Attrib_Temp, (verbose ? "System " : "S")); - - if (attribs & SMB_FA_VOL) - strcat(SMB_Attrib_Temp, (verbose ? "Volume " : "V")); - - if (attribs & SMB_FA_DIR) - strcat(SMB_Attrib_Temp, (verbose ? "Directory " : "D")); - - if (attribs & SMB_FA_ARC) - strcat(SMB_Attrib_Temp, (verbose ? "Archive " : "A")); - - return (SMB_Attrib_Temp); - -} - -/* Pick up the Max Buffer Size from the Tree Structure ... */ - -int -SMB_Get_Tree_MBS(SMB_Tree_Handle tree) -{ - if (tree != NULL) { - return (tree->mbs); - } else { - return (SMBlibE_BAD); - } -} - -/* Pick up the Max buffer size */ - -int -SMB_Get_Max_Buf_Siz(SMB_Handle_Type Con_Handle) -{ - if (Con_Handle != NULL) { - return (Con_Handle->max_xmit); - } else { - return (SMBlibE_BAD); - } - -} -/* Pickup the protocol index from the connection structure */ - -int -SMB_Get_Protocol_IDX(SMB_Handle_Type Con_Handle) -{ - if (Con_Handle != NULL) { - return (Con_Handle->prot_IDX); - } else { - return (0xFFFF); /* Invalid protocol */ - } - -} - -/* Pick up the protocol from the connection structure */ - -int -SMB_Get_Protocol(SMB_Handle_Type Con_Handle) -{ - if (Con_Handle != NULL) { - return (Con_Handle->protocol); - } else { - return (0xFFFF); /* Invalid protocol */ - } - -} - /* Figure out what protocol was accepted, given the list of dialect strings */ /* We offered, and the index back from the server. We allow for a user */ /* supplied list, and assume that it is a subset of our list */ -int -SMB_Figure_Protocol(char *dialects[], int prot_index) +static int +SMB_Figure_Protocol(const char *dialects[], int prot_index) { int i; @@ -228,7 +102,7 @@ SMB_Figure_Protocol(char *dialects[], int prot_index) /* none acceptible, and our return value is 0 if ok, <0 if problems */ int -SMB_Negotiate(SMB_Handle_Type Con_Handle, char *Prots[]) +SMB_Negotiate(SMB_Handle_Type Con_Handle, const char *Prots[]) { struct RFCNB_Pkt *pkt; int prots_len, i, pkt_len, prot, alloc_len; @@ -461,7 +335,7 @@ SMB_TreeConnect(SMB_Handle_Type Con_Handle, SMB_Tree_Handle Tree_Handle, char *path, char *password, - char *device) + const char *device) { struct RFCNB_Pkt *pkt; int param_len, pkt_len; @@ -622,106 +496,6 @@ SMB_TreeConnect(SMB_Handle_Type Con_Handle, } -int -SMB_TreeDisconnect(SMB_Tree_Handle Tree_Handle, BOOL discard) -{ - struct RFCNB_Pkt *pkt; - int pkt_len; - - pkt_len = SMB_tdis_len; - - pkt = (struct RFCNB_Pkt *) RFCNB_Alloc_Pkt(pkt_len); - - if (pkt == NULL) { - - SMBlib_errno = SMBlibE_NoSpace; - return (SMBlibE_BAD); /* Should handle the error */ - - } - /* Now plug in the values ... */ - - bzero(SMB_Hdr(pkt), SMB_tdis_len); - SIVAL(SMB_Hdr(pkt), SMB_hdr_idf_offset, SMB_DEF_IDF); /* Plunk in IDF */ - *(SMB_Hdr(pkt) + SMB_hdr_com_offset) = SMBtdis; - SSVAL(SMB_Hdr(pkt), SMB_hdr_pid_offset, Tree_Handle->con->pid); - SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, Tree_Handle->con->mid); - SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, Tree_Handle->con->uid); - *(SMB_Hdr(pkt) + SMB_hdr_wct_offset) = 0; - - SSVAL(SMB_Hdr(pkt), SMB_hdr_tid_offset, Tree_Handle->tid); - SSVAL(SMB_Hdr(pkt), SMB_tcon_bcc_offset, 0); - - /* Now send the packet and sit back ... */ - - if (RFCNB_Send(Tree_Handle->con->Trans_Connect, pkt, pkt_len) < 0) { - -#ifdef DEBUG - fprintf(stderr, "Error sending TDis request\n"); -#endif - - RFCNB_Free_Pkt(pkt); - SMBlib_errno = -SMBlibE_SendFailed; - return (SMBlibE_BAD); - - } - /* Now get the response ... */ - - if (RFCNB_Recv(Tree_Handle->con->Trans_Connect, pkt, pkt_len) < 0) { - -#ifdef DEBUG - fprintf(stderr, "Error receiving response to TCon\n"); -#endif - - RFCNB_Free_Pkt(pkt); - SMBlib_errno = -SMBlibE_RecvFailed; - return (SMBlibE_BAD); - - } - /* Check out the response type ... */ - - if (CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset) != SMBC_SUCCESS) { /* Process error */ - -#ifdef DEBUG - fprintf(stderr, "SMB_TDis failed with errorclass = %i, Error Code = %i\n", - CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset), - SVAL(SMB_Hdr(pkt), SMB_hdr_err_offset)); -#endif - - SMBlib_SMB_Error = IVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset); - RFCNB_Free_Pkt(pkt); - SMBlib_errno = SMBlibE_Remote; - return (SMBlibE_BAD); - - } - Tree_Handle->tid = 0xFFFF; /* Invalid TID */ - Tree_Handle->mbs = 0; /* Invalid */ - -#ifdef DEBUG - - fprintf(stderr, "Tree disconnect successful ...\n"); - -#endif - - /* What about the tree handle ? */ - - if (discard == TRUE) { /* Unlink it and free it ... */ - - if (Tree_Handle->next == NULL) - Tree_Handle->con->first_tree = Tree_Handle->prev; - else - Tree_Handle->next->prev = Tree_Handle->prev; - - if (Tree_Handle->prev == NULL) - Tree_Handle->con->last_tree = Tree_Handle->next; - else - Tree_Handle->prev->next = Tree_Handle->next; - - } - RFCNB_Free_Pkt(pkt); - return (0); - -} - /* Pick up the last LMBlib error ... */ int @@ -747,7 +521,7 @@ SMB_Get_Last_SMB_Err() /* Keep this table in sync with the message codes in smblib-common.h */ -static char *SMBlib_Error_Messages[] = +static const char *SMBlib_Error_Messages[] = { "Request completed sucessfully.", diff --git a/helpers/basic_auth/MSNT/smblib.c b/helpers/basic_auth/MSNT/smblib.c index b42e41a39b..bba9399cda 100644 --- a/helpers/basic_auth/MSNT/smblib.c +++ b/helpers/basic_auth/MSNT/smblib.c @@ -32,6 +32,7 @@ int SMBlib_SMB_Error; #include "rfcnb-priv.h" #include "rfcnb.h" #include "rfcnb-util.h" +#include "smbencrypt.h" #include #include @@ -41,13 +42,10 @@ int SMBlib_SMB_Error; SMB_State_Types SMBlib_State; -extern int RFCNB_Set_Sock_NoDelay(RFCNB_Con *, BOOL); -extern void SMB_Get_My_Name(char *, int); - /* Initialize the SMBlib package */ int -SMB_Init() +SMB_Init(void) { SMBlib_State = SMB_State_Started; @@ -65,20 +63,6 @@ SMB_Init() } -int -SMB_Term() -{ - -#ifdef SMBLIB_INSTRUMENT - - SMBlib_Instrument_Term(); /* Clean up and print results */ - -#endif - - return 0; - -} - /* SMB_Create: Create a connection structure and return for later use */ /* We have other helper routines to set variables */ @@ -91,23 +75,6 @@ SMB_Create_Con_Handle(void) } -int -SMBlib_Set_Sock_NoDelay(SMB_Handle_Type Con_Handle, BOOL yn) -{ - - - if (RFCNB_Set_Sock_NoDelay(Con_Handle->Trans_Connect, yn) < 0) { - -#ifdef DEBUG -#endif - - fprintf(stderr, "Setting no-delay on TCP socket failed ...\n"); - - } - return (0); - -} - /* SMB_Connect_Server: Connect to a server, but don't negotiate protocol */ /* or anything else ... */ @@ -199,7 +166,7 @@ SMB_Connect_Server(SMB_Handle_Type Con_Handle, /* If Con_Handle == NULL then create a handle and connect, otherwise */ /* use the handle passed */ -char *SMB_Prots_Restrict[] = +const char *SMB_Prots_Restrict[] = {"PC NETWORK PROGRAM 1.0", NULL}; diff --git a/helpers/basic_auth/MSNT/smblib.h b/helpers/basic_auth/MSNT/smblib.h index b08444dfec..5ebfe1141f 100644 --- a/helpers/basic_auth/MSNT/smblib.h +++ b/helpers/basic_auth/MSNT/smblib.h @@ -30,7 +30,7 @@ /* Create a handle to allow us to set/override some parameters ... */ -SMB_Handle_Type SMB_Create_Con_Handle(); +SMB_Handle_Type SMB_Create_Con_Handle(void); /* Connect to a server, but do not do a tree con etc ... */ @@ -47,12 +47,12 @@ SMB_Handle_Type SMB_Connect(SMB_Handle_Type Con_Handle, /* Negotiate a protocol */ -int SMB_Negotiate(void *Con_Handle, char *Prots[]); +int SMB_Negotiate(SMB_Handle_Type Con_Handle, const char *Prots[]); /* Connect to a tree ... */ -void *SMB_TreeConnect(void *con_handle, void *tree_handle, - char *path, char *password, char *dev); +SMB_Tree_Handle SMB_TreeConnect(SMB_Handle_Type con_handle, SMB_Tree_Handle tree_handle, + char *path, char *password, const char *dev); /* Disconnect a tree ... */ @@ -88,11 +88,18 @@ int SMB_Delete_Dir(void *tree, char *dir_name); int SMB_Check_Dir(void *tree, char *dir_name); -int SMB_Get_Last_Error(); +int SMB_Get_Last_Error(void); -int SMB_Get_Last_SMB_Err(); +int SMB_Get_Last_SMB_Err(void); -int SMB_Get_Error_Msg(int msg, char *msgbuf, int len); +void SMB_Get_Error_Msg(int msg, char *msgbuf, int len); void *SMB_Logon_And_TCon(void *con, void *tree, char *user, char *pass, char *service, char *st); + +void SMB_Get_My_Name(char *, int); + +int SMB_Init(void); + +extern int SMB_Logon_Server(SMB_Handle_Type, char *, char *); + diff --git a/helpers/basic_auth/MSNT/valid.c b/helpers/basic_auth/MSNT/valid.c index 72a9aee40a..2abdcc350c 100644 --- a/helpers/basic_auth/MSNT/valid.c +++ b/helpers/basic_auth/MSNT/valid.c @@ -5,14 +5,10 @@ #include "smblib.h" #include "valid.h" -extern int SMB_Init(void); -extern int SMB_Logon_Server(SMB_Handle_Type, char *, char *); - - int Valid_User(char *USERNAME, char *PASSWORD, char *SERVER, char *BACKUP, char *DOMAIN) { - char *SMB_Prots[] = + const char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", "MICROSOFT NETWORKS 1.03", "MICROSOFT NETWORKS 3.0",