- use workgroup from smb.conf in smbclient
authorAndrew Tridgell <tridge@samba.org>
Sat, 5 Oct 1996 02:54:37 +0000 (02:54 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 5 Oct 1996 02:54:37 +0000 (02:54 +0000)
- 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 61e3116e573637d6b5a878eeb8db72831e3c5bd1)

source3/client/client.c
source3/client/clitar.c
source3/include/includes.h
source3/include/proto.h
source3/lib/system.c
source3/libsmb/nmblib.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/uid.c

index 596d6a96770c91a04e5aca2be2a265b1389ad108..b8b63207d79cc9c7d4fd90f1afaa7b10aad855c3 100644 (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);
index 13df5fef9add0c96b2296870f925dbb3c0ad8c52..191e0e4dab0311466817cceec25f4b11ca6fbc40 100644 (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);
 }
index 5d5fd7fd55c9a08e416479c043439bf31c1cb7b4..90358ce49ad55cbad10d66be516859d736cd932d 100644 (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
index 8b26aa062ff588661adde9db5617321c9a32dfa3..779f6bd87edbc5438df72586526d465578f59777 100644 (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);
index 81e9a6679ad19a4a449f8d37f65212c879439313..5ece0ca024173149ae1a53ca127c52701aae7482 100644 (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()
 ********************************************************************/
index 4113b34cab45680de8016b3d4ed35a5008cd1c2f..c70311f99787ab944a4cd4483056391e5ccbd37b 100644 (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 &&
index 6cf1b031e8337e1919325c250b5076762a27287c..63c0a7027e15a65f9807d79e179cc1be57ccfa08 100644 (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
 }
 
 
index a710aef69bbfecf61e1c0dece17923649e215f68..9ad78404651a5bd5b5868471e44e586f6551d511 100644 (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 */
index 7274c18478b9df8df75e7c02a5ad55278e0d05c6..9312a447a086f6238dcb5e31acc39e0f2e0f84bb 100644 (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;
     }