1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-11 08:23:49 +03:00

bracket some macros

change MAX_PASSWORD_LENGTH to MAX_PASS_LEN to prevent conflict on some
systems

add #ifdef around soft link dependent code (for systems that don't
have soft links)
This commit is contained in:
Andrew Tridgell
-
parent e789179dfd
commit e10ba4b97a
5 changed files with 15 additions and 11 deletions

View File

@@ -460,7 +460,7 @@ BOOL cli_send_login(char *inbuf, char *outbuf, BOOL start_session, BOOL use_setu
/* send a session setup command */ /* send a session setup command */
bzero(outbuf,smb_size); bzero(outbuf,smb_size);
if (passlen > MAX_PASSWORD_LENGTH) { if (passlen > MAX_PASS_LEN) {
DEBUG(1,("password too long %d\n", passlen)); DEBUG(1,("password too long %d\n", passlen));
return False; return False;
} }

View File

@@ -1114,15 +1114,15 @@ extern char *sys_errlist[];
#endif #endif
#ifndef S_ISREG #ifndef S_ISREG
#define S_ISREG(x) ((S_IFREG & x)!=0) #define S_ISREG(x) ((S_IFREG & (x))!=0)
#endif #endif
#ifndef S_ISDIR #ifndef S_ISDIR
#define S_ISDIR(x) ((S_IFDIR & x)!=0) #define S_ISDIR(x) ((S_IFDIR & (x))!=0)
#endif #endif
#if !defined(S_ISLNK) && defined(S_IFLNK) #if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(x) ((S_IFLNK & x)!=0) #define S_ISLNK(x) ((S_IFLNK & (x))!=0)
#endif #endif
#ifdef UFC_CRYPT #ifdef UFC_CRYPT
@@ -1202,7 +1202,7 @@ it works and getting lots of bug reports */
/* this is a rough check to see if this machine has a lstat() call. /* this is a rough check to see if this machine has a lstat() call.
it is not guaranteed to work */ it is not guaranteed to work */
#if !(defined(S_ISLNK) || defined(S_IFLNK)) #if !defined(S_ISLNK)
#define lstat stat #define lstat stat
#endif #endif

View File

@@ -43,7 +43,7 @@
#define WORDMAX 0xFFFF #define WORDMAX 0xFFFF
/* the maximum password length before we declare a likely attack */ /* the maximum password length before we declare a likely attack */
#define MAX_PASSWORD_LENGTH 200 #define MAX_PASS_LEN 200
/* separators for lists */ /* separators for lists */
#define LIST_SEP " \t,;:\n\r" #define LIST_SEP " \t,;:\n\r"

View File

@@ -252,7 +252,7 @@ int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize)
if ((SVAL(inbuf,smb_vwv2) & 0x1) != 0) if ((SVAL(inbuf,smb_vwv2) & 0x1) != 0)
close_cnum(SVAL(inbuf,smb_tid),vuid); close_cnum(SVAL(inbuf,smb_tid),vuid);
if (passlen > MAX_PASSWORD_LENGTH) { if (passlen > MAX_PASS_LEN) {
overflow_attack(passlen); overflow_attack(passlen);
} }
@@ -388,7 +388,7 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
if (Protocol < PROTOCOL_NT1) { if (Protocol < PROTOCOL_NT1) {
smb_apasslen = SVAL(inbuf,smb_vwv7); smb_apasslen = SVAL(inbuf,smb_vwv7);
if (smb_apasslen > MAX_PASSWORD_LENGTH) if (smb_apasslen > MAX_PASS_LEN)
{ {
overflow_attack(smb_apasslen); overflow_attack(smb_apasslen);
} }
@@ -423,12 +423,12 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
if (passlen1 != 24 && passlen2 != 24) if (passlen1 != 24 && passlen2 != 24)
doencrypt = False; doencrypt = False;
if (passlen1 > MAX_PASSWORD_LENGTH) { if (passlen1 > MAX_PASS_LEN) {
overflow_attack(passlen1); overflow_attack(passlen1);
} }
passlen1 = MIN(passlen1, MAX_PASSWORD_LENGTH); passlen1 = MIN(passlen1, MAX_PASS_LEN);
passlen2 = MIN(passlen2, MAX_PASSWORD_LENGTH); passlen2 = MIN(passlen2, MAX_PASS_LEN);
if(doencrypt) { if(doencrypt) {
/* Save the lanman2 password and the NT md4 password. */ /* Save the lanman2 password and the NT md4 password. */

View File

@@ -214,9 +214,11 @@ int dos_mode(int cnum,char *path,struct stat *sbuf)
if (S_ISDIR(sbuf->st_mode)) if (S_ISDIR(sbuf->st_mode))
result = aDIR | (result & aRONLY); result = aDIR | (result & aRONLY);
#ifdef S_ISLNK
#if LINKS_READ_ONLY #if LINKS_READ_ONLY
if (S_ISLNK(sbuf->st_mode) && S_ISDIR(sbuf->st_mode)) if (S_ISLNK(sbuf->st_mode) && S_ISDIR(sbuf->st_mode))
result |= aRONLY; result |= aRONLY;
#endif
#endif #endif
/* hide files with a name starting with a . */ /* hide files with a name starting with a . */
@@ -863,6 +865,7 @@ BOOL check_name(char *name,int cnum)
/* Patch from David Clerc <David.Clerc@cui.unige.ch> /* Patch from David Clerc <David.Clerc@cui.unige.ch>
University of Geneva */ University of Geneva */
#ifdef S_ISLNK
if (!lp_symlinks(SNUM(cnum))) if (!lp_symlinks(SNUM(cnum)))
{ {
struct stat statbuf; struct stat statbuf;
@@ -873,6 +876,7 @@ BOOL check_name(char *name,int cnum)
ret=0; ret=0;
} }
} }
#endif
if (!ret) if (!ret)
DEBUG(5,("check_name on %s failed\n",name)); DEBUG(5,("check_name on %s failed\n",name));