Fixed returning success when shadow file is not writable

Resolves: #747335
This commit is contained in:
Honza Horák 2011-11-28 12:25:15 +01:00
parent 46d6e0c63b
commit f3d657dd8d
2 changed files with 38 additions and 1 deletions

31
ypserv-2.26-retval.patch Normal file
View File

@ -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);

View File

@ -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@redhat.com> - 2.26-8
- Fixed returning success when shadow file is not writable
Resolves: #747335
* Fri Nov 25 2011 Honza Horak <hhorak@redhat.com> - 2.26-7
- Fixed empty domain handling in ypinit script
Resolves: #751427