1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 475992730c)
This commit is contained in:
Jeremy Allison 1998-10-15 00:55:17 +00:00
parent bc747b8a07
commit fc7d3e4caa
9 changed files with 312 additions and 246 deletions

View File

@ -61,6 +61,7 @@
#undef HAVE_FILE_MACRO #undef HAVE_FILE_MACRO
#undef HAVE_FUNCTION_MACRO #undef HAVE_FUNCTION_MACRO
#undef HAVE_SETRESUID_DECL #undef HAVE_SETRESUID_DECL
#undef HAVE_CRYPT_DECL
#undef HAVE_SETRESUID #undef HAVE_SETRESUID
#undef WITH_NETATALK #undef WITH_NETATALK
#undef HAVE_INO64_T #undef HAVE_INO64_T

511
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -123,6 +123,14 @@ if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
AC_DEFINE(HAVE_SETRESUID_DECL) AC_DEFINE(HAVE_SETRESUID_DECL)
fi fi
# stupid glibc has the functions but no declaration. grrrr.
AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
AC_TRY_COMPILE([#include <unistd.h>],[int i = crypt],
samba_cv_have_crypt_decl=yes,samba_cv_have_crypt_decl=no)])
if test x"$samba_cv_have_crypt_decl" = x"yes"; then
AC_DEFINE(HAVE_CRYPT_DECL)
fi
# and glibc has setresuid under linux but the function does # and glibc has setresuid under linux but the function does
# nothing until kernel 2.1.44! very dumb. # nothing until kernel 2.1.44! very dumb.
AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[ AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[

View File

@ -118,6 +118,7 @@
#undef HAVE_FILE_MACRO #undef HAVE_FILE_MACRO
#undef HAVE_FUNCTION_MACRO #undef HAVE_FUNCTION_MACRO
#undef HAVE_SETRESUID_DECL #undef HAVE_SETRESUID_DECL
#undef HAVE_CRYPT_DECL
#undef HAVE_SETRESUID #undef HAVE_SETRESUID
#undef WITH_NETATALK #undef WITH_NETATALK
#undef HAVE_INO64_T #undef HAVE_INO64_T

View File

@ -674,6 +674,11 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid);
int setresgid(gid_t rgid, gid_t egid, gid_t sgid); int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
#endif #endif
#if (defined(HAVE_CRYPT) && !defined(HAVE_CRYPT_DECL))
/* stupid glibc */
int crypt(const char *key, const char *salt);
#endif
#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET) #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
#define bzero(a,b) memset((a),'\0',(b)) #define bzero(a,b) memset((a),'\0',(b))
#endif #endif

View File

@ -63,7 +63,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
#if WITH_MMAP #if WITH_MMAP
if (fsp->mmap_ptr) { 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); num = MIN(n,num);
if (num > 0) { if (num > 0) {
memcpy(data,fsp->mmap_ptr+pos,num); memcpy(data,fsp->mmap_ptr+pos,num);

View File

@ -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) int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int bufsize)
{ {
fstring name; fstring name;
int name_offset = 0;
char *data=NULL,*params=NULL; char *data=NULL,*params=NULL;
uint16 *setup=NULL; uint16 *setup=NULL;
int outsize = 0; 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", DEBUG(3,("trans <%s> data=%d params=%d setup=%d\n",
name,tdscnt,tpscnt,suwcnt)); 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")); DEBUG(5,("calling named_pipe\n"));
outsize = named_pipe(conn,vuid,outbuf, 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); suwcnt,tdscnt,tpscnt,msrcnt,mdrcnt,mprcnt);
} else { } else {
DEBUG(3,("invalid pipe name\n")); DEBUG(3,("invalid pipe name\n"));

View File

@ -54,7 +54,7 @@ BOOL open_oplock_ipc(void)
if (oplock_sock == -1) if (oplock_sock == -1)
{ {
DEBUG(0,("open_oplock_ipc: Failed to get local UDP socket for \ 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; global_oplock_port = 0;
return(False); return(False);
} }

View File

@ -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 Do a specific test for an smb password being correct, given a smb_password and
the lanman and NT responses. the lanman and NT responses.
****************************************************************************/ ****************************************************************************/
BOOL smb_password_ok(struct smb_passwd *smb_pass, BOOL smb_password_ok(struct smb_passwd *smb_pass,
uchar lm_pass[24], uchar nt_pass[24]) 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); 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) { if(smb_pass->acct_ctrl & ACB_DISABLED) {
DEBUG(3,("account for user %s was disabled.\n", DEBUG(3,("account for user %s was disabled.\n",
smb_pass->smb_name)); smb_pass->smb_name));
@ -397,9 +401,6 @@ BOOL smb_password_ok(struct smb_passwd *smb_pass,
return False; 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)) { if ((Protocol >= PROTOCOL_NT1) && (smb_pass->smb_nt_passwd != NULL)) {
/* We have the NT MD4 hash challenge available - see if we can /* We have the NT MD4 hash challenge available - see if we can
use it (ie. does it exist in the smbpasswd file). 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); 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, if (smb_password_ok(smb_pass,
(unsigned char *)password, (unsigned char *)password,
(uchar *)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) 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 /* if it is 24 bytes long then assume it is an encrypted
password */ password */
return pass_check_smb(user, password, pwd); return pass_check_smb(user, password, pwd);