includes.h: Moved undefine of SEMMSL for HPUX to where it actually has an effect !
authorJeremy Allison <jra@samba.org>
Fri, 10 Apr 1998 18:14:37 +0000 (18:14 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 10 Apr 1998 18:14:37 +0000 (18:14 +0000)
locking_slow.c: Added FTRUNCATE_NEEDS_ROOT defined code for broken systems (not sure
which these are yet).
smbpasswd.c: Clear out the struct cli_state before use.
Jeremy.

source/include/includes.h
source/locking/locking_slow.c
source/utils/smbpasswd.c

index 7848f8b9d5b7b706e3c3110ab59197a70ff1e8a0..7f46ef6485cda9ee1591298ffe4497e6e57093e8 100644 (file)
@@ -613,11 +613,6 @@ char *mktemp(char *); /* No standard include */
    not good for HPUX */
 /* #define SIGCLD_IGNORE */
 #define USE_SIGPROCMASK /* Needed to stop zombie processes on HPUX 9.x and 10.x.*/
-#ifdef HPUX10
-#ifdef SEMMSL
-#undef SEMMSL
-#endif /* SEMMSL */
-#endif /* HPUX10 */
 #endif /* HPUX */
 
 
@@ -1144,6 +1139,11 @@ union semun {
        unsigned short *array;
 };
 #endif
+#if defined(HPUX) && defined(HPUX10)
+#ifdef SEMMSL
+#undef SEMMSL
+#endif /* SEMMSL */
+#endif /* HPUX && HPUX10 */
 #endif
 
 #ifdef AFS_AUTH
index de2bb1701c1ed41a6cc7dd55a4e28956c3fc29e4..d6ac6efac14f3f054b898b74a5e3424124513171 100644 (file)
@@ -502,8 +502,17 @@ mode file %s (%s)\n", fname, strerror(errno)));
       return 0;
     }
     /* Now truncate the file at this point. */
+#ifdef FTRUNCATE_NEEDS_ROOT
+    become_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
     if(ftruncate(fd, newsize)!= 0)
     {
+
+#ifdef FTRUNCATE_NEEDS_ROOT
+      unbecome_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
       DEBUG(0,("ERROR: get_share_modes: failed to ftruncate share \
 mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
       if(*old_shares)
@@ -515,6 +524,10 @@ mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
     }
   }
 
+#ifdef FTRUNCATE_NEEDS_ROOT
+      unbecome_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
   if(buf)
     free(buf);
 
@@ -653,15 +666,29 @@ mode file %s (%s)\n", fname, strerror(errno)));
       free(buf);
     return;
   }
+
   /* Now truncate the file at this point. */
+#ifdef FTRUNCATE_NEEDS_ROOT
+  become_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
   if(ftruncate(fd, newsize) != 0)
   {
+
+#ifdef FTRUNCATE_NEEDS_ROOT
+    unbecome_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
     DEBUG(0,("ERROR: del_share_mode: failed to ftruncate share \
 mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
     if(buf)
       free(buf);
     return;
   }
+
+#ifdef FTRUNCATE_NEEDS_ROOT
+  unbecome_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
 }
   
 /*******************************************************************
@@ -795,8 +822,18 @@ deleting it (%s).\n",fname, strerror(errno)));
   }
 
   /* Now truncate the file at this point - just for safety. */
+
+#ifdef FTRUNCATE_NEEDS_ROOT
+  become_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
   if(ftruncate(fd, header_size + (SMF_ENTRY_LENGTH*num_entries))!= 0)
   {
+
+#ifdef FTRUNCATE_NEEDS_ROOT
+    unbecome_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
     DEBUG(0,("ERROR: set_share_mode: failed to ftruncate share \
 mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entries), 
                 strerror(errno)));
@@ -805,6 +842,10 @@ mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entr
     return False;
   }
 
+#ifdef FTRUNCATE_NEEDS_ROOT
+  unbecome_root(False);
+#endif /* FTRUNCATE_NEEDS_ROOT */
+
   if(buf)
     free(buf);
 
index f977346fc05fc384e9469f725ac71d33379f5317..dc38d4f7472f4fe3db2afb06295913b235f9d6d0 100644 (file)
@@ -471,7 +471,7 @@ int main(int argc, char **argv)
       exit(1);
     }
  
-    cli.error = 0;
+    memset(&cli, '\0', sizeof(struct cli_state));
  
     if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) {
       fprintf(stderr, "%s: unable to connect to SMB server on machine %s. Error was : %s.\n",