summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-10-05 02:54:37 +0000
committerAndrew Tridgell <tridge@samba.org>1996-10-05 02:54:37 +0000
commit61e3116e573637d6b5a878eeb8db72831e3c5bd1 (patch)
tree80d58d866f0e6ff03d112b11edaf59ec8c3d1959
parentdff891e69d1fd0175f806e00d10ddbcbb9fc7b0b (diff)
downloadsamba-61e3116e573637d6b5a878eeb8db72831e3c5bd1.tar.gz
- 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()
-rw-r--r--source/client/client.c5
-rw-r--r--source/client/clitar.c8
-rw-r--r--source/include/includes.h6
-rw-r--r--source/include/proto.h1
-rw-r--r--source/lib/system.c12
-rw-r--r--source/libsmb/nmblib.c5
-rw-r--r--source/smbd/reply.c7
-rw-r--r--source/smbd/server.c3
-rw-r--r--source/smbd/uid.c2
9 files changed, 39 insertions, 10 deletions
diff --git a/source/client/client.c b/source/client/client.c
index 596d6a96770..b8b63207d79 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -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);
diff --git a/source/client/clitar.c b/source/client/clitar.c
index 13df5fef9ad..191e0e4dab0 100644
--- a/source/client/clitar.c
+++ b/source/client/clitar.c
@@ -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);
}
diff --git a/source/include/includes.h b/source/include/includes.h
index 5d5fd7fd55c..90358ce49ad 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -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
diff --git a/source/include/proto.h b/source/include/proto.h
index 8b26aa062ff..779f6bd87ed 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -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);
diff --git a/source/lib/system.c b/source/lib/system.c
index 81e9a6679ad..5ece0ca0241 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -142,6 +142,18 @@ int sys_stat(char *fname,struct stat *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()
********************************************************************/
int sys_lstat(char *fname,struct stat *sbuf)
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index 4113b34cab4..c70311f9978 100644
--- a/source/libsmb/nmblib.c
+++ b/source/libsmb/nmblib.c
@@ -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 &&
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 6cf1b031e83..63c0a7027e1 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -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
}
diff --git a/source/smbd/server.c b/source/smbd/server.c
index a710aef69bb..9ad78404651 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -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 */
diff --git a/source/smbd/uid.c b/source/smbd/uid.c
index 7274c18478b..9312a447a08 100644
--- a/source/smbd/uid.c
+++ b/source/smbd/uid.c
@@ -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;
}