summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/client.c8
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/include/smb.h24
-rw-r--r--source3/lib/util.c8
-rw-r--r--source3/locking/locking.c18
-rw-r--r--source3/param/params.c1
-rw-r--r--source3/smbd/reply.c6
-rw-r--r--source3/smbd/server.c26
-rw-r--r--source3/smbparse.c8
-rw-r--r--source3/utils/status.c15
10 files changed, 21 insertions, 97 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 403eea2fc9..6d85bd8807 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4562,12 +4562,12 @@ static void usage(char *pname)
break;
case 'U':
{
- char *p;
+ char *lp;
strcpy(username,optarg);
- if ((p=strchr(username,'%')))
+ if ((lp=strchr(username,'%')))
{
- *p = 0;
- strcpy(password,p+1);
+ *lp = 0;
+ strcpy(password,lp+1);
got_pass = True;
memset(strchr(optarg,'%')+1,'X',strlen(password));
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9faecd3a00..202b151150 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -808,7 +808,7 @@ char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align);
char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align);
char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align);
char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align);
-char* smb_io_rc4_owf(BOOL io, RC4_OWF *hash, char *q, char *base, int align);
+char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align);
char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align);
char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align);
char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align);
@@ -1045,4 +1045,4 @@ void fstrcpy(char *dest, char *src);
void pstrcpy(char *dest, char *src);
char *align4(char *q, char *base);
char *align2(char *q, char *base);
-char *align_offset(char *q, char *base, int align_offset);
+char *align_offset(char *q, char *base, int align_offset_len);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 1b8f04f02e..43e402359f 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -393,12 +393,12 @@ typedef struct logon_info
} DOM_LOGON_ID;
-/* RC4_OWF */
-typedef struct rc4_owf_info
+/* ARC4_OWF */
+typedef struct arc4_owf_info
{
uint8 data[16];
-} RC4_OWF;
+} ARC4_OWF;
/* DOM_ID_INFO_1 */
@@ -409,8 +409,8 @@ typedef struct id_info_1
DOM_LOGON_ID logon_id; /* logon ID */
UNIHDR hdr_user_name; /* user name unicode header */
UNIHDR hdr_workgroup_name; /* workgroup name unicode header */
- RC4_OWF rc4_lm_owf; /* rc4 LM OWF Password */
- RC4_OWF rc4_nt_owf; /* rc4 NT OWF Password */
+ ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */
+ ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */
UNISTR2 uni_domain_name; /* domain name unicode string */
UNISTR2 uni_user_name; /* user name unicode string */
UNISTR2 uni_workgroup_name; /* workgroup name unicode string */
@@ -1040,10 +1040,8 @@ typedef struct
{
smb_shm_offset_t next_share_mode_entry;
int pid;
-#ifdef USE_OPLOCKS
uint16 op_port;
uint16 op_type;
-#endif /* USE_OPLOCKS */
int share_mode;
struct timeval time;
} share_mode_entry;
@@ -1052,10 +1050,8 @@ typedef struct
typedef struct
{
int pid;
-#ifdef USE_OPLOCKS
uint16 op_port;
uint16 op_type;
-#endif /* USE_OPLOCKS */
int share_mode;
struct timeval time;
} min_share_mode_entry;
@@ -1081,11 +1077,7 @@ struct connect_record
};
#ifndef LOCKING_VERSION
-#ifdef USE_OPLOCKS
#define LOCKING_VERSION 4
-#else /* USE_OPLOCKS */
-#define LOCKING_VERSION 3
-#endif /* USE_OPLOCKS */
#endif /* LOCKING_VERSION */
#if !defined(FAST_SHARE_MODES)
@@ -1101,11 +1093,7 @@ struct connect_record
#define SMF_FILENAME_LEN_OFFSET 8
#define SMF_HEADER_LENGTH 10
-#ifdef USE_OPLOCKS
#define SMF_ENTRY_LENGTH 20
-#else /* USE_OPLOCKS */
-#define SMF_ENTRY_LENGTH 16
-#endif /* USE_OPLOCKS */
/*
* Share mode record offsets.
@@ -1116,10 +1104,8 @@ struct connect_record
#define SME_SHAREMODE_OFFSET 8
#define SME_PID_OFFSET 12
-#ifdef USE_OPLOCKS
#define SME_PORT_OFFSET 16
#define SME_OPLOCK_TYPE_OFFSET 18
-#endif /* USE_OPLOCKS */
#endif /* FAST_SHARE_MODES */
diff --git a/source3/lib/util.c b/source3/lib/util.c
index c5cfdd99f7..611794c4a8 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2301,7 +2301,6 @@ BOOL receive_smb(int fd,char *buffer, int timeout)
return(True);
}
-#ifdef USE_OPLOCKS
/****************************************************************************
read a message from a udp fd.
The timeout is in milli seconds
@@ -2498,7 +2497,6 @@ BOOL receive_message_or_smb(int smbfd, int oplock_fd,
return receive_local_message(oplock_fd, buffer, buffer_len, 0);
}
}
-#endif /* USE_OPLOCKS */
/****************************************************************************
send an smb to a fd
@@ -4335,11 +4333,11 @@ char *align2(char *q, char *base)
align a pointer to a multiple of align_offset bytes. looks like it
will work for offsets of 0, 2 and 4...
********************************************************************/
-char *align_offset(char *q, char *base, int align_offset)
+char *align_offset(char *q, char *base, int align_offset_len)
{
- if (align_offset != 0 && ((q - base) & (align_offset-1)))
+ if (align_offset_len != 0 && ((q - base) & (align_offset_len-1)))
{
- q += align_offset - ((q - base) & (align_offset));
+ q += align_offset_len - ((q - base) & (align_offset_len));
}
return q;
}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index abda5d39d4..f29c1a6105 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -283,10 +283,8 @@ bucket %d (number of entries now = %d)\n",
*/
share_array[num_entries_copied].pid = entry_scanner_p->pid;
share_array[num_entries_copied].share_mode = entry_scanner_p->share_mode;
-#ifdef USE_OPLOCKS
share_array[num_entries_copied].op_port = entry_scanner_p->op_port;
share_array[num_entries_copied].op_type = entry_scanner_p->op_type;
-#endif /* USE_OPLOCKS */
memcpy(&share_array[num_entries_copied].time, &entry_scanner_p->time,
sizeof(struct timeval));
num_entries_copied++;
@@ -555,10 +553,8 @@ inode %d in hash bucket %d\n", fs_p->name, dev, inode, hash_entry));
new_entry_p->pid = getpid();
new_entry_p->share_mode = fs_p->share_mode;
-#ifdef USE_OPLOCKS
new_entry_p->op_port = port;
new_entry_p->op_type = op_type;
-#endif /* USE_OPLOCKS */
memcpy( (char *)&new_entry_p->time, (char *)&fs_p->open_time, sizeof(struct timeval));
/* Chain onto the share_mode_record */
@@ -589,7 +585,6 @@ Remove an oplock port and mode entry from a share mode.
********************************************************************/
BOOL remove_share_oplock(int fnum, share_lock_token token)
{
-#ifdef USE_OPLOCKS
uint32 dev, inode;
smb_shm_offset_t *mode_array;
unsigned int hash_entry;
@@ -694,9 +689,6 @@ mode record found dev = %d, inode = %d in hash bucket %d\n", dev, inode, hash_en
}
return True;
-#else /* USE_OPLOCKS */
- return False;
-#endif /* USE_OPLOCKS */
}
#else /* FAST_SHARE_MODES */
@@ -1006,10 +998,8 @@ it left a share mode entry with mode 0x%X in share file %s\n",
share_array[num_entries_copied].time.tv_usec = IVAL(p,SME_USEC_OFFSET);
share_array[num_entries_copied].share_mode = IVAL(p,SME_SHAREMODE_OFFSET);
share_array[num_entries_copied].pid = pid;
-#ifdef USE_OPLOCKS
share_array[num_entries_copied].op_port = SVAL(p,SME_PORT_OFFSET);
share_array[num_entries_copied].op_type = SVAL(p,SME_OPLOCK_TYPE_OFFSET);
-#endif /* USE_OPLOCKS */
num_entries_copied++;
}
@@ -1054,10 +1044,8 @@ position 0 for share mode file %s (%s)\n", fname, strerror(errno)));
SIVAL(p,SME_SHAREMODE_OFFSET,share_array[i].share_mode);
SIVAL(p,SME_SEC_OFFSET,share_array[i].time.tv_sec);
SIVAL(p,SME_USEC_OFFSET,share_array[i].time.tv_usec);
-#ifdef USE_OPLOCKS
SSVAL(p,SME_PORT_OFFSET,share_array[i].op_port);
SSVAL(p,SME_OPLOCK_TYPE_OFFSET,share_array[i].op_type);
-#endif /* USE_OPLOCKS */
}
newsize = (base - buf) + (SMF_ENTRY_LENGTH*num_entries_copied);
@@ -1338,10 +1326,8 @@ deleting it.\n", fname));
SIVAL(p,SME_USEC_OFFSET,fs_p->open_time.tv_usec);
SIVAL(p,SME_SHAREMODE_OFFSET,fs_p->share_mode);
SIVAL(p,SME_PID_OFFSET,pid);
-#ifdef USE_OPLOCKS
SSVAL(p,SME_PORT_OFFSET,port);
SSVAL(p,SME_OPLOCK_TYPE_OFFSET,op_type);
-#endif /* USE_OPLOCKS */
num_entries++;
@@ -1392,7 +1378,6 @@ Remove an oplock port and mode entry from a share mode.
********************************************************************/
BOOL remove_share_oplock(int fnum, share_lock_token token)
{
-#ifdef USE_OPLOCKS
pstring fname;
int fd = (int)token;
char *buf = 0;
@@ -1504,8 +1489,5 @@ mode file %s (%s)\n", fname, strerror(errno)));
return True;
-#else /* USE_OPLOCKS */
- return False;
-#endif /* USE_OPLOCKS */
}
#endif /* FAST_SHARE_MODES */
diff --git a/source3/param/params.c b/source3/param/params.c
index 8c41eef789..4d1c191b47 100644
--- a/source3/param/params.c
+++ b/source3/param/params.c
@@ -441,7 +441,6 @@ static BOOL Parse( FILE *InFile,
*/
{
int c;
- char *func = "params.c:Parse() -";
c = EatWhitespace( InFile );
while( (EOF != c) && (c > 0) )
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index a8f674183c..fa641931eb 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1621,7 +1621,6 @@ int reply_readbraw(char *inbuf, char *outbuf)
int fd;
char *fname;
-#ifdef USE_OPLOCKS
/*
* Special check if an oplock break has been issued
* and the readraw request croses on the wire, we must
@@ -1635,7 +1634,6 @@ int reply_readbraw(char *inbuf, char *outbuf)
DEBUG(5,("readbraw - oplock break finished\n"));
return -1;
}
-#endif
cnum = SVAL(inbuf,smb_tid);
fnum = GETFNUM(inbuf,smb_vwv0);
@@ -3373,7 +3371,7 @@ int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize)
unsigned char locktype = CVAL(inbuf,smb_vwv3);
#if 0
unsigned char oplocklevel = CVAL(inbuf,smb_vwv3+1);
-#endif /* USE_OPLOCKS */
+#endif
uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
uint16 num_locks = SVAL(inbuf,smb_vwv7);
uint32 count, offset;
@@ -3391,7 +3389,6 @@ int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize)
data = smb_buf(inbuf);
-#ifdef USE_OPLOCKS
/* Check if this is an oplock break on a file
we have granted an oplock on.
*/
@@ -3432,7 +3429,6 @@ dev = %x, inode = %x\n", fnum, dev, inode));
fsp->granted_oplock = False;
return -1;
}
-#endif /* USE_OPLOCKS */
/* Data now points at the beginning of the list
of smb_unlkrng structs */
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 826b17121f..4f5b01ba91 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -84,13 +84,11 @@ int chain_fnum = -1;
/* number of open connections */
static int num_connections_open = 0;
-#ifdef USE_OPLOCKS
/* Oplock ipc UDP socket. */
int oplock_sock = -1;
uint16 oplock_port = 0;
/* Current number of oplocks we have outstanding. */
int32 global_oplocks_open = 0;
-#endif /* USE_OPLOCKS */
BOOL global_oplock_break = False;
@@ -1487,7 +1485,6 @@ BOOL check_file_sharing(int cnum,char *fname)
{
min_share_mode_entry *share_entry = &old_shares[i];
-#ifdef USE_OPLOCKS
/*
* Break oplocks before checking share modes. See comment in
* open_file_shared for details.
@@ -1513,7 +1510,6 @@ dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode));
broke_oplock = True;
break;
}
-#endif /* USE_OPLOCKS */
/* someone else has a share lock on it, check to see
if we can too */
@@ -1729,7 +1725,6 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
{
min_share_mode_entry *share_entry = &old_shares[i];
-#ifdef USE_OPLOCKS
/*
* By observation of NetBench, oplocks are broken *before* share
* modes are checked. This allows a file to be closed by the client
@@ -1759,7 +1754,6 @@ dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode));
broke_oplock = True;
break;
}
-#endif /* USE_OPLOCKS */
/* someone else has a share lock on it, check to see
if we can too */
@@ -1841,7 +1835,6 @@ dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode));
if (lp_share_modes(SNUM(cnum)))
{
uint16 port = 0;
-#ifdef USE_OPLOCKS
/* JRA. Currently this only services Exlcusive and batch
oplocks (no other opens on this file). This needs to
be extended to level II oplocks (multiple reader
@@ -1862,10 +1855,6 @@ dev = %x, inode = %x\n", oplock_request, fname, dev, inode));
port = 0;
oplock_request = 0;
}
-#else /* USE_OPLOCKS */
- oplock_request = 0;
- port = 0;
-#endif /* USE_OPLOCKS */
set_share_mode(token, fnum, port, oplock_request);
}
@@ -2434,7 +2423,6 @@ static void process_smb(char *inbuf, char *outbuf)
trans_num++;
}
-#ifdef USE_OPLOCKS
/****************************************************************************
open the oplock IPC socket communication
****************************************************************************/
@@ -2882,8 +2870,6 @@ oplock break response from pid %d on port %d for dev = %x, inode = %x.\n",
return True;
}
-#endif /* USE_OPLOCKS */
-
/****************************************************************************
check if a snum is in use
****************************************************************************/
@@ -4588,9 +4574,7 @@ static void process(void)
int counter;
int last_keepalive=0;
int service_load_counter = 0;
-#ifdef USE_OPLOCKS
BOOL got_smb = False;
-#endif /* USE_OPLOCKS */
if (deadtime <= 0)
deadtime = DEFAULT_SMBD_TIMEOUT;
@@ -4601,12 +4585,8 @@ static void process(void)
errno = 0;
for (counter=SMBD_SELECT_LOOP;
-#ifdef USE_OPLOCKS
!receive_message_or_smb(Client,oplock_sock,
InBuffer,BUFFER_SIZE,SMBD_SELECT_LOOP*1000,&got_smb);
-#else /* USE_OPLOCKS */
- !receive_smb(Client,InBuffer,SMBD_SELECT_LOOP*1000);
-#endif /* USE_OPLOCKS */
counter += SMBD_SELECT_LOOP)
{
int i;
@@ -4689,14 +4669,10 @@ static void process(void)
}
}
-#ifdef USE_OPLOCKS
if(got_smb)
-#endif /* USE_OPLOCKS */
process_smb(InBuffer, OutBuffer);
-#ifdef USE_OPLOCKS
else
process_local_message(oplock_sock, InBuffer, BUFFER_SIZE);
-#endif /* USE_OPLOCKS */
}
}
@@ -4976,11 +4952,9 @@ static void usage(char *pname)
DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir()));
}
-#ifdef USE_OPLOCKS
/* Setup the oplock IPC socket. */
if(!open_oplock_ipc())
exit(1);
-#endif /* USE_OPLOCKS */
process();
close_sockets();
diff --git a/source3/smbparse.c b/source3/smbparse.c
index c44c41c4cd..95390522ff 100644
--- a/source3/smbparse.c
+++ b/source3/smbparse.c
@@ -296,9 +296,9 @@ char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align
}
/*******************************************************************
-reads or writes an RC4_OWF structure.
+reads or writes an ARC4_OWF structure.
********************************************************************/
-char* smb_io_rc4_owf(BOOL io, RC4_OWF *hash, char *q, char *base, int align)
+char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align)
{
if (hash == NULL) return NULL;
@@ -326,8 +326,8 @@ char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align
q = smb_io_unihdr(io, &(id->hdr_user_name ), q, base, align);
q = smb_io_unihdr(io, &(id->hdr_workgroup_name), q, base, align);
- q = smb_io_rc4_owf(io, &(id->rc4_lm_owf), q, base, align);
- q = smb_io_rc4_owf(io, &(id->rc4_nt_owf), q, base, align);
+ q = smb_io_arc4_owf(io, &(id->arc4_lm_owf), q, base, align);
+ q = smb_io_arc4_owf(io, &(id->arc4_nt_owf), q, base, align);
q = smb_io_unistr2(io, &(id->uni_domain_name ), q, base, align);
q = smb_io_unistr2(io, &(id->uni_user_name ), q, base, align);
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 703105012e..4143244ab4 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -148,9 +148,7 @@ locking version (was %d, should be %d).\n",fname,
void *dir;
char *s;
#endif /* FAST_SHARE_MODES */
-#ifdef USE_OPLOCKS
int oplock_type;
-#endif /* USE_OPLOCKS */
int i;
struct session_record *ptr;
@@ -347,9 +345,7 @@ locking version (was %d, should be %d).\n",fname,
t.tv_sec = entry_scanner_p->time.tv_sec;
t.tv_usec = entry_scanner_p->time.tv_usec;
strcpy(fname, file_scanner_p->file_name);
-#ifdef USE_OPLOCKS
oplock_type = entry_scanner_p->op_type;
-#endif /* USE_OPLOCKS */
#else /* FAST_SHARE_MODES */
@@ -411,9 +407,7 @@ locking version (was %d, should be %d).\n",fname,
t.tv_sec = IVAL(p,SME_SEC_OFFSET);
t.tv_usec = IVAL(p,SME_USEC_OFFSET);
-#ifdef USE_OPLOCKS
oplock_type = SVAL(p,SME_OPLOCK_TYPE_OFFSET);
-#endif /* USE_OPLOCKS */
#endif /* FAST_SHARE_MODES */
fname[sizeof(fname)-1] = 0;
@@ -421,13 +415,8 @@ locking version (was %d, should be %d).\n",fname,
if (firstopen) {
firstopen=False;
printf("Locked files:\n");
-#ifdef USE_OPLOCKS
printf("Pid DenyMode R/W Oplock Name\n");
printf("--------------------------------------------------\n");
-#else /* USE_OPLOCKS */
- printf("Pid DenyMode R/W Name\n");
- printf("----------------------------------\n");
-#endif /* USE_OPLOCKS */
}
@@ -446,7 +435,7 @@ locking version (was %d, should be %d).\n",fname,
case 1: printf("WRONLY "); break;
case 2: printf("RDWR "); break;
}
-#ifdef USE_OPLOCKS
+
if((oplock_type & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) == (EXCLUSIVE_OPLOCK|BATCH_OPLOCK))
printf("EXCLUSIVE+BATCH ");
else if (oplock_type & EXCLUSIVE_OPLOCK)
@@ -455,7 +444,7 @@ locking version (was %d, should be %d).\n",fname,
printf("BATCH ");
else
printf("NONE ");
-#endif /* USE_OPLOCKS */
+
printf(" %s %s",fname,asctime(LocalTime((time_t *)&t.tv_sec)));
#ifdef FAST_SHARE_MODES