emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100409: * movemail.c (main): Use


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100409: * movemail.c (main): Use setregid, as setegid is missing on HP-UX (Bug#6811).
Date: Sun, 23 Jan 2011 17:58:52 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100409
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Sun 2011-01-23 17:58:52 -0500
message:
  * movemail.c (main): Use setregid, as setegid is missing on HP-UX (Bug#6811).
  Suggested by Peter O'Gorman.
modified:
  lib-src/ChangeLog
  lib-src/movemail.c
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2011-01-02 23:50:46 +0000
+++ b/lib-src/ChangeLog 2011-01-23 22:58:52 +0000
@@ -1,3 +1,8 @@
+2011-01-23  Chong Yidong  <address@hidden>
+
+       * movemail.c (main): Use setregid instead of setegid, which is
+       missing on older systems.  Suggested by Peter O'Gorman (Bug#6811).
+
 2011-01-02  Glenn Morris  <address@hidden>
 
        * ebrowse.c (version) <emacs_copyright>:

=== modified file 'lib-src/movemail.c'
--- a/lib-src/movemail.c        2011-01-02 23:50:46 +0000
+++ b/lib-src/movemail.c        2011-01-23 22:58:52 +0000
@@ -360,7 +360,7 @@
       time_t touched_lock, now;
 #endif
 
-      if (setuid (getuid ()) < 0 || setegid (real_gid) < 0)
+      if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0)
        fatal ("Failed to drop privileges", 0, 0);
 
 #ifndef MAIL_USE_MMDF
@@ -387,7 +387,7 @@
       if (outdesc < 0)
        pfatal_with_name (outname);
 
-      if (setegid (priv_gid) < 0)
+      if (setregid (-1, priv_gid) < 0)
        fatal ("Failed to regain privileges", 0, 0);
 
       /* This label exists so we can retry locking
@@ -484,7 +484,7 @@
 #endif
 
       /* Prevent symlink attacks truncating other users' mailboxes */
-      if (setegid (real_gid) < 0)
+      if (setregid (-1, real_gid) < 0)
        fatal ("Failed to drop privileges", 0, 0);
 
       /* Check to make sure no errors before we zap the inbox.  */
@@ -519,7 +519,7 @@
 #endif /* not MAIL_USE_SYSTEM_LOCK */
 
       /* End of mailbox truncation */
-      if (setegid (priv_gid) < 0)
+      if (setregid (-1, priv_gid) < 0)
        fatal ("Failed to regain privileges", 0, 0);
 
 #ifdef MAIL_USE_MAILLOCK


reply via email to

[Prev in Thread] Current Thread [Next in Thread]