summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-10-15 00:55:17 +0000
committerJeremy Allison <jra@samba.org>1998-10-15 00:55:17 +0000
commitfc7d3e4caa7650c02ef36fff83b64b06050f66b1 (patch)
tree8fbe7f4ec700a5f2f42397683783e7d19249337a /source3/smbd
parentbc747b8a077d22344aa03bbba202f5137b59284d (diff)
downloadsamba-fc7d3e4caa7650c02ef36fff83b64b06050f66b1.tar.gz
samba-fc7d3e4caa7650c02ef36fff83b64b06050f66b1.tar.bz2
samba-fc7d3e4caa7650c02ef36fff83b64b06050f66b1.zip
config: Fix crypt prototype on RedHat Linux.
include/includes.h: Fix crypt prototype on RedHat Linux. smbd/fileio.c: Fix mmap bug found by WinCE client. smbd/ipc.c: Fix WinCE wierdness with pipes being opened as \server\pipe\lanman smbd/password.c: Fix encrypted null passwords. Jeremy. (This used to be commit 475992730c0ecbf31c09b3518df2f0354cec61da)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/fileio.c2
-rw-r--r--source3/smbd/ipc.c14
-rw-r--r--source3/smbd/oplock.c2
-rw-r--r--source3/smbd/password.c14
4 files changed, 24 insertions, 8 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 5c4bf7dfc2..ebc4544a76 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -63,7 +63,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
#if WITH_MMAP
if (fsp->mmap_ptr) {
- SMB_OFF_T num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : -1;
+ SMB_OFF_T num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : 0;
num = MIN(n,num);
if (num > 0) {
memcpy(data,fsp->mmap_ptr+pos,num);
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 0c4d0d5bfe..646ac83331 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -3454,6 +3454,7 @@ static int named_pipe(connection_struct *conn,uint16 vuid, char *outbuf,char *na
int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int bufsize)
{
fstring name;
+ int name_offset = 0;
char *data=NULL,*params=NULL;
uint16 *setup=NULL;
int outsize = 0;
@@ -3563,10 +3564,19 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int
DEBUG(3,("trans <%s> data=%d params=%d setup=%d\n",
name,tdscnt,tpscnt,suwcnt));
- if (strncmp(name,"\\PIPE\\",strlen("\\PIPE\\")) == 0) {
+ /*
+ * WinCE wierdness....
+ */
+
+ if (name[0] == '\\' && (StrnCaseCmp(&name[1],local_machine,
+ strlen(local_machine)) == 0)) {
+ name_offset = strlen(local_machine)+1;
+ }
+
+ if (strncmp(&name[name_offset],"\\PIPE\\",strlen("\\PIPE\\")) == 0) {
DEBUG(5,("calling named_pipe\n"));
outsize = named_pipe(conn,vuid,outbuf,
- name+strlen("\\PIPE\\"),setup,data,params,
+ name+name_offset+strlen("\\PIPE\\"),setup,data,params,
suwcnt,tdscnt,tpscnt,msrcnt,mdrcnt,mprcnt);
} else {
DEBUG(3,("invalid pipe name\n"));
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index fee1b8141d..b1c6d9a981 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -54,7 +54,7 @@ BOOL open_oplock_ipc(void)
if (oplock_sock == -1)
{
DEBUG(0,("open_oplock_ipc: Failed to get local UDP socket for \
-address %lx. Error was %s\n", htonl(INADDR_LOOPBACK), strerror(errno)));
+address %lx. Error was %s\n", (long)htonl(INADDR_LOOPBACK), strerror(errno)));
global_oplock_port = 0;
return(False);
}
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 49ad4a514f..761313b688 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -379,6 +379,7 @@ BOOL smb_password_check(char *password, unsigned char *part_passwd, unsigned cha
Do a specific test for an smb password being correct, given a smb_password and
the lanman and NT responses.
****************************************************************************/
+
BOOL smb_password_ok(struct smb_passwd *smb_pass,
uchar lm_pass[24], uchar nt_pass[24])
{
@@ -386,6 +387,9 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass,
if (!lm_pass || !smb_pass) return(False);
+ DEBUG(4,("Checking SMB password for user %s\n",
+ smb_pass->smb_name));
+
if(smb_pass->acct_ctrl & ACB_DISABLED) {
DEBUG(3,("account for user %s was disabled.\n",
smb_pass->smb_name));
@@ -397,9 +401,6 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass,
return False;
}
- DEBUG(4,("Checking SMB password for user %s\n",
- smb_pass->smb_name));
-
if ((Protocol >= PROTOCOL_NT1) && (smb_pass->smb_nt_passwd != NULL)) {
/* We have the NT MD4 hash challenge available - see if we can
use it (ie. does it exist in the smbpasswd file).
@@ -493,6 +494,11 @@ static BOOL pass_check_smb(char *user,char *password, struct passwd *pwd)
return(False);
}
+ if(password[0] == '\0' && smb_pass->acct_ctrl & ACB_PWNOTREQ && lp_null_passwords()) {
+ DEBUG(3,("account for user %s has no password and null passwords are allowed.\n", smb_pass->smb_name));
+ return(True);
+ }
+
if (smb_password_ok(smb_pass,
(unsigned char *)password,
(uchar *)password)) {
@@ -510,7 +516,7 @@ return True if the password is correct, False otherwise
****************************************************************************/
BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd)
{
- if (pwlen == 24) {
+ if (pwlen == 24 || (lp_encrypted_passwords() && (pwlen == 0) && lp_null_passwords())) {
/* if it is 24 bytes long then assume it is an encrypted
password */
return pass_check_smb(user, password, pwd);