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

Makefile: Added cleandir target.

chgpasswd.c: Added patch from Roland Haag <haag@think.de> to allow
             password changes to be done more than once.
loadparm.c: Added entries for the "directory mode/directory mask parameters".
            Changed default file mode to 644.
proto.h: Added sys_gethostbyname.
server.c: Added directory mode changes.
system.c: Added sys_gethostbyname.
trans2.c: Added NT_FILE_ATTRIBUTE_NORMAL patch from Roger Orr
          <rorr@csfp.csfb.com>
trans2.h: Defined NT_FILE_ATTRIBUTE_NORMAL for above patch.
util.c: Changes calls to gethostbyname to sys_gethostbyname.
jra@cygnus.com
This commit is contained in:
Samba Release Account 0001-01-01 00:00:00 +00:00
parent 8851556da7
commit d8d8a7ee00
8 changed files with 81 additions and 18 deletions

View File

@ -238,6 +238,7 @@ BOOL lp_map_system(int );
BOOL lp_delete_readonly(int );
BOOL lp_fake_oplocks(int );
int lp_create_mode(int );
int lp_dir_mode(int );
int lp_max_connections(int );
int lp_defaultcase(int );
int lp_minprintspace(int );
@ -762,6 +763,7 @@ int sys_rename(char *from, char *to);
int sys_chmod(char *fname,int mode);
int sys_chown(char *fname,int uid,int gid);
int sys_chroot(char *dname);
struct hostent *sys_gethostbyname(char *name);
/*The following definitions come from testparm.c */

View File

@ -228,6 +228,11 @@ Byte offset Type name description
#define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
/* NT uses a FILE_ATTRIBUTE_NORMAL when no other attributes
are set. */
#define NT_FILE_ATTRIBUTE_NORMAL 0x80
/* Function prototypes */

View File

@ -146,7 +146,11 @@ The wait() calls vary between systems
********************************************************************/
int sys_waitpid(pid_t pid,int *status,int options)
{
#ifdef USE_WAITPID
return waitpid(pid,status,options);
#else /* USE_WAITPID */
return wait4(pid, status, options, NULL);
#endif /* USE_WAITPID */
}
/*******************************************************************
@ -235,3 +239,41 @@ int sys_chroot(char *dname)
return(chroot(dname));
#endif
}
/**************************************************************************
A wrapper for gethostbyname() that tries avoids looking up hostnames
in the root domain, which can cause dial-on-demand links to come up for no
apparent reason.
****************************************************************************/
struct hostent *sys_gethostbyname(char *name)
{
char query[256], hostname[256];
char *domain;
/* Does this name have any dots in it? If so, make no change */
if (strchr(name, '.'))
return(gethostbyname(name));
/* Get my hostname, which should have domain name
attached. If not, just do the gethostname on the
original string.
*/
gethostname(hostname, sizeof(hostname) - 1);
hostname[sizeof(hostname) - 1] = 0;
if ((domain = strchr(hostname, '.')) == NULL)
return(gethostbyname(name));
/* Attach domain name to query and do modified query.
If names too large, just do gethostname on the
original string.
*/
if((strlen(name) + strlen(domain)) >= sizeof(query))
return(gethostbyname(name));
sprintf(query, "%s%s", name, domain);
return(gethostbyname(query));
}

View File

@ -3238,7 +3238,7 @@ struct hostent *Get_Hostbyname(char *name)
return(NULL);
}
ret = gethostbyname(name2);
ret = sys_gethostbyname(name2);
if (ret != NULL)
{
free(name2);
@ -3247,7 +3247,7 @@ struct hostent *Get_Hostbyname(char *name)
/* try with all lowercase */
strlower(name2);
ret = gethostbyname(name2);
ret = sys_gethostbyname(name2);
if (ret != NULL)
{
free(name2);
@ -3256,7 +3256,7 @@ struct hostent *Get_Hostbyname(char *name)
/* try with all uppercase */
strupper(name2);
ret = gethostbyname(name2);
ret = sys_gethostbyname(name2);
if (ret != NULL)
{
free(name2);

View File

@ -213,6 +213,7 @@ typedef struct
char *volume;
int iMinPrintSpace;
int iCreate_mode;
int iDir_mode;
int iMaxConnections;
int iDefaultCase;
BOOL bAlternatePerm;
@ -286,7 +287,8 @@ static service sDefault =
NULL, /* writelist */
NULL, /* volume */
0, /* iMinPrintSpace */
0755, /* iCreate_mode */
0644, /* iCreate_mode */
0755, /* iDir_mode */
0, /* iMaxConnections */
CASE_LOWER, /* iDefaultCase */
False, /* bAlternatePerm */
@ -479,6 +481,8 @@ struct parm_struct
{"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL},
{"create mask", P_OCTAL, P_LOCAL, &sDefault.iCreate_mode, NULL},
{"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mode, NULL},
{"directory mask", P_OCTAL, P_LOCAL, &sDefault.iDir_mode, NULL},
{"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mode, NULL},
{"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL},
{"status", P_BOOL, P_LOCAL, &sDefault.status, NULL},
{"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL},
@ -851,6 +855,7 @@ FN_LOCAL_BOOL(lp_delete_readonly,bDeleteReadonly)
FN_LOCAL_BOOL(lp_fake_oplocks,bFakeOplocks)
FN_LOCAL_INTEGER(lp_create_mode,iCreate_mode)
FN_LOCAL_INTEGER(lp_dir_mode,iDir_mode)
FN_LOCAL_INTEGER(lp_max_connections,iMaxConnections)
FN_LOCAL_INTEGER(lp_defaultcase,iDefaultCase)
FN_LOCAL_INTEGER(lp_minprintspace,iMinPrintSpace)

View File

@ -41,7 +41,7 @@ static int findpty(char **slave)
#ifdef SVR4
extern char *ptsname();
#else
static char line[12] = "/dev/ptyXX";
static char line[12];
void *dirp;
char *dpname;
#endif
@ -54,13 +54,17 @@ static int findpty(char **slave)
return (master);
}
#else
strcpy( line, "/dev/ptyXX" );
dirp = OpenDir("/dev");
if (!dirp) return(-1);
while ((dpname = ReadDirName(dirp)) != NULL) {
if (strncmp(dpname, "pty", 3) == 0 && strlen(dpname) == 5) {
DEBUG(3,("pty: try to open %s, line was %s\n", dpname, line ) );
line[8] = dpname[3];
line[9] = dpname[4];
if ((master = open(line, O_RDWR)) >= 0) {
DEBUG(3,("pty: opened %s\n", line ) );
line[5] = 't';
*slave = line;
CloseDir(dirp);
@ -280,7 +284,7 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence)
kill(pid, SIGKILL); /* be sure to end this process */
return(False);
}
if ((wpid = waitpid(pid, &wstat, 0)) < 0) {
if ((wpid = sys_waitpid(pid, &wstat, 0)) < 0) {
DEBUG(3,("The process is no longer waiting!\n\n"));
return(False);
}

View File

@ -130,19 +130,21 @@ mode_t unix_mode(int cnum,int dosmode)
if ( !IS_DOS_READONLY(dosmode) )
result |= (S_IWUSR | S_IWGRP | S_IWOTH);
if (IS_DOS_DIR(dosmode))
if (IS_DOS_DIR(dosmode)) {
result |= (S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH | S_IWUSR);
if (MAP_ARCHIVE(cnum) && IS_DOS_ARCHIVE(dosmode))
result |= S_IXUSR;
result &= (lp_dir_mode(SNUM(cnum)) | 0700);
} else {
if (MAP_ARCHIVE(cnum) && IS_DOS_ARCHIVE(dosmode))
result |= S_IXUSR;
if (MAP_SYSTEM(cnum) && IS_DOS_SYSTEM(dosmode))
result |= S_IXGRP;
if (MAP_SYSTEM(cnum) && IS_DOS_SYSTEM(dosmode))
result |= S_IXGRP;
if (MAP_HIDDEN(cnum) && IS_DOS_HIDDEN(dosmode))
result |= S_IXOTH;
if (MAP_HIDDEN(cnum) && IS_DOS_HIDDEN(dosmode))
result |= S_IXOTH;
result &= CREATE_MODE(cnum);
result &= CREATE_MODE(cnum);
}
return(result);
}

View File

@ -276,6 +276,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
strequal(Connections[cnum].dirpath,".") ||
strequal(Connections[cnum].dirpath,"/"));
BOOL was_8_3;
int nt_extmode; /* Used for NT connections instead of mode */
*fname = 0;
*out_of_space = False;
@ -357,6 +358,8 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
name_map_mangle(fname,False,SNUM(cnum));
nt_extmode = mode ? mode : NT_FILE_ATTRIBUTE_NORMAL;
switch (info_level)
{
case 1:
@ -440,7 +443,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
put_long_date(p,mdate); p += 8;
SIVAL(p,0,size); p += 8;
SIVAL(p,0,size); p += 8;
SIVAL(p,0,mode); p += 4;
SIVAL(p,0,nt_extmode); p += 4;
SIVAL(p,0,strlen(fname)); p += 4;
SIVAL(p,0,0); p += 4;
if (!was_8_3) {
@ -468,7 +471,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
put_long_date(p,mdate); p += 8;
SIVAL(p,0,size); p += 8;
SIVAL(p,0,size); p += 8;
SIVAL(p,0,mode); p += 4;
SIVAL(p,0,nt_extmode); p += 4;
SIVAL(p,0,strlen(fname)); p += 4;
strcpy(p,fname);
p = pdata + len;
@ -486,7 +489,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
put_long_date(p,mdate); p += 8;
SIVAL(p,0,size); p += 8;
SIVAL(p,0,size); p += 8;
SIVAL(p,0,mode); p += 4;
SIVAL(p,0,nt_extmode); p += 4;
SIVAL(p,0,strlen(fname)); p += 4;
SIVAL(p,0,0); p += 4;
strcpy(p,fname);