소스 검색

* apt-pkg/deb/dpkgpm.cc:
- set permissions of term.log to root.adm and 644 (LP: #404724)

Michael Vogt 15 년 전
부모
커밋
9c76a88155
2개의 변경된 파일과 13개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      apt-pkg/deb/dpkgpm.cc
  2. 4 0
      debian/changelog

+ 9 - 1
apt-pkg/deb/dpkgpm.cc

@@ -32,6 +32,8 @@
 #include <algorithm>
 #include <sstream>
 #include <map>
+#include <pwd.h>
+#include <grp.h>
 
 #include <termios.h>
 #include <unistd.h>
@@ -667,7 +669,13 @@ bool pkgDPkgPM::OpenLog()
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str());
       setvbuf(term_out, NULL, _IONBF, 0);
       SetCloseExec(fileno(term_out), true);
-      chmod(logfile_name.c_str(), 0600);
+      struct passwd *pw;
+      struct group *gr;
+      pw = getpwnam("root");
+      gr = getgrnam("adm");
+      if (pw != NULL && gr != NULL)
+	  chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid);
+      chmod(logfile_name.c_str(), 0644);
       fprintf(term_out, "\nLog started: %s\n", timestr);
    }
 

+ 4 - 0
debian/changelog

@@ -86,6 +86,10 @@ apt (0.8.15) UNRELEASED; urgency=low
   * apt-pkg/deb/debindexfile.cc:
     - remove some no longer valid checks for "TranslationsAvailable()"
 
+  [ Kenneth Solbø Andersen ]
+  * apt-pkg/deb/dpkgpm.cc:
+    - set permissions of term.log to root.adm and 644 (LP: #404724)
+
  -- Michael Vogt <mvo@debian.org>  Mon, 16 May 2011 14:57:52 +0200
 
 apt (0.8.14.1) unstable; urgency=low