1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

- use workgroup from smb.conf in smbclient

- change debug level on clitar stuff

- define MAP_FILE if not defined

- ensure we never set authoritative on queries in nmbd

- fake a positive response to SMBioctl, apparently this is needed for
some WfWg printer drivers

- deny file access for non-fcbopen queries when (access_allowed == AREAD && flags == O_RDWR)

- add sys_waitpid()
(This used to be commit 61e3116e57)
This commit is contained in:
Andrew Tridgell 1996-10-05 02:54:37 +00:00
parent 32e9d441af
commit 38087ccb40
9 changed files with 39 additions and 10 deletions

View File

@ -36,7 +36,7 @@ pstring desthost="";
extern pstring myname;
pstring password = "";
pstring username="";
pstring workgroup=WORKGROUP;
pstring workgroup="";
char *cmdstr="";
BOOL got_pass = False;
BOOL connect_as_printer = False;
@ -4503,6 +4503,9 @@ static void usage(char *pname)
return (-1);
}
if (*workgroup == 0)
strcpy(workgroup,lp_workgroup());
load_interfaces();
get_myname(*myname?NULL:myname,NULL);
strupper(myname);

View File

@ -823,7 +823,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
datalen = 0;
}
DEBUG(2,("getting file %s of size %d bytes as a tar file %s",
DEBUG(1,("getting file %s of size %d bytes as a tar file %s",
finfo.name,
finfo.size,
lname));
@ -1079,7 +1079,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
get_total_size += finfo.size;
/* Thanks to Carel-Jan Engel (ease@mail.wirehub.nl) for this one */
DEBUG(2,("(%g kb/s) (average %g kb/s)\n",
DEBUG(1,("(%g kb/s) (average %g kb/s)\n",
finfo.size / MAX(0.001, (1.024*this_time)),
get_total_size / MAX(0.001, (1.024*get_total_time_ms))));
}
@ -1406,7 +1406,7 @@ void cmd_block(void)
}
blocksize=block;
DEBUG(2,("blocksize is now %d\n", blocksize));
DEBUG(1,("blocksize is now %d\n", blocksize));
}
/****************************************************************************
@ -1483,7 +1483,7 @@ void cmd_setmode(void)
return;
}
DEBUG(2, ("\nperm set %d %d\n", attra[ATTRSET], attra[ATTRRESET]));
DEBUG(1, ("\nperm set %d %d\n", attra[ATTRSET], attra[ATTRRESET]));
(void) do_setrattr(fname, attra[ATTRSET], ATTRSET);
(void) do_setrattr(fname, attra[ATTRRESET], ATTRRESET);
}

View File

@ -220,6 +220,7 @@ Here come some platform specific sections
#define HAVE_BZERO
#define HAVE_MEMMOVE
#define USE_SIGPROCMASK
#define USE_WAITPID
#if 0
/* SETFS disabled until we can check on some bug reports */
#if _LINUX_C_LIB_VERSION_MAJOR >= 5
@ -258,6 +259,7 @@ typedef unsigned short mode_t;
#define REPLACE_GETPASS
#define BSD_TERMIO
#define USE_SIGPROCMASK
#define USE_WAITPID
#endif
@ -1080,6 +1082,10 @@ it works and getting lots of bug reports */
#define SIGCLD SIGCHLD
#endif
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
#ifndef HAVE_FCNTL_LOCK
#define HAVE_FCNTL_LOCK 1
#endif

View File

@ -754,6 +754,7 @@ int sys_unlink(char *fname);
int sys_open(char *fname,int flags,int mode);
DIR *sys_opendir(char *dname);
int sys_stat(char *fname,struct stat *sbuf);
int sys_waitpid(pid_t pid,int *status,int options);
int sys_lstat(char *fname,struct stat *sbuf);
int sys_mkdir(char *dname,int mode);
int sys_rmdir(char *dname);

View File

@ -141,6 +141,18 @@ int sys_stat(char *fname,struct stat *sbuf)
return(stat(dos_to_unix(fname,False),sbuf));
}
/*******************************************************************
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
return wait4(pid,status,options,NULL);
#endif
}
/*******************************************************************
don't forget lstat()
********************************************************************/

View File

@ -395,7 +395,7 @@ static BOOL parse_nmb(char *inbuf,int length,struct nmb_packet *nmb)
nmb->header.nm_flags.recursion_available = (nm_flags&8)?True:False;
nmb->header.nm_flags.recursion_desired = (nm_flags&0x10)?True:False;
nmb->header.nm_flags.trunc = (nm_flags&0x20)?True:False;
nmb->header.nm_flags.authoritative = (nm_flags&0x40)?True:False;
nmb->header.nm_flags.authoritative = (nm_flags&0x40)?True:False;
nmb->header.rcode = CVAL(inbuf,3) & 0xF;
nmb->header.qdcount = RSVAL(inbuf,4);
nmb->header.ancount = RSVAL(inbuf,6);
@ -606,7 +606,8 @@ static int build_nmb(char *buf,struct packet_struct *p)
RSSVAL(ubuf,offset,nmb->header.name_trn_id);
ubuf[offset+2] = (nmb->header.opcode & 0xF) << 3;
if (nmb->header.response) ubuf[offset+2] |= (1<<7);
if (nmb->header.nm_flags.authoritative) ubuf[offset+2] |= 0x4;
if (nmb->header.nm_flags.authoritative &&
nmb->header.response) ubuf[offset+2] |= 0x4;
if (nmb->header.nm_flags.trunc) ubuf[offset+2] |= 0x2;
if (nmb->header.nm_flags.recursion_desired) ubuf[offset+2] |= 0x1;
if (nmb->header.nm_flags.recursion_available &&

View File

@ -294,8 +294,13 @@ int reply_unknown(char *inbuf,char *outbuf)
int reply_ioctl(char *inbuf,char *outbuf)
{
DEBUG(3,("ignoring ioctl\n"));
#if 1
/* we just say it succeeds and hope its all OK.
some day it would be nice to interpret them individually */
return set_message(outbuf,1,0,True);
#else
return(ERROR(ERRSRV,ERRnosupport));
#endif
}

View File

@ -1158,6 +1158,7 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
share_pid,fname);
if ((access_allowed == AFAIL) ||
(!fcbopen && (access_allowed == AREAD && flags == O_RDWR)) ||
(access_allowed == AREAD && flags == O_WRONLY) ||
(access_allowed == AWRITE && flags == O_RDONLY)) {
DEBUG(2,("Share violation on file (%d,%d,%d,%d,%s) = %d\n",
@ -1586,7 +1587,7 @@ static int sig_cld()
DEBUG(5,("got SIGCLD\n"));
#ifdef USE_WAITPID
while (waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0);
while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0);
#endif
/* Stop zombies */

View File

@ -415,7 +415,7 @@ int smbrun(char *cmd,char *outfile,BOOL shared)
if ((pid=fork())) {
int status=0;
/* the parent just waits for the child to exit */
if (waitpid(pid,&status,0) != pid) {
if (sys_waitpid(pid,&status,0) != pid) {
DEBUG(2,("waitpid(%d) : %s\n",pid,strerror(errno)));
return -1;
}