[ypserv] Fixed returning success when shadow file is not writable Resolves: #747335

Jan Horak hhorak at fedoraproject.org
Mon Nov 28 11:25:25 UTC 2011


commit f3d657dd8d8aaa56ad45ae12a5c58d67b14a6965
Author: Honza HorĂ¡k <hhorak at redhat.com>
Date:   Mon Nov 28 12:25:15 2011 +0100

    Fixed returning success when shadow file is not writable
    Resolves: #747335

 ypserv-2.26-retval.patch |   31 +++++++++++++++++++++++++++++++
 ypserv.spec              |    8 +++++++-
 2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/ypserv-2.26-retval.patch b/ypserv-2.26-retval.patch
new file mode 100644
index 0000000..d99d404
--- /dev/null
+++ b/ypserv-2.26-retval.patch
@@ -0,0 +1,31 @@
+diff -up ypserv-2.26/rpc.yppasswdd/update.c.retval ypserv-2.26/rpc.yppasswdd/update.c
+--- ypserv-2.26/rpc.yppasswdd/update.c.retval	2011-10-19 16:27:10.292847501 +0200
++++ ypserv-2.26/rpc.yppasswdd/update.c	2011-10-19 16:29:01.983839864 +0200
+@@ -720,7 +720,12 @@ update_files (yppasswd *yppw, char *logb
+       if (link (path_shadow, path_shadow_old) == -1)
+ 	log_msg ("Cannot create backup file %s: %s",
+ 		 path_shadow_old, strerror (errno));
+-      rename (path_shadow_tmp, path_shadow);
++      if (rename (path_shadow_tmp, path_shadow) == -1) 
++        {
++          log_msg ("Cannot move temporary file %s to %s: %s",
++                 path_shadow_tmp, path_shadow, strerror (errno));
++          *shadow_changed = 0;
++        }
+     }
+   else
+     unlink (path_shadow_tmp);
+@@ -732,7 +737,12 @@ update_files (yppasswd *yppw, char *logb
+       if (link (path_passwd, path_passwd_old) == -1)
+ 	log_msg ("Cannot create backup file %s: %s",
+ 		 path_passwd_old, strerror (errno));
+-      rename (path_passwd_tmp, path_passwd);
++      if (rename (path_passwd_tmp, path_passwd) == -1)
++        {
++          log_msg ("Cannot move temporary file %s to %s: %s",
++                 path_passwd_tmp, path_passwd, strerror (errno));
++          *passwd_changed = 0;
++        }
+     }
+   else
+     unlink (path_passwd_tmp);
diff --git a/ypserv.spec b/ypserv.spec
index 0fdc901..5770032 100644
--- a/ypserv.spec
+++ b/ypserv.spec
@@ -2,7 +2,7 @@ Summary: The NIS (Network Information Service) server
 Url: http://www.linux-nis.org/nis/ypserv/index.html
 Name: ypserv
 Version: 2.26
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source0: ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypserv-%{version}.tar.bz2
@@ -32,6 +32,7 @@ Patch11: ypserv-2.26-request.patch
 Patch12: ypserv-2.26-shadow.patch
 Patch13: ypserv-2.26-errmsg.patch
 Patch14: ypserv-2.26-emptydomain.patch
+Patch15: ypserv-2.26-retval.patch
 BuildRequires: gdbm-devel
 BuildRequires: systemd-units
 
@@ -68,6 +69,7 @@ machines.
 %patch12 -p1 -b .shadow
 %patch13 -p1 -b .errmsg
 %patch14 -p1 -b .emptydomain
+%patch15 -p1 -b .retval
 
 %build
 cp etc/README etc/README.etc
@@ -168,6 +170,10 @@ exit 0
 %{_includedir}/*/*
 
 %changelog
+* Mon Nov 28 2011 Honza Horak <hhorak at redhat.com> - 2.26-8
+- Fixed returning success when shadow file is not writable
+  Resolves: #747335
+
 * Fri Nov 25 2011 Honza Horak <hhorak at redhat.com> - 2.26-7
 - Fixed empty domain handling in ypinit script
   Resolves: #751427


More information about the scm-commits mailing list