From f3d657dd8d8aaa56ad45ae12a5c58d67b14a6965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Hor=C3=A1k?= Date: Mon, 28 Nov 2011 12:25:15 +0100 Subject: [PATCH] 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 deletion(-) create mode 100644 ypserv-2.26-retval.patch 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 - 2.26-8 +- Fixed returning success when shadow file is not writable + Resolves: #747335 + * Fri Nov 25 2011 Honza Horak - 2.26-7 - Fixed empty domain handling in ypinit script Resolves: #751427