Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl2/xcvs/dist/src - check return value of write(2)



details:   https://anonhg.NetBSD.org/src/rev/b1f68a2b2732
branches:  trunk
changeset: 777885:b1f68a2b2732
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 08 20:41:48 2012 +0000

description:
- check return value of write(2)
- add acl support

diffstat:

 external/gpl2/xcvs/dist/src/server.c |  45 ++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 7 deletions(-)

diffs (115 lines):

diff -r 6f1ea845ca7d -r b1f68a2b2732 external/gpl2/xcvs/dist/src/server.c
--- a/external/gpl2/xcvs/dist/src/server.c      Thu Mar 08 20:41:20 2012 +0000
+++ b/external/gpl2/xcvs/dist/src/server.c      Thu Mar 08 20:41:48 2012 +0000
@@ -692,7 +692,8 @@
      */
 
     /* If this gives an error, not much we could do.  syslog() it?  */
-    write (STDOUT_FILENO, msg, sizeof (msg) - 1);
+    if (write (STDOUT_FILENO, msg, sizeof (msg) - 1) == -1)
+       exit(EXIT_FAILURE);
 # ifdef HAVE_SYSLOG_H
     syslog (LOG_DAEMON | LOG_ERR, "virtual memory exhausted");
 # endif /* HAVE_SYSLOG_H */
@@ -977,12 +978,16 @@
        if (forced && !quiet
            && alloc_pending_warning (120 + strlen (program_name)))
            sprintf (pending_warning_text,
-"E %s server: Forcing compression level %d (allowed: %d <= z <= %d).",
+"E %s server: Forcing compression level %d (allowed: %zu <= z <= %zu).",
                     program_name, gzip_level, config->MinCompressionLevel,
                     config->MaxCompressionLevel);
     }
 
-    if (!nolock) {
+    /* cvsacl patch */
+    parse_aclconfig (current_parsed_root->directory);
+
+    if (!nolock)
+    {
     path = xmalloc (strlen (current_parsed_root->directory)
                   + sizeof (CVSROOTADM)
                   + 2);
@@ -4623,7 +4628,20 @@
   do_cvs_command ("rls", ls);
 }
 
-
+/* cvsacl patch */
+static void
+serve_acl (char *arg)
+{
+    do_cvs_command ("acl", cvsacl);
+}
+ 
+/* cvsacl patch */
+static void
+serve_racl (char *arg)
+{
+    cvs_cmd_name = "racl";
+    do_cvs_command ("racl", cvsacl);
+}
 
 static void
 serve_add (char *arg)
@@ -5488,7 +5506,7 @@
     if (forced && !quiet
        && alloc_pending_warning (120 + strlen (program_name)))
        sprintf (pending_warning_text,
-"E %s server: Forcing compression level %d (allowed: %d <= z <= %d).",
+"E %s server: Forcing compression level %d (allowed: %zu <= z <= %zu).",
                 program_name, level, config->MinCompressionLevel,
                 config->MaxCompressionLevel);
 
@@ -5519,7 +5537,7 @@
     if (forced && !quiet
        && alloc_pending_warning (120 + strlen (program_name)))
        sprintf (pending_warning_text,
-"E %s server: Forcing compression level %d (allowed: %d <= z <= %d).",
+"E %s server: Forcing compression level %d (allowed: %zu <= z <= %zu).",
                 program_name, level, config->MinCompressionLevel,
                 config->MaxCompressionLevel);
        
@@ -5936,6 +5954,11 @@
   REQ_LINE("diff", serve_diff, 0),
   REQ_LINE("log", serve_log, 0),
   REQ_LINE("rlog", serve_rlog, 0),
+
+  /* cvsacl patch */
+  REQ_LINE("acl", serve_acl, 0),
+  REQ_LINE("racl", serve_racl, 0),
+  
   REQ_LINE("list", serve_ls, 0),
   REQ_LINE("rlist", serve_rls, 0),
   /* This allows us to avoid sending `-q' as a command argument to `cvs ls',
@@ -6232,7 +6255,8 @@
 
            /* Make sure our working directory isn't inside the tree we're
               going to delete.  */
-           CVS_CHDIR (get_cvs_tmp_dir ());
+           if (CVS_CHDIR (get_cvs_tmp_dir ()) == -1)
+               error (0, errno, "Cannot chdir to `%s'", get_cvs_tmp_dir ());
 
            /* Temporarily clear noexec, so that we clean up our temp directory
               regardless of it (this could more cleanly be handled by moving
@@ -6553,6 +6577,10 @@
     }
 #endif
 
+    /* cvsacl patch */
+    if (use_cvs_acl && cvs_server_run_as)
+       username = cvs_server_run_as;
+
     pw = getpwnam (username);
     if (pw == NULL)
     {
@@ -7252,6 +7280,9 @@
        in a new CVSROOT/config file to fix the broken one!  */
     config = get_root_allow_config (repository, gConfigPath);
 
+    /* cvsacl patch */
+    parse_aclconfig (repository);
+       
     /* We need the real cleartext before we hash it. */
     descrambled_password = descramble (password);
     host_user = check_password (username, descrambled_password, repository);



Home | Main Index | Thread Index | Old Index